// ==UserScript== // @name Chaturbate MULTI-CAM Viewer // @namespace https://tesomayn.com // @description Adds a new tab to Chaturbate, and allows you to watch multiple webcams at once // @version 2.0.2 // @include http://chaturbate.com/ // @include http://chaturbate.com/#* // @include http://chaturbate.com/#live* // @include http://chaturbate.com/*-cams/* // @include http://*.chaturbate.com/ // @include http://*.chaturbate.com/#* // @include http://*.chaturbate.com/*-cams/* // @include https://chaturbate.com/ // @include https://chaturbate.com/#* // @include https://chaturbate.com/#live* // @include https://chaturbate.com/*-cams/* // @include https://*.chaturbate.com/ // @include https://*.chaturbate.com/#* // @include https://*.chaturbate.com/*-cams/* // @exclude http://serve.ads.chaturbate.com/* // @require https://code.jquery.com/jquery-2.1.4.min.js // @require https://greasyfork.org/scripts/14852-patreon-lib/code/Patreonlib.js?version=93835 // @grant unsafeWindow // @grant GM_registerMenuCommand // @grant GM_openInTab // @grant GM_getValue // @grant GM_setValue // @license MIT // @downloadURL https://update.sleazyfork.org/scripts/9701/Chaturbate%20MULTI-CAM%20Viewer.user.js // @updateURL https://update.sleazyfork.org/scripts/9701/Chaturbate%20MULTI-CAM%20Viewer.meta.js // ==/UserScript== $(function() { if (window.top != window.self) return; var gm = function(){ var self = this; this.STORAGE_KEY_NAME = "chaturbate_girls"; this.LAYOUT_KEY_NAME = "chaturbate_layout"; this.get_layout = function(){ setTimeout(function(){ var temp = 2; var layout_id = GM_getValue(self.LAYOUT_KEY_NAME); if (typeof layout_id == "undefined") layout_id = temp; var adder = function(lid){ viewer.layout_id = lid; viewer.layout(lid); } var script = document.createElement("script"); script.textContent = "(" + adder.toString() + ")("+layout_id+");"; //document.body.appendChild(script); },0); } this.get_girls = function(){ setTimeout(function(){ var temp = '[]'; var sJSON = GM_getValue(self.STORAGE_KEY_NAME); if (typeof sJSON == "undefined") sJSON = temp; var adder = function(savedGirls){ $.each(savedGirls,function(){ viewer.girls.push(new Girl(this)); }); if ( location.hash == "#live" ) viewer.show(); } var script = document.createElement("script"); script.textContent = "(" + adder.toString() + ")("+sJSON+");"; document.body.appendChild(script); },0); } this.set_girls = function(){ setTimeout(function(){ var data = JSON.stringify(unsafeWindow.jQuery.map(unsafeWindow.viewer.girls,function(o){ return o.username })); GM_setValue(self.STORAGE_KEY_NAME, data); },0); } this.set_layout = function(){ setTimeout(function(){ GM_setValue(self.LAYOUT_KEY_NAME, unsafeWindow.viewer.layout_id); },0); } return self; }; if (cloneInto){ var insideGM = new gm(); var outsideGM = createObjectIn(unsafeWindow, {defineAs: "gm"}); Object.keys(insideGM).forEach(function(key){ try { if (typeof insideGM[key] == 'function'){ exportFunction(insideGM[key], outsideGM, {defineAs: key}); } } catch(e){ } }); } else { unsafeWindow.gm = new gm; } function main() { if (typeof jQuery != "undefined"){ jQuery(document).ready(function(){ function getKey(e) { if(window.event) { // IE return e.keyCode; } else if(e.which) { // Netscape/Firefox/Opera return e.which } } var exports = "getKey,toHtml,websiteHostName,Girl,viewer"; var toHtml = function(data, template){ return template.replace(/#(?:\{|%7B)(.*?)(?:\}|%7D)/g, function($1, $2){ return ($2 in data) ? data[$2] : ''; }) } var websiteHostName = location.protocol + "//" + location.host + "/"; var Girl = function(name){ var user = name.replace(/\//g,""); var self = this; this.href = websiteHostName + user; this.username = user; this.src = websiteHostName + "embed/" + self.username + "/?join_overlay=1&room=" + self.username; } var viewer = new (function(){ var self = this; var list_template = '