Last active
August 29, 2015 14:19
-
-
Save cheebow/5655d30b8ae893affc24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name showroom star aggregator | |
// @namespace http://nipotan.com/ | |
// @version 0.8 | |
// @description 特定のルームには連射ボタン等があり、他は閉じるだけ | |
// @match https://www.showroom-live.com/* | |
// @grant none | |
// @copyright 2014 nipotan | |
// ==/UserScript== | |
$(document).ready(function(){ | |
if (!$('#js-room-volume')) return false; | |
var roomName = $('#room-header>div.name').html(); | |
if (!roomName) return false; | |
var safeList = ['lovelydoll', 'angereve', 'akiba_lovelydoll', 'stella', 'kerupani8252', 'arcjewel', 'haruna_lovelydoll', 'kana_lovelydoll']; // 自由に編集してください | |
var checkHash = {}; | |
for (var i = 0; i < safeList.length; i++) checkHash[safeList[i]] = 1; | |
if (checkHash[location.pathname.match(/^\/([^\/]*)/)[1]]) { | |
var burstButton = $('<button>'); | |
burstButton.attr('type', 'button'); | |
burstButton.attr('class', 'js-room-comment-btn comment-btn'); | |
burstButton.text('1〜50まで自動投稿'); | |
burstButton.css('position','fixed'); | |
burstButton.css('top', '40px'); | |
burstButton.css('left', $('#gift-image-1').get(0).getBoundingClientRect().left); | |
$('body').append(burstButton); | |
burstButton.click(function(){ | |
var autoPost = function (num) { | |
window.setTimeout(function(){ | |
$('#js-chat-input-comment').val(num); | |
$('#js-room-comment').submit(); | |
}, 2000 * (num - 1)); | |
}; | |
for (var comNum = 1; comNum <= 50; comNum++) { | |
autoPost(comNum); | |
} | |
}); | |
var stars = ['1','1001','1002','1003','2']; | |
for (var i = 0; i < stars.length; i++) { | |
var imgId = '#gift-image-' + stars[i]; | |
var star = $(imgId); | |
var starDom = star.get(0); | |
var pos = star.get(0).getBoundingClientRect(); | |
var burst = $('<img>'); | |
burst.attr('src', star.attr('src')); | |
burst.width(30); | |
burst.height(30); | |
burst.css('cursor', 'pointer'); | |
burst.css('position','fixed'); | |
burst.attr('base-star', imgId); | |
burst.css('top', '70px'); | |
burst.css('left', pos.left); | |
$('body').append(burst); | |
burst.click(function(){ | |
var baseStar = $($(this).attr('base-star')).parent(); | |
var starLeft = baseStar.next().html().replace(/^\D+/, '') - 0; | |
if (starLeft) { | |
starLeft = starLeft > 10 ? 10 : starLeft; | |
for (var j = 0; j <= starLeft; j++) { | |
setTimeout(function(){ baseStar.click() }, j * 50); | |
} | |
} | |
}); | |
} | |
return false; | |
} | |
var volumeOffAndClose = function(count){ | |
window.setTimeout(function(){ | |
if (!setVolume) { | |
console.log(count); | |
if (count <= 30) { | |
window.setTimeout(volumeOffAndClose(count + 1)); | |
} | |
} | |
if ($('#js-room-volume').attr('class') != 'icon-room-volume-off') | |
$('#js-room-volume').click(); | |
$('#js-room-volume').click(); | |
setVolume(0); | |
$('#icon-room-twitter').click(); | |
window.setTimeout(function(){ | |
$('#twitter-textarea').val('d '); | |
$('#twitter-post-btn').click(); | |
}, 500); | |
window.setTimeout(function(){ | |
window.close(); | |
}, 32500); | |
}, 2000 * count); | |
}; | |
volumeOffAndClose(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment