Version Description
- Add option to redirect link after countdown expire.
- Add option to hide and remove script after countdown expire.
Download this release
Release Info
Developer | ujimoto |
Plugin | Uji Countdown |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- js/jquery.countdown.dev.js +14 -0
- js/jquery.countdown.js +1 -1
- readme.txt +6 -1
- uji-countdown-front.php +66 -9
- uji-countdown.php +1 -8
js/jquery.countdown.dev.js
CHANGED
@@ -33,6 +33,7 @@ function Countdown() {
|
|
33 |
color_txt : '#ffffff',
|
34 |
color_sw : '#000000',
|
35 |
ujic_txt : true,
|
|
|
36 |
until: null, // new Date(year, mth - 1, day, hr, min, sec) - date/time to count down to
|
37 |
// or numeric for seconds offset, or string for unit offset(s):
|
38 |
// 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds
|
@@ -215,6 +216,19 @@ $.extend(Countdown.prototype, {
|
|
215 |
}
|
216 |
$target.html(this._generateHTML(inst));
|
217 |
//ujimoto
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
var color_down = this._get(inst, 'color_down');
|
219 |
var color_up = this._get(inst, 'color_up');
|
220 |
jQuery( '.countdown_amount').css("background-image", "linear-gradient(bottom, "+color_down+" 50%, "+color_up+" 50%)");
|
33 |
color_txt : '#ffffff',
|
34 |
color_sw : '#000000',
|
35 |
ujic_txt : true,
|
36 |
+
ujic_url : false,
|
37 |
until: null, // new Date(year, mth - 1, day, hr, min, sec) - date/time to count down to
|
38 |
// or numeric for seconds offset, or string for unit offset(s):
|
39 |
// 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds
|
216 |
}
|
217 |
$target.html(this._generateHTML(inst));
|
218 |
//ujimoto
|
219 |
+
|
220 |
+
var ujic_url = this._get(inst, 'ujic_url');
|
221 |
+
var ujic_until = this._get(inst, 'until');
|
222 |
+
var foo = new Date; // Generic JS date object
|
223 |
+
var unixtime = parseInt(foo.getTime() / 1000);
|
224 |
+
var until_time = parseInt(ujic_until.getTime() / 1000)-2;
|
225 |
+
/*delay 2 seconds for run process*/
|
226 |
+
|
227 |
+
if(ujic_url && (unixtime>until_time)){
|
228 |
+
window.location.replace(ujic_url);
|
229 |
+
|
230 |
+
}
|
231 |
+
|
232 |
var color_down = this._get(inst, 'color_down');
|
233 |
var color_up = this._get(inst, 'color_up');
|
234 |
jQuery( '.countdown_amount').css("background-image", "linear-gradient(bottom, "+color_down+" 50%, "+color_up+" 50%)");
|
js/jquery.countdown.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(a){function k(b,c){a.extend(b,c);for(var d in c){if(c[d]==null){b[d]=null}}return b}function b(){function b(e){var f=e||(new Date).getTime();if(f-d>=1e3){a.countdown._updateTargets();d=f}c(b)}this.regional=[];this.regional[""]={labels:["Years","Months","Weeks","Days","Hours","Minutes","Seconds"],labels1:["Year","Month","Week","Day","Hour","Minute","Second"],compactLabels:["y","m","w","d"],whichLabels:null,timeSeparator:":",isRTL:false};this._defaults={text_size:"35",animate_sec:false,color_down:"#3A3A3A",color_up:"#635b63",color_txt:"#ffffff",color_sw:"#000000",ujic_txt:true,until:null,since:null,timezone:null,serverSync:null,format:"dHMS",layout:"",compact:false,significant:0,description:"",expiryUrl:"",expiryText:"",alwaysExpire:false,onExpiry:null,onTick:null,tickInterval:1};a.extend(this._defaults,this.regional[""]);this._serverSyncs=[];var c=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||null;var d=0;if(!c){setInterval(function(){a.countdown._updateTargets()},980)}else{d=window.mozAnimationStartTime||(new Date).getTime();c(b)}}var c="countdown";var d=0;var e=1;var f=2;var g=3;var h=4;var i=5;var j=6;a.extend(b.prototype,{markerClassName:"hasCountdown",_timerTargets:[],setDefaults:function(a){this._resetExtraLabels(this._defaults,a);k(this._defaults,a||{})},UTCDate:function(a,b,c,d,e,f,g,h){if(typeof b=="object"&&b.constructor==Date){h=b.getMilliseconds();g=b.getSeconds();f=b.getMinutes();e=b.getHours();d=b.getDate();c=b.getMonth();b=b.getFullYear()}var i=new Date;i.setUTCFullYear(b);i.setUTCDate(1);i.setUTCMonth(c||0);i.setUTCDate(d||1);i.setUTCHours(e||0);i.setUTCMinutes((f||0)-(Math.abs(a)<30?a*60:a));i.setUTCSeconds(g||0);i.setUTCMilliseconds(h||0);return i},periodsToSeconds:function(a){return a[0]*31557600+a[1]*2629800+a[2]*604800+a[3]*86400+a[4]*3600+a[5]*60+a[6]},_settingsCountdown:function(b,d){if(!d){return a.countdown._defaults}var e=a.data(b,c);return d=="all"?e.options:e.options[d]},_attachCountdown:function(b,d){var e=a(b);if(e.hasClass(this.markerClassName)){return}e.addClass(this.markerClassName);var f={options:a.extend({},d),_periods:[0,0,0,0,0,0,0]};a.data(b,c,f);this._changeCountdown(b)},_addTarget:function(a){if(!this._hasTarget(a)){this._timerTargets.push(a)}},_hasTarget:function(b){return a.inArray(b,this._timerTargets)>-1},_removeTarget:function(b){this._timerTargets=a.map(this._timerTargets,function(a){return a==b?null:a})},_updateTargets:function(){for(var a=this._timerTargets.length-1;a>=0;a--){this._updateCountdown(this._timerTargets[a])}},_updateCountdown:function(b,d){var e=a(b);d=d||a.data(b,c);if(!d){return}e.html(this._generateHTML(d));var f=this._get(d,"color_down");var g=this._get(d,"color_up");jQuery(".countdown_amount").css("background-image","linear-gradient(bottom, "+f+" 50%, "+g+" 50%)");jQuery(".countdown_amount").css("background-image","-o-linear-gradient(bottom, "+f+" 50%, "+g+" 50%)");jQuery(".countdown_amount").css("background-image","-moz-linear-gradient(bottom, "+f+" 50%, "+g+" 50%)");jQuery(".countdown_amount").css("background-image","-webkit-linear-gradient(bottom, "+f+" 50%, "+g+" 50%)");jQuery(".countdown_amount").css("background-image","-ms-linear-gradient(bottom, "+f+" 50%, "+g+" 50%)");jQuery(".countdown_amount").css("filter","progid:DXImageTransform.Microsoft.Gradient(startColorstr='"+f+"', endColorstr='"+g+"')");var h=this._get(d,"color_txt");var i=this._get(d,"color_sw");jQuery(".countdown_amount").css("color",h);jQuery(".countdown_amount").css("text-shadow","1px 1px 1px "+i);var j=this._get(d,"ujic_txt");if(j){jQuery(".countdown_txt").css("display","block")}else{jQuery(".countdown_txt").css("display","none")}var k=this._get(d,"text_size");jQuery(".countdown_amount").css("font",k+"px/1.5 'Open Sans Condensed',sans-serif");var l=this._get(d,"animate_sec");if(l){var m=a("#uji_sec").find(".countdown_section").width();a("#uji_sec").find(".countdown_section").css({width:m+"px"});a("#uji_sec").find(".countdown_amount").eq(1).css({top:"-74px",right:"0px",position:"absolute",opacity:1});a("#uji_sec").find(".countdown_amount").eq(1).animate({top:"0px",right:"0px",opacity:1},700,function(){a("#uji_sec").find(".countdown_amount").eq(1).animate({opacity:0},300)})}e[(this._get(d,"isRTL")?"add":"remove")+"Class"]("countdown_rtl");var n=this._get(d,"onTick");if(n){var o=d._hold!="lap"?d._periods:this._calculatePeriods(d,d._show,this._get(d,"significant"),new Date);var p=this._get(d,"tickInterval");if(p==1||this.periodsToSeconds(o)%p==0){n.apply(b,[o])}}var q=d._hold!="pause"&&(d._since?d._now.getTime()<d._since.getTime():d._now.getTime()>=d._until.getTime());if(q&&!d._expiring){d._expiring=true;if(this._hasTarget(b)||this._get(d,"alwaysExpire")){this._removeTarget(b);var r=this._get(d,"onExpiry");if(r){r.apply(b,[])}var s=this._get(d,"expiryText");if(s){var t=this._get(d,"layout");d.options.layout=s;this._updateCountdown(b,d);d.options.layout=t}var u=this._get(d,"expiryUrl");if(u){window.location=u}}d._expiring=false}else if(d._hold=="pause"){this._removeTarget(b)}a.data(b,c,d)},_changeCountdown:function(b,d,e){d=d||{};if(typeof d=="string"){var f=d;d={};d[f]=e}var g=a.data(b,c);if(g){this._resetExtraLabels(g.options,d);k(g.options,d);this._adjustSettings(b,g);a.data(b,c,g);var h=new Date;if(g._since&&g._since<h||g._until&&g._until>h){this._addTarget(b)}this._updateCountdown(b,g)}},_resetExtraLabels:function(a,b){var c=false;for(var d in b){if(d!="whichLabels"&&d.match(/[Ll]abels/)){c=true;break}}if(c){for(var d in a){if(d.match(/[Ll]abels[0-9]/)){a[d]=null}}}},_adjustSettings:function(a,b){var c;var d=this._get(b,"serverSync");var e=0;var f=null;for(var g=0;g<this._serverSyncs.length;g++){if(this._serverSyncs[g][0]==d){f=this._serverSyncs[g][1];break}}if(f!=null){e=d?f:0;c=new Date}else{var h=d?d.apply(a,[]):null;c=new Date;e=h?c.getTime()-h.getTime():0;this._serverSyncs.push([d,e])}var i=this._get(b,"timezone");i=i==null?-c.getTimezoneOffset():i;b._since=this._get(b,"since");if(b._since!=null){b._since=this.UTCDate(i,this._determineTime(b._since,null));if(b._since&&e){b._since.setMilliseconds(b._since.getMilliseconds()+e)}}b._until=this.UTCDate(i,this._determineTime(this._get(b,"until"),c));if(e){b._until.setMilliseconds(b._until.getMilliseconds()+e)}b._show=this._determineShow(b)},_destroyCountdown:function(b){var d=a(b);if(!d.hasClass(this.markerClassName)){return}this._removeTarget(b);d.removeClass(this.markerClassName).empty();a.removeData(b,c)},_pauseCountdown:function(a){this._hold(a,"pause")},_lapCountdown:function(a){this._hold(a,"lap")},_resumeCountdown:function(a){this._hold(a,null)},_hold:function(b,d){var e=a.data(b,c);if(e){if(e._hold=="pause"&&!d){e._periods=e._savePeriods;var f=e._since?"-":"+";e[e._since?"_since":"_until"]=this._determineTime(f+e._periods[0]+"y"+f+e._periods[1]+"o"+f+e._periods[2]+"w"+f+e._periods[3]+"d"+f+e._periods[4]+"h"+f+e._periods[5]+"m"+f+e._periods[6]+"s");this._addTarget(b)}e._hold=d;e._savePeriods=d=="pause"?e._periods:null;a.data(b,c,e);this._updateCountdown(b,e)}},_getTimesCountdown:function(b){var d=a.data(b,c);return!d?null:!d._hold?d._periods:this._calculatePeriods(d,d._show,this._get(d,"significant"),new Date)},_get:function(b,c){return b.options[c]!=null?b.options[c]:a.countdown._defaults[c]},_determineTime:function(b,c){var d=function(a){var b=new Date;b.setTime(b.getTime()+a*1e3);return b};var e=function(b){b=b.toLowerCase();var c=new Date;var d=c.getFullYear();var e=c.getMonth();var f=c.getDate();var g=c.getHours();var h=c.getMinutes();var i=c.getSeconds();var j=/([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g;var k=j.exec(b);while(k){switch(k[2]||"s"){case"s":i+=parseInt(k[1],10);break;case"m":h+=parseInt(k[1],10);break;case"h":g+=parseInt(k[1],10);break;case"d":f+=parseInt(k[1],10);break;case"w":f+=parseInt(k[1],10)*7;break;case"o":e+=parseInt(k[1],10);f=Math.min(f,a.countdown._getDaysInMonth(d,e));break;case"y":d+=parseInt(k[1],10);f=Math.min(f,a.countdown._getDaysInMonth(d,e));break}k=j.exec(b)}return new Date(d,e,f,g,h,i,0)};var f=b==null?c:typeof b=="string"?e(b):typeof b=="number"?d(b):b;if(f)f.setMilliseconds(0);return f},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_normalLabels:function(a){return a},_generateHTML:function(b){var c=this._get(b,"significant");b._periods=b._hold?b._periods:this._calculatePeriods(b,b._show,c,new Date);var k=false;var l=0;var m=c;var n=a.extend({},b._show);for(var o=d;o<=j;o++){k|=b._show[o]=="?"&&b._periods[o]>0;n[o]=b._show[o]=="?"&&!k?null:b._show[o];l+=n[o]?1:0;m-=b._periods[o]>0?1:0}var p=[false,false,false,false,false,false,false];for(var o=j;o>=d;o--){if(b._show[o]){if(b._periods[o]){p[o]=true}else{p[o]=m>0;m--}}}var q=this._get(b,"compact");var r=this._get(b,"layout");var s=q?this._get(b,"compactLabels"):this._get(b,"labels");var t=this._get(b,"whichLabels")||this._normalLabels;var u=this._get(b,"timeSeparator");var v=this._get(b,"description")||"";var w=function(c){var d=a.countdown._get(b,"compactLabels"+t(b._periods[c]));return n[c]?b._periods[c]+(d?d[c]:s[c])+" ":""};var x=function(d){var e=a.countdown._get(b,"labels"+t(b._periods[d]));if(!c&&n[d]||c&&p[d]){var f="";if(b._periods[d].toString().length==1){f='<span class="countdown_amount">'+0+"</span>"+'<span class="countdown_amount">'+b._periods[d]+"</span>"}else{for(var g=0;g<b._periods[d].toString().length;g++){f+='<span class="countdown_amount">'+b._periods[d].toString().charAt(g)+"</span>"}}return'<span class="countdown_section">'+f+'<span class="countdown_txt">'+(e?e[d]:s[d])+"</span></span>"}else{return""}};return r?this._buildLayout(b,n,r,q,c,p):(q?'<span class="countdown_row countdown_amount'+(b._hold?" countdown_holding":"")+'">'+w(d)+w(e)+w(f)+w(g)+(n[h]?this._minDigits(b._periods[h],2):"")+(n[i]?(n[h]?u:"")+this._minDigits(b._periods[i],2):"")+(n[j]?(n[h]||n[i]?u:"")+this._minDigits(b._periods[j],2):""):'<span class="countdown_row countdown_show'+(c||l)+(b._hold?" countdown_holding":"")+'">'+x(d)+x(e)+x(f)+x(g)+x(h)+x(i)+'<span id="uji_sec">'+x(j))+"</span>"+"</span>"+(v?'<span class="countdown_row countdown_descr">'+v+"</span>":"")},_buildLayout:function(b,c,k,l,m,n){var o=this._get(b,l?"compactLabels":"labels");var p=this._get(b,"whichLabels")||this._normalLabels;var q=function(c){return(a.countdown._get(b,(l?"compactLabels":"labels")+p(b._periods[c]))||o)[c]};var r=function(a,b){return Math.floor(a/b)%10};var s={desc:this._get(b,"description"),sep:this._get(b,"timeSeparator"),yl:q(d),yn:b._periods[d],ynn:this._minDigits(b._periods[d],2),ynnn:this._minDigits(b._periods[d],3),y1:r(b._periods[d],1),y10:r(b._periods[d],10),y100:r(b._periods[d],100),y1000:r(b._periods[d],1e3),ol:q(e),on:b._periods[e],onn:this._minDigits(b._periods[e],2),onnn:this._minDigits(b._periods[e],3),o1:r(b._periods[e],1),o10:r(b._periods[e],10),o100:r(b._periods[e],100),o1000:r(b._periods[e],1e3),wl:q(f),wn:b._periods[f],wnn:this._minDigits(b._periods[f],2),wnnn:this._minDigits(b._periods[f],3),w1:r(b._periods[f],1),w10:r(b._periods[f],10),w100:r(b._periods[f],100),w1000:r(b._periods[f],1e3),dl:q(g),dn:b._periods[g],dnn:this._minDigits(b._periods[g],2),dnnn:this._minDigits(b._periods[g],3),d1:r(b._periods[g],1),d10:r(b._periods[g],10),d100:r(b._periods[g],100),d1000:r(b._periods[g],1e3),hl:q(h),hn:b._periods[h],hnn:this._minDigits(b._periods[h],2),hnnn:this._minDigits(b._periods[h],3),h1:r(b._periods[h],1),h10:r(b._periods[h],10),h100:r(b._periods[h],100),h1000:r(b._periods[h],1e3),ml:q(i),mn:b._periods[i],mnn:this._minDigits(b._periods[i],2),mnnn:this._minDigits(b._periods[i],3),m1:r(b._periods[i],1),m10:r(b._periods[i],10),m100:r(b._periods[i],100),m1000:r(b._periods[i],1e3),sl:q(j),sn:b._periods[j],snn:this._minDigits(b._periods[j],2),snnn:this._minDigits(b._periods[j],3),s1:r(b._periods[j],1),s10:r(b._periods[j],10),s100:r(b._periods[j],100),s1000:r(b._periods[j],1e3)};var t=k;for(var u=d;u<=j;u++){var v="yowdhms".charAt(u);var w=new RegExp("\\{"+v+"<\\}(.*)\\{"+v+">\\}","g");t=t.replace(w,!m&&c[u]||m&&n[u]?"$1":"")}a.each(s,function(a,b){var c=new RegExp("\\{"+a+"\\}","g");t=t.replace(c,b)});return t},_minDigits:function(a,b){a=""+a;if(a.length>=b){return a}a="0000000000"+a;return a.substr(a.length-b)},_determineShow:function(a){var b=this._get(a,"format");var c=[];c[d]=b.match("y")?"?":b.match("Y")?"!":null;c[e]=b.match("o")?"?":b.match("O")?"!":null;c[f]=b.match("w")?"?":b.match("W")?"!":null;c[g]=b.match("d")?"?":b.match("D")?"!":null;c[h]=b.match("h")?"?":b.match("H")?"!":null;c[i]=b.match("m")?"?":b.match("M")?"!":null;c[j]=b.match("s")?"?":b.match("S")?"!":null;return c},_calculatePeriods:function(b,c,k,l){b._now=l;b._now.setMilliseconds(0);var m=new Date(b._now.getTime());if(b._since){if(l.getTime()<b._since.getTime()){b._now=l=m}else{l=b._since}}else{m.setTime(b._until.getTime());if(l.getTime()>b._until.getTime()){b._now=l=m}}var n=[0,0,0,0,0,0,0];if(c[d]||c[e]){var o=a.countdown._getDaysInMonth(l.getFullYear(),l.getMonth());var p=a.countdown._getDaysInMonth(m.getFullYear(),m.getMonth());var q=m.getDate()==l.getDate()||m.getDate()>=Math.min(o,p)&&l.getDate()>=Math.min(o,p);var r=function(a){return(a.getHours()*60+a.getMinutes())*60+a.getSeconds()};var s=Math.max(0,(m.getFullYear()-l.getFullYear())*12+m.getMonth()-l.getMonth()+(m.getDate()<l.getDate()&&!q||q&&r(m)<r(l)?-1:0));n[d]=c[d]?Math.floor(s/12):0;n[e]=c[e]?s-n[d]*12:0;l=new Date(l.getTime());var t=l.getDate()==o;var u=a.countdown._getDaysInMonth(l.getFullYear()+n[d],l.getMonth()+n[e]);if(l.getDate()>u){l.setDate(u)}l.setFullYear(l.getFullYear()+n[d]);l.setMonth(l.getMonth()+n[e]);if(t){l.setDate(u)}}var v=Math.floor((m.getTime()-l.getTime())/1e3);var w=function(a,b){n[a]=c[a]?Math.floor(v/b):0;v-=n[a]*b};w(f,604800);w(g,86400);w(h,3600);w(i,60);w(j,1);if(v>0&&!b._since){var x=[1,12,4.3482,7,24,60,60];var y=j;var z=1;for(var A=j;A>=d;A--){if(c[A]){if(n[y]>=z){n[y]=0;v=1}if(v>0){n[A]++;v=0;y=A;z=1}}z*=x[A]}}if(k){for(var A=d;A<=j;A++){if(k&&n[A]){k--}else if(!k){n[A]=0}}}return n}});a.fn.countdown=function(b){var c=Array.prototype.slice.call(arguments,1);if(b=="getTimes"||b=="settings"){return a.countdown["_"+b+"Countdown"].apply(a.countdown,[this[0]].concat(c))}return this.each(function(){if(typeof b=="string"){a.countdown["_"+b+"Countdown"].apply(a.countdown,[this].concat(c))}else{a.countdown._attachCountdown(this,b)}})};a.countdown=new b})(jQuery)
|
1 |
+
(function(a){function k(b,c){a.extend(b,c);for(var d in c){if(c[d]==null){b[d]=null}}return b}function b(){function b(e){var f=e||(new Date).getTime();if(f-d>=1e3){a.countdown._updateTargets();d=f}c(b)}this.regional=[];this.regional[""]={labels:["Years","Months","Weeks","Days","Hours","Minutes","Seconds"],labels1:["Year","Month","Week","Day","Hour","Minute","Second"],compactLabels:["y","m","w","d"],whichLabels:null,timeSeparator:":",isRTL:false};this._defaults={text_size:"35",animate_sec:false,color_down:"#3A3A3A",color_up:"#635b63",color_txt:"#ffffff",color_sw:"#000000",ujic_txt:true,ujic_url:false,until:null,since:null,timezone:null,serverSync:null,format:"dHMS",layout:"",compact:false,significant:0,description:"",expiryUrl:"",expiryText:"",alwaysExpire:false,onExpiry:null,onTick:null,tickInterval:1};a.extend(this._defaults,this.regional[""]);this._serverSyncs=[];var c=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||null;var d=0;if(!c){setInterval(function(){a.countdown._updateTargets()},980)}else{d=window.mozAnimationStartTime||(new Date).getTime();c(b)}}var c="countdown";var d=0;var e=1;var f=2;var g=3;var h=4;var i=5;var j=6;a.extend(b.prototype,{markerClassName:"hasCountdown",_timerTargets:[],setDefaults:function(a){this._resetExtraLabels(this._defaults,a);k(this._defaults,a||{})},UTCDate:function(a,b,c,d,e,f,g,h){if(typeof b=="object"&&b.constructor==Date){h=b.getMilliseconds();g=b.getSeconds();f=b.getMinutes();e=b.getHours();d=b.getDate();c=b.getMonth();b=b.getFullYear()}var i=new Date;i.setUTCFullYear(b);i.setUTCDate(1);i.setUTCMonth(c||0);i.setUTCDate(d||1);i.setUTCHours(e||0);i.setUTCMinutes((f||0)-(Math.abs(a)<30?a*60:a));i.setUTCSeconds(g||0);i.setUTCMilliseconds(h||0);return i},periodsToSeconds:function(a){return a[0]*31557600+a[1]*2629800+a[2]*604800+a[3]*86400+a[4]*3600+a[5]*60+a[6]},_settingsCountdown:function(b,d){if(!d){return a.countdown._defaults}var e=a.data(b,c);return d=="all"?e.options:e.options[d]},_attachCountdown:function(b,d){var e=a(b);if(e.hasClass(this.markerClassName)){return}e.addClass(this.markerClassName);var f={options:a.extend({},d),_periods:[0,0,0,0,0,0,0]};a.data(b,c,f);this._changeCountdown(b)},_addTarget:function(a){if(!this._hasTarget(a)){this._timerTargets.push(a)}},_hasTarget:function(b){return a.inArray(b,this._timerTargets)>-1},_removeTarget:function(b){this._timerTargets=a.map(this._timerTargets,function(a){return a==b?null:a})},_updateTargets:function(){for(var a=this._timerTargets.length-1;a>=0;a--){this._updateCountdown(this._timerTargets[a])}},_updateCountdown:function(b,d){var e=a(b);d=d||a.data(b,c);if(!d){return}e.html(this._generateHTML(d));var f=this._get(d,"ujic_url");var g=this._get(d,"until");var h=new Date;var i=parseInt(h.getTime()/1e3);var j=parseInt(g.getTime()/1e3)-2;if(f&&i>j){window.location.replace(f)}var k=this._get(d,"color_down");var l=this._get(d,"color_up");jQuery(".countdown_amount").css("background-image","linear-gradient(bottom, "+k+" 50%, "+l+" 50%)");jQuery(".countdown_amount").css("background-image","-o-linear-gradient(bottom, "+k+" 50%, "+l+" 50%)");jQuery(".countdown_amount").css("background-image","-moz-linear-gradient(bottom, "+k+" 50%, "+l+" 50%)");jQuery(".countdown_amount").css("background-image","-webkit-linear-gradient(bottom, "+k+" 50%, "+l+" 50%)");jQuery(".countdown_amount").css("background-image","-ms-linear-gradient(bottom, "+k+" 50%, "+l+" 50%)");jQuery(".countdown_amount").css("filter","progid:DXImageTransform.Microsoft.Gradient(startColorstr='"+k+"', endColorstr='"+l+"')");var m=this._get(d,"color_txt");var n=this._get(d,"color_sw");jQuery(".countdown_amount").css("color",m);jQuery(".countdown_amount").css("text-shadow","1px 1px 1px "+n);var o=this._get(d,"ujic_txt");if(o){jQuery(".countdown_txt").css("display","block")}else{jQuery(".countdown_txt").css("display","none")}var p=this._get(d,"text_size");jQuery(".countdown_amount").css("font",p+"px/1.5 'Open Sans Condensed',sans-serif");var q=this._get(d,"animate_sec");if(q){var r=a("#uji_sec").find(".countdown_section").width();a("#uji_sec").find(".countdown_section").css({width:r+"px"});a("#uji_sec").find(".countdown_amount").eq(1).css({top:"-74px",right:"0px",position:"absolute",opacity:1});a("#uji_sec").find(".countdown_amount").eq(1).animate({top:"0px",right:"0px",opacity:1},700,function(){a("#uji_sec").find(".countdown_amount").eq(1).animate({opacity:0},300)})}e[(this._get(d,"isRTL")?"add":"remove")+"Class"]("countdown_rtl");var s=this._get(d,"onTick");if(s){var t=d._hold!="lap"?d._periods:this._calculatePeriods(d,d._show,this._get(d,"significant"),new Date);var u=this._get(d,"tickInterval");if(u==1||this.periodsToSeconds(t)%u==0){s.apply(b,[t])}}var v=d._hold!="pause"&&(d._since?d._now.getTime()<d._since.getTime():d._now.getTime()>=d._until.getTime());if(v&&!d._expiring){d._expiring=true;if(this._hasTarget(b)||this._get(d,"alwaysExpire")){this._removeTarget(b);var w=this._get(d,"onExpiry");if(w){w.apply(b,[])}var x=this._get(d,"expiryText");if(x){var y=this._get(d,"layout");d.options.layout=x;this._updateCountdown(b,d);d.options.layout=y}var z=this._get(d,"expiryUrl");if(z){window.location=z}}d._expiring=false}else if(d._hold=="pause"){this._removeTarget(b)}a.data(b,c,d)},_changeCountdown:function(b,d,e){d=d||{};if(typeof d=="string"){var f=d;d={};d[f]=e}var g=a.data(b,c);if(g){this._resetExtraLabels(g.options,d);k(g.options,d);this._adjustSettings(b,g);a.data(b,c,g);var h=new Date;if(g._since&&g._since<h||g._until&&g._until>h){this._addTarget(b)}this._updateCountdown(b,g)}},_resetExtraLabels:function(a,b){var c=false;for(var d in b){if(d!="whichLabels"&&d.match(/[Ll]abels/)){c=true;break}}if(c){for(var d in a){if(d.match(/[Ll]abels[0-9]/)){a[d]=null}}}},_adjustSettings:function(a,b){var c;var d=this._get(b,"serverSync");var e=0;var f=null;for(var g=0;g<this._serverSyncs.length;g++){if(this._serverSyncs[g][0]==d){f=this._serverSyncs[g][1];break}}if(f!=null){e=d?f:0;c=new Date}else{var h=d?d.apply(a,[]):null;c=new Date;e=h?c.getTime()-h.getTime():0;this._serverSyncs.push([d,e])}var i=this._get(b,"timezone");i=i==null?-c.getTimezoneOffset():i;b._since=this._get(b,"since");if(b._since!=null){b._since=this.UTCDate(i,this._determineTime(b._since,null));if(b._since&&e){b._since.setMilliseconds(b._since.getMilliseconds()+e)}}b._until=this.UTCDate(i,this._determineTime(this._get(b,"until"),c));if(e){b._until.setMilliseconds(b._until.getMilliseconds()+e)}b._show=this._determineShow(b)},_destroyCountdown:function(b){var d=a(b);if(!d.hasClass(this.markerClassName)){return}this._removeTarget(b);d.removeClass(this.markerClassName).empty();a.removeData(b,c)},_pauseCountdown:function(a){this._hold(a,"pause")},_lapCountdown:function(a){this._hold(a,"lap")},_resumeCountdown:function(a){this._hold(a,null)},_hold:function(b,d){var e=a.data(b,c);if(e){if(e._hold=="pause"&&!d){e._periods=e._savePeriods;var f=e._since?"-":"+";e[e._since?"_since":"_until"]=this._determineTime(f+e._periods[0]+"y"+f+e._periods[1]+"o"+f+e._periods[2]+"w"+f+e._periods[3]+"d"+f+e._periods[4]+"h"+f+e._periods[5]+"m"+f+e._periods[6]+"s");this._addTarget(b)}e._hold=d;e._savePeriods=d=="pause"?e._periods:null;a.data(b,c,e);this._updateCountdown(b,e)}},_getTimesCountdown:function(b){var d=a.data(b,c);return!d?null:!d._hold?d._periods:this._calculatePeriods(d,d._show,this._get(d,"significant"),new Date)},_get:function(b,c){return b.options[c]!=null?b.options[c]:a.countdown._defaults[c]},_determineTime:function(b,c){var d=function(a){var b=new Date;b.setTime(b.getTime()+a*1e3);return b};var e=function(b){b=b.toLowerCase();var c=new Date;var d=c.getFullYear();var e=c.getMonth();var f=c.getDate();var g=c.getHours();var h=c.getMinutes();var i=c.getSeconds();var j=/([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g;var k=j.exec(b);while(k){switch(k[2]||"s"){case"s":i+=parseInt(k[1],10);break;case"m":h+=parseInt(k[1],10);break;case"h":g+=parseInt(k[1],10);break;case"d":f+=parseInt(k[1],10);break;case"w":f+=parseInt(k[1],10)*7;break;case"o":e+=parseInt(k[1],10);f=Math.min(f,a.countdown._getDaysInMonth(d,e));break;case"y":d+=parseInt(k[1],10);f=Math.min(f,a.countdown._getDaysInMonth(d,e));break}k=j.exec(b)}return new Date(d,e,f,g,h,i,0)};var f=b==null?c:typeof b=="string"?e(b):typeof b=="number"?d(b):b;if(f)f.setMilliseconds(0);return f},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_normalLabels:function(a){return a},_generateHTML:function(b){var c=this._get(b,"significant");b._periods=b._hold?b._periods:this._calculatePeriods(b,b._show,c,new Date);var k=false;var l=0;var m=c;var n=a.extend({},b._show);for(var o=d;o<=j;o++){k|=b._show[o]=="?"&&b._periods[o]>0;n[o]=b._show[o]=="?"&&!k?null:b._show[o];l+=n[o]?1:0;m-=b._periods[o]>0?1:0}var p=[false,false,false,false,false,false,false];for(var o=j;o>=d;o--){if(b._show[o]){if(b._periods[o]){p[o]=true}else{p[o]=m>0;m--}}}var q=this._get(b,"compact");var r=this._get(b,"layout");var s=q?this._get(b,"compactLabels"):this._get(b,"labels");var t=this._get(b,"whichLabels")||this._normalLabels;var u=this._get(b,"timeSeparator");var v=this._get(b,"description")||"";var w=function(c){var d=a.countdown._get(b,"compactLabels"+t(b._periods[c]));return n[c]?b._periods[c]+(d?d[c]:s[c])+" ":""};var x=function(d){var e=a.countdown._get(b,"labels"+t(b._periods[d]));if(!c&&n[d]||c&&p[d]){var f="";if(b._periods[d].toString().length==1){f='<span class="countdown_amount">'+0+"</span>"+'<span class="countdown_amount">'+b._periods[d]+"</span>"}else{for(var g=0;g<b._periods[d].toString().length;g++){f+='<span class="countdown_amount">'+b._periods[d].toString().charAt(g)+"</span>"}}return'<span class="countdown_section">'+f+'<span class="countdown_txt">'+(e?e[d]:s[d])+"</span></span>"}else{return""}};return r?this._buildLayout(b,n,r,q,c,p):(q?'<span class="countdown_row countdown_amount'+(b._hold?" countdown_holding":"")+'">'+w(d)+w(e)+w(f)+w(g)+(n[h]?this._minDigits(b._periods[h],2):"")+(n[i]?(n[h]?u:"")+this._minDigits(b._periods[i],2):"")+(n[j]?(n[h]||n[i]?u:"")+this._minDigits(b._periods[j],2):""):'<span class="countdown_row countdown_show'+(c||l)+(b._hold?" countdown_holding":"")+'">'+x(d)+x(e)+x(f)+x(g)+x(h)+x(i)+'<span id="uji_sec">'+x(j))+"</span>"+"</span>"+(v?'<span class="countdown_row countdown_descr">'+v+"</span>":"")},_buildLayout:function(b,c,k,l,m,n){var o=this._get(b,l?"compactLabels":"labels");var p=this._get(b,"whichLabels")||this._normalLabels;var q=function(c){return(a.countdown._get(b,(l?"compactLabels":"labels")+p(b._periods[c]))||o)[c]};var r=function(a,b){return Math.floor(a/b)%10};var s={desc:this._get(b,"description"),sep:this._get(b,"timeSeparator"),yl:q(d),yn:b._periods[d],ynn:this._minDigits(b._periods[d],2),ynnn:this._minDigits(b._periods[d],3),y1:r(b._periods[d],1),y10:r(b._periods[d],10),y100:r(b._periods[d],100),y1000:r(b._periods[d],1e3),ol:q(e),on:b._periods[e],onn:this._minDigits(b._periods[e],2),onnn:this._minDigits(b._periods[e],3),o1:r(b._periods[e],1),o10:r(b._periods[e],10),o100:r(b._periods[e],100),o1000:r(b._periods[e],1e3),wl:q(f),wn:b._periods[f],wnn:this._minDigits(b._periods[f],2),wnnn:this._minDigits(b._periods[f],3),w1:r(b._periods[f],1),w10:r(b._periods[f],10),w100:r(b._periods[f],100),w1000:r(b._periods[f],1e3),dl:q(g),dn:b._periods[g],dnn:this._minDigits(b._periods[g],2),dnnn:this._minDigits(b._periods[g],3),d1:r(b._periods[g],1),d10:r(b._periods[g],10),d100:r(b._periods[g],100),d1000:r(b._periods[g],1e3),hl:q(h),hn:b._periods[h],hnn:this._minDigits(b._periods[h],2),hnnn:this._minDigits(b._periods[h],3),h1:r(b._periods[h],1),h10:r(b._periods[h],10),h100:r(b._periods[h],100),h1000:r(b._periods[h],1e3),ml:q(i),mn:b._periods[i],mnn:this._minDigits(b._periods[i],2),mnnn:this._minDigits(b._periods[i],3),m1:r(b._periods[i],1),m10:r(b._periods[i],10),m100:r(b._periods[i],100),m1000:r(b._periods[i],1e3),sl:q(j),sn:b._periods[j],snn:this._minDigits(b._periods[j],2),snnn:this._minDigits(b._periods[j],3),s1:r(b._periods[j],1),s10:r(b._periods[j],10),s100:r(b._periods[j],100),s1000:r(b._periods[j],1e3)};var t=k;for(var u=d;u<=j;u++){var v="yowdhms".charAt(u);var w=new RegExp("\\{"+v+"<\\}(.*)\\{"+v+">\\}","g");t=t.replace(w,!m&&c[u]||m&&n[u]?"$1":"")}a.each(s,function(a,b){var c=new RegExp("\\{"+a+"\\}","g");t=t.replace(c,b)});return t},_minDigits:function(a,b){a=""+a;if(a.length>=b){return a}a="0000000000"+a;return a.substr(a.length-b)},_determineShow:function(a){var b=this._get(a,"format");var c=[];c[d]=b.match("y")?"?":b.match("Y")?"!":null;c[e]=b.match("o")?"?":b.match("O")?"!":null;c[f]=b.match("w")?"?":b.match("W")?"!":null;c[g]=b.match("d")?"?":b.match("D")?"!":null;c[h]=b.match("h")?"?":b.match("H")?"!":null;c[i]=b.match("m")?"?":b.match("M")?"!":null;c[j]=b.match("s")?"?":b.match("S")?"!":null;return c},_calculatePeriods:function(b,c,k,l){b._now=l;b._now.setMilliseconds(0);var m=new Date(b._now.getTime());if(b._since){if(l.getTime()<b._since.getTime()){b._now=l=m}else{l=b._since}}else{m.setTime(b._until.getTime());if(l.getTime()>b._until.getTime()){b._now=l=m}}var n=[0,0,0,0,0,0,0];if(c[d]||c[e]){var o=a.countdown._getDaysInMonth(l.getFullYear(),l.getMonth());var p=a.countdown._getDaysInMonth(m.getFullYear(),m.getMonth());var q=m.getDate()==l.getDate()||m.getDate()>=Math.min(o,p)&&l.getDate()>=Math.min(o,p);var r=function(a){return(a.getHours()*60+a.getMinutes())*60+a.getSeconds()};var s=Math.max(0,(m.getFullYear()-l.getFullYear())*12+m.getMonth()-l.getMonth()+(m.getDate()<l.getDate()&&!q||q&&r(m)<r(l)?-1:0));n[d]=c[d]?Math.floor(s/12):0;n[e]=c[e]?s-n[d]*12:0;l=new Date(l.getTime());var t=l.getDate()==o;var u=a.countdown._getDaysInMonth(l.getFullYear()+n[d],l.getMonth()+n[e]);if(l.getDate()>u){l.setDate(u)}l.setFullYear(l.getFullYear()+n[d]);l.setMonth(l.getMonth()+n[e]);if(t){l.setDate(u)}}var v=Math.floor((m.getTime()-l.getTime())/1e3);var w=function(a,b){n[a]=c[a]?Math.floor(v/b):0;v-=n[a]*b};w(f,604800);w(g,86400);w(h,3600);w(i,60);w(j,1);if(v>0&&!b._since){var x=[1,12,4.3482,7,24,60,60];var y=j;var z=1;for(var A=j;A>=d;A--){if(c[A]){if(n[y]>=z){n[y]=0;v=1}if(v>0){n[A]++;v=0;y=A;z=1}}z*=x[A]}}if(k){for(var A=d;A<=j;A++){if(k&&n[A]){k--}else if(!k){n[A]=0}}}return n}});a.fn.countdown=function(b){var c=Array.prototype.slice.call(arguments,1);if(b=="getTimes"||b=="settings"){return a.countdown["_"+b+"Countdown"].apply(a.countdown,[this[0]].concat(c))}return this.each(function(){if(typeof b=="string"){a.countdown["_"+b+"Countdown"].apply(a.countdown,[this].concat(c))}else{a.countdown._attachCountdown(this,b)}})};a.countdown=new b})(jQuery)
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wpmanage.com/Uji-countdown
|
|
4 |
Tags: countdown, counter, html5 countdown, animated countdown, countdown timer, count down, countdown clock, jQuery countdown, clock, timer
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3.1
|
7 |
-
Stable tag: 1.0.
|
8 |
|
9 |
Uji Countdown - HTML5 Customizable Countdown Timer
|
10 |
|
@@ -44,6 +44,11 @@ WPmanage [(http://www.wpmanage.com/uji-countdown/)](http://www.wpmanage.com/uji-
|
|
44 |
|
45 |
== Changelog ==
|
46 |
|
|
|
|
|
|
|
|
|
|
|
47 |
= 1.0.2 =
|
48 |
|
49 |
* Fix do_shortcode when using hardcoded.
|
4 |
Tags: countdown, counter, html5 countdown, animated countdown, countdown timer, count down, countdown clock, jQuery countdown, clock, timer
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3.1
|
7 |
+
Stable tag: 1.0.3
|
8 |
|
9 |
Uji Countdown - HTML5 Customizable Countdown Timer
|
10 |
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
= 1.0.3 =
|
48 |
+
|
49 |
+
* Add option to redirect link after countdown expire.
|
50 |
+
* Add option to hide and remove script after countdown expire.
|
51 |
+
|
52 |
= 1.0.2 =
|
53 |
|
54 |
* Fix do_shortcode when using hardcoded.
|
uji-countdown-front.php
CHANGED
@@ -15,7 +15,29 @@ function add_ujic_popup(){
|
|
15 |
timeFormat: 'hh:mm',
|
16 |
dateFormat: 'yy/mm/dd'
|
17 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
function InsertContdown(){
|
20 |
|
21 |
|
@@ -29,9 +51,22 @@ function add_ujic_popup(){
|
|
29 |
alert("Please select time for countdown");
|
30 |
return;
|
31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
var form_name = jQuery("#add_form_id option[value='" + style_id + "']").text().replace(/[\[\]]/g, '');
|
34 |
-
window.send_to_editor("[ujicountdown id=\"" + style_id + "\" expire=\"" + time_id + "\"]");
|
35 |
}
|
36 |
</script>
|
37 |
|
@@ -45,6 +80,7 @@ function add_ujic_popup(){
|
|
45 |
</span>
|
46 |
</div>
|
47 |
<div style="padding:15px 15px 0 15px;">
|
|
|
48 |
<select id="add_style">
|
49 |
<option value=""> Select a Style </option>
|
50 |
<?php
|
@@ -53,10 +89,18 @@ function add_ujic_popup(){
|
|
53 |
</select>
|
54 |
</div>
|
55 |
<div style="padding:15px 15px 0 15px;">
|
56 |
-
<
|
57 |
<input type="text" value="" width="200px" id="dateujic" />
|
58 |
</div>
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
<div style="padding:15px;">
|
61 |
<input type="button" class="button-primary" value="Insert Countdown" onclick="InsertContdown();"/>
|
62 |
<a class="button" style="color:#bbb;" href="#" onclick="tb_remove(); return false;">Cancel</a>
|
@@ -67,6 +111,7 @@ function add_ujic_popup(){
|
|
67 |
|
68 |
<?php
|
69 |
}
|
|
|
70 |
function ujic_forms(){
|
71 |
global $wpdb;
|
72 |
$table_name = $wpdb->prefix ."uji_counter";
|
@@ -83,15 +128,25 @@ function ujic_forms(){
|
|
83 |
|
84 |
function ujic_code( $atts, $content = null ) {
|
85 |
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
|
|
|
|
|
|
87 |
wp_enqueue_style( 'ujiStyleCount');
|
88 |
wp_enqueue_scripts('jQuery');
|
89 |
wp_print_scripts('UJI_js_countdown');
|
90 |
-
|
91 |
-
extract(shortcode_atts(array(
|
92 |
-
'id' => "ujic-black",
|
93 |
-
'expire' =>"2012/2/21 01:00:00"
|
94 |
-
), $atts));
|
95 |
|
96 |
$table_name = $wpdb->prefix ."uji_counter";
|
97 |
$ujic_datas = $wpdb->get_results("SELECT * FROM $table_name WHERE title = '".$id."'");
|
@@ -116,6 +171,7 @@ function ujic_code( $atts, $content = null ) {
|
|
116 |
$ujic_col_sw = !empty($ujic_col_sw) ? $ujic_col_sw : '#000000';
|
117 |
$ujic_txt = !empty($ujic_txt) ? 'true' : 'false';
|
118 |
$ujic_ani = !empty($ujic_ani) ? 'true' : 'false';
|
|
|
119 |
|
120 |
if($class=='center'){ $center_script = 'jQuery("#ujiCountdown").css({"width": (jQuery("#ujiCountdown").width()+5)+"px", "padding-left": "10px", "display": "block"});';} else{$center_script = '';}
|
121 |
$script =' <script type="text/javascript">
|
@@ -129,7 +185,7 @@ $script =' <script type="text/javascript">
|
|
129 |
whichLabels: null,
|
130 |
timeSeparator: \':\', isRTL: false};
|
131 |
jQuery.countdown.setDefaults(jQuery.countdown.regional["uji"]);
|
132 |
-
jQuery("#ujiCountdown").countdown({until: austDay, text_size: \''.$ujic_txt_size.'\', color_down: \''.$ujic_col_dw.'\', color_up: \''.$ujic_col_up.'\', color_txt: \''.$ujic_col_txt.'\', color_sw: \''.$ujic_col_sw.'\', ujic_txt: '.$ujic_txt .', animate_sec: '.$ujic_ani.'});
|
133 |
'.$center_script.'
|
134 |
});
|
135 |
|
@@ -137,6 +193,7 @@ $script =' <script type="text/javascript">
|
|
137 |
</script>';
|
138 |
|
139 |
return strip_shortcodes($script.'<div id="ujiCountdown" '.$classh.'></div>'.$content);
|
|
|
140 |
}
|
141 |
add_shortcode("ujicountdown", "ujic_code");
|
142 |
|
15 |
timeFormat: 'hh:mm',
|
16 |
dateFormat: 'yy/mm/dd'
|
17 |
});
|
18 |
+
|
19 |
+
jQuery('#urlujic').keyup(function () {
|
20 |
+
var value = jQuery(this).val();
|
21 |
+
|
22 |
+
if(value){
|
23 |
+
jQuery('input[name=hideujic]').attr('checked', false);
|
24 |
+
}else{
|
25 |
+
jQuery('input[name=hideujic]').attr('checked', true);
|
26 |
+
}
|
27 |
+
|
28 |
+
}).keyup();
|
29 |
});
|
30 |
+
|
31 |
+
function isUrl(url) {
|
32 |
+
var RegExp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
|
33 |
+
if(RegExp.test(url)){
|
34 |
+
return true;
|
35 |
+
}else{
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
function InsertContdown(){
|
42 |
|
43 |
|
51 |
alert("Please select time for countdown");
|
52 |
return;
|
53 |
}
|
54 |
+
var url = "";
|
55 |
+
var url_id = jQuery('#urlujic').val();
|
56 |
+
if(url_id != "" && !isUrl(url_id)){
|
57 |
+
alert("Please insert valid link");
|
58 |
+
return;
|
59 |
+
}else if(url_id != ""){
|
60 |
+
url = " url = \"" + url_id + "\"";
|
61 |
+
}
|
62 |
+
var hide = "";
|
63 |
+
if( jQuery('input[name=hideujic]').is(':checked')){
|
64 |
+
var hide = " hide = \"true\"";
|
65 |
+
}
|
66 |
+
|
67 |
|
68 |
var form_name = jQuery("#add_form_id option[value='" + style_id + "']").text().replace(/[\[\]]/g, '');
|
69 |
+
window.send_to_editor("[ujicountdown id=\"" + style_id + "\" expire=\"" + time_id + "\"" + hide + url +"]");
|
70 |
}
|
71 |
</script>
|
72 |
|
80 |
</span>
|
81 |
</div>
|
82 |
<div style="padding:15px 15px 0 15px;">
|
83 |
+
<h3 style="display:block; font-size:14px; margin-bottom:10px">Select style:</h3>
|
84 |
<select id="add_style">
|
85 |
<option value=""> Select a Style </option>
|
86 |
<?php
|
89 |
</select>
|
90 |
</div>
|
91 |
<div style="padding:15px 15px 0 15px;">
|
92 |
+
<h3 style="display:block; font-size:14px; margin-bottom:10px">Countdown Expire In:</h3>
|
93 |
<input type="text" value="" width="200px" id="dateujic" />
|
94 |
</div>
|
95 |
+
<div style="padding:15px 15px 0 15px;">
|
96 |
+
<h3 style="display:block; font-size:14px; margin-bottom:10px">After expiry:</h3>
|
97 |
+
<span style="inline-block; font-size:14px; margin:0px 10px 0 10px">Hide countdown:</span>
|
98 |
+
<input name="hideujic" id="hideujic" type="checkbox" value="1" checked />
|
99 |
+
<div style="display:block; padding: 10px 0 10px 0">
|
100 |
+
<span style="display:inline-block; font-size:14px; margin:0px 35px 0 10px">Or go to link:</span>
|
101 |
+
<input type="text" value="" id="urlujic" name="urlujic" style="width:240px" />
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
<div style="padding:15px;">
|
105 |
<input type="button" class="button-primary" value="Insert Countdown" onclick="InsertContdown();"/>
|
106 |
<a class="button" style="color:#bbb;" href="#" onclick="tb_remove(); return false;">Cancel</a>
|
111 |
|
112 |
<?php
|
113 |
}
|
114 |
+
|
115 |
function ujic_forms(){
|
116 |
global $wpdb;
|
117 |
$table_name = $wpdb->prefix ."uji_counter";
|
128 |
|
129 |
function ujic_code( $atts, $content = null ) {
|
130 |
global $wpdb;
|
131 |
+
extract(shortcode_atts(array(
|
132 |
+
'id' => "ujic-black",
|
133 |
+
'expire' => "2012/12/21 01:00:00",
|
134 |
+
'hide' => "false",
|
135 |
+
'url' => ""
|
136 |
+
), $atts));
|
137 |
+
//Timezone
|
138 |
+
|
139 |
+
$utc = 2*(60*60);
|
140 |
+
$now_time = strtotime(date_i18n("Y/m/d H:i:s"))-$utc;
|
141 |
+
$unx_time = $expire.":00";
|
142 |
+
$unx_time = strtotime($unx_time)-$utc;
|
143 |
|
144 |
+
if($hide=="true" && $now_time > $unx_time){
|
145 |
+
return $content;
|
146 |
+
}else{
|
147 |
wp_enqueue_style( 'ujiStyleCount');
|
148 |
wp_enqueue_scripts('jQuery');
|
149 |
wp_print_scripts('UJI_js_countdown');
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
$table_name = $wpdb->prefix ."uji_counter";
|
152 |
$ujic_datas = $wpdb->get_results("SELECT * FROM $table_name WHERE title = '".$id."'");
|
171 |
$ujic_col_sw = !empty($ujic_col_sw) ? $ujic_col_sw : '#000000';
|
172 |
$ujic_txt = !empty($ujic_txt) ? 'true' : 'false';
|
173 |
$ujic_ani = !empty($ujic_ani) ? 'true' : 'false';
|
174 |
+
$ujic_url = !empty($url) ? '\''.$url.'\'' : 'false';
|
175 |
|
176 |
if($class=='center'){ $center_script = 'jQuery("#ujiCountdown").css({"width": (jQuery("#ujiCountdown").width()+5)+"px", "padding-left": "10px", "display": "block"});';} else{$center_script = '';}
|
177 |
$script =' <script type="text/javascript">
|
185 |
whichLabels: null,
|
186 |
timeSeparator: \':\', isRTL: false};
|
187 |
jQuery.countdown.setDefaults(jQuery.countdown.regional["uji"]);
|
188 |
+
jQuery("#ujiCountdown").countdown({until: austDay, text_size: \''.$ujic_txt_size.'\', color_down: \''.$ujic_col_dw.'\', color_up: \''.$ujic_col_up.'\', color_txt: \''.$ujic_col_txt.'\', color_sw: \''.$ujic_col_sw.'\', ujic_txt: '.$ujic_txt .', animate_sec: '.$ujic_ani.', ujic_url: '.$ujic_url.'});
|
189 |
'.$center_script.'
|
190 |
});
|
191 |
|
193 |
</script>';
|
194 |
|
195 |
return strip_shortcodes($script.'<div id="ujiCountdown" '.$classh.'></div>'.$content);
|
196 |
+
}
|
197 |
}
|
198 |
add_shortcode("ujicountdown", "ujic_code");
|
199 |
|
uji-countdown.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Uji Countdown
|
4 |
Plugin URI: http://www.wpmanage.com/uji-countdown/
|
5 |
Description: HTML5 Countdown.
|
6 |
-
Version: 1.0.
|
7 |
Author: Ujog Raul
|
8 |
Author URI: http://www.wpmanage.com
|
9 |
|
@@ -33,13 +33,6 @@ if (!defined('UJI_VERSION_NUM'))
|
|
33 |
|
34 |
///////////////////////////////////DB///////////////////////////////////////
|
35 |
|
36 |
-
/*DEBUG*/
|
37 |
-
add_action('activated_plugin','save_error');
|
38 |
-
function save_error(){
|
39 |
-
update_option('plugin_error', ob_get_contents());
|
40 |
-
}
|
41 |
-
echo get_option('plugin_error');
|
42 |
-
/*DEBUG*/
|
43 |
|
44 |
function create_ujic_db(){
|
45 |
global $wpdb;
|
3 |
Plugin Name: Uji Countdown
|
4 |
Plugin URI: http://www.wpmanage.com/uji-countdown/
|
5 |
Description: HTML5 Countdown.
|
6 |
+
Version: 1.0.3
|
7 |
Author: Ujog Raul
|
8 |
Author URI: http://www.wpmanage.com
|
9 |
|
33 |
|
34 |
///////////////////////////////////DB///////////////////////////////////////
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
function create_ujic_db(){
|
38 |
global $wpdb;
|