// ==UserScript== // @name Chaturbate // @namespace http://use.i.E.your.homepage/ // @version 0.2 // @description enter something useful // @match http://testbed.chaturbate.com/* // @match http://chaturbate.com/* // @copyright 2012+, Nerdguy // ==/UserScript== var main = function () { var settings = { API_ROOT: 'http://127.0.0.1:8000/v2/', PIN: 3, CURRENT: 0 }; var additional_callbacks = { on_room_message: function(nick, message) {}, on_private_message: function (from_nick, message, tab_nick) {}, notify_goalset: function (amount, current, hightipper, hightipper_amount, lasttipper, lasttipper_amount) {}, notify_goalreached: function () {}, notify_goalcancel: function () {}, notify_tipalert: function(amount, from_username, to_username, message, history) { settings.CURRENT += parseInt(amount); if (settings.URL && settings.GOAL && settings.CURRENT !== undefined) { value = utils.scale(1, settings.GOAL, settings.CURRENT); data = {type: "digital", mode: "pwm", value: value}; $.post(settings.URL, data); } }, notify_tokenbalanceupdate: function(usernames, amounts) {} }; var connectPort = function(port) { if (port) { $.ajax({ type: 'PUT', url: settings.API_ROOT + 'boards/', data: {port: port}, success: function(data) { settings.BOARD = data['pk'] settings.URL = settings.API_ROOT + 'boards/'+ settings.BOARD + '/' + settings.PIN + '/'; $('#firmataPort').removeAttr('disabled'); goal = $('
'); $('#firmataGoal', goal).change(function(e) { val = $(this).val(); if (val !== undefined && val != '') { settings.GOAL = parseInt($(this).val()); } }); $('#firmata').append(goal); } }); } }; var setup = function() { var ui = $('