// ==UserScript== // @name Heise.de Forum: all comments on one page v2 // @namespace Vorticon // @author marrr, edited by commander_keen, jn // @version 2.3.5 // @description All comments on one page, iReply, quick-vote, user-scores. // @include http://www.heise.de/*/foren/* // @include https://www.heise.de/*/foren/* // @include http://www.heise.de/foren/* // @include https://www.heise.de/foren/* // @include http://www.heise.de/forum/* // @include https://www.heise.de/forum/* // @grant GM_getValue // @grant GM_setValue // @grant GM_xmlhttpRequest // @grant GM_log // @grant GM_addStyle // @downloadURL none // ==/UserScript== // known issues: Greasemonkey 3.1 GM_xmlhttpRequest doesn't send Cookies, so inline voting is not possible (function() { // Opera wrapper /******************************************** * USER SETTINGS ********************************************/ var overviewPagePostCount = 16; var maxJoinedPosts = overviewPagePostCount * 10; // in overview, add x posts * y pages var maxJoinedPostsInThread = 80; // user score is scaled by this value and then fitted into 0-10 var posterScoreScaleFactor = 0.3; // here you can enable joining on different overview levels /*var joinTopLevelForen = 1; this is nowhere to be found*/ var joinSubLevelForen = 1; var enableThreadView = 1; // reply stuff var enableIReply = 1; var enableAutoQuote = 1; var enableQuickVote = 1; // "plain" for disabling colored bar indentation var displayMode = "colored"; // defines the colors used for colored indentation var branchBorderStyle = "1px dashed"; function getBranchColor(lvl) { switch(lvl % 8) { case 0: return "#999999"; case 1: return "#445599"; case 2: return "#995544"; case 3: return "#449955"; case 4: return "#994455"; case 5: return "#554499"; case 6: return "#CC77CC"; case 7: return "#554499"; } } function getQuoteColor(lvl) { switch(lvl) { case 2: return "#668811"; case 3: return "#445599"; case 4: return "#995544"; case 5: return "#449955"; case 6: return "#994455"; case 7: return "#554499"; case 8: return "#CC77CC"; case 9: return "#554499"; // ... default: return ""; } } /******************************************** * BROWSER DEPENDENT ********************************************/ function isOpera() { return typeof(opera) != "undefined"; } function isSafari() { return typeof(safari) != "undefined" || /apple/i.test(navigator.vendor) || /safari/i.test(navigator.userAgent); } function isChrome() { return typeof(chrome) != "undefined"; } function log(msg) { if (isOpera()) opera.postError(msg); // else if (isChrome()) console.log(msg); // chrome supports GM_log else if(isSafari()) { // according to the docs, GM_log is supported if(typeof(GM_log) != undefined) GM_log(msg); } else GM_log(msg); } function requestHTML(fileUrl, callback, nr, div) { fileUrl = ensureAbsoluteUrl(fileUrl); if (isOpera() || isSafari()) { var xmlHttp = new XMLHttpRequest(); xmlHttp.open('GET', fileUrl, true); xmlHttp.onreadystatechange = function () { if(xmlHttp.readyState == 4 && xmlHttp.status == 200) callback(xmlHttp.responseText, nr, div, fileUrl); }; xmlHttp.send(null); } else { // maybe the opera way works here, but this one contains more GM_s GM_xmlhttpRequest( { method: 'GET', url: fileUrl, onload: function(resp) { if(resp.status == 200) callback(resp.responseText, nr, div, fileUrl); } }); } } // TODO: this is limited to simple values, yet sufficient function setLocalValue(name, val) { if (isOpera() || isChrome() || isSafari()) { var lifeTime = 31536000; document.cookie = escape(name) + "=" + escape(val) + ";expires=" + (new Date((new Date()).getTime() + (1000 * lifeTime))).toGMTString() + ";path=/"; } else GM_setValue(name, val); } function getLocalValue(name, def ) { if(isOpera() || isChrome() || isSafari()) { var cookieJar = document.cookie.split("; "); for(var x = 0; x < cookieJar.length; x++) { var oneCookie = cookieJar[x].split( "=" ); if( oneCookie[0] == escape(name) ) { try { eval('var footm = '+unescape(oneCookie[1])); return footm; } catch(e) { return def; } } } return def; } else return GM_getValue(name, def); } /******************************************** * THE CODE ********************************************/ var baseUrl = document.location.protocol + '//' + document.location.host; var postingRegExp; var isNewForum = /^\/forum\//.test(document.location.pathname) ? true : false; if(isNewForum) postingRegExp = /((
))\3[\s\S]*?<\/div>\s*<\/div>)(?=\s*
)/; else postingRegExp = /((
[\s\S]*?)?(?=(
))\3[\s\S]*?(?=(