Apps Home
|
Create an App
PruebaS51
Author:
naomiwhite_
Description
Source Code
Launch App
Current Users
Created by:
Naomiwhite_
//Classic Tip Goal by Admin + Customizable panel by Silici0 // vars var total_tipped = 0; var high_tip_username = null; var high_tip_amount = 0; var last_tip_username = null; var last_tip_amount = 0; var subject_is_set_with_0 = false; var panelConfig = cb.settings.panelConfig; var imageConfig = cb.settings.imageConfig; var imageSelec = cb.settings.imageSelec; var imageConfigTrue = cb.settings.imageConfigTrue; var row1_LabelText =cb.settings.row1_LabelText; var row1_LabelColor = cb.settings.row1_LabelColor; var row1_Color = cb.settings.row1_Color; var row1_Background = cb.settings.row1_Background; var row2_LabelText = cb.settings.row2_LabelText; var row2_LabelColor = cb.settings.row2_LabelColor; var row2_Color = cb.settings.row2_Color; var row2_Background = cb.settings.row2_Background; var row3_LabelText = cb.settings.row3_LabelText; var row3_LabelColor = cb.settings.row3_LabelColor; var row3_Color = cb.settings.row3_Color; var row3_Background = cb.settings.row3_Background; cb.settings_choices = [ {name: 'tokens', type: 'int', minValue: 1, default: 100}, {name: 'goal_description', type: 'str', minLength: 1, maxLength: 255}, { name: "hashtag", label:"Hashtags", type: "str", minLength: 1, maxLength: 255 },{ name: "panelConfig", label:"Panel configuration", type: "choice", choice1:"classic", choice2:"table", choice3:"image", defaultValue:"image" },{ name: "imageSelec", label:"Select an image ID. You can see all the images in the top of Code Source section", type: "choice", choice1:"Image ID written in next section", choice2:"18c80fb6-16b1-4b60-bd58-60833ca4d7b3", defaultValue:"Image ID written in next section", },{ name: "imageConfig", label:"Image Panel configuration, select: Image ID written... first, (useful if you copy these app to upload your own image)", type: 'str', minLength: 1, maxLength: 50, defaultValue:"18c80fb6-16b1-4b60-bd58-60833ca4d7b3", required: true },{ name: "row1_LabelText", label:"Row1 Label Text, default:Love Received / Goal", type: 'str', minLength: 1, maxLength: 26, defaultValue:"Tip Received / Goal :", required: true },{ name: "row1_LabelColor", label:"Color Row1 Label, only for Table or Image Panel", type: 'str', minLength: 1, maxLength: 50, defaultValue:"black", required: true },{ name: "row1_Color", label:"Row1 Text Color, only for Table or Image Panel", type: 'str', minLength: 1, maxLength: 50, defaultValue:"black", required: true },{ name: "row1_Background", label:"Row1 Background Color, only for Table", type: 'str', minLength: 1, maxLength: 50, defaultValue:"#ADD8E6", required: true },{ name: "row2_LabelText", label:"Row2 Label Text, default: Highest Tip: ", type: 'str', minLength: 1, maxLength: 26, defaultValue:"Highest Tip:", required: true },{ name: "row2_LabelColor", label:"Row2 Label Color, only for Table or Image Panel", type: 'str', minLength: 1, maxLength: 50, defaultValue:"black", required: true },{ name: "row2_Color", label:"Row2 Tex Color, only for Table or Image Panel", type: 'str', minLength: 1, maxLength: 50, defaultValue:"black", required: true },{ name: "row2_Background", label:"Row2 Background Color, only for Table", type: 'str', minLength: 1, maxLength: 50, defaultValue:"pink", required: true },{ name: "row3_LabelText", label:"Row3 Label Text, default: Latest Tip Received: ", type: 'str', minLength: 1, maxLength: 26, defaultValue:"Latest Tip :", required: true },{ name: "row3_LabelColor", label:"Row3 Label Color, only for Table or Image Panel", type: 'str', minLength: 1, maxLength: 50, defaultValue:"black", required: true },{ name: "row3_Color", label:"Row3 Color, only for Table or Image Panel", type: 'str', minLength: 1, maxLength: 50, defaultValue:"black", required: true },{ name: "row3_Background", label:"Row3 Background Color, only for Table", type: 'str', minLength: 1, maxLength: 50, defaultValue:"#ADD8E6", required: true }, ]; // handlers if(imageSelec != "Image ID written in next section"){ imageConfigTrue = imageSelec } else { imageConfigTrue = imageConfig }; cb.onTip(function(tip) { total_tipped += tip['amount'] if (total_tipped > cb.settings.tokens) { total_tipped = cb.settings.tokens; } update_subject(); last_tip_amount = tip['amount'] last_tip_username = tip['from_user'] if (tip['amount'] > high_tip_amount) { high_tip_amount = tip['amount'] high_tip_username = tip['from_user'] } cb.drawPanel(); }); cb.onDrawPanel(function(user) { /*return { 'template': '3_rows_of_labels', //'row1_label': 'Tip Received / Goal :', 'row1_label': row1_LabelText + ':', 'row1_value': '' + total_tipped + ' / ' + cb.settings.tokens, //'row2_label': 'Highest Tip:', 'row2_label': row2_LabelText + ':', 'row2_value': " " + format_username(high_tip_username) + ' (' + high_tip_amount + ')', //'row3_label': 'Latest Tip Received:', 'row3_label': row3_LabelText + ':', 'row3_value': " " + format_username(last_tip_username) + ' (' + last_tip_amount + ')' }; }); */ if (cb.settings.panelConfig == "image"){ return { "template": "image_template", "layers": [ {'type': 'image', 'fileID': imageConfigTrue}, { 'type': 'text', 'text': row1_LabelText, 'top': 5, 'left': 10, 'font-size': 11, //'text-align': 'center', 'font-weight': 'bold', 'color': row1_LabelColor, }, { 'type': 'text', 'text': row2_LabelText, 'top': 29, 'left': 10, 'font-size': 11, //'text-align': 'center', 'font-weight': 'bold', 'color': row2_LabelColor, }, { 'type': 'text', 'text': row3_LabelText, 'top': 52, 'left': 10, 'font-size': 11, //'text-align': 'center', 'font-weight': 'bold', 'color': row3_LabelColor, },{ 'type': 'text', 'text': '' + total_tipped + ' / ' + cb.settings.tokens, 'top': 5, 'left': 147, 'font-size': 11, //'text-align': 'center', 'font-weight': 'bold', 'color': row1_Color, }, { 'type': 'text', 'text': " " + format_username(high_tip_username) + ' (' + high_tip_amount + ')', 'top': 29, 'left': 147, 'font-size': 11, //'text-align': 'center', 'font-weight': 'bold', 'color': row2_Color, }, { 'type': 'text', 'text': " " + format_username(last_tip_username) + ' (' + last_tip_amount + ')', 'top': 52, 'left': 147, 'font-size': 11, //'text-align': 'center', 'font-weight': 'bold', 'color': row3_Color, }, ], }; } if (cb.settings.panelConfig == "table"){ return { "template": "image_template", "table": { "row_1": { "background-color": row1_Background, "col_1": { "color": row1_LabelColor, "text-align": "center", "font-weight": "bold", "value": row1_LabelText }, "col_2": { "color": row1_Color, "text-align": "center", "value": ' ' + total_tipped + ' / ' + cb.settings.tokens, }, }, "row_2": { "background-color": row2_Background, "col_1": { "color": row2_LabelColor, "text-align": "center", "font-weight": "bold", "value": row2_LabelText }, "col_2": { "color": row2_Color, "text-align": "center", "value":" " + format_username(high_tip_username) + ' (' + high_tip_amount + ')' } }, "row_3": { "background-color": row3_Background, "col_1": { "color": row3_LabelColor, "text-align": "center", "font-weight": "bold", "value": row3_LabelText }, "col_2": { "color": row3_Color, "text-align": "center", "value":" " + format_username(last_tip_username) + ' (' + last_tip_amount + ')' } } } }; } else { return { 'template': '3_rows_of_labels', //'row1_label': 'Tip Received / Goal :', 'row1_label': row1_LabelText + ':', 'row1_value': '' + total_tipped + ' / ' + cb.settings.tokens, //'row2_label': 'Highest Tip:', 'row2_label': row2_LabelText + ':', 'row2_value':" " + format_username(high_tip_username) + ' (' + high_tip_amount + ')', //'row3_label': 'Latest Tip Received:', 'row3_label': row3_LabelText + ':', 'row3_value':" "+ format_username(last_tip_username) + ' (' + last_tip_amount + ')' }; } }); cb.drawPanel(); // helper functions function update_subject() { if (tips_remaining() == 0) { if (subject_is_set_with_0) { return; } subject_is_set_with_0 = true; } else { subject_is_set_with_0 = false; } var new_subject = cb.settings.goal_description + " [" + tips_remaining() + " tokens remaining] " + cb.settings.hashtag; cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject); } function tips_remaining() { var r = cb.settings.tokens - total_tipped; if (r < 0) { return 0; } else { return r; } } function format_username(val) { if (val === null) { return "--"; } else { return val.substring(0, 12); } } function init() { update_subject(); } init();
© Copyright Freesexcam 2011- 2024. All Rights Reserved.