Apps Home
|
Create an App
tracy test 123
Author:
200qa
Description
Source Code
Launch App
Current Users
Created by:
200qa
/** * Created by tracy on 5/9/18. */ var whitespace = '\u2003'; var whitespace5 = '\u2003\u2003\u2003\u2003\u2003'; var tips = 0; var lastTipper = ''; var lastTipAmount = 0; var highestTipper = ''; var highestTip = 0; var thankyou=false; var timer=cb.settings.timer * 1000; var reduceBy=cb.settings.reduceBy; var timeoutId; var fontSize = 11; var image = 'a4795ca1-eb95-4f99-838e-0d1fb6b43e36'; var image2 = '35c1f6f6-36db-40fe-9730-e5643296e01b'; cb.settings_choices = [ {name:'timer', type:'int', minValue:1, maxValue:60, default:10, label:'Reduce the tip jar every X seconds:'}, {name:'reduceBy', type:'int', minValue:1, maxValue:20, default:1, label:'Amount to reduce tip jar by:'} ]; cb.onTip(function (tip) { tips += tip.amount; lastTipper = tip.from_user; lastTipAmount = tip.amount; if (tip.amount > highestTip){ highestTipper=tip.from_user; highestTip=tip.amount; thankyou=true; } cb.drawPanel(); }); function checkJar() { if(tips>0) { tips=tips-reduceBy; } var timeoutId = cb.setTimeout(checkJar, timer); cb.drawPanel(); } function cancelTimeout() { cb.cancelTimeout(timeoutId); } cb.onDrawPanel(function(user) { if (thankyou){ cb.cancelTimeout(timeoutId); thankyou=false; return { 'template': 'image_template', 'layers': [ {'type': 'image', 'fileID': '35c1f6f6-36db-40fe-9730-e5643296e01b'} ], 'table': { 'row_1': { 'background-color': ' #f2f9fd', 'col_1': { 'value': '', 'text-align': 'center' }, 'col_2': { 'value': whitespace5 + highestTipper, 'color': 'red', } }, 'row_2': { 'background-color': ' #f2f9fd', 'col_1': { 'value': '' }, 'col_2': { 'value': 'tipped ' + highestTip, 'color': 'magenta', 'text-align': 'center' } }, 'row_3': { 'background-color': ' #f2f9fd', 'color': 'blue', 'col_1': { 'value': '', 'text-align': 'center' }, 'col_2': { 'value': 'Thank you!!!', 'text-align': 'center', 'color': 'magenta' } } } }; } if (tips === 0 || tips === undefined){ return { 'template': 'image_template', 'layers': [ {'type': 'image', 'fileID':'a4795ca1-eb95-4f99-838e-0d1fb6b43e36'}, { 'type': 'text', 'text': 'Tips: 0', 'width': 270, 'top': 10, 'left': 185, 'text-align': 'left', 'font-size': 12, }, { 'type': 'text', 'text': 'My jar is empty!', 'width': 270, 'top': 40, 'left': 185, 'text-align': 'left', 'font-size': 12, }, ], }; } else { return { 'template': 'image_template', 'layers': [ { 'type': 'text', 'text': 'TIPS JAR', 'top': 5, 'left': 61, 'font-size': fontSize, 'color': 'orange', }, { 'type': 'text', 'text': 'LAST TIPPER', 'top': 29, 'left': 73, 'font-size': fontSize, 'color': 'orange', }, { 'type': 'text', 'text': 'HIGHEST TIPPER', 'top': 52, 'left': 28, 'font-size': fontSize, 'color': 'orange', }, { 'type': 'text', 'text': tips, 'top': 5, 'left': 147, 'font-size': fontSize, 'color': 'black', }, { 'type': 'text', 'text': lastTipper + " (" + lastTipAmount + ")", 'top': 29, 'left': 147, 'font-size': fontSize, 'color': 'black', }, { 'type': 'text', 'text': highestTipper + " (" + highestTip + ")", 'top': 50, 'left': 147, 'font-size': fontSize, 'color': 'black', }] } } }); var timeoutId = cb.setTimeout(checkJar, timer); cb.drawPanel();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.