From 86d7b8ec5d039debbe8f772dec2a310746b46fbb Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Tue, 16 Sep 2014 10:17:49 +0430 Subject: [PATCH 01/14] Create count --- count | 1 + 1 file changed, 1 insertion(+) create mode 100644 count diff --git a/count b/count new file mode 100644 index 0000000..573541a --- /dev/null +++ b/count @@ -0,0 +1 @@ +0 -- 2.34.1 From cfeff0b7ce3189f6d4b4ba8e810e535aa0c2f636 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Tue, 16 Sep 2014 10:18:54 +0430 Subject: [PATCH 02/14] Add counter --- ipsum.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/ipsum.js b/ipsum.js index f00c8e7..5b1f804 100644 --- a/ipsum.js +++ b/ipsum.js @@ -1,7 +1,12 @@ var express = require('express'), - app = express(); + app = express(), + server = require('http').Server(app), + io = require('socket.io')(server), + fs = require('fs'); -app.use(express.static(__dirname + '/ipsum', {maxAge: 60*60*24*7})); +var count = require('./count.json'); + +app.use(express.static(__dirname + '/client', {maxAge: 60*60*24*7})); module.exports.app = app; @@ -87,6 +92,19 @@ function loremipsum(data) { } } function go(url) { - var req = url.split('/'); - return loremipsum(req.slice(1)); + var req = url.split('/').slice(1); + counting(loremipsum(req)); + return loremipsum(req); +} + +//COUNTER +io.on('connection', function(socket) { + io.emit('counter', count); +}); +function counting(data) { + var r = data.split(' ').join('').length + count; + fs.writeFile(__dirname + '/count.json', r, function() { + count = +(fs.readFileSync(__dirname + '/count.json', 'utf8')); + }) + io.emit('counter', r); } -- 2.34.1 From 2b2613b72d50cf0bf6d2c614aebb8b0598658e6d Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Tue, 16 Sep 2014 10:19:27 +0430 Subject: [PATCH 03/14] Rename count to count.json --- count => count.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename count => count.json (100%) diff --git a/count b/count.json similarity index 100% rename from count rename to count.json -- 2.34.1 From f7191e59b140056715e9f74fd0d55dae081a703c Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Tue, 16 Sep 2014 10:20:23 +0430 Subject: [PATCH 04/14] Update main.js --- client/js/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/js/main.js b/client/js/main.js index 77e9a63..8a67647 100644 --- a/client/js/main.js +++ b/client/js/main.js @@ -1,3 +1,5 @@ +var socket = io(); + var $run = $('h1, h3, .options, a'); $('li[contenteditable]').click(function(e) { @@ -39,3 +41,7 @@ function success(ipsum) { selection.removeAllRanges(); selection.addRange(range); } + +socket.on('counter', function(count) { + $('#count').text(count); +}); -- 2.34.1 From 3289dd83da0c7991b5848c9b28e7c71e90b2dd62 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Tue, 16 Sep 2014 10:21:40 +0430 Subject: [PATCH 05/14] Update main.css --- client/css/main.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/css/main.css b/client/css/main.css index e22a900..e228481 100644 --- a/client/css/main.css +++ b/client/css/main.css @@ -510,3 +510,12 @@ a[href="#"].running { background-color: rgba(255, 255, 255, 0.2); color: white; } +.counter { + padding: 10px; + position: fixed; + left: 0px; + bottom: 0px; +} +.counter p { + font-size: 20px; +} -- 2.34.1 From 9db089775e81a086856846989818abaa8fc65d19 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Tue, 16 Sep 2014 10:22:07 +0430 Subject: [PATCH 06/14] Update main.less --- client/css/main.less | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/css/main.less b/client/css/main.less index 619142c..abc0e89 100644 --- a/client/css/main.less +++ b/client/css/main.less @@ -191,3 +191,12 @@ a[href="#"].running { background-color: rgba(255, 255, 255, 0.2); color: white; } +.counter { + padding: 10px; + position: fixed; + left: 0px; + bottom: 0px; +} +.counter p { + font-size: 20px; +} -- 2.34.1 From fadf18f1a0a21332c614d3317b46b5572aff9f00 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Wed, 17 Sep 2014 11:20:52 +0430 Subject: [PATCH 07/14] Add counter --- ipsum.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ipsum.js b/ipsum.js index 5b1f804..46c2d89 100644 --- a/ipsum.js +++ b/ipsum.js @@ -92,9 +92,9 @@ function loremipsum(data) { } } function go(url) { - var req = url.split('/').slice(1); - counting(loremipsum(req)); - return loremipsum(req); + var lorem = loremipsum(url.split('/').slice(1)); + counting(lorem); + return lorem; } //COUNTER -- 2.34.1 From a8c37ff6399a66923854dbf50f319d7f46bb20cf Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Fri, 2 Jan 2015 23:29:30 +0330 Subject: [PATCH 08/14] Fix app.static directory --- ipsum.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipsum.js b/ipsum.js index f00c8e7..17f5e80 100644 --- a/ipsum.js +++ b/ipsum.js @@ -1,7 +1,7 @@ var express = require('express'), app = express(); -app.use(express.static(__dirname + '/ipsum', {maxAge: 60*60*24*7})); +app.use(express.static(__dirname + '/client', {maxAge: 60*60*24*7})); module.exports.app = app; -- 2.34.1 From 4c996020f778ac9290cf3105eeb027b1df973729 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Sat, 3 Jan 2015 12:22:31 +0330 Subject: [PATCH 09/14] Currently, support Delete key and arrow keys --- client/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/js/main.js b/client/js/main.js index 77e9a63..e52bf00 100644 --- a/client/js/main.js +++ b/client/js/main.js @@ -5,7 +5,7 @@ $('li[contenteditable]').click(function(e) { }); $('li[contenteditable]').on('keydown', function(e) { - if(e.keyCode !== 8 && isNaN(+e.key)) return e.preventDefault(); + if([8, 37, 38, 39 ,40, 46].indexOf(e.keyCode) < 0 && isNaN(+e.key)) return e.preventDefault(); }); $('li[contenteditable]').on('keyup', function(e) { $(this).data('val', /\d*/.exec($(this).html())); -- 2.34.1 From d16e6fb07eb8765657af0e649b91101ff835a332 Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Sun, 4 Jan 2015 14:39:37 +0330 Subject: [PATCH 10/14] client -> ipsum (there's a reason for that) --- {client => ipsum}/css/fonts.less | 0 {client => ipsum}/css/main.css | 0 {client => ipsum}/css/main.less | 0 {client => ipsum}/css/normalize.less | 0 {client => ipsum}/design.json | 0 {client => ipsum}/design.svg | 0 {client => ipsum}/fonts/BRoya.eot | Bin {client => ipsum}/fonts/BRoya.ttf | Bin {client => ipsum}/fonts/BRoya.woff | Bin {client => ipsum}/fonts/Mj_Zobeir.eot | Bin {client => ipsum}/fonts/Mj_Zobeir.html | 0 {client => ipsum}/fonts/Mj_Zobeir.svg | 0 {client => ipsum}/fonts/Mj_Zobeir.ttf | Bin {client => ipsum}/fonts/Mj_Zobeir.woff | Bin {client => ipsum}/fonts/sMj_Zobeir.ttf | Bin {client => ipsum}/index.html | 0 {client => ipsum}/js/libs/zepto.js | 0 {client => ipsum}/js/main.js | 0 {client => ipsum}/less.js | 0 19 files changed, 0 insertions(+), 0 deletions(-) rename {client => ipsum}/css/fonts.less (100%) rename {client => ipsum}/css/main.css (100%) rename {client => ipsum}/css/main.less (100%) rename {client => ipsum}/css/normalize.less (100%) rename {client => ipsum}/design.json (100%) rename {client => ipsum}/design.svg (100%) rename {client => ipsum}/fonts/BRoya.eot (100%) rename {client => ipsum}/fonts/BRoya.ttf (100%) rename {client => ipsum}/fonts/BRoya.woff (100%) rename {client => ipsum}/fonts/Mj_Zobeir.eot (100%) rename {client => ipsum}/fonts/Mj_Zobeir.html (100%) rename {client => ipsum}/fonts/Mj_Zobeir.svg (100%) rename {client => ipsum}/fonts/Mj_Zobeir.ttf (100%) rename {client => ipsum}/fonts/Mj_Zobeir.woff (100%) rename {client => ipsum}/fonts/sMj_Zobeir.ttf (100%) rename {client => ipsum}/index.html (100%) rename {client => ipsum}/js/libs/zepto.js (100%) rename {client => ipsum}/js/main.js (100%) rename {client => ipsum}/less.js (100%) diff --git a/client/css/fonts.less b/ipsum/css/fonts.less similarity index 100% rename from client/css/fonts.less rename to ipsum/css/fonts.less diff --git a/client/css/main.css b/ipsum/css/main.css similarity index 100% rename from client/css/main.css rename to ipsum/css/main.css diff --git a/client/css/main.less b/ipsum/css/main.less similarity index 100% rename from client/css/main.less rename to ipsum/css/main.less diff --git a/client/css/normalize.less b/ipsum/css/normalize.less similarity index 100% rename from client/css/normalize.less rename to ipsum/css/normalize.less diff --git a/client/design.json b/ipsum/design.json similarity index 100% rename from client/design.json rename to ipsum/design.json diff --git a/client/design.svg b/ipsum/design.svg similarity index 100% rename from client/design.svg rename to ipsum/design.svg diff --git a/client/fonts/BRoya.eot b/ipsum/fonts/BRoya.eot similarity index 100% rename from client/fonts/BRoya.eot rename to ipsum/fonts/BRoya.eot diff --git a/client/fonts/BRoya.ttf b/ipsum/fonts/BRoya.ttf similarity index 100% rename from client/fonts/BRoya.ttf rename to ipsum/fonts/BRoya.ttf diff --git a/client/fonts/BRoya.woff b/ipsum/fonts/BRoya.woff similarity index 100% rename from client/fonts/BRoya.woff rename to ipsum/fonts/BRoya.woff diff --git a/client/fonts/Mj_Zobeir.eot b/ipsum/fonts/Mj_Zobeir.eot similarity index 100% rename from client/fonts/Mj_Zobeir.eot rename to ipsum/fonts/Mj_Zobeir.eot diff --git a/client/fonts/Mj_Zobeir.html b/ipsum/fonts/Mj_Zobeir.html similarity index 100% rename from client/fonts/Mj_Zobeir.html rename to ipsum/fonts/Mj_Zobeir.html diff --git a/client/fonts/Mj_Zobeir.svg b/ipsum/fonts/Mj_Zobeir.svg similarity index 100% rename from client/fonts/Mj_Zobeir.svg rename to ipsum/fonts/Mj_Zobeir.svg diff --git a/client/fonts/Mj_Zobeir.ttf b/ipsum/fonts/Mj_Zobeir.ttf similarity index 100% rename from client/fonts/Mj_Zobeir.ttf rename to ipsum/fonts/Mj_Zobeir.ttf diff --git a/client/fonts/Mj_Zobeir.woff b/ipsum/fonts/Mj_Zobeir.woff similarity index 100% rename from client/fonts/Mj_Zobeir.woff rename to ipsum/fonts/Mj_Zobeir.woff diff --git a/client/fonts/sMj_Zobeir.ttf b/ipsum/fonts/sMj_Zobeir.ttf similarity index 100% rename from client/fonts/sMj_Zobeir.ttf rename to ipsum/fonts/sMj_Zobeir.ttf diff --git a/client/index.html b/ipsum/index.html similarity index 100% rename from client/index.html rename to ipsum/index.html diff --git a/client/js/libs/zepto.js b/ipsum/js/libs/zepto.js similarity index 100% rename from client/js/libs/zepto.js rename to ipsum/js/libs/zepto.js diff --git a/client/js/main.js b/ipsum/js/main.js similarity index 100% rename from client/js/main.js rename to ipsum/js/main.js diff --git a/client/less.js b/ipsum/less.js similarity index 100% rename from client/less.js rename to ipsum/less.js -- 2.34.1 From 9c9d213d47d2e27bb7e5b88a233935457e9a1ec2 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Thu, 21 May 2015 09:19:29 +0430 Subject: [PATCH 11/14] Add new words --- economy.json | 31 +++++++++++++++++++++++++++++++ geographic.json | 32 ++++++++++++++++++++++++++++++++ history.json | 32 ++++++++++++++++++++++++++++++++ ipsum.js | 8 +++++++- ipsum/index.html | 13 +++++++++---- sanitary.json | 32 ++++++++++++++++++++++++++++++++ social.json | 31 +++++++++++++++++++++++++++++++ sporty.json | 32 ++++++++++++++++++++++++++++++++ 8 files changed, 206 insertions(+), 5 deletions(-) create mode 100644 economy.json create mode 100644 geographic.json create mode 100644 history.json create mode 100644 sanitary.json create mode 100644 social.json create mode 100644 sporty.json diff --git a/economy.json b/economy.json new file mode 100644 index 0000000..d3562d0 --- /dev/null +++ b/economy.json @@ -0,0 +1,31 @@ +[ + "مسکن", + "مشتری", + "وام", + "سهام", + "شرکت", + "حقوق", + "درآمد", + "صنعت", + "تجارت", + "یورو", + "ریال", + "دلار", + "قیمت", + "خرید", + "بورس", + "پول", + "بانک", + "اقتصاد", + "کالا", + "گمرک", + "سهامداران", + "تورم", + "سود", + "هر اونس طلا", + "رکود", + "نرخ", + "نفت", + "عمران", + "بیمه" +] \ No newline at end of file diff --git a/geographic.json b/geographic.json new file mode 100644 index 0000000..2e129c8 --- /dev/null +++ b/geographic.json @@ -0,0 +1,32 @@ +[ + "کوه", + "زلزله", + "اختر شناسی", + "پدیده های انسانی", + "خاک", + "توپوگرافی", + "سیل", + "جغرافیا", + "آتشفشان", + "دانش نقشه برداری", + "عصر کاوش", + "آب و هوا", + "گردباد", + "ابن فضلان", + "پدیده های طبیعی", + "موقعیت", + "جنگل", + "اورست", + "نیم کره ی شمالی", + "قله", + "رود", + "محیط زیست", + "بوم", + "جغرافی دان", + "اقیانوس", + "وارونگی هوا", + "آبشار", + "اقلیم شناسی", + "گسل", + "سهند" +] \ No newline at end of file diff --git a/history.json b/history.json new file mode 100644 index 0000000..8813b76 --- /dev/null +++ b/history.json @@ -0,0 +1,32 @@ +[ + "تاریخ", + "پادشاه", + "تمدن", + "انسان اولیه", + "انقلاب", + "کودتا", + "کوروش", + "کشف قاره آمریکا", + "فبیله", + "آتشکده", + "قوم مایا", + "قرن", + "اشکانیان", + "معماری سلوکیان", + "گذشته", + "بانو آرتا", + "عصر مسیحیت", + "مادها", + "کاخ هترا", + "نهضت پرنی ها", + "شاهنشاهی", + "قیام", + "امپراطور روم", + "ساسانیان", + "داریوش", + "معاصر", + "سپهبد سورنا", + "تبار ایرانی", + "شاهنامه فردوسی", + "سزار" +] \ No newline at end of file diff --git a/ipsum.js b/ipsum.js index 17f5e80..2253e00 100644 --- a/ipsum.js +++ b/ipsum.js @@ -38,7 +38,13 @@ var stretch = function stretch(a, n) { var general = require('./general.json'); var dictionary = { 'design': require('./design.json'), - 'news': require('./news.json') + 'news': require('./news.json'), + 'economy': require('./economy.json'), + 'sporty': require('./sporty.json'), + 'social': require('./social.json'), + 'sanitary': require('./sanitary.json'), + 'history': require('./history.json'), + 'geographic': require('./geographic.json') }; var normal = 'لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است. چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد. کتابهای زیادی در شصت و سه درصد گذشته، حال و آینده شناخت فراوان جامعه و متخصصان را می طلبد تا با نرم افزارها شناخت بیستری را برای طراحان رایانه ای و فرهنگ پیشرو در زبان فارسی ایجاد کرد. در این صورت می توان امید داشت که تمام و دشواری موجود در ارائه راهکارها و شرایط سخت تایپ به پایان رسد وزمان مورد نیاز شامل حروفچینی دستاوردهای اصلی و جوابگوی سوالات پیوسته اهل دنیای موجود طراحی اساسا مورد استفاده قرار گیرد.'; diff --git a/ipsum/index.html b/ipsum/index.html index b38ac21..e241bc4 100644 --- a/ipsum/index.html +++ b/ipsum/index.html @@ -16,10 +16,15 @@

دسته بندی

    -
  • طراحی
  • -
  • ساده
  • - -
  • اخبار
  • +
  • ساده
  • +
  • طراحی
  • +
  • اقتصادی
  • +
  • خبری
  • +
  • ورزشی
  • +
  • اجتماعی
  • +
  • بهداشتی
  • +
  • جغرافیایی
  • +
  • تاریخی
diff --git a/sanitary.json b/sanitary.json new file mode 100644 index 0000000..052cae9 --- /dev/null +++ b/sanitary.json @@ -0,0 +1,32 @@ +[ + "بهداشت", + "درمانگاه", + "پزشک", + "بیمار", + "پرستار", + "عمل", + "دندان", + "محیط زیست", + "زندگی", + "سلامتی", + "حمام", + "فلج اطفال", + "شفا", + "ویتامین ها", + "سرطان زا", + "شیوع", + "فیوتراپی", + "عینک", + "سمعک", + "تغذیه", + "مسمومیت", + "بیولوژی", + "درمان", + "امنیت غذایی", + "پیشگیری", + "طب سنتی", + "خوراکی", + "پوست", + "دارو", + "مراقبت" +] \ No newline at end of file diff --git a/social.json b/social.json new file mode 100644 index 0000000..f6cbd00 --- /dev/null +++ b/social.json @@ -0,0 +1,31 @@ +[ + "اجتماع", + "آرامش", + "دانش عمومی", + "راهکار", + "طلاق", + "سلامتی", + "جامعه", + "آینده", + "مشکل", + "فقط", + "اعتیاد", + "مردم", + "آسایش", + "شغل", + "ملت", + "ازدواج", + "خانه", + "کلاه برداری", + "رهبر", + "پدر و مادر", + "خانواده", + "زندگی", + "بهبود", + "مشقت", + "بازار کار", + "فرزند", + "محله", + "دوستی", + "طبقات مردم" +] \ No newline at end of file diff --git a/sporty.json b/sporty.json new file mode 100644 index 0000000..6abfbff --- /dev/null +++ b/sporty.json @@ -0,0 +1,32 @@ +[ + "فوتبال", + "قهرمان", + "پهلوان", + "پیروزی", + "شکست", + "مسابقات", + "کشتی", + "تکواندو", + "مدال", + "المپیک", + "جام جهانی", + "کوهنوردی", + "فدراسیون", + "طلا", + "نفره", + "برنز", + "لیگ", + "باشگاه", + "وزنه", + "دمبل", + "رزمی", + "سرمربی", + "صعود", + "تیم", + "اردو", + "بازیکن", + "ملی پوش", + "افتخار آفرین", + "منتخب", + "سقوط" +] \ No newline at end of file -- 2.34.1 From d3ca5124eda078c304cc623f244a97ccc761476b Mon Sep 17 00:00:00 2001 From: Bugpedia Date: Sat, 20 Jun 2015 15:56:27 -0400 Subject: [PATCH 12/14] listen --- ipsum.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ipsum.js b/ipsum.js index 2253e00..d8b74cb 100644 --- a/ipsum.js +++ b/ipsum.js @@ -96,3 +96,5 @@ function go(url) { var req = url.split('/'); return loremipsum(req.slice(1)); } + +app.listen(8888); -- 2.34.1 From 97922f506cf23bc8cf0f7dc5fc2fa36f99b32e7d Mon Sep 17 00:00:00 2001 From: Bugpedia Date: Sat, 20 Jun 2015 16:01:14 -0400 Subject: [PATCH 13/14] package.json gitignoe --- .gitignore | 1 + package.json | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .gitignore create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/package.json b/package.json new file mode 100644 index 0000000..0b7d161 --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "ipsum", + "version": "1.0.0", + "description": "The code powering [ipsum.ir](http://ipsum.ir), a categorized ipsum generator with REST API for those who care.", + "main": "ipsum.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/mdibaiee/ipsum" + }, + "author": "", + "license": "BSD-2-Clause", + "bugs": { + "url": "https://github.com/mdibaiee/ipsum/issues" + }, + "devDependencies": { + "express": "~4.12.4" + } +} -- 2.34.1 From 4190130c1f5603c0195eb9fbb7fd0f0e99c84c16 Mon Sep 17 00:00:00 2001 From: Bugpedia Date: Sat, 20 Jun 2015 16:15:57 -0400 Subject: [PATCH 14/14] client -> ipsum --- ipsum.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipsum.js b/ipsum.js index d8b74cb..cc66a8d 100644 --- a/ipsum.js +++ b/ipsum.js @@ -1,7 +1,7 @@ var express = require('express'), app = express(); -app.use(express.static(__dirname + '/client', {maxAge: 60*60*24*7})); +app.use(express.static(__dirname + '/ipsum', {maxAge: 60*60*24*7})); module.exports.app = app; -- 2.34.1