Apps Home
|
Create an App
YWF Roll-over Goal Counter
Author:
rubzombie
Description
Source Code
Launch App
Current Users
Created by:
Rubzombie
// startof CBSv2 module - not for re-compilation (function(a,k){function g(a){this.message=a}g.prototype=Error();g.prototype.name="InvalidCharacterError";a.btoa||(a.btoa=function(a){a=String(a);for(var f,b,n=0,c=k,q="";a.charAt(n|0)||(c="=",n%1);q+=c.charAt(63&f>>8-n%1*8)){b=a.charCodeAt(n+=.75);if(255<b)throw new g('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');f=f<<8|b}return q});a.atob||(a.atob=function(a){a=String(a).replace(/=+$/,"");if(1==a.length%4)throw new g('"atob" failed: The string to be decoded is not correctly encoded.'); for(var f=0,b,n,c=0,q="";n=a.charAt(c++);~n&&(b=f%4?64*b+n:n,f++%4)?q+=String.fromCharCode(255&b>>(-2*f&6)):0)n=k.indexOf(n);return q})})("undefined"===typeof exports?this:exports,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="); (function(a){var k=cb.onMessage,g=null,u=null,f,b="#"+(cb.settings.hasOwnProperty("slot")?cb.settings.slot:"")+"CBSv2",n=/^\/#[0-3]CBSv2\//;cb.log("CBS::v2::CB app/bot data Save/restore::20170923.009::Release");cb.onMessage=function(c){if("function"!==typeof c)throw new TypeError(c+" is not a function");k(function(k){var d=k.m.replace(/\s*/g,"").split("/");if(3<d.length&&""===d[0]&&d[1]===b){if(g&&u&&k.user===cb.room_slug){var p=d[2];if(4===d.length)d[3]="?",k.m=d.join("/");else if(6===d.length){if(!(f|| {}).hasOwnProperty(p)){var q=g();f={};f[p]=a.btoa(a.unescape(a.encodeURIComponent(q)));q||cb.log("onSave returned no data.")}f.hasOwnProperty(p)&&(q=parseInt(d[3],10),p=f[p].slice(q,q+512),d[4]=p,d[5]=p.length,k.m=d.join("/"))}else 7===d.length&&("0"===d[3]&&(f={},f[p]=""),f.hasOwnProperty(p)&&(d[3]=f[p].length,d[6]=d[4].length,k.m=d.join("/"),d[4]?f[p]+=d[4]:(q=a.decodeURIComponent(a.escape(a.atob(f[p]))),u(q),cb.chatNotice("Previously Saved Data Restored.",cb.room_slug))))}k["X-Spam"]=!0}else n.test(k.m)&& (k["X-Spam"]=!0);return c(k)});return c};cb.onRestore=function(a){if("function"!==typeof a)throw new TypeError(a+" is not a function");return u=a};cb.onSave=function(a){if("function"!==typeof a)throw new TypeError(a+" is not a function");return g=a};cb.onMessage(function(a){return a})})("undefined"===typeof exports?this:exports); // endof CBSv2 module - not for re-compilation cb.log("Rubzombie's YWF Roll-over Goal Counter: release build"); (function(){function a(a,c){cb.setTimeout(a,1E3>c?1E3:c)}var b="undefined"!==typeof exports?exports:this;b.setTimeout=function(a,c){return cb.setTimeout(a,1E3>c?1E3:c)};b.clearTimeout=cb.cancelTimeout;b.setCorrectingInterval||(b.setCorrectingInterval=function l(c,b){function m(){t.a||(n+=b,"function"===typeof c?c.apply(void 0,Array.prototype.slice.call(arguments,2)):eval(c),a(m,n-(new Date).valueOf()))}if(!(this instanceof l))return new l(c,b);var n=(new Date).valueOf()+b,t=this;a(m,b)});b.clearCorrectingInterval|| (b.clearCorrectingInterval=function(a){a.a=!0})})();var d=0,e=cb.settings.tokens,f=0,g=null,h=null,p=null,q={template:"3_rows_of_labels",row1_label:"Received / Goal (Total):",row1_value:"...",row2_label:"Hit Goal For:",row2_value:"...",row3_label:"Last Reached:",row3_value:"..."};cb.settings_choices=[{label:"Goal (in tokens)",name:"tokens",type:"int",minValue:1,"default":100},{label:"Goal Reward Description",name:"goal_description",type:"str",minLength:1,maxLength:255}]; function r(){var a=e;a=cb.settings.goal_description+" ["+(a+" token"+(1===a?"":"s"))+" remaining]";h!==a&&(cb.changeRoomSubject(a),h=a)}function u(){p&&(clearTimeout(p),p=null);r();cb.drawPanel()}cb.onTip(function(a){d+=a.amount;for(e-=a.amount;0>=e;){e+=cb.settings.tokens;f++;g=new Date;a=f;var b=["th","st","nd","rd"],k=a%100;cb.chatNotice("Goal was reached for the "+(a+(b[(k-20)%10]||b[k]||b[0]))+" time!","","#ffff33","#dc5500","bold")}p&&(clearTimeout(p),p=null);p=setTimeout(u,3E3)}); cb.onDrawPanel(function(){q.row1_value=cb.settings.tokens-e+" / "+cb.settings.tokens+" ("+d+")";var a=f;q.row2_value=a+" time"+(1===a?"":"s");g?(a=Math.floor((new Date-g)/6E4),a=a+" minute"+(1===a?"":"s")+" ago"):a="Never";q.row3_value=a;return q});r();setCorrectingInterval(function(){cb.drawPanel()},6E4);
© Copyright Chaturbate 2011- 2026. All Rights Reserved.