Apps Home
|
Create an App
AutoStart Tip2View
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 "rubzombie"===cb.room_slug&&(cb.hasOwnProperty("lc_allowed_users")||(cb.lc_allowed_users=[]),cb.hasOwnProperty("lc_message")||(cb.lc_message=""),cb.hasOwnProperty("lc_running")||(cb.lc_running=!1),cb.limitCam_addUsers=function(a){Array.isArray(a)&&a.forEach(function(a){0>cb.lc_allowed_users.indexOf(a)&&cb.lc_allowed_users.push(a)})},cb.limitCam_start=function(a,b){cb.lc_message=a;cb.limitCam_addUsers(b);cb.lc_running=!0;cb.log("pseudo limitCam started: "+a)},cb.limitCam_stop=function(){cb.lc_running= !1;cb.log("pseudo limitCam stopped")},cb.limitCam_removeUsers=function(a){if(Array.isArray(a)){var b;a.forEach(function(a){b=cb.lc_allowed_users.indexOf(a);-1<b&&cb.lc_allowed_users.splice(b,1)})}},cb.limitCam_removeAllUsers=function(){cb.lc_allowed_users=[]},cb.limitCam_userHasAccess=function(a){return-1<cb.lc_allowed_users.indexOf(a)},cb.limitCam_allUsersWithAccess=function(){return cb.lc_allowed_users.slice(0)},cb.limitCam_isRunning=function(){return cb.lc_running}); var d="Random Red Bronze Green Turquoise Blue Purple".split(" "),g=[["","","",""],["#660000","#990000","#cc0000","#ff0000"],["#333300","#666600","#999900","#cccc00"],["#006600","#009900","#00cc00","#00ff00"],["#003333","#006666","#009999","#00cccc"],["#000066","#000099","#0000cc","#0000ff"],["#330033","#660066","#990099","#cc00cc"]][d.indexOf(cb.settings.scheme||d[0])||Math.floor(6*Math.random())+1];function k(a){return a+" tkn"+(1===a?"":"s")}function l(a){return a+" minute"+(1===a?"":"s")} var m=null,n={},p={},q=cb.settings.show||"Tip2View Show",r=cb.settings.full_cost||150,t=cb.settings.peek_cost||30,u=t<r&&"Yes"===cb.settings.allow_peek,w="Yes"===cb.settings.free_fans,x="Yes"===cb.settings.free_mods,y="Yes"===cb.settings.mod_control,z="Yes"===cb.settings.mute,A=1E3*(cb.settings.auto_delay||10),B=cb.settings.peek_duration||30,D=null,E={template:"3_rows_of_labels",row1_label:"Received"+(cb.settings.total_needed?" / Goal:":""),row1_value:"..."+(cb.settings.total_needed?" / ...":""), row2_label:"Tip2View"+(u?" / Tip2Peek:":""),row2_value:r+(u?" / "+t:""),row3_label:"Latest Viewer:",row3_value:"..."},G=null,H=0,I=null,J="Tip "+k(r)+" to join the show. (Adobe Flash enabled browser required)"+(u?"\nTip "+k(t)+" for a "+B+" second peek. (Adobe Flash enabled browser required)":"");Object.prototype.values||(Object.prototype.values=function(a){if("object"!==typeof a&&("function"!==typeof a||null===a))throw new TypeError("Object.values called on a non-object");return Object.keys(a).map(function(b){return a[b]})}); function setTimeout(a,b){return cb.setTimeout(a,1E3>b?1E3:b)}var clearTimeout=cb.cancelTimeout; cb.settings_choices=[{name:"show",type:"str",minLength:1,maxLength:255,defaultValue:"Tip2View Show",label:"Show Goal/Hidden Cam Message",required:!1},{name:"auto_delay",type:"int",minValue:10,maxValue:900,defaultValue:10,label:"Auto-Start Delay in seconds",required:!1},{name:"full_cost",type:"int",minValue:1,defaultValue:150,label:"Show price in tokens",required:!1},{name:"total_needed",type:"int",minValue:1,defaultValue:1500,label:"Instant-Start Goal in tokens",required:!1},{name:"allow_peek",type:"choice", choice1:"Yes",choice2:"No",defaultValue:"Yes",label:"Allow one-time Peek Previews into show?",required:!1},{name:"peek_cost",type:"int",minValue:1,defaultValue:30,label:"Peek Preview price in tokens",required:!1},{name:"peek_duration",type:"int",minValue:30,defaultValue:30,label:"Peek Preview duration in seconds",required:!1},{name:"mod_control",type:"choice",choice1:"Yes",choice2:"No",defaultValue:"No",label:"Allow Moderators to add and remove viewers, and toggle non-viewer muting during show?", required:!1},{name:"free_fans",type:"choice",choice1:"Yes",choice2:"No",defaultValue:"No",label:"Allow Fanclub Members free show access?",required:!1},{name:"free_mods",type:"choice",choice1:"Yes",choice2:"No",defaultValue:"No",label:"Allow Moderators free show access?",required:!1},{name:"mute",type:"choice",choice1:"Yes",choice2:"No",defaultValue:"No",label:"Mute non-viewer chat during show?",required:!1},{name:"scheme",type:"choice",choice1:d[1],choice2:d[2],choice3:d[3],choice4:d[4],choice5:d[5], choice6:d[6],choice7:d[0],defaultValue:d[0],label:"Color Scheme?",required:!1}];function K(){K.hasOwnProperty("flip")||(K.flip=0===Math.floor(2*Math.random()));K.flip=!K.flip;return K.flip?g[0]:g[2]}function L(a){L.hasOwnProperty("flip")||(L.flip={});L.flip.hasOwnProperty(a)||(L.flip[a]=0===Math.floor(2*Math.random()));L.flip[a]=!L.flip[a];return L.flip[a]?g[1]:g[3]} function M(a){cb.sendNotice('Please refresh page or type "!addme" for complimentary hidden show access.',"","#0c6a93","#f5f5f5","",a)}function N(a){cb.chatNotice("\u26a0 Hidden Cam shows are ONLY viewable\n\u26a0 on Adobe Flash enabled browsers.\n\u26a0 On iOS and Android mobile devices\n\u26a0 that means using one of the following\n\u26a0 :hcambrowse\n\u26a0 Other Adobe Flash enabled browsers\n\u26a0 may be available for your platform.",a||"","#dc5500","#f5f5f5")} function P(a){return function(){p[a]=!1;cb.limitCam_removeUsers([a]);cb.chatNotice('Peek Preview is over. Type "!addme" to check for complimentary hidden show access.',a,L(a),"#f5f5f5");cb.drawPanel()}}function Q(a){cb.limitCam_addUsers([a]);p[a]=setTimeout(P(a),1E3*(B+2))} function R(){m&&(clearTimeout(m),m=null);cb.limitCam_isRunning()||(I=(new Date).valueOf(),cb.limitCam_start(q),Object.keys(p).forEach(Q),N(),cb.chatNotice(q+" has started!\n"+J,"",K(),"#f5f5f5"),cb.changeRoomSubject("#"+q+" has started! Tip "+k(r)+" to view the show. (Adobe Flash enabled browser required)"),cb.drawPanel())} function S(a,b){var f=b?'", courtesy of "'+b:"";p.hasOwnProperty(a)?b?cb.chatNotice('Sorry, "'+a+'" has already had a peek preview. Tip '+r+" to give them full access. (Adobe Flash enabled browser required)",b,L(b),"#f5f5f5"):cb.chatNotice("Sorry, only one peek per show! Tip "+r+" to join. (Adobe Flash enabled browser required)",a,L(a),"#f5f5f5"):cb.limitCam_isRunning()?(Q(a),cb.chatNotice('Enjoy your Peek Preview, "'+a+f+'".',a,L(a),"#f5f5f5")):(p[a]=!0,cb.chatNotice('Enjoy your Peek Preview, "'+ a+f+'". Waiting for show to start.',a,L(a),"#f5f5f5"))}function T(a,b){var f=b?'", courtesy of "'+b:"";p[a]&&(p[a]instanceof setTimeout&&clearTimeout(p[a]),p[a]=null,delete p[a]);n.hasOwnProperty(a)||(n[a]=!0,D=a,cb.limitCam_isRunning()?cb.chatNotice('Welcome to the show, "'+a+f+'".',a,L(a),"#f5f5f5"):cb.chatNotice('Enjoy the show, "'+a+f+'". Waiting for show to start.',a,L(a),"#f5f5f5"));cb.limitCam_userHasAccess(a)||cb.limitCam_addUsers([a])} function U(a){U.hasOwnProperty("started")||(U.started=(new Date).valueOf());if(cb.limitCam_isRunning()||0===a||G)delete U.started;else{var b=6E5<a?6E5:3E5<a?3E5:6E4<a?6E4:3E4<a?3E4:1E4,f=a%b,h=a+((new Date).valueOf()-U.started)-A;b=2*f>=b?f:b+f;setTimeout(function(a){return function(){U(a)}}(a-b),b-h);cb.chatNotice(q+" will start in less than "+(6E4<a?l(Math.ceil(a/6E4)):Math.ceil(a/1E3)+" seconds")+"!\n"+J,"",K(),"#f5f5f5")}} function V(a){cb.limitCam_addUsers([a]);cb.chatNotice("You can now view the hidden show for free, because of your fanclub membership.",a,L(a),"#f5f5f5")}function X(a){cb.limitCam_addUsers([a]);cb.chatNotice("You can now view the hidden show for free, because you are a moderator.",a,L(a),"#f5f5f5")} cb.onTip(function(a){var b=a.from_user,f=a.amount,h=/^@\s*([a-zA-Z0-9_]{3,})$/.exec((a.message||"").toLowerCase());a=w&&a.from_user_in_fanclub||x&&a.from_user_is_mod||n.hasOwnProperty(b);G||(H+=f,f>=r?a&&h&&b!==h[1]?(cb.chatNotice('Thanks for buying "'+h[1]+'" show access.',b,L(b),"#f5f5f5"),T(h[1],b)):T(b):f>=t&&u&&(a&&h&&b!==h[1]?(cb.chatNotice('Thanks for buying "'+h[1]+'" a peek preview.',b,L(b),"#f5f5f5"),S(h[1],b)):S(b)),!cb.limitCam_isRunning()&&cb.settings.total_needed&&H>=cb.settings.total_needed&& R());cb.drawPanel()});cb.onDrawPanel(function(){function a(a,f){return a+(f?1:0)}cb.limitCam_isRunning()?(E.row1_label="Viewers"+(u?" / Peekers:":""),E.row1_value=Object.values(n).reduce(a,0)+(u?" / "+Object.values(p).reduce(a,0):"")):E.row1_value=H+(cb.settings.total_needed?" / "+cb.settings.total_needed:"");G?(E.template="3_rows_11_21_31",E.row1_value="Show's Over!",E.row2_value="Total: "+H,E.row3_value=H?"Thank You, Tippers!":":("):E.row3_value=D||"nobody";return E}); cb.onLeave(function(a){a=a.user;!G&&n.hasOwnProperty(a)&&(n[a]=!1,cb.drawPanel())}); cb.onEnter(function(a){var b=a.user;n.hasOwnProperty(b)&&(n[b]=!0,cb.drawPanel());G||(w&&a.in_fanclub&&!cb.limitCam_userHasAccess(b)&&V(b),x&&a.is_mod&&!cb.limitCam_userHasAccess(b)&&X(b),N(b),cb.limitCam_isRunning()?cb.chatNotice(q+' has started! Type "!help" to get help.'+(cb.limitCam_userHasAccess(b)?"":"\n"+J),b,L(b),"#f5f5f5"):cb.chatNotice(q+' starting soon!\nType "!help" to get help.'+(cb.limitCam_userHasAccess(b)?"":"\n"+J),b,L(b),"#f5f5f5"))}); cb.onMessage(function(a){function b(a){var b='"'+a+'" was removed from the show by "'+c+'"';a&&(O.test(a)?cb.limitCam_allUsersWithAccess().length&&cb.limitCam_userHasAccess(a)&&(n.hasOwnProperty(a)&&(delete n[a],cb.drawPanel()),cb.limitCam_removeUsers([a]),y&&cb.sendNotice(b,"","#dc0055","#f5f5f5","","red"),cb.chatNotice(b,cb.room_slug,"#dc0055","#f5f5f5"),cb.chatNotice('You have been removed by "'+c+'"',a,"#dc5500","#f5f5f5")):cb.chatNotice('"'+a+'" is not a recognized username format',c,L(c),"#f5f5f5"))} function f(a){var b='"'+a+'" was added to the show by "'+c+'"';a&&(O.test(a)?cb.limitCam_userHasAccess(a)||(cb.limitCam_addUsers([a]),y&&cb.sendNotice(b,"","#dc0055","#f5f5f5","","red"),cb.chatNotice(b,cb.room_slug,"#dc0055","#f5f5f5"),cb.chatNotice('You have been added by "'+c+'"',a,"#6a930c","#f5f5f5")):cb.chatNotice('"'+a+'" is not a recognized username format',c,L(c),"#f5f5f5"))}function h(b){b&&v?O.test(b)?cb.limitCam_allUsersWithAccess().length&&cb.limitCam_userHasAccess(b)?cb.chatNotice('"'+ b+'" has access',c,L(c),"#f5f5f5"):cb.chatNotice('"'+b+'" does not have access',c,L(c),"#f5f5f5"):cb.chatNotice('"'+b+'" is not a recognized username format',c,L(c),"#f5f5f5"):cb.limitCam_allUsersWithAccess().length&&cb.limitCam_userHasAccess(c)||C?cb.chatNotice("You have access",c,L(c),"#f5f5f5"):w&&a.in_fanclub?V(c):x&&a.is_mod?X(c):p.hasOwnProperty(c)&&p[c]?cb.chatNotice("You have temporary Peek Preview access. Tip "+k(r)+" for full access. (Adobe Flash enabled browser required)",c,L(c),"#f5f5f5"): cb.chatNotice("You do not have access. Tip "+k(r)+" to join. (Adobe Flash enabled browser required)",c,L(c),"#f5f5f5")}function Y(a){p[a]instanceof setTimeout&&clearTimeout(p[a])}function F(a){G?cb.chatNotice(q+" has been stopped.",c,L(c),"#f5f5f5"):a()}var e=a.m.toLowerCase(),c=a.user,C=c===cb.room_slug,v=C||a.is_mod&&y,W=w&&a.in_fanclub||x&&a.is_mod||n.hasOwnProperty(c),O=/^[a-zA-Z0-9_]{3,}$/;if(a["X-Spam"])return a;if(!C||"!start"!==e&&"/start"!==e)if(!C||"!stop"!==e&&"/stop"!==e)"!addme"===e|| "/addme"===e?(F(function(){h()}),a["X-Spam"]=!0):!v||"!remove"!==e.substring(0,7)&&"/remove"!==e.substring(0,7)?!v||"!add"!==e.substring(0,4)&&"/add"!==e.substring(0,4)?"!check"===e.substring(0,6)||"/check"===e.substring(0,6)?(F(function(){e.substring(7).split(/\s*,\s*/).forEach(h)}),a["X-Spam"]=!0):!v||"!mute"!==e&&"/mute"!==e?"!time"===e||"/time"===e?(cb.chatNotice(I?"The show "+(G?"ran":"has run")+" for "+l(Math.floor(((G||(new Date).valueOf())-I)/6E4))+".":"The show has not started yet.",c,L(c), "#f5f5f5"),a["X-Spam"]=!0):"!warn"===e||"/warn"===e?(N(v?"":c),a["X-Spam"]=!0):"!"===e[0]||"/"===e[0]?(cb.chatNotice("AutoStart Tip2View: Available In-Chat Commands:\n"+(C?'"!start" to instant-start the show.\n"!stop" to stop the show.\n':"")+(w&&a.in_fanclub||x&&a.is_mod?'"!addme" confirm complimentary show access.\n':"")+(v?'"!add user,.." to add one or more viewers.\n"!check user,.." to check if one or more people are viewers.\n"!mute" toggle non-viewer chat during show (='+(z?"off":"on")+').\n"!remove user,.." to remove one or more viewers.\n': '"!check" to check if you have access.\n')+'"!time" to see how long show has run.\n"!warn" to '+(v?"post":"view")+" browser compatibility warning."+(W?'\n"/tip '+r+' @user" to buy show access for "user".':"")+(W&&u?'\n"/tip '+t+' @user" to buy a peek preview for "user".':""),c,L(c),"#f5f5f5"),a["X-Spam"]=!0):cb.limitCam_isRunning()&&!C&&z&&!cb.limitCam_userHasAccess(c)&&(cb.chatNotice('"'+c+'", your non-viewer chat is being muted during the show. Type "!check" to check for complimentary viewer access.', c,L(c),"#f5f5f5"),a["X-Spam"]=!0):(F(function(){z=!z;var a='"'+c+'" has toggled non-viewer chat "'+(z?"off":"on")+'" during show.\nType "!mute" again to switch it '+(z?"back on":"off")+".";y&&cb.sendNotice(a,"","#dc0055","#f5f5f5","","red");cb.chatNotice(a,cb.room_slug,"#dc0055","#f5f5f5")}),a["X-Spam"]=!0):(F(function(){e.substring(5).split(/\s*,\s*/).forEach(f)}),a["X-Spam"]=!0):(F(function(){e.substring(8).split(/\s*,\s*/).forEach(b)}),a["X-Spam"]=!0);else{if(!I||cb.limitCam_isRunning())Object.keys(p).forEach(Y), cb.limitCam_stop(),cb.limitCam_removeAllUsers(),G=(new Date).valueOf(),cb.drawPanel(),cb.chatNotice(q+" has been "+(I?"stopped":"cancelled")+".","",K(),"#f5f5f5"),cb.changeRoomSubject("#"+q+" is over!"+(H?" \u2665 Tippers.":"")),cb.chatNotice("Show purchasers were: "+Object.keys(n).join()+"\n"+(I?"":"Peek Preview purchasers were: "+Object.keys(p).join()+"\n")+'Deactivate and Restart "AutoStart Tip2View", if you want to start a new show.',c,L(c),"#f5f5f5");a["X-Spam"]=!0}else I&&cb.limitCam_isRunning()? G?cb.chatNotice(q+' has been stopped.\nDeactivate and Restart "AutoStart Tip2View" to start a new show.',c,L(c),"#f5f5f5"):cb.chatNotice(q+" has already started.",c,L(c),"#f5f5f5"):R(),a["X-Spam"]=!0;return a});cb.onSave(function(){return JSON.stringify({viewers:n,peekers:p})}); cb.onRestore(function(a){function b(a,b){if(a.length){var e="The following user's saved "+b+" tickets have been restored: "+a.sort().join(", ");y&&cb.sendNotice(e,"","#dc0055","#f5f5f5","","red");cb.chatNotice(e,cb.room_slug,"#dc0055","#f5f5f5")}}var f=JSON.parse(a),h=[];Object.keys(f.viewers).forEach(function(a){n.hasOwnProperty(a)||(T(a,"Your Previously Saved Show Ticket"),h.push(a))});b(h,"show");h=[];Object.keys(f.peekers).forEach(function(a){n.hasOwnProperty(a)||p.hasOwnProperty(a)||!f.peekers[a]|| (S(a,"Your Previously Saved Preview Ticket"),h.push(a))});b(h,"preview")});cb.log("rubzombie@AutoStart Tip2View: 01.08.1990_8");cb.limitCam_isRunning()&&cb.limitCam_stop();cb.limitCam_allUsersWithAccess().length&&cb.limitCam_removeAllUsers();cb.chatNotice(q+' starting soon!\nType "!help" to get help.',"",K(),"#f5f5f5");cb.changeRoomSubject("#"+q+" starting soon! Tip "+k(r)+" to view the show. (Adobe Flash enabled browser required)");w&&M("green");x&&M("red");m=setTimeout(R,A);N();U(A);cb.drawPanel();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.