diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 3c3629e..0000000
--- a/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
diff --git a/ipsum/css/fonts.less b/client/css/fonts.less
similarity index 100%
rename from ipsum/css/fonts.less
rename to client/css/fonts.less
diff --git a/ipsum/css/main.css b/client/css/main.css
similarity index 98%
rename from ipsum/css/main.css
rename to client/css/main.css
index e22a900..e228481 100644
--- a/ipsum/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;
+}
diff --git a/ipsum/css/main.less b/client/css/main.less
similarity index 96%
rename from ipsum/css/main.less
rename to client/css/main.less
index 619142c..abc0e89 100644
--- a/ipsum/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;
+}
diff --git a/ipsum/css/normalize.less b/client/css/normalize.less
similarity index 100%
rename from ipsum/css/normalize.less
rename to client/css/normalize.less
diff --git a/ipsum/design.json b/client/design.json
similarity index 100%
rename from ipsum/design.json
rename to client/design.json
diff --git a/ipsum/design.svg b/client/design.svg
similarity index 100%
rename from ipsum/design.svg
rename to client/design.svg
diff --git a/ipsum/fonts/BRoya.eot b/client/fonts/BRoya.eot
similarity index 100%
rename from ipsum/fonts/BRoya.eot
rename to client/fonts/BRoya.eot
diff --git a/ipsum/fonts/BRoya.ttf b/client/fonts/BRoya.ttf
similarity index 100%
rename from ipsum/fonts/BRoya.ttf
rename to client/fonts/BRoya.ttf
diff --git a/ipsum/fonts/BRoya.woff b/client/fonts/BRoya.woff
similarity index 100%
rename from ipsum/fonts/BRoya.woff
rename to client/fonts/BRoya.woff
diff --git a/ipsum/fonts/Mj_Zobeir.eot b/client/fonts/Mj_Zobeir.eot
similarity index 100%
rename from ipsum/fonts/Mj_Zobeir.eot
rename to client/fonts/Mj_Zobeir.eot
diff --git a/ipsum/fonts/Mj_Zobeir.html b/client/fonts/Mj_Zobeir.html
similarity index 100%
rename from ipsum/fonts/Mj_Zobeir.html
rename to client/fonts/Mj_Zobeir.html
diff --git a/ipsum/fonts/Mj_Zobeir.svg b/client/fonts/Mj_Zobeir.svg
similarity index 100%
rename from ipsum/fonts/Mj_Zobeir.svg
rename to client/fonts/Mj_Zobeir.svg
diff --git a/ipsum/fonts/Mj_Zobeir.ttf b/client/fonts/Mj_Zobeir.ttf
similarity index 100%
rename from ipsum/fonts/Mj_Zobeir.ttf
rename to client/fonts/Mj_Zobeir.ttf
diff --git a/ipsum/fonts/Mj_Zobeir.woff b/client/fonts/Mj_Zobeir.woff
similarity index 100%
rename from ipsum/fonts/Mj_Zobeir.woff
rename to client/fonts/Mj_Zobeir.woff
diff --git a/ipsum/fonts/sMj_Zobeir.ttf b/client/fonts/sMj_Zobeir.ttf
similarity index 100%
rename from ipsum/fonts/sMj_Zobeir.ttf
rename to client/fonts/sMj_Zobeir.ttf
diff --git a/ipsum/index.html b/client/index.html
similarity index 77%
rename from ipsum/index.html
rename to client/index.html
index e241bc4..b38ac21 100644
--- a/ipsum/index.html
+++ b/client/index.html
@@ -16,15 +16,10 @@
دسته بندی
- - ساده
- - طراحی
- - اقتصادی
- - خبری
- - ورزشی
- - اجتماعی
- - بهداشتی
- - جغرافیایی
- - تاریخی
+ - طراحی
+ - ساده
+
+ - اخبار
diff --git a/ipsum/js/libs/zepto.js b/client/js/libs/zepto.js
similarity index 100%
rename from ipsum/js/libs/zepto.js
rename to client/js/libs/zepto.js
diff --git a/ipsum/js/main.js b/client/js/main.js
similarity index 87%
rename from ipsum/js/main.js
rename to client/js/main.js
index e52bf00..8a67647 100644
--- a/ipsum/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) {
@@ -5,7 +7,7 @@ $('li[contenteditable]').click(function(e) {
});
$('li[contenteditable]').on('keydown', function(e) {
- if([8, 37, 38, 39 ,40, 46].indexOf(e.keyCode) < 0 && isNaN(+e.key)) return e.preventDefault();
+ if(e.keyCode !== 8 && isNaN(+e.key)) return e.preventDefault();
});
$('li[contenteditable]').on('keyup', function(e) {
$(this).data('val', /\d*/.exec($(this).html()));
@@ -39,3 +41,7 @@ function success(ipsum) {
selection.removeAllRanges();
selection.addRange(range);
}
+
+socket.on('counter', function(count) {
+ $('#count').text(count);
+});
diff --git a/ipsum/less.js b/client/less.js
similarity index 100%
rename from ipsum/less.js
rename to client/less.js
diff --git a/count.json b/count.json
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/count.json
@@ -0,0 +1 @@
+0
diff --git a/economy.json b/economy.json
deleted file mode 100644
index d3562d0..0000000
--- a/economy.json
+++ /dev/null
@@ -1,31 +0,0 @@
-[
- "مسکن",
- "مشتری",
- "وام",
- "سهام",
- "شرکت",
- "حقوق",
- "درآمد",
- "صنعت",
- "تجارت",
- "یورو",
- "ریال",
- "دلار",
- "قیمت",
- "خرید",
- "بورس",
- "پول",
- "بانک",
- "اقتصاد",
- "کالا",
- "گمرک",
- "سهامداران",
- "تورم",
- "سود",
- "هر اونس طلا",
- "رکود",
- "نرخ",
- "نفت",
- "عمران",
- "بیمه"
-]
\ No newline at end of file
diff --git a/geographic.json b/geographic.json
deleted file mode 100644
index 2e129c8..0000000
--- a/geographic.json
+++ /dev/null
@@ -1,32 +0,0 @@
-[
- "کوه",
- "زلزله",
- "اختر شناسی",
- "پدیده های انسانی",
- "خاک",
- "توپوگرافی",
- "سیل",
- "جغرافیا",
- "آتشفشان",
- "دانش نقشه برداری",
- "عصر کاوش",
- "آب و هوا",
- "گردباد",
- "ابن فضلان",
- "پدیده های طبیعی",
- "موقعیت",
- "جنگل",
- "اورست",
- "نیم کره ی شمالی",
- "قله",
- "رود",
- "محیط زیست",
- "بوم",
- "جغرافی دان",
- "اقیانوس",
- "وارونگی هوا",
- "آبشار",
- "اقلیم شناسی",
- "گسل",
- "سهند"
-]
\ No newline at end of file
diff --git a/history.json b/history.json
deleted file mode 100644
index 8813b76..0000000
--- a/history.json
+++ /dev/null
@@ -1,32 +0,0 @@
-[
- "تاریخ",
- "پادشاه",
- "تمدن",
- "انسان اولیه",
- "انقلاب",
- "کودتا",
- "کوروش",
- "کشف قاره آمریکا",
- "فبیله",
- "آتشکده",
- "قوم مایا",
- "قرن",
- "اشکانیان",
- "معماری سلوکیان",
- "گذشته",
- "بانو آرتا",
- "عصر مسیحیت",
- "مادها",
- "کاخ هترا",
- "نهضت پرنی ها",
- "شاهنشاهی",
- "قیام",
- "امپراطور روم",
- "ساسانیان",
- "داریوش",
- "معاصر",
- "سپهبد سورنا",
- "تبار ایرانی",
- "شاهنامه فردوسی",
- "سزار"
-]
\ No newline at end of file
diff --git a/ipsum.js b/ipsum.js
index cc66a8d..46c2d89 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;
@@ -38,13 +43,7 @@ var stretch = function stretch(a, n) {
var general = require('./general.json');
var dictionary = {
'design': require('./design.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')
+ 'news': require('./news.json')
};
var normal = 'لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است. چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد. کتابهای زیادی در شصت و سه درصد گذشته، حال و آینده شناخت فراوان جامعه و متخصصان را می طلبد تا با نرم افزارها شناخت بیستری را برای طراحان رایانه ای و فرهنگ پیشرو در زبان فارسی ایجاد کرد. در این صورت می توان امید داشت که تمام و دشواری موجود در ارائه راهکارها و شرایط سخت تایپ به پایان رسد وزمان مورد نیاز شامل حروفچینی دستاوردهای اصلی و جوابگوی سوالات پیوسته اهل دنیای موجود طراحی اساسا مورد استفاده قرار گیرد.';
@@ -93,8 +92,19 @@ function loremipsum(data) {
}
}
function go(url) {
- var req = url.split('/');
- return loremipsum(req.slice(1));
+ var lorem = loremipsum(url.split('/').slice(1));
+ counting(lorem);
+ return lorem;
}
-app.listen(8888);
+//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);
+}
diff --git a/package.json b/package.json
deleted file mode 100644
index 0b7d161..0000000
--- a/package.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "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"
- }
-}
diff --git a/sanitary.json b/sanitary.json
deleted file mode 100644
index 052cae9..0000000
--- a/sanitary.json
+++ /dev/null
@@ -1,32 +0,0 @@
-[
- "بهداشت",
- "درمانگاه",
- "پزشک",
- "بیمار",
- "پرستار",
- "عمل",
- "دندان",
- "محیط زیست",
- "زندگی",
- "سلامتی",
- "حمام",
- "فلج اطفال",
- "شفا",
- "ویتامین ها",
- "سرطان زا",
- "شیوع",
- "فیوتراپی",
- "عینک",
- "سمعک",
- "تغذیه",
- "مسمومیت",
- "بیولوژی",
- "درمان",
- "امنیت غذایی",
- "پیشگیری",
- "طب سنتی",
- "خوراکی",
- "پوست",
- "دارو",
- "مراقبت"
-]
\ No newline at end of file
diff --git a/social.json b/social.json
deleted file mode 100644
index f6cbd00..0000000
--- a/social.json
+++ /dev/null
@@ -1,31 +0,0 @@
-[
- "اجتماع",
- "آرامش",
- "دانش عمومی",
- "راهکار",
- "طلاق",
- "سلامتی",
- "جامعه",
- "آینده",
- "مشکل",
- "فقط",
- "اعتیاد",
- "مردم",
- "آسایش",
- "شغل",
- "ملت",
- "ازدواج",
- "خانه",
- "کلاه برداری",
- "رهبر",
- "پدر و مادر",
- "خانواده",
- "زندگی",
- "بهبود",
- "مشقت",
- "بازار کار",
- "فرزند",
- "محله",
- "دوستی",
- "طبقات مردم"
-]
\ No newline at end of file
diff --git a/sporty.json b/sporty.json
deleted file mode 100644
index 6abfbff..0000000
--- a/sporty.json
+++ /dev/null
@@ -1,32 +0,0 @@
-[
- "فوتبال",
- "قهرمان",
- "پهلوان",
- "پیروزی",
- "شکست",
- "مسابقات",
- "کشتی",
- "تکواندو",
- "مدال",
- "المپیک",
- "جام جهانی",
- "کوهنوردی",
- "فدراسیون",
- "طلا",
- "نفره",
- "برنز",
- "لیگ",
- "باشگاه",
- "وزنه",
- "دمبل",
- "رزمی",
- "سرمربی",
- "صعود",
- "تیم",
- "اردو",
- "بازیکن",
- "ملی پوش",
- "افتخار آفرین",
- "منتخب",
- "سقوط"
-]
\ No newline at end of file