Stories
Slash Boxes
Comments

SoylentNews is people

The Fine print: The following are owned by whoever posted them. We are not responsible for them in any way.

Journal by takyon

// ==UserScript==
// @name Soylent Upgrade
// @match http://soylentnews.org/submit.pl
// @match https://soylentnews.org/submit.pl
// @match http://soylentnews.org/submit.pl?op=viewsub&subid=*
// @match https://soylentnews.org/submit.pl?op=viewsub&subid=*
// @match http://soylentnews.org/admin.pl
// @match https://soylentnews.org/admin.pl
// @match http://soylentnews.org/admin.pl?op=edit&sid=*
// @match https://soylentnews.org/admin.pl?op=edit&sid=*
// @match http://soylentnews.org/comments.pl*
// ==/UserScript==

var simplifyChars = true;

var boxes = document.getElementsByTagName("textarea");
for (var x=0; x<boxes.length; x++)
{
    if (boxes[x].name == "introtext" || boxes[x].name == "bodytext")
    {
        var temp = boxes[x].value;
        temp = temp.replace(/<\/p><p>/g,"<\/p>\n\n<p>");
        temp = temp.replace(/<br>\s?<br>/g,"<\/p>\n\n<p>");
        temp = temp.replace(/<\/blockquote><p>/g,"<\/blockquote>\n\n<p>");
        temp = temp.replace(/<\/p><blockquote>/g,"<\/p>\n\n<blockquote>");
        temp = temp.replace(/<blockquote><div><p>/g,"<blockquote><div>\n\n<p>");
        temp = temp.replace(/<\/p><\/div><\/blockquote>/g,"<\/p>\n\n<\/div><\/blockquote>");
        temp = temp.replace(/<\/blockquote><blockquote>/g,"<\/blockquote>\n\n<blockquote>");
        temp = temp.replace(/<p class="byline">\s/i,"<p class=\"byline\">");
        temp = temp.replace(/<p>\s/g,"<p>");
        temp = temp.replace(/\s<\/p>/g,"<\/p>");
        temp = temp.replace(/<\/li><li>/g,"<\/li>\n<li>");
        temp = temp.replace(/<\/li><\/ul>/g,"<\/li>\n<\/ul>");
        temp = temp.replace(/<\/p><ul>/g,"<\/p>\n\n<ul>");
        temp = temp.replace(/  /g," ");
        if (simplifyChars)
        {
            temp = temp.replace(/\u2018/g,"'");
            temp = temp.replace(/\u2019/g,"'");
            temp = temp.replace(/\u201C/g,"\"");
            temp = temp.replace(/\u201D/g,"\"");
            temp = temp.replace(/\u2026/g,"..."); // ellipsis
        }
        boxes[x].value = temp;
        boxes[x].rows = 32;
    }
    var toolbar = document.createElement("div");
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","Blockquote");
    tempbutton.setAttribute("onmousedown","addBlockquote(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);
    boxes[x].parentNode.insertBefore(toolbar, boxes[x].nextSibling);
}

var temp = document.createElement("script");
temp.appendChild(document.createTextNode("function addBlockquote(area) { var sel = getSelection(); if (sel.length != 0) { area.value = area.value.replace(sel,'<blockquote>'+sel+'<\/blockquote>'); } }"));
document.getElementsByTagName('head')[0].appendChild(temp);

function getSelection() {
    return (!!document.getSelection) ? document.getSelection() :
           (!!window.getSelection)   ? window.getSelection() :
           document.selection.createRange().text;
}

Display Options Threshold/Breakthrough Reply to Article Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.