Last active
August 29, 2015 13:56
-
-
Save 0x4a/8884668 to your computer and use it in GitHub Desktop.
YouScrobbler 1.2.1: display button below the video - https://userscripts.org/scripts/show/119694 #youtube #userscript #mod #diff
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
--- youscrobbler.user.js Tue Sep 09 23:39:36 2014 | |
+++ youscrobbler.user.mod.js Tue Sep 09 23:54:07 2014 | |
@@ -2,7 +2,7 @@ | |
// @name YouScrobbler | |
// @namespace userscripts.org | |
// @author http://www.lukash.de | |
-// @description Scrobbles the currently watching YouTube video to last.fm. | |
+// @description Scrobbles the currently watching YouTube video to last.fm. - modified by github.com/0x4a: moved button below video, changed autoscrobble-time from 3/4 to 2/3 | |
// @identifier http://userscripts.org/scripts/source/119694.user.js | |
// @include http://*.youtube.com/watch?*v=* | |
// @include http://*.youtube.com/watch#!*v=* | |
@@ -20,7 +20,7 @@ | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// @grant GM_xmlhttpRequest | |
-// @version 1.2.4 | |
+// @version 1.2.4-mod | |
// ==/UserScript== | |
/** | |
@@ -28,6 +28,8 @@ | |
* | |
* *YouScrobbler is build on the code of youscrobble (http://userscripts.org/scripts/show/71606) but its an new script with many new features | |
* *Authentication-Function is adapted from ScrobbleSmurf (http://daan.hostei.com/lastfm/) | |
+* | |
+* *modified by github.com/0x4a: moved button below video, changed autoscrobble-time from 3/4 to 2/3, minor spelling fixes in comments | |
*/ | |
const VERSION = "1.2.4"; | |
@@ -407,12 +409,12 @@ | |
button.innerHTML = '<img id="us_icon_small" style="margin-bottom: -3px;" src="'+us_icon()+'" alt="icon" /><input id="us_temp_info" video_is_playing="1" type="hidden" us_secs="'+secs+'" us_playstart_s="'+t+'" us_playstart="'+t2+'"/><input id="us_resetCore" type="button" style="display:none"/><a class="start" id="us_start_scrobblebutton"> <span id="us_start_scrobblebutton_text">Scrobble</span></a><span class="masthead-link-separator">|</span>';//postxanadus | |
- //Feather check | |
+ //Father check | |
if (document.getElementById("masthead-nav")) { | |
BFather = document.getElementById("masthead-nav"); | |
BFather.insertBefore(button, BFather.firstChild); | |
- } else if (document.getElementById("yt-masthead-content")){ | |
- BFather = document.getElementById("yt-masthead-content"); | |
+ } else if (document.getElementById("watch7-headline")){ | |
+ BFather = document.getElementById("watch7-headline"); | |
button.setAttribute("class", "yt-uix-button-group"); | |
button.style.float = "right"; | |
button.style.marginLeft = "20px"; | |
@@ -632,7 +634,7 @@ | |
window.setTimeout(function() { document.getElementById('us_infobox').style.display = "none";}, 500); | |
} | |
-//shows the optional datafiels | |
+//shows the optional datafields | |
function us_showmoreform() { | |
var i1 = document.getElementById('us_hiddenform'); | |
var a = document.getElementById('us_more'); | |
@@ -876,7 +878,7 @@ | |
*/ | |
function us_scrobble(artist,track,album,mbid,retry,queued,auto) { | |
if ((us_getTempData("scrobbled"))==1 && !queued) { | |
- us_saveTempData("us_leftToPlay", parseInt(us_getTempData("us_secs")*(3/4))); | |
+ us_saveTempData("us_leftToPlay", parseInt(us_getTempData("us_secs")*(2/3))); | |
us_saveTempData("scrobbled", 0); | |
} | |
var args = "?artist=" + encodeURIComponent(artist) + "&sk=" + us_getValue("us_sessionKey") + | |
@@ -899,7 +901,7 @@ | |
if (retry==0) { | |
if (auto==1) { | |
us_infoBox('<div><span class="us_trackinfo"><span id="us_artist_display">'+artist+ '</span> <span class="sep">-</span> <span id="us_track_display">' +track+'</span></span> scrobbling in '+time_left_to_scrobble+' seconds. <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA7CAAAOwgEVKEqAAAAAGnRFWHRTb2Z0d2FyZQBQYWludC5ORVQgdjMuNS4xMDD0cqEAAAG4SURBVDhPdVNNS0JREL19mAV9LSRo4zqEfoK0FCKiKCyqRQuhFK2HEBRSEPmkTBCjRdHGZRD9idb2uRBavMC30EJwlW4iXnN0roxFA4d7OXPO3LlfSsbnd91z9p4xlq3Zu8Cr35EAhxw0LO+Ml8aTf9WaL0BMYzFZ3jfjdsQ07E0Tc3CcK0DLtlaAWLSmsVLVcZw9QjdhKW6HCwDNw8zloYG2XaT2VfOsWHNYGeYsoYugYBAF+pnrIWShhQdela4kDbRGcU7QZmBUFJgUPHACD7xq296orr8Fi0QOcxKrYHSLAmhfFnDBA69qVTrCvkcIsoPoPwXchBx5THibBShcnAS0OB0thXQBnA06G+Ic4JMFBkUCcOWrl80VKFKEPuYDPALedgG0Q4TeO7aRAL9mLYD3MO8jeHm+SwfY2sJWKaQPcYyTA0hkKim0fk3QV6gPGZiAB155jTeEXkJkx47d0iivVe4dXIA7N34/pEMCbgOt6i39xhS07YeEeG48yKecYKG8GayKrVxBAy08TbOOx/q9/EwXZvkAB3hMGKd5TH4maNnWGfiquY9TI2jN/PnO4JDr/M5K/QDEQYmHdixexAAAAABJRU5ErkJggg==" alt="queued" /></div>'); | |
- window.setTimeout(function() { us_closeinfobox();}, 5000); | |
+ window.setTimeout(function() { us_closeinfobox();}, 2500); | |
} else { | |
us_boxcontent('Queued...','<div class="us_done">This will be scrobbled in '+time_left_to_scrobble+' seconds. </div>'); | |
window.setTimeout(function() { us_closebox(); }, 2000); | |
@@ -1285,7 +1287,7 @@ | |
//watched seconds till scrobbling | |
var time_left_to_scrobble; | |
if (us_getTempData("us_leftToPlay", false)==false || us_getTempData("us_leftToPlay") < 0){ | |
- time_left_to_scrobble = parseInt(us_getTempData("us_secs")*(3/4)); | |
+ time_left_to_scrobble = parseInt(us_getTempData("us_secs")*(2/3)); | |
us_saveTempData("us_leftToPlay", parseInt(time_left_to_scrobble)); | |
} | |
@@ -1319,7 +1321,7 @@ | |
if (TO1Helper) { | |
scrobble_statusbar("scrobble"); | |
- document.getElementById("us_scrobble_statusbar").style.width = Math.round(100-100*(leftToPlay/(us_getTempData("us_secs")*(3/4))))+"%"; | |
+ document.getElementById("us_scrobble_statusbar").style.width = Math.round(100-100*(leftToPlay/(us_getTempData("us_secs")*(2/3))))+"%"; | |
} /* else { | |
document.getElementById("us_scrobble_statusbar").style.width = 0; | |
} */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment