NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Autoblog Comments // @namespace // @version 1.0.0 // @description Autoblog Comments Enhancer (ACE) https://openuserjs.org/scripts/joeviocoe/Autoblog_Comments // @include http://*.autoblog.com/* // @exclude *_uac* // @copyright 2014+, Joeviocoe // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js // @updateURL https://openuserjs.org/install/Joeviocoe/Autoblog_Comments.user.js // @downloadURL https://openuserjs.org/install/Joeviocoe/Autoblog_Comments.user.js // ==/UserScript== // Copyright (c) 2014, Joeviocoe // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Joeviocoe nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // /*jslint browser: true*/ /*global $, jQuery, alert*/ ///// Declare Global Variables ///// var Initialize, version = '1.0.0', updateURL = 'https://openuserjs.org/scripts/joeviocoe/Autoblog_Comments', reLog, tester; var input1, input2, input3, input4, input5, input6, input7, input8, input9, input10, input11, input12, toolbar; var newComments = 0, currentAge = 0, currentEdit = "", unEditFlag = 0; var editBtn, ignoreBtn, ignoreViewToggleBtn, quoteBtn, sigBtn; var togglePersist, checkPersist, clearPersist, toolTipHelp; var status_myComments, status_HighlightAge, status_Linkify, status_expand, status_timer, status_myComments_A, status_HighlightAge_A, status_Linkify_A, status_expand_A, status_gotoLast_A; var expandAll, collapseAll, hasCollapsed, expandComments, setAgeArray, unHighlightAge, Linkify, UnLinkify; var ageHrs, ageMin, scrollUp, scrollDown, myCommentsOn, myCommentsOff, timerOn, timerOff, home, end, ageCancel; var scrollUpAge, scrollDownAge, pullUpdate, updateScript, EditOrQuote, makeEditAll, hideThis, makeEditThis, editPeek; var tagAge, placeLinks, linkifyContainer, linkifyTextNode, makeEditAll, makeSigBtn, detectChanges, pullUpdate, user, placeSig, getUserSig, resetUserSig; var arrayAges = [], firstNav = 1, timeSet, restoreWatch, updatePage, reFresh, reflectValue; var IgnoreList = [], IgnoreAddRemove, ignoreViewToggle, currentIgnore, numIgnored = 0, numIgnored_i = 0, numIgnored_x = 0; ///// User Options ///// var autoGotoLatest, pollingTime, defaultSignature, signature; pollingTime = 30; // (in seconds) How often to determine if there are new comments on the server. defaultSignature = "Autoblog Comments Enhancer (ACE) v" + version + " - bit.ly/Autoblog_Comments"; //////////////////////////////// Main //////////////////////////////// setTimeout (Initialize, 200); //////////////////////////////// INITIALIZATION //////////////////////////////// function Initialize() { /// newComments += 1; // TEST New Comments var i, d; user = $('.toggle-auth').text(); user = user.replace("Hi ", "").replace(" (Sign out)", ""); checkPersist(); if ( GM_getValue("autoExpand") == 1 ) { setTimeout ( function () { expandAll(); }, 2000); } else { status_expand = "DISABLED"; } if ( GM_getValue("autoHyperlink") == 1 ) { Linkify(); } else { status_Linkify = "DISABLED"; } if ( GM_getValue("autoHighlightOwn") == 1 ) { myCommentsOn(); } else { status_myComments = "DISABLED"; } if ( GM_getValue("autoHighlightAge") == 1 ) { tagAge(); } else { tagAge(); status_HighlightAge = "DISABLED"; } if ( autoGotoLatest == 1 ) { setTimeout ( function () { var nextPost = $('#ACE-' +arrayAges[currentAge]).parent().parent().offset().top - 30; $('html, body').animate({scrollTop:nextPost}, 800); $('#ACE-' +arrayAges[currentAge]).css('text-decoration','underline'); firstNav = 0; }, 2000); } getUserSig(); setTimeout(function() { placeLinks(); makeEditAll(); updatePage(); detectChanges(); pullUpdate(newComments); }, 3000); toolbar = document.getElementsByClassName("comments-meta")[0]; $(toolbar).css('z-index',9999999999); for ( i = 1; i <= 12; i++ ) { toolbar.appendChild(eval("input" + i)); } d = new Date(); timeSet = d.toTimeString().slice(0, 5); input9.value=timeSet + "\n\u27F3"; if ( document.URL.match('&&')) { restoreWatch(); } } //////////////////////////////// Persistent User Options //////////////////////////////// function togglePersist(event) { setTimeout (function () { var target = event.target.onclick.name; if ( target == "myCommentsOff" || target == "myCommentsOn" ) { GM_setValue( "autoHighlightOwn", 1 - GM_getValue("autoHighlightOwn" ) ); } if ( target == "unHighlightAge" || target == "ageHrs" || target == "ageMin" ) { GM_setValue( "autoHighlightAge", 1 - GM_getValue("autoHighlightAge") ); } if ( target == "UnLinkify" || target == "Linkify" ) { GM_setValue( "autoHyperlink", 1 - GM_getValue("autoHyperlink") ); } if ( target == "collapseAll" || target == "expandAll" ) { GM_setValue( "autoExpand", 1 - GM_getValue("autoExpand") ); } if ( target == "timerOn" || target == "timerOff" ) { GM_setValue( "autoGotoLatest", 1 - GM_getValue("autoGotoLatest") ); } checkPersist(); }, 1000); } function checkPersist() { if ( GM_getValue("IGNORE_LIST") == null ) { IgnoreList = []; } else { IgnoreList = GM_getValue("IGNORE_LIST").split(" &&& "); } if ( GM_getValue("autoHighlightOwn") == null ) { GM_setValue("autoHighlightOwn", "1"); } if ( GM_getValue("autoHighlightAge") == null ) { GM_setValue("autoHighlightAge", "1"); } if ( GM_getValue("autoHyperlink") == null ) { GM_setValue("autoHyperlink", "1"); } if ( GM_getValue("autoExpand") == null ) { GM_setValue("autoExpand", "1"); } if ( GM_getValue("autoGotoLatest") == null ) { GM_setValue("autoGotoLatest", "0"); } if ( GM_getValue("autoHighlightOwn") == 1 ) { status_myComments_A = " & SET TO AUTORUN"; input8.style.borderStyle = "solid"; } if ( GM_getValue("autoHighlightOwn") == 0 ) { status_myComments_A = ""; input8.style.borderStyle = "dashed"; } if ( GM_getValue("autoHighlightAge") == 1 ) { status_HighlightAge_A = " & SET TO AUTORUN"; input2.style.fontWeight = " bold "; input4.style.fontWeight = " bold "; input5.style.fontWeight = " bold "; } if ( GM_getValue("autoHighlightAge") == 0 ) { status_HighlightAge_A = ""; input2.style.fontWeight = "";input4.style.fontWeight = ""; input5.style.fontWeight = ""; } if ( GM_getValue("autoHyperlink") == 1 ) { status_Linkify_A = " & SET TO AUTORUN"; input3.style.fontWeight = " bold "; } if ( GM_getValue("autoHyperlink") == 0 ) { status_Linkify_A = ""; input3.style.fontWeight = ""; } if ( GM_getValue("autoExpand") == 1 ) { status_expand_A = " & SET TO AUTORUN"; input1.style.fontWeight = " bold "; input1.style.fontSize = "23px"; } if ( GM_getValue("autoExpand") == 0 ) { status_expand_A = ""; input1.style.fontWeight = ""; input1.style.fontSize = "20px"; } if ( GM_getValue("autoGotoLatest") == 1 ) { status_gotoLast_A = "ENABLED"; input9.style.fontWeight = " bold "; autoGotoLatest = 1; } if ( GM_getValue("autoGotoLatest") == 0 ) { status_gotoLast_A = "DISABLED"; input9.style.fontWeight = ""; autoGotoLatest = 0; } toolTipHelp(); var i, key, keys = GM_listValues(); for (i=0; i<keys.length; i++) { key=keys[i]; console.log(key + " = " + GM_getValue(key)); } } function clearPersist() { var i, key, keys = GM_listValues(); for (i=0; i<keys.length; i++) { key=keys[i]; GM_deleteValue(key); console.log("Deleting: " + key); } } function getUserSig() { if ( !GM_getValue("sign") ) { signature = prompt("Autoblog Comments Enhancer (ACE)\nversion " + version + " \u00A92014, Joeviocoe\n\n\ Enter your Signature to appear below your comments\n\n(leave blank to use default signature)", ""); GM_setValue("sign", signature); } if ( GM_getValue("sign").length == 0 || GM_getValue("sign") == "isDefault" ) { signature = defaultSignature; GM_setValue("sign", "isDefault"); } else { signature = GM_getValue("sign"); } } function resetUserSig() { GM_deleteValue("sign"); var target = $(this).siblings("b.text-wrapper").children("textarea"); target.val( target.val().replace("\n\n" + signature, "") ); getUserSig(); } //////////////////////////////// UPKEEP //////////////////////////////// // Refreshes the changes when new comments load function detectChanges (){ var numComments1, numComments2; numComments1 = $('.comment-body').length; numComments2 = $('.comment-body').length; setInterval (function (){ toolTipHelp(); numComments2 = $('.comment-body').length; if ( input8.src != document.getElementById('aol-comments').getElementsByTagName('img')[0].src ) { input8.src=document.getElementById('aol-comments').getElementsByTagName('img')[0].src; } if ( numComments1 != numComments2 ) { updatePage(); numComments1 = numComments2; console.log("ACE: Detected New Comment Loaded"); } if ( $(".reply-comment-textarea").val() || $("#aol-comments-textarea").val().length != 22 ) { makeSigBtn(); } }, 5000); } function updatePage() { placeLinks(); makeEditAll(); $("b.date:contains('Edited')").off('click').click(editPeek); if ( GM_getValue("autoExpand") == 1 ) { expandComments(); } if ( document.getElementById("LinkifyId").style.color == 'black') { Linkify(); } if ( document.getElementById("icon").style.borderColor == 'black') { myCommentsOn(); } if ( document.getElementById("ageHrsId").style.color == 'black') { tagAge(); ageHrs(); } if ( document.getElementById("ageMinId").style.color == 'black') { tagAge(); ageMin(); } } // Expand through all hidden comments to load everything // function expandAll() { input1.style.color =" grey "; if ( hasCollapsed != 1 ) { var i = $(".level-one").length, root = $('div[id=aol-comments-root-count]').text(); //console.log("ACE: Expand All\nroot comments showing = " + i); while (i < root) { $('.load-more-comments').get(0).click(); i+=10; } } setTimeout (expandComments, 2000); setTimeout (expandComments, 4000); setTimeout (function() { if ( autoGotoLatest == 1 ) { var nextPost = $('#ACE-' +arrayAges[currentAge]).parent().parent().offset().top - 30; $('html, body').animate({scrollTop:nextPost}, 800); $('#ACE-' +arrayAges[currentAge]).css('text-decoration','underline'); } else { firstNav = 1; } }, 4000); setTimeout (function () { input1.style.color =" black "; status_expand = "ENABLED"; }, 4000); setTimeout (tagAge, 4000); input1.onclick = collapseAll; } function expandComments() { $('.toggle-link').not('.expanded').each(function() { $(this).get(0).click(); }); } function collapseAll() { input1.style.color =" grey "; $('.expanded').each(function() { $(this).get(0).click(); }); input1.style.color =" lightgrey "; status_expand = "DISABLED"; hasCollapsed = 1; input1.onclick = expandAll; } ////////////////////////////////////////// Edit, Quote, Ignore and Signatures ////////////////////////////////////////// function placeLinks() { var selstr, count, editTarget; user = $('.toggle-auth').text().replace("Hi ", "").replace(" (Sign out)", ""); $( "b.display-name" ).parent().mouseover(function() { $(this).children(".comment-meta")[0].appendChild(quoteBtn); quoteBtn.style.display='block'; $("a#ACE_Quote_Btn").off('hover').hover( function() { selstr = window.getSelection().toString().trim(); editTarget = $( "div.comment-hover:contains('" + selstr + "')" ).parent().attr('id'); if ( selstr.length > 0 && editTarget ) { $(this).text("Quote").css('text-decoration','underline'); } else { $(this).text("Reply To").css('text-decoration','underline'); } }, function() { $(this).text("Quote").css('text-decoration',''); editBtn.onclick=EditOrQuote; } ); }); $( "b.display-name:not( :contains('" + user + "') )" ).parent().mouseover(function() { $(this).children(".comment-meta")[0].appendChild(ignoreBtn); ignoreBtn.style.display='block'; if ( $(this).children("p").attr('ace-banned') != undefined ) { $(this).children(".comment-meta").children("a#ACE_Ignore_Btn").text("Undo Ignore"); currentIgnore = $(this).children("p").attr('ace-banned'); ignoreBtn.setAttribute("title", "Autoblog Comments Enhancer (ACE) Ignore Feature \u00A92014, Joeviocoe\n\n" + currentIgnore); return 0; } $("a#ACE_Ignore_Btn").off('hover').hover( function() { selstr = window.getSelection().toString().trim(); editTarget = $( "div.comment-hover:contains('" + selstr + "')" ).parent().attr('id'); if ( selstr.length > 1 && editTarget ) { if ( selstr == $(this).parent().siblings("b.display-name").text().trim() ) { $(this).text("Ignore User").css('text-decoration','underline'); } else { $(this).text("Ignore Selection").css('text-decoration','underline'); } } else { $(this).text("Ignore Comment").css('text-decoration','underline'); } }, function() { $(this).text("Ignore").css('text-decoration',''); } ); }); $( "b.display-name:contains('" + user + "')" ).parent().mouseover(function() { $(this).children(".comment-meta")[0].appendChild(editBtn); $(this).children(".comment-meta").children("#ACE_Ignore_Btn").remove(); editBtn.style.display='block'; $("a#ACE_Edit_Btn").off('hover').hover( function() { selstr = window.getSelection().toString().trim(); editTarget = $( "div.comment-hover:contains('" + selstr + "')" ).parent().attr('id'); if ( selstr.length > 0 && editTarget ) { count = $("#aol-comments-" + editTarget.slice(-6)).children(".comment-body").children("p").text().match(new RegExp(selstr, "g")).length; $(this).text("Edit").css('text-decoration','underline'); if ( count > 1 ) { $(this).text("String Too Common").css({"color":"red","text-decoration":""}); editBtn.onclick=''; } } else { $(this).text("Nothing Selected").css({"color":"red"}); editBtn.onclick=''; } }, function() { $(this).text("Edit").css({"color":"","text-decoration":""}); editBtn.onclick=EditOrQuote; } ); }); $(".num-of-comments")[0].appendChild(ignoreViewToggleBtn); } function IgnoreAddRemove(event){ var str0, TargetComm, TargetUser; if ( !document.URL.match('#aol-comments') ) { window.history.pushState("object or string", "Title", document.URL.split("#")[0] + "#aol-comments"); } if ( event.target.text == "Undo Ignore" ) { IgnoreList.splice($.inArray($(this).parent().siblings("p").attr('ace-banned'), IgnoreList),1); $( "p[ace-banned]" ).parents(".comment-body").css({"color":"","font-weight":""}); $( "p[ace-banned]" ).removeAttr('ace-banned'); makeEditAll(); ignoreViewToggle(); } else { str0 = window.getSelection().toString().trim(); TargetComm = $(this).parents(".comment").attr('id').slice(-6); TargetUser = $(this).parent().siblings("b.display-name").text().trim(); if ( event.target.text == "Ignore Comment" ) { IgnoreList.push("comm~" + TargetComm); } if ( event.target.text == "Ignore Selection" ) { IgnoreList.push("strg~" + str0); } if ( event.target.text == "Ignore User" ) { IgnoreList.push("user~" + TargetUser); } makeEditAll(); } console.log("Ingore List: " + IgnoreList); GM_setValue( "IGNORE_LIST", IgnoreList.join(" &&& ") ); } function ignoreViewToggle(event) { if ( ignoreViewToggleBtn.style.color == 'red' ) { ignoreViewToggleBtn.style.color = ''; makeEditAll(); return 0; } if ( event ) { if ( event.target.id == "ACE_unIgnore_Btn" ) { ignoreViewToggleBtn.style.color = 'red'; } } $( "p[ace-banned]" ).parents(".comment").show(); $( "p[ace-banned]" ).parents(".comment-body").css({"color":"red","font-weight":"bolder"}); numIgnored = $( "p[ace-banned]" ).parent().parent().find(".comment-body").length; numIgnored_x = $( "p[ace-banned]" ).length; numIgnored_i = numIgnored - numIgnored_x; toolTipHelp(); if ( numIgnored > 1 ) { ignoreViewToggleBtn.innerHTML=numIgnored + " comments ignored"; } if ( numIgnored == 1 ) { ignoreViewToggleBtn.innerHTML=numIgnored + " comment ignored"; } if ( numIgnored == 0 ) { ignoreViewToggleBtn.innerHTML=""; } } function makeEditAll() { var i, type, mark; for ( i=0; i<IgnoreList.length; i++ ) { type = IgnoreList[i].slice(0,5); mark = IgnoreList[i].slice(5); if ( type == "comm~" ) { $("#aol-comments-" + mark).children(".comment-body").children("p").attr('ACE-BANNED', IgnoreList[i]); } if ( type == "strg~" ) { $("p:contains('" + mark + "')").parents(".comment-body").children("p").attr('ACE-BANNED', IgnoreList[i]); } if ( type == "user~" ) { $("b.display-name:contains('" + mark + "')").siblings("p").attr('ACE-BANNED', IgnoreList[i]); } } ignoreViewToggle(); $("b.date:contains('Edited')").click(editPeek); $( "p:contains('#ACE-EDIT: ')" ).each ( function() { return makeEditThis.call(this); } ); $( "p:contains('#ACE-EDIT: ')" ).each ( function() { return hideThis.call(this); } ); $( "p[ace-banned]" ).each ( function() { return hideThis.call(this); } ); } function editPeek() { var editTarget, temp1, temp2; editTarget = $(this).parents(".comment").attr('id').slice(-6); temp1 = $(this).parents(".comment-body").attr("orig"); temp2 = $(this).parents(".comment-body").attr("origage"); $(this).parent().siblings("p").html(temp1); $(this).text(temp2); if ( unEditFlag == 0 ) { unEditFlag = 1; } else { unEditFlag = 0; } $( "p:contains('" + editTarget + "')" ).each ( function() { return makeEditThis.call(this); } ); return unEditFlag; } function hideThis() { var origNum, newThread, newNum, path, id; $(this).parent().parent().hide(); // HIDE EDIT REPLIES AND IGNORED COMMENTS path = $(this).closest(".thread").siblings(".toggle-thread").children(".toggle-link"); origNum = path.text().match(/\d+/g); if ( $(this).parents(".comment").attr('id') ) { id = $(this).parents(".comment").attr('id').slice(-6); } if ( !path.attr(id) ) { path.attr(id, 'isEdit'); } else { return 0; } newNum = parseInt(origNum, 10) - 1; newThread = path.text().replace(origNum, newNum); if ( newNum == 1 ) { newThread = newThread.replace("replies", "reply"); } if ( newNum == 0 ) { path.hide(); } // ADJUST NUM OF REPLIES path.text(newThread); } function makeEditThis () { var i, pairs, str0, str1, editSource, editTime, editTarget, editSourceUsr, editTargetUsr, original, originalAge, editor, path, temp; editSource = $(this).html().replace(/<br\>/g, "\n"); editTarget = editSource.substr(0, 6); editSourceUsr = $(this).siblings(".display-name").text().trim(); path = $("#aol-comments-" + editTarget).children(".comment-body"); editTargetUsr = path.children(".display-name").text().trim(); editTime = $(this).next().children("b.date").text(); if ( editSourceUsr != editTargetUsr ) { console.log("Invalid User"); return 1; } original = path.children("p").html(); originalAge = path.children("b.comment-meta").children("b.date").text(); if ( !path.attr('orig') ) { path.attr( 'orig', original ); path.attr( 'origage', originalAge ); } pairs = editSource.split("\n~ "); //console.log("\nACE Edit Source: " + editSource + "\n\nEdit Target: " + editTarget + "\nEdited At: " + editTime + "\nPairs: " + [pairs.length-1]); temp = original; for ( i=1; i<pairs.length; i++ ) { str0 = pairs[i].split(" ~~> ")[0]; str1 = pairs[i].split(" ~~> ")[1]; if ( !str1 ) { str1 = ""; str0 = str0.replace(" ~~>", ""); } if ( unEditFlag == 1 ) { temp = temp.replace(str0, "<strike>" + str0 + "</strike> <u>" + str1 + "</u>"); path.children("b.comment-meta").children("b.date").text('Original ' + editTime).css('cursor', 'pointer'); } else { path.children("b.comment-meta").children("b.date").text('Edited ' + editTime).css('cursor', 'pointer'); temp = temp.replace(str0, str1); } path.children("p").html(temp); // EDITOR temp = path.children("p").html(); //console.log("\n" + i + " - Old String: " + str0 + "\n" + i + " - New String: " + str1); } } function EditOrQuote(event) { var str0, str1, Target, replyBtn, count, Insert, theHeader = ""; //console.log(event.target.id); if ( !document.URL.match('#aol-comments') ) { window.history.pushState("object or string", "Title", document.URL.split("#")[0] + "#aol-comments"); } str0 = window.getSelection().toString().trim(); Target = $(this).parents(".comment").attr('id').slice(-6); console.log("ACE: Edit Target: " + Target); replyBtn = Target; if( $("#aol-comments-r-" + replyBtn + ".reply").text() != 'Reply' ) { replyBtn = $("#aol-comments-" + Target).parent().parent().attr('id').slice(-6); } if ( event.target.id == "ACE_Edit_Btn" ) { str1 = prompt("ACE-EDIT \u00A92014, Joeviocoe\n\n\nTarget Comment: " + Target + "\nFrom: \"" + str0 + "\"\nTo: ", str0); if (str1 == str0) { alert("ERROR:\nSelected string and the typed string are the same\nNothing to Change\n\n"); return 0; } if (str1 == null) { return 0; } theHeader = Target + "\n#ACE-EDIT: A feature of Autoblog Comments Enhancer\nbit.ly/Autoblog_Comments\n"; Insert = "\n~ " + str0 + " ~~> " + str1; } if ( event.target.id == "ACE_Quote_Btn" ) { theHeader = "@" + $(this).parent().siblings("b.display-name").text() ; if ( $("#aol-comments-f-" + replyBtn + ".reply-comment-textarea").val() ) { currentEdit = $(".reply-comment-textarea").val().replace(theHeader, "").replace("Type your comment here", ""); } if ( str0 ) { Insert = "\n--\"" + str0 + "\"\n"; } else { Insert = ''; } } if (!$(".reply-comment-textarea").length) { currentEdit = ''; } currentEdit += Insert; $("#aol-comments-r-" + replyBtn + ".reply").get(0).click(); $("#aol-comments-f-" + replyBtn + ".reply-comment-textarea").val(theHeader + currentEdit); //console.log('\nACE Edit:\n\nFrom~ ' + str0 + "\nTo~ " + str1 + "\nOn~ " + Target); return currentEdit; } function makeSigBtn() { var focused = $(':focus'); focused.parent().siblings('b.comment-button').after(sigBtn); sigBtn.style.display='block'; $(".sign").css('cursor', 'pointer'); } function placeSig() { var target = $(this).siblings("b.text-wrapper").children("textarea"); target.val( target.val().replace("\n\n" + signature, "").replace("Type your comment here", "") + "\n\n" + signature ); } //////////////////////////////// POLLING //////////////////////////////// // Polling for new comments Timer setInterval ( function updateInterval () { pullUpdate(newComments); }, pollingTime * 1000); // Polls the server for new comments (HTML text only) function pullUpdate (newComments) { var live, loaded, brandNewComments; $.ajax({ url: document.URL, success: function(data) { live = data.split('num-of-comments')[1].split('Comment')[0].match(/\d+/g); loaded = $(".num-of-comments").text().split('Comment')[0].match(/\d+/g); brandNewComments = live - loaded; if ( brandNewComments > 0 ) { newComments = (+newComments) + (+brandNewComments); document.title = "<" + newComments + "> " + document.title.replace(/<[\d+]*\>/g, ''); if ( input9.style.color == 'green' || input9.style.color == 'red' ) { input9.value="\u27F3"; input9.style.fontSize = "20"; reFresh(newComments, timeSet); } } document.title = "\u200c" + loaded + " ~ \u200c" + document.title.replace(/\u200c[\w\W]*?\u200c/g, ''); if ( input9.style.color == 'green' || input9.style.color == 'red' ) { input9.value = input9.value.replace(/\n<[\d+]*\>/g, '') + "\n<" + newComments + ">"; } } }); } // Starts watch timer function timerOn() { var d = new Date(); timeSet = d.toTimeString().slice(0, 5); input9.value=timeSet + "\n<0>"; input9.onclick = timerOff; input9.style.color = " green "; input9.style.fontSize = "6"; status_timer = "ENABLED"; pullUpdate(newComments); return timeSet; } // Ends watch timer function timerOff() { var d = new Date(); timeSet = d.toTimeString().slice(0, 5); input9.value=timeSet + "\n\u27F3"; input9.style.color =" black "; input9.style.fontSize = "6"; input9.onclick = timerOn; status_timer = "DISABLED"; newComments = 0; document.title = "<" + newComments + "> " + document.title.replace(/<[\d+]*\>/g, ''); } // Reloads the page if new comments detected and user has not typed into a comment box function reFresh(newComments, timeSet) { var textareas = document.getElementsByTagName('textarea'), rootTextArea = document.getElementById("aol-comments-textarea"); if ( textareas.length == 1 && rootTextArea.value.length == 22 ) { window.location.search += "&&" + timeSet + "&&" + newComments + "&&/"; // Refresh Page } else { input9.setAttribute("title", "WAITING ON USER TO CLEAR ANY COMMENT BOXES"); input9.style.color = " red "; } } // After an automatic refresh of page, scroll to latest comment and keep watching function restoreWatch() { var d, timeCheck, timeCheckMin, timeCheckHrs, timeSetMin, timeSetHrs, durationMin, durationHrs; timeSet = document.URL.split('&&')[1]; newComments = document.URL.split('&&')[2]; window.history.pushState("object or string", "Title", document.URL.split("?&&")[0]); if ( GM_getValue("autoExpand") != 1 ) { expandAll(); } input9.value=timeSet + "\n<0>"; input9.style.color = " green "; input9.style.fontSize = "6"; input9.onclick = timerOff; input9.setAttribute("title", "Watching page since " + timeSet); input9.value = input9.value.replace(/\n<[\d+]*\>/g, '') + "\n<" + newComments + ">"; document.title = "<" + newComments + "> " + document.title.replace(/<[\d+]*\>/g, ''); d = new Date(); timeCheck = d.toTimeString().slice(0, 5); timeCheckMin = timeCheck.split(":")[1]; timeCheckHrs = timeCheck.split(":")[0]; timeSetMin = timeSet.split(":")[1]; timeSetHrs = timeSet.split(":")[0]; durationMin = timeCheckMin - timeSetMin; durationHrs = timeCheckHrs - timeSetHrs; console.log("ACE: Duration = " + durationHrs + ":" + durationMin); if ( durationHrs > 0 ) { input2.value=durationHrs + 1; ageHrs(); } else { input2.value=durationMin + 10; ageMin(); } autoGotoLatest = 1; return newComments; } //////////////////////////////// NAVIGATION //////////////////////////////// //// Highlight Comments by Age ///// function unHighlightAge() { input4.style.color =" lightgrey "; input5.style.color =" lightgrey "; input2.style.color =" lightgrey "; $("b.date").css({"color":"","font-weight":"","font-size":"","margin":""}); input4.onclick = ageHrs; input5.onclick = ageMin; status_HighlightAge = "DISABLED"; } function ageHrs() { var i, t=0, fontSizeHrs, index = $('input[name=InputAge]').val() * 60 + '999'; //console.log("ACE: index = " + index); for (i = 0; i <= arrayAges.length; i++) { if ( arrayAges[i] - 1 <= index ) { //console.log("ACE: Age Array\n" + arrayAges[i]); fontSizeHrs = 8 + 60000/arrayAges[i] + "pt"; $('#ACE-' + arrayAges[i]).css({"color":"orange","font-weight":"bolder","font-size":fontSizeHrs,"margin":".5em"}); } else { $('#ACE-' + arrayAges[i]).css({"color":"","font-weight":"","font-size":"","margin":""}); } if ( arrayAges[i] - 1 <= 60000 ) { fontSizeHrs = 12 + 10000/arrayAges[i] + "pt"; $('#ACE-' + arrayAges[i]).css({"color":"red","font-weight":"bolder","font-size":fontSizeHrs,"margin":".5em"}); } } input5.style.color =" lightgrey "; input4.style.color =" black "; input2.style.color =" black "; input4.onclick = unHighlightAge; input5.onclick = ageMin; status_HighlightAge = "ENABLED"; } function ageMin() { var i, fontSizeHrs, index = $('input[name=InputAge]').val() + '999'; //console.log("ACE: index = " + index); for (i = 0; i <= arrayAges.length; i++) { if ( arrayAges[i] - 1 <= index ) { //console.log("ACE: Age Array\n" + arrayAges[i]); fontSizeHrs = 12 + 10000/arrayAges[i] + "pt"; $('#ACE-' + arrayAges[i]).css({"color":"red","font-weight":"bolder","font-size":fontSizeHrs,"margin":".5em"}); } else { $('#ACE-' + arrayAges[i]).css({"color":"","font-weight":"","font-size":"","margin":""}); } } input4.style.color =" lightgrey "; input5.style.color =" black "; input2.style.color =" black "; input5.onclick = unHighlightAge; input4.onclick = ageHrs; status_HighlightAge = "ENABLED"; } function setAgeArray() { var i, t, index=0; if ( input4.style.color == 'black' ) { index = $('input[name=InputAge]').val() * 60 + '999'; } if ( input5.style.color == 'black' ) { index = $('input[name=InputAge]').val() + '999'; } currentAge = 0; for ( i=0; i<arrayAges.length; i++ ){ if ( parseInt(index,10) > arrayAges[i] && parseInt(index,10) < arrayAges[i + 1] ) { currentAge = i; } } //console.log("ACE: setAgeArray:\nIndex = " + index + "\nCurrentAge = " + arrayAges[currentAge] + " : " + arrayAges); } // Scroll through comments by Age // function tagAge() { while(arrayAges.length > 0) { arrayAges.pop(); } $( "b.date:contains('hour')" ).attr('id',function() { return 'ACE-' + $(this).text().match(/\d+/g)*60 + $(this).offset().top.toString().substr(0, 3); } ); $( "b.date:contains('minute')" ).attr('id',function() { return 'ACE-' + $(this).text().match(/\d+/g) + $(this).offset().top.toString().substr(0, 3); } ); $( 'b.date:contains("less than a minute ago")' ).attr('id', 'ACE-900'); $( 'b.date:contains("just now")' ).attr('id', 'ACE-800'); $("b.date[id*='ACE-']").each(function () { arrayAges.push($(this).attr("id").match(/\d+/g)); }); arrayAges = arrayAges.sort(function(a, b){return a-b;}); reflectValue(); //console.log("ACE: TagAge:\nCurrentAge = " + firstNav + " : " + currentAge + " : " + arrayAges[currentAge] + " : " + arrayAges); return arrayAges; } function scrollUpAge(event) { var delay = 100; if ( currentAge >= arrayAges.length - 1 ) { currentAge = 0; } else { currentAge += 1; } if ( firstNav == 1 ) { firstNav = 0; currentAge = 0; } if ( event.type == "dblclick" ) { delay = 1500; currentAge = arrayAges.length - 1; } $('#ACE-' +arrayAges[currentAge]).css('text-decoration',''); reflectValue(); setTimeout ( function() { var nextPost = $('#ACE-' +arrayAges[currentAge]).parent().parent().offset().top - 50; $('html, body').animate({scrollTop:nextPost}, 1600); }, delay); $('#ACE-' +arrayAges[currentAge]).css('text-decoration','underline'); //console.log("ACE: Scroll Up Age:\nArray Length = " + arrayAges.length + "\nCurrent Index #: " + currentAge + "\nCurrent Age = " + arrayAges[currentAge] + "\n : " + arrayAges); if ( document.getElementById("ageHrsId").style.color == 'black') { ageHrs(); } if ( document.getElementById("ageMinId").style.color == 'black') { ageMin(); } } function scrollDownAge(event) { var delay = 100; if ( currentAge == 0 ) { currentAge = arrayAges.length - 1; } else { currentAge -= 1; } if ( firstNav == 1 ) { firstNav = 0; currentAge = 0; } if ( event.type == "dblclick" ) { delay = 1500; currentAge = 0; } $('#ACE-' +arrayAges[currentAge]).css('text-decoration',''); reflectValue(); setTimeout ( function() { var nextPost = $('#ACE-' +arrayAges[currentAge]).parent().parent().offset().top - 50; $('html, body').animate({scrollTop:nextPost}, 1600); }, delay); $('#ACE-' +arrayAges[currentAge]).css('text-decoration','underline'); //console.log("ACE: Scroll Down Age:\nArray Length = " + arrayAges.length + "\nCurrent Index #: " + currentAge + "\nCurrent Age = " + arrayAges[currentAge] + "\n : " + arrayAges); if ( document.getElementById("ageHrsId").style.color == 'black') { ageHrs(); } if ( document.getElementById("ageMinId").style.color == 'black') { ageMin(); } } function reflectValue() { if ( arrayAges[currentAge] >= 60000 ) { input2.value = Math.floor( arrayAges[currentAge] / 60000 ); if ( GM_getValue("autoHighlightAge") == 1 ) { input5.style.color =" lightgrey "; input4.style.color =" black "; input2.style.color =" black "; } } else { input2.value = Math.floor( arrayAges[currentAge] / 1000 ); if ( GM_getValue("autoHighlightAge") == 1 ) { input4.style.color =" lightgrey "; input5.style.color =" black "; input2.style.color =" black "; } } if ( arrayAges[arrayAges.length - 1] >= 60000 ) { input10.value="\u21D3 " + Math.floor( arrayAges[arrayAges.length - 1] / 60000 ) +"H \u21D3" ; } else { input10.value="\u21D3 " + Math.floor( arrayAges[arrayAges.length - 1] / 1000 ) +"M \u21D3" ; } if ( arrayAges[0] >= 60000 ) { input11.value="\u21D1 " + Math.floor( arrayAges[0] / 60000 ) +"H \u21D1" ; } else { input11.value="\u21D1 " + Math.floor( arrayAges[0] / 1000 ) +"M \u21D1" ; } input10.style.color="black" ; input11.style.color="black"; if ( firstNav == 1 || currentAge == 0 || currentAge == arrayAges.length - 1 ) { input10.value="\u21D3 \u21D3" ; input11.value="\u21D1 \u21D1" ; if ( currentAge == 0 ) { input10.style.color="black" ; input11.style.color="lightgrey"; } if ( currentAge == arrayAges.length - 1 ) { input10.style.color="lightgrey" ; input11.style.color="black"; } } //console.log("ACE: Reflect Value:\nArray Length = " + arrayAges.length + "\nCurrent Index #: " + currentAge + "\nCurrent Age = " + arrayAges[currentAge] + "\n : " + arrayAges); return input2.value; } // Scroll through your Comments // function home() { setTimeout ( function() { $("html, body").animate({ scrollTop: $(".mini-profile").offset().top }, 400); }, 1000); } function end() { setTimeout ( function() { $("html, body").animate({ scrollTop: $(document).height() }, 400); }, 1000); } function myCommentsOn() { $( "b:contains('" + user + "')" ).next().css({"color":"green","font-weight":"bolder"}); $( "b:contains('" + user + "\'s comment')" ).next().css( "color", ""); $( "a:contains('Sign out')" ).css( "color", "" ); input8.style.borderColor =" black "; status_myComments = "ENABLED"; input8.onclick = myCommentsOff; } function myCommentsOff() { user = $('.toggle-auth').text(); user = user.replace("Hi ", "").replace(" (Sign out)", ""); $( "b:contains('" + user + "')" ).next().css({"color":"","font-weight":""}); input8.style.borderColor =" lightgrey "; status_myComments = "DISABLED"; input8.onclick = myCommentsOn; } function scrollUp() { user = $('.toggle-auth').text(); user = user.replace("Hi ", "").replace(" (Sign out)", ""); var scrollPosition = $(document).scrollTop(), nextPost = 0, currentPosition = $(document).height(); jQuery.fn.reverse = [].reverse; $( "b.display-name:contains('" + user + "')" ).reverse().each(function() { currentPosition = $(this).offset().top - 50; if (currentPosition < scrollPosition - 70) { nextPost = currentPosition; return false; } }); if (nextPost > 10) { $('html, body').animate({scrollTop:nextPost}, 800); } } function scrollDown() { user = $('.toggle-auth').text(); user = user.replace("Hi ", "").replace(" (Sign out)", ""); var scrollPosition = $(document).scrollTop(), nextPost = 0, currentPosition = 0; $( "b.display-name:contains('" + user + "')" ).each(function() { currentPosition = $(this).offset().top - 50; if (currentPosition > scrollPosition + 70) { nextPost = currentPosition; return false; } }); if (nextPost > 10) { $('html, body').animate({scrollTop:nextPost}, 800); } } //////////////////////////////// Define Toolbar Elements //////////////////////////////// input1=document.createElement("input"); input1.className = "ACE_button"; input1.type="button"; input1.value="\u27F1"; input1.onclick = expandAll; input1.ondblclick = togglePersist; input1.setAttribute("style", "color:lightgrey;font-size:20px;width:40px;height:28px;position:fixed;line-height:8px;top:30px;right:124px;"); input2=document.createElement("input"); input2.className = "ACE_button"; input2.type="number"; input2.value="30"; input2.min="0"; input2.max="60"; input2.name="InputAge"; input2.onchange=setAgeArray; input2.ondblclick=reLog; input2.setAttribute("style", "color:lightgrey;font-size:18px;width:46px;height:32px;position:fixed;line-height:8px;top:49px;right:72px;"); input3=document.createElement("input"); input3.className = "ACE_button"; input3.type="button"; input3.value="www"; input3.id="LinkifyId"; input3.onclick = Linkify; input3.ondblclick = togglePersist; input3.setAttribute("style", "color:lightgrey;text-decoration:underline;font-size:12px;width:40px;height:22px;position:fixed;line-height:8px;top:60px;right:124px;"); input4=document.createElement("input"); input4.className = "ACE_button"; input4.type="button"; input4.value="H"; input4.id="ageHrsId"; input4.onclick = ageHrs; input4.ondblclick = togglePersist; input4.setAttribute("style", "color:grey;font-size:xx-small;width:24px;height:15px;position:fixed;line-height:8px;top:86px;right:98px;"); input5=document.createElement("input"); input5.className = "ACE_button"; input5.type="button"; input5.value="M"; input5.id="ageMinId"; input5.onclick = ageMin; input5.ondblclick = togglePersist; input5.setAttribute("style", "color:grey;font-size:xx-small;width:24px;height:15px;position:fixed;line-height:8px;top:86px;right:72px;"); input6=document.createElement("input"); input6.className = "ACE_button"; input6.type="button"; input6.value="\u21D1 Up \u21D1"; input6.onclick = scrollUp; input6.ondblclick = home; input6.setAttribute("style", "font-size:xx-small;width:60px;height:15px;position:fixed;line-height:8px;top:30px;right:10px;"); input7=document.createElement("input"); input7.className = "ACE_button"; input7.type="button"; input7.value="\u21D3 Down \u21D3"; input7.onclick = scrollDown; input7.ondblclick = end; input7.setAttribute("style", "font-size:xx-small;width:60px;height:15px;position:fixed;line-height:8px;top:105px;right:10px;"); input8=document.createElement("input"); input8.className = "ACE_button"; input8.type="image"; input8.src=document.getElementById('aol-comments').getElementsByTagName('img')[0].src; input8.id="icon"; input8.onclick = myCommentsOn; input8.ondblclick = togglePersist; input8.setAttribute("style", "border-width:2px;border-style:dashed;border-color:lightgrey;position:fixed;width:56px;height:56px;line-height:8px;top:45px;right:10px;"); input9=document.createElement("input"); input9.className = "ACE_button"; input9.type="button"; input9.id="timerId"; input9.onclick = timerOn; status_timer = "DISABLED"; input9.ondblclick = togglePersist; input9.setAttribute("style", "font-size:6;width:40px;height:36px;line-height:12px;position:fixed;top:84px;right:124px;"); input10=document.createElement("input"); input10.className = "ACE_button"; input10.type="button"; input10.value=" \u21D1 "; input10.onclick = scrollUpAge; input10.ondblclick = scrollUpAge; input10.setAttribute("style", "font-size:xx-small;width:50px;height:15px;position:fixed;line-height:8px;top:105px;right:72px;"); input11=document.createElement("input"); input11.className = "ACE_button"; input11.type="button"; input11.value=" \u21D3 "; input11.onclick = scrollDownAge; input11.ondblclick = scrollDownAge; input11.setAttribute("style", "font-size:xx-small;width:50px;height:15px;position:fixed;line-height:8px;top:30px;right:72px;"); input12=document.createElement("input"); input12.className = "ACE_button"; input12.type="button"; input12.value="ACE v" + version + " \u00A92014, Joeviocoe"; input12.id="copyRight"; input12.onclick=updateScript; input12.setAttribute("style", "color:grey;font-size:xx-small;width:154px;height:17px;position:fixed;line-height:8px;top:11px;right:10px;"); editBtn = document.createElement("a"); editBtn.id="ACE_Edit_Btn"; editBtn.setAttribute('class', 'permalink'); editBtn.href="#"; editBtn.onclick=EditOrQuote; editBtn.innerHTML="Edit"; quoteBtn = document.createElement("a"); quoteBtn.id="ACE_Quote_Btn"; quoteBtn.setAttribute('class', 'permalink'); quoteBtn.href="#"; quoteBtn.onclick=EditOrQuote; quoteBtn.innerHTML="Quote"; ignoreBtn = document.createElement("a"); ignoreBtn.id="ACE_Ignore_Btn"; ignoreBtn.setAttribute('class', 'permalink'); ignoreBtn.href="#"; ignoreBtn.onclick=IgnoreAddRemove; ignoreBtn.innerHTML="Ignore"; ignoreViewToggleBtn = document.createElement("a"); ignoreViewToggleBtn.id="ACE_unIgnore_Btn"; ignoreViewToggleBtn.setAttribute('class', 'permalink'); ignoreViewToggleBtn.href="#"; ignoreViewToggleBtn.onclick=ignoreViewToggle; ignoreViewToggleBtn.setAttribute("style", "margin:16px 16px 16px 16px; font-size:8px;"); sigBtn= document.createElement("a"); sigBtn.id="ACE_Sig_Btn"; sigBtn.setAttribute('class', 'sign'); sigBtn.onclick=placeSig; sigBtn.ondblclick=resetUserSig; sigBtn.innerHTML="Signature"; sigBtn.setAttribute("style", "margin:16px 16px 16px 0px; float:right; font-size:13px;"); function toolTipHelp() { input1.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Expand All Comments and Replies\n\n\ Click: Toggle feature (on/off)\n\ Double-click: Toggle Autorun when page loads (on/off) \n\n\ STATUS: " + status_expand + status_expand_A); input2.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Highlight Comments newer than....\n\n\ Click: Toggle feature (on/off)\n\ Double-click: Toggle Autorun when page loads (on/off) \n\n\ STATUS: " + status_HighlightAge + status_HighlightAge_A); input3.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Create Hyperlinks from URLs\n\n\ Click: Toggle feature (on/off)\n\ Double-click: Toggle Autorun when page loads (on/off) \n\n\ STATUS: " + status_Linkify + status_Linkify_A); input4.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Highlight Comments newer than....\n\n\ Click: Toggle feature (on/off)\n\ Double-click: Toggle Autorun when page loads (on/off) \n\n\ STATUS: " + status_HighlightAge + status_HighlightAge_A); input5.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Highlight Comments newer than....\n\n\ Click: Toggle feature (on/off)\n\ Double-click: Toggle Autorun when page loads (on/off) \n\n\ STATUS: " + status_HighlightAge + status_HighlightAge_A); input6.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Scroll through YOUR Comments\n\n\ Click: Scroll Up\nDouble-click: Go to the top of the Comments Section\n"); input7.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Scroll through YOUR Comments\n\n\ Click: Scroll Down\nDouble-click: Go to the bottom of the Comments Section\n"); input8.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Highlight YOUR comments\n\n\ Click: Toggle feature (on/off)\n\ Double-click: Toggle Autorun when page loads (on/off) \n\n\ STATUS: " + status_myComments + status_myComments_A); input9.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Auto-Refresh when new comments are detected\n(watching since the displayed time)\n\n\ Click: Toggle feature (on/off) 'Refresh page when new comments are detected on server' - " + status_timer + "\n\ Double-click: Toggle (on/off) 'Scroll to latest comment when page loads' - " + status_gotoLast_A ); input10.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Scroll through last 24 hours of Comments\n\n\ Click: Scroll to the Next Comment\nDouble-click: Go to the earliest comment of the day\n"); input11.setAttribute("title", "Autoblog Comments Enhancer (ACE) \u00A92014, Joeviocoe\n\ --Scroll through last 24 hours of Comments\n\n\ Click: Scroll to the Previous Comment\nDouble-click: Go to the latest comment of the day\n"); input12.setAttribute("title", "Autoblog Comments Enhancer (ACE) version " + version + " \u00A92014, Joeviocoe\n" + updateURL + "\n\n\ Click: Set/Clear all User Options to Default & go to website"); editBtn.setAttribute("title", "Autoblog Comments Enhancer (ACE) Edit Feature \u00A92014, Joeviocoe\n\n\ Step 1: Select a string of text that is unique in this comment \n\ Step 2: Hover over this edit button \n\t-if Red, make a wider selection \n\t-if Green, proceed \n\ Step 3: Click this edit button and replace/delete the selection when prompted\n\ Step 4: Submit the generated reply without any changes, the edit function will make changes automatically\n\n\ To peek at edited comments, click on the 'edited comment age'"); quoteBtn.setAttribute("title", "Autoblog Comments Enhancer (ACE) Quote Feature \u00A92014, Joeviocoe\n\n\ Select the text you wish to quote first, or simply Reply directly to the comment"); ignoreBtn.setAttribute("title", "Autoblog Comments Enhancer (ACE) Ignore Feature \u00A92014, Joeviocoe\n\n\ Choose an option, then click this button:\n (A) Highlight the Username of the person you would like to ignore\ \n (B) Highlight a string of text to ignore all comments with that phrase\ \n (C) Click without highlighting to ignore only this comment\n\n"); ignoreViewToggleBtn.setAttribute("title", "Autoblog Comments Enhancer (ACE) Ignore Feature \u00A92014, Joeviocoe\n\n\ " + numIgnored_x + " explicitly ignored\n" + numIgnored_i + " replies to ignored thread\n\nIgnore List:\n" + IgnoreList.join("\n") + "\n\nClick to show ignored comments\n"); sigBtn.setAttribute("title", "Autoblog Comments Enhancer (ACE) Signature Feature \u00A92014, Joeviocoe\n\n\ Click: Write your signature at the end of the comment \nDouble-Click: Reset your signature"); } //////////////////////////////// Testing //////////////////////////////// function updateScript() { if ( !document.URL.match('#aol-comments') ) { window.history.pushState("object or string", "Title", document.URL.split("#")[0] + "#aol-comments"); } input12.style.color =" red "; if (input12.style.color == 'red' ) { window.open(updateURL, '_blank'); } clearPersist(); } /////////////////////////////////////////////////////////////////////////////////////////////// // name Linkify Plus // version 2.1.4 // namespace http://arantius.com/misc/greasemonkey/ // description Turn plain text URLs into links. Supports http, https, ftp, email addresses. // // Copyright (c) 2011, Anthony Lieuallen // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Anthony Lieuallen nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // /******************************************************************************* Loosely based on the Linkify script located at: http://downloads.mozdev.org/greasemonkey/linkify.user.js *******************************************************************************/ var notInTags = [ 'a', 'b', 'code', 'head', 'noscript', 'option', 'script', 'style', 'title', 'textarea']; var textNodeXpath = ".//text()[not(ancestor::"+notInTags.join(') and not(ancestor::')+")]"; // Built based on: // - http://en.wikipedia.org/wiki/URI_scheme // - http://www.regular-expressions.info/regexbuddy/email.html var urlRE = new RegExp( '(' // leading scheme:// or "www." + '\\b([a-z][-a-z0-9+.]+://|bit.ly|www\\.)' // everything until non-URL character + '[^\\s\'"<>()]+' + '|' // email + '\\b[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}\\b' + ')', 'gi'); var queue = []; function Linkify() { linkifyContainer(document.getElementById("aol-comments")); input3.style.color =" black "; status_Linkify = "ENABLED"; input3.onclick = UnLinkify; } function UnLinkify() { $('a.linkifyplus').unwrap().contents().unwrap(); input3.style.color =" lightgrey "; status_Linkify = "DISABLED"; input3.onclick = Linkify; } function linkifyContainer(container) { // Prevent infinite recursion, in case X(HT)ML documents with namespaces // break the XPath's attempt to do so. (Don't evaluate spans we put our // classname into.) if (container.className && container.className.match(/\blinkifyplus\b/)) { return; } var i = 0, parent, xpathResult ; xpathResult = document.evaluate( textNodeXpath, container, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); function continuation() { var node = null, counter = 0; while ((node = xpathResult.snapshotItem(i++)) !== null ) { parent = node.parentNode; if (!parent) { continue; } // Skip styled <pre> -- often highlighted by script. if ('PRE' == parent.tagName && parent.className) { continue; } linkifyTextNode(node); if (++counter > 50) { return setTimeout(continuation, 0); } } } setTimeout(continuation, 0); } function linkifyTextNode(node) { var i, l, m, txt, span, p, lLen, a; txt = node.textContent; span = null; p = 0; while ((m = urlRE.exec(txt)) !== null ) { if (null == span) { // Create a span to hold the new text with links in it. span = document.createElement('span'); span.className = 'linkifyplus'; } //get the link without trailing dots l = m[0].replace(/\.*$/, ''); lLen = l.length; //put in text up to the link span.appendChild(document.createTextNode(txt.substring(p, m.index))); //create a link and put it in the span a = document.createElement('a'); a.className = 'linkifyplus'; a.appendChild(document.createTextNode(l)); if (l.indexOf(":/") < 0) { if (l.indexOf("@") > 0) { l = "mailto:" + l; } else { l = "http://" + l; } } a.setAttribute('href', l); span.appendChild(a); //track insertion point p = m.index+lLen; } // Custom underline on mouse hover $('a.linkifyplus').hover(function(){ $(this).css('text-decoration','underline'); }, function(){ $(this).css('text-decoration','none'); }); if (span) { //take the text after the last link span.appendChild(document.createTextNode(txt.substring(p, txt.length))); //replace the original text with the new span try { node.parentNode.replaceChild(span, node); } catch (e) { console.error(e); console.log(node); } } } function reLog() { console.log("Test"); }