Apps Home
|
Create an App
234234234
Author:
200qa
Description
Source Code
Launch App
Current Users
Created by:
200qa
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 image = '6c43b004-55b9-42ef-8b03-a1d949e1bbd8'; var image2 = '3227a88e-5c70-44ed-8bb9-0ea03a0f58be'; 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', 'filename': image2} ], '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', 'filename':image}, { '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', 'table': { 'row_1': { 'background-color': '#d5ebf8', 'col_1': { 'value': 'Tip Jar:', 'text-align': 'right', 'color' : 'green' }, 'col_2': { 'value': whitespace + tips, 'text-align': 'left', } }, 'row_2': { 'background-color': ' #f2f9fd', 'col_1': { 'value': 'Last Tipper:', 'text-align': 'right' }, 'col_2': { 'value': whitespace + lastTipper + " (" + lastTipAmount+")", 'text-align': 'left', 'font-style': 'italic', 'color': 'pink' } }, 'row_3': { 'background-color': ' #f2f9fd', 'col_1': { 'value': 'Highest Tipper:', 'text-align': 'right' }, 'col_2': { 'value': whitespace + highestTipper + " (" + highestTip +")", 'text-align': 'left', 'font-style': 'italic', 'color': 'red' } } } }; } }); var timeoutId = cb.setTimeout(checkJar, timer); cb.drawPanel();
© Copyright Freesexcam 2011- 2024. All Rights Reserved.