From 8433d3e025923fab808d6b86626cbf4b2425c91e Mon Sep 17 00:00:00 2001 From: bitpshr Date: Sun, 30 Dec 2012 13:52:36 -0500 Subject: [PATCH] Added ability to refresh current page & redirect to new url if necessary --- .gitignore | 1 + README.md | 18 ++++- bin/holler | 10 +-- bin/holler-server | 2 +- demo/index.html | 24 ++++-- dist/holler-client.concat.js | 8 +- dist/holler-client.min.js | 2 +- npm-debug.log | 150 ----------------------------------- package.json | 4 +- src/holler-client.js | 8 +- 10 files changed, 59 insertions(+), 168 deletions(-) create mode 100644 .gitignore delete mode 100644 npm-debug.log diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/README.md b/README.md index 9ea0bfc..0a9004f 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [Holler.js](http://bitpshr.info/holler) ================= -real-time, in-app notifications for web and mobile via the command line. [see it in action](http://bitpshr.info/holler) +real-time, in-app notifications and admin for web and mobile via the command line. [see it in action](http://bitpshr.info/holler) ##Usage Sending notifications with Holler is as easy as four steps: @@ -9,7 +9,7 @@ Sending notifications with Holler is as easy as four steps: ###1. Install a module Holler is built with Node and is distributed as an npm module. If you don't have Node yet, install the hell out of it. Next we just install holler: ```console -npm install holler +npm install holler -g ``` ###2. Add a script tag @@ -53,6 +53,20 @@ holler http://yourServerUrl:port success "This is a success message." holler http://yourServerUrl:port error "This is an error message." ``` +* Refresh Page + +Now you can use holler to perform admin tasks such as refreshing the current page. Again, all users using the app will have their page refreshed in real-time. +```console +holler http://yourServerUrl:port refresh +``` + +* Error Messages + +You can also redirect the current page to a new url. Again, all users using the app will have their page redirected in real-time. +```console +holler http://yourServerUrl:port redirect http://someOtherUrl +``` + ##Going forward I definitely need to address the following: diff --git a/bin/holler b/bin/holler index bb69002..d6add7c 100755 --- a/bin/holler +++ b/bin/holler @@ -6,8 +6,8 @@ // // make sure we have the right number of options -if(process.argv.length!=5){ - console.error("usage: node holler.js [url] [type] [message]"); +if(process.argv.length<4){ + console.error("usage: holler [url:port] [type] [message|redirectUrl]?"); process.exit(); } @@ -19,8 +19,8 @@ var faye = require('faye'), url = p.substring(p.length-1) == "/" ? p.substring(0,p.length-1) : p; // validate notification type -if(type!="log" && type!="success" && type!="error"){ - console.error("uh oh: [type] must be one of [log, success, error]"); +if(type!="log" && type!="success" && type!="error" && type!="refresh" && type!="redirect"){ + console.error("uh oh: [type] must be one of [log, success, error, refresh, redirect]"); process.exit(); } @@ -28,7 +28,7 @@ if(type!="log" && type!="success" && type!="error"){ var client = new faye.Client(url+'/faye'); var notification = client.publish('/holler', { type: type, - message: process.argv[4] + message: type != "refresh" ? process.argv[4] : null }); // when done, kill this sucker diff --git a/bin/holler-server b/bin/holler-server index e7a16e4..fc36748 100755 --- a/bin/holler-server +++ b/bin/holler-server @@ -7,7 +7,7 @@ // make sure we have only one arg if(process.argv.length>3){ - console.error("usage: node holler-server.js [port]"); + console.error("usage: holler-server [port]"); process.exit(); } diff --git a/demo/index.html b/demo/index.html index 8a34ad4..940ebe9 100755 --- a/demo/index.html +++ b/demo/index.html @@ -4,7 +4,7 @@ - + holler.js @@ -20,7 +20,7 @@

Holler.js

-

real-time, in-app notifications for web and mobile via the command line

+

real-time, in-app notifications and admin for web and mobile via the command line

@@ -79,8 +79,11 @@

3. Start a server

4. Holler stuff

- Show notifications to all users currently using your app in real-time using holler.js. Notifications use Alertify so they look nice and sexy. See it in action. + Show notifications to all users currently using your app in real-time using holler. You can also refresh the current page, or redirect to a new url. Notifications use Alertify so they look nice and sexy. See it in action.

+

+ Try this! Open up multiple browser windows all pointing to your test page. All windows should receive the notification in real-time. +

Log Messages

@@ -96,8 +99,19 @@

Error Messages

holler http://yourServerUrl:port error "This is an error message."

-

- Try this! Open up multiple browser windows all pointing to your test page. All windows should receive the notification in real-time. +

+

Refresh Page

+

+ New! Now you can use holler to perform admin tasks such as refreshing the current page. Again, all users using the app will have their page refreshed in real-time. +

+
holler http://yourServerUrl:port refresh
+

+

+

Redirect to URL

+

+ New! You can also redirect the current page to a new url. Again, all users using the app will have their page redirected in real-time. +

+
holler http://yourServerUrl:port redirect http://someOtherUrl

diff --git a/dist/holler-client.concat.js b/dist/holler-client.concat.js index 7b04934..0798bc2 100755 --- a/dist/holler-client.concat.js +++ b/dist/holler-client.concat.js @@ -517,7 +517,13 @@ }); // subscribe to notification channel var subscription = client.subscribe('/holler',function(obj) { - alertify.log(obj.message, obj.type); + if(obj.type=="redirect"){ + window.location = obj.message; + }else if(obj.type=="refresh"){ + window.location.reload(true); + }else{ + alertify.log(obj.message, obj.type); + } }); }); diff --git a/dist/holler-client.min.js b/dist/holler-client.min.js index b3b2d80..bd48546 100755 --- a/dist/holler-client.min.js +++ b/dist/holler-client.min.js @@ -1 +1 @@ -(function(e,t){"use strict";var n=e.document,r;r=function(){var r={},i={},s=!1,o={ENTER:13,ESC:27,SPACE:32},u=[],a,f,l,c,h;return i={buttons:{holder:'',submit:'',ok:'{{ok}}',cancel:'{{cancel}}'},input:'',message:'

{{message}}

',log:'
{{message}}
'},a=function(e){return n.getElementById(e)},r={labels:{ok:"OK",cancel:"Cancel"},delay:5e3,addListeners:function(r){var i=a("alertify-resetFocus"),s=a("alertify-ok")||t,u=a("alertify-cancel")||t,f=a("alertify-text")||t,l=a("alertify-form")||t,c=typeof s!="undefined",h=typeof u!="undefined",p=typeof f!="undefined",d="",v=this,m,g,y,b,w;m=function(e){typeof e.preventDefault!="undefined"&&e.preventDefault(),y(e),typeof f!="undefined"&&(d=f.value),typeof r=="function"&&r(!0,d)},g=function(e){typeof e.preventDefault!="undefined"&&e.preventDefault(),y(e),typeof r=="function"&&r(!1)},y=function(e){v.hide(),v.unbind(n.body,"keyup",b),v.unbind(i,"focus",w),p&&v.unbind(l,"submit",m),c&&v.unbind(s,"click",m),h&&v.unbind(u,"click",g)},b=function(e){var t=e.keyCode;t===o.SPACE&&!p&&m(e),t===o.ESC&&h&&g(e)},w=function(e){p?f.focus():h?u.focus():s.focus()},this.bind(i,"focus",w),c&&this.bind(s,"click",m),h&&this.bind(u,"click",g),this.bind(n.body,"keyup",b),p&&this.bind(l,"submit",m),e.setTimeout(function(){f?(f.focus(),f.select()):s.focus()},50)},bind:function(e,t,n){typeof e.addEventListener=="function"?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)},build:function(e){var t="",n=e.type,r=e.message,s=e.cssClass||"";t+='
',n==="prompt"&&(t+='
'),t+='
',t+=i.message.replace("{{message}}",r),n==="prompt"&&(t+=i.input),t+=i.buttons.holder,t+="
",n==="prompt"&&(t+="
"),t+='Reset Focus',t+="
";switch(n){case"confirm":t=t.replace("{{buttons}}",i.buttons.cancel+i.buttons.ok),t=t.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"prompt":t=t.replace("{{buttons}}",i.buttons.cancel+i.buttons.submit),t=t.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"alert":t=t.replace("{{buttons}}",i.buttons.ok),t=t.replace("{{ok}}",this.labels.ok);break;default:}return c.className="alertify alertify-show alertify-"+n+" "+s,l.className="alertify-cover",t},close:function(e,t){var n=t&&!isNaN(t)?+t:this.delay;this.bind(e,"click",function(){h.removeChild(e)}),setTimeout(function(){typeof e!="undefined"&&e.parentNode===h&&h.removeChild(e)},n)},dialog:function(e,t,r,i,o){f=n.activeElement;var a=function(){if(c&&c.scrollTop!==null)return;a()};if(typeof e!="string")throw new Error("message must be a string");if(typeof t!="string")throw new Error("type must be a string");if(typeof r!="undefined"&&typeof r!="function")throw new Error("fn must be a function");return typeof this.init=="function"&&(this.init(),a()),u.push({type:t,message:e,callback:r,placeholder:i,cssClass:o}),s||this.setup(),this},extend:function(e){if(typeof e!="string")throw new Error("extend method must have exactly one paramter");return function(t,n){return this.log(t,e,n),this}},hide:function(){u.splice(0,1),u.length>0?this.setup():(s=!1,c.className="alertify alertify-hide alertify-hidden",l.className="alertify-cover alertify-hidden",f.focus())},init:function(){n.createElement("nav"),n.createElement("article"),n.createElement("section"),l=n.createElement("div"),l.setAttribute("id","alertify-cover"),l.className="alertify-cover alertify-hidden",n.body.appendChild(l),c=n.createElement("section"),c.setAttribute("id","alertify"),c.className="alertify alertify-hidden",n.body.appendChild(c),h=n.createElement("section"),h.setAttribute("id","alertify-logs"),h.className="alertify-logs",n.body.appendChild(h),n.body.setAttribute("tabindex","0"),delete this.init},log:function(e,t,n){var r=function(){if(h&&h.scrollTop!==null)return;r()};return typeof this.init=="function"&&(this.init(),r()),this.notify(e,t,n),this},notify:function(e,t,r){var i=n.createElement("article");i.className="alertify-log"+(typeof t=="string"&&t!==""?" alertify-log-"+t:""),i.innerHTML=e,h.insertBefore(i,h.firstChild),setTimeout(function(){i.className=i.className+" alertify-log-show"},50),this.close(i,r)},set:function(e){var t;if(typeof e!="object"&&e instanceof Array)throw new Error("args must be an object");for(t in e)e.hasOwnProperty(t)&&(this[t]=e[t])},setup:function(){var e=u[0];s=!0,c.innerHTML=this.build(e),typeof e.placeholder=="string"&&e.placeholder!==""&&(a("alertify-text").value=e.placeholder),this.addListeners(e.callback)},unbind:function(e,t,n){typeof e.removeEventListener=="function"?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)}},{alert:function(e,t,n){return r.dialog(e,"alert",t,"",n),this},confirm:function(e,t,n){return r.dialog(e,"confirm",t,"",n),this},extend:r.extend,init:r.init,log:function(e,t,n){return r.log(e,t,n),this},prompt:function(e,t,n,i){return r.dialog(e,"prompt",t,n,i),this},success:function(e,t){return r.log(e,"success",t),this},error:function(e,t){return r.log(e,"error",t),this},set:function(e){r.set(e)},labels:r.labels}},typeof define=="function"?define([],function(){return new r}):typeof e.alertify=="undefined"&&(e.alertify=new r)})(this),function(e){var t=window.hollerConfig,n=t&&t.port?t.port:"1337",r=t&&t.host?t.host:"http://127.0.0.1",i=document.createElement("style");i.type="text/css",i.innerHTML=".alertify-show, .alertify-log { -webkit-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1); /* older webkit */ -webkit-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); -moz-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); -ms-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); -o-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); /* easeOutBack */ } .alertify-hide { -webkit-transition: all 250ms cubic-bezier(0.600, 0, 0.735, 0.045); /* older webkit */ -webkit-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); -moz-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); -ms-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); -o-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); /* easeInBack */ } .alertify-cover { position: fixed; z-index: 99999; top: 0; right: 0; bottom: 0; left: 0; } .alertify { position: fixed; z-index: 99999; top: 50px; left: 50%; width: 550px; margin-left: -275px; } .alertify-hidden { top: -50px; visibility: hidden; } .alertify-logs { position: fixed; z-index: 5000; bottom: 10px; right: 10px; width: 300px; } .alertify-log { display: block; margin-top: 10px; position: relative; right: -300px; } .alertify-log-show { right: 0; } .alertify-dialog { padding: 25px; } .alertify-resetFocus { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } .alertify-inner { text-align: center; } .alertify-text { margin-bottom: 15px; width: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; font-size: 100%; } .alertify-buttons { } .alertify-button { /* line-height and font-size for input button */ line-height: 1.5; font-size: 100%; display: inline-block; cursor: pointer; margin-left: 5px; } @media only screen and (max-width: 680px) { .alertify, .alertify-logs { width: 90%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .alertify { left: 5%; margin: 0; } } /** * Default Look and Feel */ .alertify, .alertify-log { font-family: sans-serif; } .alertify { background: #FFF; border: 10px solid #333; /* browsers that don't support rgba */ border: 10px solid rgba(0,0,0,.7); border-radius: 8px; box-shadow: 0 3px 3px rgba(0,0,0,.3); -webkit-background-clip: padding; /* Safari 4? Chrome 6? */ -moz-background-clip: padding; /* Firefox 3.6 */ background-clip: padding-box; /* Firefox 4, Safari 5, Opera 10, IE 9 */ } .alertify-text { border: 1px solid #CCC; padding: 10px; border-radius: 4px; } .alertify-button { border-radius: 4px; color: #FFF; font-weight: bold; padding: 6px 15px; text-decoration: none; text-shadow: 1px 1px 0 rgba(0,0,0,.5); box-shadow: inset 0 1px 0 0 rgba(255,255,255,.5); background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); background-image: -moz-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); background-image: -ms-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); background-image: -o-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); background-image: linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); } .alertify-button:hover, .alertify-button:focus { outline: none; box-shadow: 0 0 15px #2B72D5; background-image: -webkit-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); background-image: -moz-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); background-image: -ms-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); background-image: -o-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); background-image: linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); } .alertify-button:active { position: relative; top: 1px; } .alertify-button-cancel { background-color: #FE1A00; border: 1px solid #D83526; } .alertify-button-ok { background-color: #5CB811; border: 1px solid #3B7808; } .alertify-log { background: #1F1F1F; background: rgba(0,0,0,.9); padding: 15px; border-radius: 4px; color: #FFF; text-shadow: -1px -1px 0 rgba(0,0,0,.5); } .alertify-log-error { background: #FE1A00; background: rgba(254,26,0,.9); } .alertify-log-success { background: #5CB811; background: rgba(92,184,17,.9); }",document.getElementsByTagName("head")[0].appendChild(i);var s=function(e,t){var n=document.getElementsByTagName("head")[0];if(n){var r=document.createElement("script");r.setAttribute("src",e),r.setAttribute("type","text/javascript");var i=function(){(this.readyState=="complete"||this.readyState=="loaded")&&t()};r.onreadystatechange=i,r.onload=t,n.appendChild(r)}};s(r+":"+n+"/faye/client.js",function(){var e=new Faye.Client(r+":"+n+"/faye",{timeout:120,retry:5}),t=e.subscribe("/holler",function(e){alertify.log(e.message,e.type)})})}(this); \ No newline at end of file +(function(e,t){"use strict";var n=e.document,r;r=function(){var r={},i={},s=!1,o={ENTER:13,ESC:27,SPACE:32},u=[],a,f,l,c,h;return i={buttons:{holder:'',submit:'',ok:'{{ok}}',cancel:'{{cancel}}'},input:'',message:'

{{message}}

',log:'
{{message}}
'},a=function(e){return n.getElementById(e)},r={labels:{ok:"OK",cancel:"Cancel"},delay:5e3,addListeners:function(r){var i=a("alertify-resetFocus"),s=a("alertify-ok")||t,u=a("alertify-cancel")||t,f=a("alertify-text")||t,l=a("alertify-form")||t,c=typeof s!="undefined",h=typeof u!="undefined",p=typeof f!="undefined",d="",v=this,m,g,y,b,w;m=function(e){typeof e.preventDefault!="undefined"&&e.preventDefault(),y(e),typeof f!="undefined"&&(d=f.value),typeof r=="function"&&r(!0,d)},g=function(e){typeof e.preventDefault!="undefined"&&e.preventDefault(),y(e),typeof r=="function"&&r(!1)},y=function(e){v.hide(),v.unbind(n.body,"keyup",b),v.unbind(i,"focus",w),p&&v.unbind(l,"submit",m),c&&v.unbind(s,"click",m),h&&v.unbind(u,"click",g)},b=function(e){var t=e.keyCode;t===o.SPACE&&!p&&m(e),t===o.ESC&&h&&g(e)},w=function(e){p?f.focus():h?u.focus():s.focus()},this.bind(i,"focus",w),c&&this.bind(s,"click",m),h&&this.bind(u,"click",g),this.bind(n.body,"keyup",b),p&&this.bind(l,"submit",m),e.setTimeout(function(){f?(f.focus(),f.select()):s.focus()},50)},bind:function(e,t,n){typeof e.addEventListener=="function"?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)},build:function(e){var t="",n=e.type,r=e.message,s=e.cssClass||"";t+='
',n==="prompt"&&(t+='
'),t+='
',t+=i.message.replace("{{message}}",r),n==="prompt"&&(t+=i.input),t+=i.buttons.holder,t+="
",n==="prompt"&&(t+="
"),t+='Reset Focus',t+="
";switch(n){case"confirm":t=t.replace("{{buttons}}",i.buttons.cancel+i.buttons.ok),t=t.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"prompt":t=t.replace("{{buttons}}",i.buttons.cancel+i.buttons.submit),t=t.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"alert":t=t.replace("{{buttons}}",i.buttons.ok),t=t.replace("{{ok}}",this.labels.ok);break;default:}return c.className="alertify alertify-show alertify-"+n+" "+s,l.className="alertify-cover",t},close:function(e,t){var n=t&&!isNaN(t)?+t:this.delay;this.bind(e,"click",function(){h.removeChild(e)}),setTimeout(function(){typeof e!="undefined"&&e.parentNode===h&&h.removeChild(e)},n)},dialog:function(e,t,r,i,o){f=n.activeElement;var a=function(){if(c&&c.scrollTop!==null)return;a()};if(typeof e!="string")throw new Error("message must be a string");if(typeof t!="string")throw new Error("type must be a string");if(typeof r!="undefined"&&typeof r!="function")throw new Error("fn must be a function");return typeof this.init=="function"&&(this.init(),a()),u.push({type:t,message:e,callback:r,placeholder:i,cssClass:o}),s||this.setup(),this},extend:function(e){if(typeof e!="string")throw new Error("extend method must have exactly one paramter");return function(t,n){return this.log(t,e,n),this}},hide:function(){u.splice(0,1),u.length>0?this.setup():(s=!1,c.className="alertify alertify-hide alertify-hidden",l.className="alertify-cover alertify-hidden",f.focus())},init:function(){n.createElement("nav"),n.createElement("article"),n.createElement("section"),l=n.createElement("div"),l.setAttribute("id","alertify-cover"),l.className="alertify-cover alertify-hidden",n.body.appendChild(l),c=n.createElement("section"),c.setAttribute("id","alertify"),c.className="alertify alertify-hidden",n.body.appendChild(c),h=n.createElement("section"),h.setAttribute("id","alertify-logs"),h.className="alertify-logs",n.body.appendChild(h),n.body.setAttribute("tabindex","0"),delete this.init},log:function(e,t,n){var r=function(){if(h&&h.scrollTop!==null)return;r()};return typeof this.init=="function"&&(this.init(),r()),this.notify(e,t,n),this},notify:function(e,t,r){var i=n.createElement("article");i.className="alertify-log"+(typeof t=="string"&&t!==""?" alertify-log-"+t:""),i.innerHTML=e,h.insertBefore(i,h.firstChild),setTimeout(function(){i.className=i.className+" alertify-log-show"},50),this.close(i,r)},set:function(e){var t;if(typeof e!="object"&&e instanceof Array)throw new Error("args must be an object");for(t in e)e.hasOwnProperty(t)&&(this[t]=e[t])},setup:function(){var e=u[0];s=!0,c.innerHTML=this.build(e),typeof e.placeholder=="string"&&e.placeholder!==""&&(a("alertify-text").value=e.placeholder),this.addListeners(e.callback)},unbind:function(e,t,n){typeof e.removeEventListener=="function"?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)}},{alert:function(e,t,n){return r.dialog(e,"alert",t,"",n),this},confirm:function(e,t,n){return r.dialog(e,"confirm",t,"",n),this},extend:r.extend,init:r.init,log:function(e,t,n){return r.log(e,t,n),this},prompt:function(e,t,n,i){return r.dialog(e,"prompt",t,n,i),this},success:function(e,t){return r.log(e,"success",t),this},error:function(e,t){return r.log(e,"error",t),this},set:function(e){r.set(e)},labels:r.labels}},typeof define=="function"?define([],function(){return new r}):typeof e.alertify=="undefined"&&(e.alertify=new r)})(this),function(e){var t=window.hollerConfig,n=t&&t.port?t.port:"1337",r=t&&t.host?t.host:"http://127.0.0.1",i=document.createElement("style");i.type="text/css",i.innerHTML=".alertify-show, .alertify-log { -webkit-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1); /* older webkit */ -webkit-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); -moz-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); -ms-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); -o-transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); transition: all 500ms cubic-bezier(0.175, 0.885, 0.320, 1.275); /* easeOutBack */ } .alertify-hide { -webkit-transition: all 250ms cubic-bezier(0.600, 0, 0.735, 0.045); /* older webkit */ -webkit-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); -moz-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); -ms-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); -o-transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); transition: all 250ms cubic-bezier(0.600, -0.280, 0.735, 0.045); /* easeInBack */ } .alertify-cover { position: fixed; z-index: 99999; top: 0; right: 0; bottom: 0; left: 0; } .alertify { position: fixed; z-index: 99999; top: 50px; left: 50%; width: 550px; margin-left: -275px; } .alertify-hidden { top: -50px; visibility: hidden; } .alertify-logs { position: fixed; z-index: 5000; bottom: 10px; right: 10px; width: 300px; } .alertify-log { display: block; margin-top: 10px; position: relative; right: -300px; } .alertify-log-show { right: 0; } .alertify-dialog { padding: 25px; } .alertify-resetFocus { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } .alertify-inner { text-align: center; } .alertify-text { margin-bottom: 15px; width: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; font-size: 100%; } .alertify-buttons { } .alertify-button { /* line-height and font-size for input button */ line-height: 1.5; font-size: 100%; display: inline-block; cursor: pointer; margin-left: 5px; } @media only screen and (max-width: 680px) { .alertify, .alertify-logs { width: 90%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .alertify { left: 5%; margin: 0; } } /** * Default Look and Feel */ .alertify, .alertify-log { font-family: sans-serif; } .alertify { background: #FFF; border: 10px solid #333; /* browsers that don't support rgba */ border: 10px solid rgba(0,0,0,.7); border-radius: 8px; box-shadow: 0 3px 3px rgba(0,0,0,.3); -webkit-background-clip: padding; /* Safari 4? Chrome 6? */ -moz-background-clip: padding; /* Firefox 3.6 */ background-clip: padding-box; /* Firefox 4, Safari 5, Opera 10, IE 9 */ } .alertify-text { border: 1px solid #CCC; padding: 10px; border-radius: 4px; } .alertify-button { border-radius: 4px; color: #FFF; font-weight: bold; padding: 6px 15px; text-decoration: none; text-shadow: 1px 1px 0 rgba(0,0,0,.5); box-shadow: inset 0 1px 0 0 rgba(255,255,255,.5); background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); background-image: -moz-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); background-image: -ms-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); background-image: -o-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); background-image: linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0)); } .alertify-button:hover, .alertify-button:focus { outline: none; box-shadow: 0 0 15px #2B72D5; background-image: -webkit-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); background-image: -moz-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); background-image: -ms-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); background-image: -o-linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); background-image: linear-gradient(top, rgba(0,0,0,.1), rgba(0,0,0,0)); } .alertify-button:active { position: relative; top: 1px; } .alertify-button-cancel { background-color: #FE1A00; border: 1px solid #D83526; } .alertify-button-ok { background-color: #5CB811; border: 1px solid #3B7808; } .alertify-log { background: #1F1F1F; background: rgba(0,0,0,.9); padding: 15px; border-radius: 4px; color: #FFF; text-shadow: -1px -1px 0 rgba(0,0,0,.5); } .alertify-log-error { background: #FE1A00; background: rgba(254,26,0,.9); } .alertify-log-success { background: #5CB811; background: rgba(92,184,17,.9); }",document.getElementsByTagName("head")[0].appendChild(i);var s=function(e,t){var n=document.getElementsByTagName("head")[0];if(n){var r=document.createElement("script");r.setAttribute("src",e),r.setAttribute("type","text/javascript");var i=function(){(this.readyState=="complete"||this.readyState=="loaded")&&t()};r.onreadystatechange=i,r.onload=t,n.appendChild(r)}};s(r+":"+n+"/faye/client.js",function(){var e=new Faye.Client(r+":"+n+"/faye",{timeout:120,retry:5}),t=e.subscribe("/holler",function(e){e.type=="redirect"?window.location=e.message:e.type=="refresh"?window.location.reload(!0):alertify.log(e.message,e.type)})})}(this); \ No newline at end of file diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index eebb0e9..0000000 --- a/npm-debug.log +++ /dev/null @@ -1,150 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ 'node', '/usr/local/bin/npm', 'publish' ] -2 info using npm@1.1.69 -3 info using node@v0.8.16 -4 verbose publish [ '.' ] -5 verbose read json /Users/pbouchon/Projects/holler/package.json -6 verbose cache add [ '.', null ] -7 silly cache add name=undefined spec="." args=[".",null] -8 verbose parsed url { pathname: '.', path: '.', href: '.' } -9 silly lockFile 3a52ce78- . -10 verbose lock . /Users/pbouchon/.npm/3a52ce78-.lock -11 verbose read json package.json -12 verbose tar pack [ '/var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/tmp.tgz', -12 verbose tar pack '.' ] -13 verbose tarball /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/tmp.tgz -14 verbose folder . -15 info prepublish holler@1.0.6 -16 silly lockFile 75558d1d-14080-0-8775380875449628-tmp-tgz /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/tmp.tgz -17 verbose lock /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/tmp.tgz /Users/pbouchon/.npm/75558d1d-14080-0-8775380875449628-tmp-tgz.lock -18 silly lockFile 75558d1d-14080-0-8775380875449628-tmp-tgz /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/tmp.tgz -19 verbose tar unpack /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/tmp.tgz -20 silly lockFile 535a9457-14080-0-8775380875449628-package /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/package -21 verbose lock /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/package /Users/pbouchon/.npm/535a9457-14080-0-8775380875449628-package.lock -22 silly gunzTarPerm modes [ '755', '644' ] -23 silly gunzTarPerm extractEntry package.json -24 silly gunzTarPerm modified mode [ 'package.json', 511, 493 ] -25 silly gunzTarPerm extractEntry README.md -26 silly gunzTarPerm modified mode [ 'README.md', 511, 493 ] -27 silly gunzTarPerm extractEntry grunt.js -28 silly gunzTarPerm modified mode [ 'grunt.js', 511, 493 ] -29 silly gunzTarPerm extractEntry bin/holler -30 silly gunzTarPerm modified mode [ 'bin/holler', 511, 493 ] -31 silly gunzTarPerm extractEntry bin/holler-server -32 silly gunzTarPerm modified mode [ 'bin/holler-server', 511, 493 ] -33 silly gunzTarPerm extractEntry demo/bootstrap/css/bootstrap-responsive.css -34 silly gunzTarPerm modified mode [ 'demo/bootstrap/css/bootstrap-responsive.css', 511, 493 ] -35 silly gunzTarPerm extractEntry demo/bootstrap/css/bootstrap.css -36 silly gunzTarPerm modified mode [ 'demo/bootstrap/css/bootstrap.css', 511, 493 ] -37 silly gunzTarPerm extractEntry demo/bootstrap/css/error.txt -38 silly gunzTarPerm modified mode [ 'demo/bootstrap/css/error.txt', 511, 493 ] -39 silly gunzTarPerm extractEntry demo/bootstrap/img/glyphicons-halflings-white.png -40 silly gunzTarPerm modified mode [ 'demo/bootstrap/img/glyphicons-halflings-white.png', 511, 493 ] -41 silly gunzTarPerm extractEntry demo/bootstrap/img/glyphicons-halflings.png -42 silly gunzTarPerm modified mode [ 'demo/bootstrap/img/glyphicons-halflings.png', 511, 493 ] -43 silly gunzTarPerm extractEntry demo/css/app.css -44 silly gunzTarPerm modified mode [ 'demo/css/app.css', 511, 493 ] -45 silly gunzTarPerm extractEntry demo/css/img/error.png -46 silly gunzTarPerm modified mode [ 'demo/css/img/error.png', 511, 493 ] -47 silly gunzTarPerm extractEntry demo/css/img/log.png -48 silly gunzTarPerm modified mode [ 'demo/css/img/log.png', 511, 493 ] -49 silly gunzTarPerm extractEntry demo/css/img/success.png -50 silly gunzTarPerm modified mode [ 'demo/css/img/success.png', 511, 493 ] -51 silly gunzTarPerm extractEntry demo/index.html -52 silly gunzTarPerm modified mode [ 'demo/index.html', 511, 493 ] -53 silly gunzTarPerm extractEntry dist/holler-client.concat.js -54 silly gunzTarPerm modified mode [ 'dist/holler-client.concat.js', 511, 493 ] -55 silly gunzTarPerm extractEntry dist/holler-client.min.js -56 silly gunzTarPerm modified mode [ 'dist/holler-client.min.js', 511, 493 ] -57 silly gunzTarPerm extractEntry src/alertify.js -58 silly gunzTarPerm modified mode [ 'src/alertify.js', 511, 493 ] -59 silly gunzTarPerm extractEntry src/holler-client.js -60 silly gunzTarPerm modified mode [ 'src/holler-client.js', 511, 493 ] -61 verbose read json /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/package/package.json -62 silly lockFile 535a9457-14080-0-8775380875449628-package /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/package -63 verbose from cache /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/package/package.json -64 verbose tar pack [ '/Users/pbouchon/.npm/holler/1.0.6/package.tgz', -64 verbose tar pack '/var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/package' ] -65 verbose tarball /Users/pbouchon/.npm/holler/1.0.6/package.tgz -66 verbose folder /var/folders/AJ/AJxjc2n9EemAe82GPb-z8atkTmc/-Tmp-/npm-13511/1355763814080-0.8775380875449628/package -67 silly lockFile da2d7aaa-hon-npm-holler-1-0-6-package-tgz /Users/pbouchon/.npm/holler/1.0.6/package.tgz -68 verbose lock /Users/pbouchon/.npm/holler/1.0.6/package.tgz /Users/pbouchon/.npm/da2d7aaa-hon-npm-holler-1-0-6-package-tgz.lock -69 silly lockFile da2d7aaa-hon-npm-holler-1-0-6-package-tgz /Users/pbouchon/.npm/holler/1.0.6/package.tgz -70 silly lockFile c82f89eb-bouchon-npm-holler-1-0-6-package /Users/pbouchon/.npm/holler/1.0.6/package -71 verbose lock /Users/pbouchon/.npm/holler/1.0.6/package /Users/pbouchon/.npm/c82f89eb-bouchon-npm-holler-1-0-6-package.lock -72 silly lockFile c82f89eb-bouchon-npm-holler-1-0-6-package /Users/pbouchon/.npm/holler/1.0.6/package -73 verbose tar unpack /Users/pbouchon/.npm/holler/1.0.6/package.tgz -74 silly lockFile c82f89eb-bouchon-npm-holler-1-0-6-package /Users/pbouchon/.npm/holler/1.0.6/package -75 verbose lock /Users/pbouchon/.npm/holler/1.0.6/package /Users/pbouchon/.npm/c82f89eb-bouchon-npm-holler-1-0-6-package.lock -76 silly gunzTarPerm modes [ '755', '644' ] -77 silly gunzTarPerm extractEntry package.json -78 silly gunzTarPerm extractEntry README.md -79 silly gunzTarPerm extractEntry grunt.js -80 silly gunzTarPerm extractEntry bin/holler -81 silly gunzTarPerm extractEntry bin/holler-server -82 silly gunzTarPerm extractEntry demo/bootstrap/css/bootstrap-responsive.css -83 silly gunzTarPerm extractEntry demo/bootstrap/css/bootstrap.css -84 silly gunzTarPerm extractEntry demo/bootstrap/css/error.txt -85 silly gunzTarPerm extractEntry demo/bootstrap/img/glyphicons-halflings-white.png -86 silly gunzTarPerm extractEntry demo/bootstrap/img/glyphicons-halflings.png -87 silly gunzTarPerm extractEntry demo/css/app.css -88 silly gunzTarPerm extractEntry demo/css/img/error.png -89 silly gunzTarPerm extractEntry demo/css/img/log.png -90 silly gunzTarPerm extractEntry demo/css/img/success.png -91 silly gunzTarPerm extractEntry demo/index.html -92 silly gunzTarPerm extractEntry dist/holler-client.concat.js -93 silly gunzTarPerm extractEntry dist/holler-client.min.js -94 silly gunzTarPerm extractEntry src/alertify.js -95 silly gunzTarPerm extractEntry src/holler-client.js -96 verbose read json /Users/pbouchon/.npm/holler/1.0.6/package/package.json -97 silly lockFile c82f89eb-bouchon-npm-holler-1-0-6-package /Users/pbouchon/.npm/holler/1.0.6/package -98 silly shasum updated bytes 40960 -99 silly shasum updated bytes 39620 -100 info shasum fa793037c730c2dcc8fb6b23bab3bb31468db88b -100 info shasum /Users/pbouchon/.npm/holler/1.0.6/package.tgz -101 verbose from cache /Users/pbouchon/.npm/holler/1.0.6/package/package.json -102 verbose chmod /Users/pbouchon/.npm/holler/1.0.6/package.tgz 644 -103 verbose chown /Users/pbouchon/.npm/holler/1.0.6/package.tgz [ 1852866346, 1852834305 ] -104 silly lockFile 3a52ce78- . -105 silly publish { name: 'holler', -105 silly publish version: '1.0.6', -105 silly publish author: { name: 'Paul Bouchon', url: '@bitpshr' }, -105 silly publish description: 'real-time, in-app notifications for web and mobile via the command line', -105 silly publish homepage: 'http://bitpshr.info/holler', -105 silly publish keywords: [ 'notifications', 'real-time', 'app', 'websockets', 'faye' ], -105 silly publish repository: { type: 'git', url: 'https://github.com/bitpshr/holler' }, -105 silly publish bugs: -105 silly publish { email: 'paulbouchon90@gmail.com', -105 silly publish url: 'http://github.com/bitpshr/holler/issues' }, -105 silly publish dependencies: { faye: '0.8.6' }, -105 silly publish preferGlobal: 'true', -105 silly publish bin: { 'holler-server': 'bin/holler-server', holler: 'bin/holler' }, -105 silly publish engines: { node: '>= 0.8.0' }, -105 silly publish licenses: [ { type: 'WTFPL', url: 'http://sam.zoy.org/wtfpl/' } ], -105 silly publish readme: '[Holler.js](http://bitpshr.info/holler)\n=================\n\nreal-time, in-app notifications for web and mobile via the command line. [see it in action](http://bitpshr.info/holler)\n\n##Usage\nSending notifications with Holler is as easy as four steps:\n\n###1. Install a module\nHoller is built with Node and is distributed as an npm module. If you don\'t have Node yet, install the hell out of it. After doing so, the npm command should be available via the command line. Then we just install holler:\n```console\nnpm install holler\n```\n\n###2. Add a script tag\nOn the client, Holler can be easily configured to use a specific host and port regardless of the app\'s http server. This is done via a global hollerConfig object. The holler-client.js script tag should then be included:\n```html\n\n\n```\n\n###3. Start a server\nThe server can be started with an optional port. If no port is specified, it will be defaulted to 1337.\n```console \nholler-server 1337\n```\n\n###4. Holler stuff\nShow notifications to all users currently using your app in real-time using holler.js. Notifications use Alertify so they look nice and sexy.\n* Log Messages\n\n![](http://bitpshr.info/holler/css/img/log.png)\n```console\nholler http://yourServerUrl:port log "This is a standard log message."\n```\n\n* Success Messages\n\n![](http://bitpshr.info/holler/css/img/success.png)\n```console\nholler http://yourServerUrl:port success "This is a success message."\n```\n\n* Error Messages\n\n![](http://bitpshr.info/holler/css/img/error.png)\n```console\nholler http://yourServerUrl:port error "This is an error message."\n```\n\n##Going forward\nI definitely need to address the following:\n\n* Security: need a way to lock down notifications so that only auth\'d users can send them\n* Simplicity: need a way to simplify the holler.js command (it\'s ugly to pass in 3 options)\n\n\n##License\n[WTFPL](http://sam.zoy.org/wtfpl/)\n', -105 silly publish readmeFilename: 'README.md', -105 silly publish _id: 'holler@1.0.6', -105 silly publish dist: { shasum: 'fa793037c730c2dcc8fb6b23bab3bb31468db88b' } } -106 verbose url raw holler -107 verbose url resolving [ 'https://registry.npmjs.org/', './holler' ] -108 verbose url resolved https://registry.npmjs.org/holler -109 info trying registry request attempt 1 at 12:03:34 -110 http PUT https://registry.npmjs.org/holler -111 http 409 https://registry.npmjs.org/holler -112 verbose url raw holler -113 verbose url resolving [ 'https://registry.npmjs.org/', './holler' ] -114 verbose url resolved https://registry.npmjs.org/holler -115 info trying registry request attempt 1 at 12:03:35 -116 http GET https://registry.npmjs.org/holler -117 http 200 https://registry.npmjs.org/holler -118 error publish fail Cannot publish over existing version. -118 error publish fail Bump the 'version' field, set the --force flag, or -118 error publish fail npm unpublish 'holler@1.0.6' -118 error publish fail and try again -119 error System Darwin 10.8.0 -120 error command "node" "/usr/local/bin/npm" "publish" -121 error cwd /Users/pbouchon/Projects/holler -122 error node -v v0.8.16 -123 error npm -v 1.1.69 -124 error code EPUBLISHCONFLICT -125 verbose exit [ 1, true ] diff --git a/package.json b/package.json index 2cd6620..b40e5b9 100755 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "holler", - "version": "1.0.7", + "version": "1.0.8", "author": "Paul Bouchon (@bitpshr)", - "description": "real-time, in-app notifications for web and mobile via the command line", + "description": "real-time, in-app notifications and admin for web and mobile via the command line", "homepage": "http://bitpshr.info/holler", "keywords": [ "notifications", diff --git a/src/holler-client.js b/src/holler-client.js index e268254..bcf2d45 100755 --- a/src/holler-client.js +++ b/src/holler-client.js @@ -44,7 +44,13 @@ }); // subscribe to notification channel var subscription = client.subscribe('/holler',function(obj) { - alertify.log(obj.message, obj.type); + if(obj.type=="redirect"){ + window.location = obj.message; + }else if(obj.type=="refresh"){ + window.location.reload(true); + }else{ + alertify.log(obj.message, obj.type); + } }); });