From eda0375d432fe708b8d61810c90b4b4b8ab3e2df Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Fri, 16 Jan 2015 13:24:55 +0330 Subject: [PATCH 01/11] Create count.json --- count.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 count.json diff --git a/count.json b/count.json new file mode 100644 index 0000000..573541a --- /dev/null +++ b/count.json @@ -0,0 +1 @@ +0 -- 2.34.1 From c1100aba6f25df687d0e7291648257bdb4c1befa Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Fri, 16 Jan 2015 13:25:23 +0330 Subject: [PATCH 02/11] Add counter --- ipsum.js | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/ipsum.js b/ipsum.js index 17f5e80..3e8bde9 100644 --- a/ipsum.js +++ b/ipsum.js @@ -1,13 +1,16 @@ 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 + '/client', {maxAge: 60*60*24*7})); module.exports.app = app; app.get(/.*\/.*\/.*/, function(req, res) { - res.charset = 'utf-8'; - res.end(go(req.url)); + res.charset = 'utf-8'; + res.end(go(req.url)); }); if(!String.prototype.repeat) { @@ -86,7 +89,21 @@ function loremipsum(data) { return s; } } -function go(url) { - var req = url.split('/'); - return loremipsum(req.slice(1)); + +//COUNTER +io.on('connection', function(socket) { + socket.emit('count', +fs.readFileSync('count.json', 'utf8')); +}); +function counter(data) { + var count = data.split(' ').length + (+fs.readFileSync('count.json', 'utf8')); + fs.writeFileSync('count.json', count); + io.emit('count', count); +} + + +function go(url) { + var req = url.split('/'), + ipsum = loremipsum(req.slice(1)); + counter(ipsum); + return ipsum; } -- 2.34.1 From 1d2931858bc297fd22548ae879e35e974be473b4 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Fri, 16 Jan 2015 13:27:04 +0330 Subject: [PATCH 03/11] Add counter element to show count --- ipsum/index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ipsum/index.html b/ipsum/index.html index b38ac21..e64fab1 100644 --- a/ipsum/index.html +++ b/ipsum/index.html @@ -51,8 +51,13 @@ +
+ تا حالا کلمه ساختم +
+ Fork me on GitHub + -- 2.34.1 From d21f138ebe1e87c4779f7ef9de87f176331b9abe Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Fri, 16 Jan 2015 13:28:27 +0330 Subject: [PATCH 04/11] Update design --- ipsum/css/main.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ipsum/css/main.css b/ipsum/css/main.css index e22a900..5059d94 100644 --- a/ipsum/css/main.css +++ b/ipsum/css/main.css @@ -510,3 +510,10 @@ a[href="#"].running { background-color: rgba(255, 255, 255, 0.2); color: white; } + +.count { + position: fixed; + bottom: 3rem; + left: 3rem; + font-size: 2.2rem; +} -- 2.34.1 From 4109b8ce1c6caccc33038c2261f72cc02f29f193 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Fri, 16 Jan 2015 13:29:32 +0330 Subject: [PATCH 05/11] Add counter --- ipsum/js/main.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ipsum/js/main.js b/ipsum/js/main.js index e52bf00..4932d5b 100644 --- a/ipsum/js/main.js +++ b/ipsum/js/main.js @@ -1,3 +1,5 @@ +var socket = io(); + var $run = $('h1, h3, .options, a'); $('li[contenteditable]').click(function(e) { @@ -39,3 +41,8 @@ function success(ipsum) { selection.removeAllRanges(); selection.addRange(range); } + +//UPDATE COUNT +socket.on('count', function(data) { + $('#count').html(data); +}) -- 2.34.1 From 5343798933a8813f21aff8e139a4c47ead6118d2 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Sat, 17 Jan 2015 11:40:28 +0330 Subject: [PATCH 06/11] Fix bugs --- ipsum.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipsum.js b/ipsum.js index 3e8bde9..4b5ea6d 100644 --- a/ipsum.js +++ b/ipsum.js @@ -4,13 +4,15 @@ var express = require('express'), io = require('socket.io')(server), fs = require('fs'); -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; app.get(/.*\/.*\/.*/, function(req, res) { + if(req.url.split('/')[1] != 'socket.io') { res.charset = 'utf-8'; res.end(go(req.url)); + } }); if(!String.prototype.repeat) { -- 2.34.1 From 0863c41eb77a635f4a0962791c4d5e6161834d73 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Sat, 17 Jan 2015 11:41:19 +0330 Subject: [PATCH 07/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9cc5d9f..bfda8b0 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Examples: http://ipsum.ir/design/p/2 http://ipsum.ir/normal/c/250 - http://ipsum.ir/design/w/10 + http://ipsum.ir/news/w/10 ## Contributing -- 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 08/11] 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 09/11] 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 10/11] 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 11/11] 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