Stories
Slash Boxes
Comments

SoylentNews is people

Log In

Log In

Create Account  |  Retrieve Password


Papa John Blames NFL for Lost Pizza Sales 🍕📉

Posted by takyon on Wednesday November 01 2017, @10:45PM (#2739)
8 Comments
Business

Papa John's Blames the NFL for Hurting Pizza Sales 🍕📉🔥

Papa John’s International Inc. founder John Schnatter is going after NFL Commissioner Roger Goodell, saying weak handling of the league’s national-anthem controversy has hammered sales of his pizza.

“The NFL has hurt us by not resolving the current debacle to the players’ and owners’ satisfaction,” Schnatter, who serves as the pizza chain’s chairman and chief executive officer, said on a conference call. “NFL leadership has hurt Papa John’s shareholders.”

The remarks follow a controversy over NFL football players protesting during the national anthem, a movement that started last season. The demonstrations have sparked calls for a boycott and raised concerns among league sponsors. But Schnatter’s comments mark the highest-profile example of an NFL partner publicly blaming the outcry for hurting business.

Fox News Employees Know Their Mueller/Russia Coverage Stinks

Posted by takyon on Wednesday November 01 2017, @01:56AM (#2737)
12 Comments

Soylent Upgrade Greasemonkey/Tampermonkey extension v14

Posted by takyon on Saturday October 28 2017, @04:53PM (#2712)
7 Comments
Code

NOW WITH MORE BLOAT!

SKIP TO THE COMMENTS

// ==UserScript==
// @name Soylent Upgrade
// @version 14.0
// @grant none
// @match http://soylentnews.org/*article.pl*
// @match http://*.soylentnews.org/*article.pl*
// @match https://soylentnews.org/*article.pl*
// @match https://*.soylentnews.org/*article.pl*

// @match http://soylentnews.org/*submit.pl*
// @match http://*.soylentnews.org/*submit.pl*
// @match https://soylentnews.org/*submit.pl*
// @match https://*.soylentnews.org/*submit.pl*

// @match http://soylentnews.org/*admin.pl*
// @match http://*.soylentnews.org/*admin.pl*
// @match https://soylentnews.org/*admin.pl*
// @match https://*.soylentnews.org/*admin.pl*

// @match http://soylentnews.org/*comments.pl*
// @match http://*.soylentnews.org/*comments.pl*
// @match https://soylentnews.org/*comments.pl*
// @match https://*.soylentnews.org/*comments.pl*

// @include /^https?://(.*\.)?soylentnews\.org/.*?journal\.pl.*?/
// @match http://soylentnews.org/*journal.pl*
// @match http://*.soylentnews.org/*journal.pl*
// @match https://soylentnews.org/*journal.pl*
// @match https://*.soylentnews.org/*journal.pl*

// @include /^https?://(.*\.)?soylentnews\.org/.*?pollBooth\.pl\?qid=.*/
// ==/UserScript==

// Begin User Options:

var simplifyChars = true; // Change to false if you don't want stylized quotation marks, ellipses, etc. to be replaced
var stripEmail = false; // Remove auto-filled email from submission
var doiChecker = true; // Add Crossref search to DOIs in the summary
var disableCycler = false; // Change to true to disable the button that cycles through *New* comments

// End User Options

/* ! http://mths.be/fromcodepoint v0.1.0 by @mathias */
if (!String.fromCodePoint) { (function() { var defineProperty = (function() { try { var object = {}; var $defineProperty = Object.defineProperty; var result = $defineProperty(object, object, object) && $defineProperty; } catch(error) {} return result; }()); var stringFromCharCode = String.fromCharCode; var floor = Math.floor; var fromCodePoint = function() { var MAX_SIZE = 0x4000; var codeUnits = []; var highSurrogate; var lowSurrogate; var index = -1; var length = arguments.length; if (!length) { return ''; } var result = ''; while (++index < length) { var codePoint = Number(arguments[index]); if ( !isFinite(codePoint) || codePoint < 0 || codePoint > 0x10FFFF || floor(codePoint) != codePoint ) { throw RangeError('Invalid code point: ' + codePoint); } if (codePoint <= 0xFFFF) { codeUnits.push(codePoint); } else { codePoint -= 0x10000; highSurrogate = (codePoint >> 10) + 0xD800; lowSurrogate = (codePoint % 0x400) + 0xDC00; codeUnits.push(highSurrogate, lowSurrogate); } if (index + 1 == length || codeUnits.length > MAX_SIZE) { result += stringFromCharCode.apply(null, codeUnits); codeUnits.length = 0; } } return result; }; if (defineProperty) { defineProperty(String, 'fromCodePoint', { 'value': fromCodePoint, 'configurable': true, 'writable': true }); } else { String.fromCodePoint = fromCodePoint; } }()); }

// Add "Quote This" buttons to all initially visible comments
var spans = document.getElementsByTagName("span");
for (var x=0; x<spans.length; x++)
{
    if (spans[x].id.indexOf("reply_link_")==0)
    {
        var button = document.createElement("span");
        button.setAttribute("class","nbutton");
        var p = document.createElement("p");
        var b = document.createElement("b");
        var a = document.createElement("a");
        // Set the href of the "Quote This" button to the href of the "Reply to This" button, with the escaped contents of the post added to URL and any [domain.names] following links in the post cut out:
        a.setAttribute("href",spans[x].getElementsByTagName("a")[0].href.replace("#post_comment","&postercomment="+escape("<blockquote>"+document.getElementById("comment_body_"+spans[x].id.replace("reply_link_","")).innerHTML.replace(/<\/a>\s\[.*?\..*?\]/g,"<\/a>")+"<\/blockquote>\n\n")+"#post_comment"));
        // To Do: Shorten URLs longer than 2000 characters
        a.appendChild(document.createTextNode("Quote This"));
        b.appendChild(a);
        p.appendChild(b);
        button.appendChild(p);
        spans[x].parentNode.insertBefore(button, spans[x].nextSibling);
        spans[x].parentNode.insertBefore(document.createTextNode(" "), spans[x].nextSibling); // Divider
    }
}

// DOI checker in the summary
if (doiChecker && window.location.href.search(/https?\:\/\/.*soylentnews\.org.*?\/article\.pl/)!=-1)
{
    var summary = document.getElementById("articles").getElementsByClassName("intro")[0];
    summary.innerHTML = summary.innerHTML.replace(/(\(|\[)DOI: (10[^\s\n<]*)(\)|\])/gi,"$1DOI: <a href='http://search.crossref.org/?q=$2' target='_blank'>$2</a>$3");
    summary.innerHTML = summary.innerHTML.replace(/(\(|\[)open, DOI: (10[^\s\n<]*)(\)|\])/gi,"$1open, DOI: <a href='http://search.crossref.org/?q=$2' target='_blank'>$2</a>$3");
    if (document.getElementById("articles").getElementsByClassName("full").length > 0)
    {
        var summary2 = document.getElementById("articles").getElementsByClassName("full")[0];
        summary2.innerHTML = summary2.innerHTML.replace(/(\(|\[)DOI: (10[^\s\n<]*)(\)|\])/gi,"$1DOI: <a href='http://search.crossref.org/?q=$2' target='_blank'>$2</a>$3");
        summary2.innerHTML = summary2.innerHTML.replace(/(\(|\[)open, DOI: (10[^\s\n<]*)(\)|\])/gi,"$1open, DOI: <a href='http://search.crossref.org/?q=$2' target='_blank'>$2</a>$3");
    }
}

// Empty email input area, but only on submission page
if (stripEmail && window.location.href.search(/https?\:\/\/.*soylentnews\.org.*?\/submit\.pl/)!=-1)
{
    var boxes = document.getElementsByTagName("input");
    for (var x=0; x<boxes.length; x++)
    {
        if (boxes[x].name == "email")
        {
            boxes[x].value = "";
        }
    }
}

// Add title case button next to title/subj field on Story Submissions, Submission Preview, Story Preview, and New Journal
if (window.location.href.search(/https?\:\/\/.*soylentnews\.org.*?\/(submit\.pl|admin\.pl|journal\.pl|journal\.pl\?op=edit)/)!=-1)
{
    var boxes = document.getElementsByTagName("input");
    for (var x=0; x<boxes.length; x++)
    {
        if (boxes[x].name == "title" || boxes[x].name == "subj" || boxes[x].name == "description")
        {
            boxes[x].id = "storyTitle";
            var button = document.createElement("input");
            button.setAttribute("type","button");
            button.setAttribute("value","Title Case");
            button.setAttribute("title","Convert title to title case.");
            button.setAttribute("onclick","document.getElementById('storyTitle').value=document.getElementById('storyTitle').value.replace(/^\\s/gi,'').replace(/\\b([a-z])/gi,function(m, p1){return p1.toUpperCase();}).replace(/\\b(at|of|is|and|to|in|by|as|its|be|the|on|a|an|but|or|for)\\b/gi,function(m, p1){return p1.toLowerCase();}).replace(/^([a-z])/gi,function(m, p1){return p1.toUpperCase();}).replace(/:\\s([a-z])/gi,function(m, p1){return ': '+p1.toUpperCase();}).replace(/([a-z])['\u2019]([a-z])/gi,function(m, p1, p2){return p1+'\\''+p2.toLowerCase();}).replace(/\\bx(86|64)\\b/gi,'x$1').replace(/\\bIphone/gi,'iPhone').replace(/\\s$/gi,'');");
            boxes[x].parentNode.insertBefore(button, boxes[x].nextSibling);
            if (window.location.href.search(/https?\:\/\/.*soylentnews\.org.*?\/admin\.pl/)!=-1 || boxes[x].name == "subj")
            {
                boxes[x].parentNode.insertBefore(document.createElement("br"), boxes[x].nextSibling);
            }
            else
            {
                boxes[x].parentNode.insertBefore(document.createTextNode(" "), boxes[x].nextSibling);
            }
        }
    }
}

// Add warning for creating a story in the past
if (window.location.href.search(/https?\:\/\/.*soylentnews\.org.*?\/admin\.pl/)!=-1)
{
    var boxes = document.getElementsByTagName("input");
    for (var x=0; x<boxes.length; x++)
    {
        if (boxes[x].name == "op" && (boxes[x].value == "save"))
        {
            // New onclick extracts the post date, compares to the current date, and only submits if the post date is in the future or the user overrides the warning:
            boxes[x].setAttribute("onclick","var d = new Date(document.getElementById('slashstoryform').elements['time'].value.replace(/\\s/,'T')); var a = true; if (d < Date.now()){a = confirm('Are you sure you want to post a story '+(Math.round((Date.now()-d)/60000))+' minutes in the past?');} if (a) {st_submit(this);}");
        }
    }
}

// Expand all initially hidden spoiler blocks when editing a story
if (window.location.href.search(/https?\:\/\/.*soylentnews\.org.*?\/admin\.pl/)!=-1)
{
    var boxes = document.getElementsByTagName("input");
    for (var x=0; x<boxes.length; x++)
    {
        if (boxes[x].className == "spoiler")
        {
            boxes[x].checked = true;
        }
    }
}

// Add draft capabilties to story submission form
if (window.location.href.search(/https?\:\/\/.*soylentnews\.org.*?\/submit\.pl/)!=-1)
{
    var boxes = document.getElementsByTagName("textarea");
    for (var x=0; x<boxes.length; x++)
    {
        if (boxes[x].name == "story")
        {
            var p = document.createElement("p");

            // Save Draft button
            var button = document.createElement("input");
            button.setAttribute("type","button");
            button.setAttribute("value","Save Draft");
            button.setAttribute("onclick","saveSoydraft();");
            p.appendChild(button);

            p.appendChild(document.createTextNode(" "));

            // Discard Draft button
            var button = document.createElement("input");
            button.setAttribute("type","button");
            button.setAttribute("id","discardDraft");
            button.setAttribute("value","Discard");
            // Disable the Discard Draft button onload if no draft is available
            if(!localStorage.getItem("soydraft"))
            {
                button.setAttribute("disabled","disabled");
            }
            else
            {
                button.setAttribute("onclick","discardSoydraft();");
            }
            p.appendChild(button);

            p.appendChild(document.createTextNode(" "));

            // Autosave checkbox
            var span = document.createElement("span");
            span.setAttribute("id","autosaveBar");
            // Hide autosave checkbox onload if no draft is available
            if (document.getElementById("storyTitle").value == "" && boxes[x].value == "")
            {
                if(localStorage.getItem("soydraft"))
                {
                    span.setAttribute("style","visibility:visible;");
                }
                else
                {
                    span.setAttribute("style","visibility:hidden;");
                }
            }
            span.appendChild(document.createTextNode("Autosave?"));
            var checkbox = document.createElement("input");
            checkbox.setAttribute("type","checkbox");
            checkbox.setAttribute("id","autosave");
            checkbox.setAttribute("value","");
            checkbox.setAttribute("onclick","if (this.checked==false){autosaveOff();} else {autosaveOn();}");
            checkbox.setAttribute("style","vertical-align:middle;");
            span.appendChild(checkbox);
            span.appendChild(document.createTextNode(" "));
            p.appendChild(span);

            // "Saved." text will appear and fade out whenever a draft is saved
            var span2 = document.createElement("span");
            span2.setAttribute("id","autosaveState");
            span2.setAttribute("style","opacity:0;");
            span2.appendChild(document.createTextNode("Saved."));
            p.appendChild(span2);

            boxes[x].parentNode.insertBefore(p, boxes[x]);

            // Load draft if it exists, but only if workspace is clear
            if (document.getElementById("storyTitle").value == "" && boxes[x].value == "")
            {
                if(localStorage.getItem("soydraft"))
                {
                    document.getElementById("storyTitle").value = decodeURI(JSON.parse(localStorage.getItem("soydraft"))[0]);
                    for (var y=0; y<document.getElementsByClassName("fullbox").length; y++)
                    {
                        if (document.getElementsByClassName("fullbox")[y].name == "dept")
                        {
                            document.getElementsByClassName("fullbox")[y].value = decodeURI(JSON.parse(localStorage.getItem("soydraft"))[1]);
                            break;
                        }
                    }
                    document.getElementById("primaryskid").value = JSON.parse(localStorage.getItem("soydraft"))[2];
                    document.getElementById("tid").value = JSON.parse(localStorage.getItem("soydraft"))[3];
                    boxes[x].value = decodeURI(JSON.parse(localStorage.getItem("soydraft"))[4]);
                }
            }
        }
    }
}

var boxes = document.getElementsByTagName("textarea");
for (var x=0; x<boxes.length; x++)
{
    if (boxes[x].name == "introtext" || boxes[x].name == "bodytext" || boxes[x].name == "story")
    {
        var temp = boxes[x].value; // Retrieve textarea contents
        temp = temp.replace(/<\/p><p>/g,"<\/p>\n\n<p>"); // Add newlines between paragraphs
        temp = temp.replace(/<br>\s?<br>/g,"<\/p>\n\n<p>"); // Convert double break tags to paragraph tags
        temp = temp.replace(/<\/blockquote><p>/g,"<\/blockquote>\n\n<p>"); // Add newlines after blockquotes
        temp = temp.replace(/<\/p><blockquote>/g,"<\/p>\n\n<blockquote>"); // Add newlines before blockquotes
        temp = temp.replace(/<blockquote><div><p>/g,"<blockquote><div>\n\n<p>"); // Add newlines within start of blockquotes
        temp = temp.replace(/<\/p><\/div><\/blockquote>/g,"<\/p>\n\n<\/div><\/blockquote>"); // Add newlines within end of blockquotes
        temp = temp.replace(/<\/blockquote><blockquote>/g,"<\/blockquote>\n\n<blockquote>"); // Add newlines between two blockquotes
        temp = temp.replace(/<p class="byline">\s/i,"<p class=\"byline\">"); // Remove extra space from byline
        temp = temp.replace(/<p>\s/g,"<p>"); // Remove extra space from start of paragraph
        temp = temp.replace(/\s<\/p>/g,"<\/p>"); // Remove extra space from end of paragraph
        temp = temp.replace(/<\/li><li>/g,"<\/li>\n<li>"); // Add newlines between list items
        temp = temp.replace(/(<\/li>)(<\/[u|o]l>)/g,'$1\n$2'); // Add newline after last list item
        temp = temp.replace(/(<\/p>)(<[u|o]l>)/g,'$1\n$2'); // Add newlines before lists
        temp = temp.replace(/<p>\[...\]/g,"<p>[...] "); // Add space within beginning of foreshortened paragraph
        while (temp.indexOf("  ")!=-1)
        {
            temp = temp.replace(/  /g," "); // Replace double spaces with single spaces
        }
        if (simplifyChars)
        {
            temp = temp.replace(/\u2018/g,"'"); // 'LEFT SINGLE QUOTATION MARK' (U+2018) to (U+0027)
            temp = temp.replace(/\u2019/g,"'"); // 'RIGHT SINGLE QUOTATION MARK' (U+2019) to (U+0027)
            temp = temp.replace(/\u201C/g,"\""); // 'LEFT DOUBLE QUOTATION MARK' (U+201C) to (U+0022)
            temp = temp.replace(/\u201D/g,"\""); // 'RIGHT DOUBLE QUOTATION MARK' (U+201D) to (U+0022)
            temp = temp.replace(/\u2026/g,"..."); // 'HORIZONTAL ELLIPSIS' (U+2026) to (U+002E) x3
        }
        boxes[x].value = temp;
        boxes[x].rows = 32; // Expand textarea height to 32 rows
    }
    var toolbar = document.createElement("div");

    // Blockquote button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","Blockquote");
    tempbutton.setAttribute("title","Wrap \u003Cblockquote\u003E tags around the selected text.");
    tempbutton.setAttribute("onclick","addBlockquote(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    // Paragraph and Line break buttons
    var tempspan = document.createElement("span");
    tempspan.setAttribute("id","htmlFormatButtons");
    if (document.getElementById("posttype") && document.getElementById("posttype").selectedIndex == 0)
    {
        tempspan.setAttribute("style","display:none;"); // Hide if initial post type option is "Plain Old Text"
    }
    if (document.getElementById("posttype"))
    {
        document.getElementById("posttype").addEventListener("change", function() {if (document.getElementById('posttype').selectedIndex == 0) {document.getElementById('htmlFormatButtons').style.display = 'none'} else {document.getElementById('htmlFormatButtons').style.display = 'inline'}}); // Change visibility of these buttons based on value of post type
    }
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","P");
    tempbutton.setAttribute("title","Wrap \u003Cp\u003E tags around the selected text.");
    tempbutton.setAttribute("onclick","addPara(document.getElementsByTagName('textarea')["+x+"]);");
    tempspan.appendChild(tempbutton);
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","BR");
    tempbutton.setAttribute("title","Insert a line break.");
    tempbutton.setAttribute("onclick","addBreak(document.getElementsByTagName('textarea')["+x+"]);");
    tempspan.appendChild(tempbutton);
    toolbar.appendChild(tempspan);

    // HR button, if editing a story
    if (boxes[x].name == "introtext" || boxes[x].name == "bodytext" || boxes[x].name == "story")
    {
        var tempbutton = document.createElement("input");
        tempbutton.setAttribute("type","button");
        tempbutton.setAttribute("value","HR");
        tempbutton.setAttribute("title","Insert a horizontal rule.");
        tempbutton.setAttribute("style","text-decoration:underline overline;");
        tempbutton.setAttribute("onclick","addHRule(document.getElementsByTagName('textarea')["+x+"]);");
        tempspan.appendChild(tempbutton);
        toolbar.appendChild(tempspan);
    }

    // URL button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","URL");
    tempbutton.setAttribute("title","Create a hyperlink around the selected text.");
    tempbutton.setAttribute("style","text-decoration:underline;");
    tempbutton.setAttribute("onclick","addHyperlink(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);
    toolbar.appendChild(document.createTextNode(" "));

    // Bold button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","B");
    tempbutton.setAttribute("title","Bold");
    tempbutton.setAttribute("style","font-weight:bold;");
    tempbutton.setAttribute("onclick","addBold(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    // Italic button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","I");
    tempbutton.setAttribute("title","Italic");
    tempbutton.setAttribute("style","font-style:italic;");
    tempbutton.setAttribute("onclick","addItalic(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    // Strike button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","S");
    tempbutton.setAttribute("title","Strikethrough");
    tempbutton.setAttribute("style","text-decoration:line-through;");
    tempbutton.setAttribute("onclick","addStrike(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    toolbar.appendChild(document.createTextNode(" ")); // Divider

    // Code button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","Code");
    tempbutton.setAttribute("title","Wrap \u003Cecode\u003E tags around the selected text.");
    tempbutton.setAttribute("style","font-family:monospace;");
    tempbutton.setAttribute("onclick","addEcode(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    // Teletype button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","TT");
    tempbutton.setAttribute("title","Wrap \u003Ctt\u003E (teletype, i.e. monospace) tags around the selected text.");
    tempbutton.setAttribute("style","font-family:monospace;");
    tempbutton.setAttribute("onclick","addTT(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    // Spoiler button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","\u25A0\u25A0\u25A0");
    tempbutton.setAttribute("title","Wrap \u003Cspoiler\u003E tags around the selected text.");
    //tempbutton.setAttribute("style","font-family:monospace;");
    tempbutton.setAttribute("onclick","addSpoiler(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    // Small button, if editing a story
    if (boxes[x].name == "introtext" || boxes[x].name == "bodytext" || boxes[x].name == "story")
    {
        var tempbutton = document.createElement("input");
        tempbutton.setAttribute("type","button");
        tempbutton.setAttribute("value","\u0073\u1D0D\u1D00\u029F\u029F");
        tempbutton.setAttribute("title","Wrap \u003Csmall\u003E tags around the selected text.");
        // tempbutton.setAttribute("style","font-size:75%;");
        tempbutton.setAttribute("onclick","addSmall(document.getElementsByTagName('textarea')["+x+"]);");
        toolbar.appendChild(tempbutton);
    }

    toolbar.appendChild(document.createTextNode(" ")); // Divider

    // Superscript button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","x\u00B2");
    tempbutton.setAttribute("title","Superscript");
    tempbutton.setAttribute("style","font-family:monospace;");
    tempbutton.setAttribute("onclick","addSuper(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    // Subscript button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","x\u2082");
    tempbutton.setAttribute("title","Subscript");
    tempbutton.setAttribute("style","font-family:monospace;");
    tempbutton.setAttribute("onclick","addSubsc(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    toolbar.appendChild(document.createTextNode(" ")); // Divider

    // Ordered list button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","1. List");
    tempbutton.setAttribute("title","Insert an ordered list or convert newline-separated text into an ordered list.");
    tempbutton.setAttribute("onclick","addOrdlist(document.getElementsByTagName('textarea')["+x+"],'1');");
    toolbar.appendChild(tempbutton);

    // Ordered list button - Alpha
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","A. List");
    tempbutton.setAttribute("title","Insert an ordered list or convert newline-separated text into an ordered list.");
    tempbutton.setAttribute("onclick","addOrdlist(document.getElementsByTagName('textarea')["+x+"],'A');");
    toolbar.appendChild(tempbutton);

    // Ordered list button - Roman
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","I. List");
    tempbutton.setAttribute("title","Insert an ordered list or convert newline-separated text into an ordered list.");
    tempbutton.setAttribute("onclick","addOrdlist(document.getElementsByTagName('textarea')["+x+"],'I');");
    toolbar.appendChild(tempbutton);

    // Unordered list button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","\u2022 List");
    tempbutton.setAttribute("title","Insert an unordered list or convert newline-separated text into an unordered list.");
    tempbutton.setAttribute("onclick","addUnordlist(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    toolbar.appendChild(document.createElement("br")); // Divider
    toolbar.appendChild(document.createElement("br")); // Divider

    // Create 7 macro buttons
    for (var i=1; i<=7; i++)
    {
        // Create macros if they don't exist
        if(!localStorage.getItem("soymacro"+i))
        {
            localStorage.setItem("soymacro"+i,JSON.stringify(["M"+i,"string","Sample Text"]));
            //localStorage.setItem("soymacro"+i,JSON.stringify(["M"+i,"regexp","/a/gi","b"]));
        }
        var tempbutton = document.createElement("input");
        tempbutton.setAttribute("type","button");
        tempbutton.setAttribute("id","soymacros"+x+"button"+i);
        tempbutton.setAttribute("value",JSON.parse(localStorage.getItem("soymacro"+i))[0]);
        if (JSON.parse(localStorage.getItem("soymacro"+i))[1]=="string")
        {
            if (JSON.parse(localStorage.getItem("soymacro"+i))[2].length < 40)
            {
                tempbutton.setAttribute("title","Insert or replace selected text with: " + JSON.parse(localStorage.getItem("soymacro"+i))[2]);
            }
            else
            {
                tempbutton.setAttribute("title","Insert or replace selected text with: " + JSON.parse(localStorage.getItem("soymacro"+i))[2].substring(0,40)+"...");
            }
            tempbutton.setAttribute("onclick","macroChoose(document.getElementsByTagName('textarea')["+x+"],"+i+");");
        }
        else
        {
            tempbutton.setAttribute("title","Replace text matched by the regular expression: " + JSON.parse(localStorage.getItem("soymacro"+i))[2] + " with: " + JSON.parse(localStorage.getItem("soymacro"+i))[3]);
            tempbutton.setAttribute("onclick","macroChoose(document.getElementsByTagName('textarea')["+x+"],"+i+");");
        }
        toolbar.appendChild(tempbutton);
    }
    // Create macros edit button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","Edit");
    tempbutton.setAttribute("title","Configure user macros or discard changes.");
    tempbutton.setAttribute("onclick","if (document.getElementById('macrobar"+x+"').style.display == 'none') {document.getElementById('macrobar"+x+"').style.display = 'block'; macrobarInit("+x+");} else {document.getElementById('macrobar"+x+"').style.display = 'none'; if (p = document.getElementById('postercomment')) { var x = p.offsetTop; while (p = p.offsetParent) {x += p.offsetLeft;} window.scrollTo(0,x-75);}}");
    toolbar.appendChild(tempbutton);

    toolbar.appendChild(document.createElement("br")); // Divider

    // Despace button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value","Despace");
    tempbutton.setAttribute("title","Delete newlines within the selection.");
    tempbutton.setAttribute("onclick","despace(document.getElementsByTagName('textarea')["+x+"]);");
    toolbar.appendChild(tempbutton);

    // Symbol button
    var tempbutton = document.createElement("input");
    tempbutton.setAttribute("type","button");
    tempbutton.setAttribute("value",":-)");
    tempbutton.setAttribute("title","Insert a symbol.");
    tempbutton.setAttribute("onclick","if (document.getElementById('smilebar"+x+"').style.display == 'none') {document.getElementById('smilebar"+x+"').style.display = 'block'} else {document.getElementById('smilebar"+x+"').style.display = 'none'; if (p = document.getElementById('postercomment')) { var x = p.offsetTop; while (p = p.offsetParent) {x += p.offsetLeft;} window.scrollTo(0,x-75); } }");
    toolbar.appendChild(tempbutton);
    boxes[x].parentNode.insertBefore(toolbar, boxes[x].nextSibling);

    // Symbol list
    var smilebar = document.createElement("div");
    smilebar.setAttribute("style","-moz-user-select:none; -webkit-user-select:none; display:none; font-size:16pt; max-height:240px; overflow:auto; padding:0.5em;");
    smilebar.setAttribute("id","smilebar"+x);
    var smiles = ["\u0026amp;","\u0026lt;","\u0026gt;","\u0026nbsp;"];

    var codes = [[161,169],[171,172],[174],[176,177],[180,183],[187,191],[215],[224,255],[402],[629],[632],[916],[920],[931],[934],[937],[945,946],[956],[960],[963],[8211,8213],[8216,8221],[8226],[8230],[8251],[8315],[8331],[8364],[8478],[8482],[8528,8542],[8585],[8592,8652],[8712,8716],[8721],[8730],[8733,8734],[8736],[8743,8749],[8756,8757],[8773],[8776],[8800,8805],[8834,8837],[8984],[9095],[9760],[9762,9765],[9770],[9773,9775],[9784,9794],[9812,9831],[9833,9842],[9850],[9855,9861],[9874,9877],[9882,9885],[9888,9893],[9913],[9940],[9962],[9971],[9981],[9992,10087],[12316],[12336],[21328],[65533],[127744,127756],[127759],[127775,127776],[127797],[127801],[127804,127812],[127817],[127820,127822],[127828,127831],[127838,127839],[127843],[127849],[127855],[127860,127867],[127873,127877],[127884],[127891],[127904,127911],[127918],[127939],[127942],[127977],[128025],[128039],[128074,128078],[128123,128131],[128137,128142],[128148,128150],[128152],[128158],[128161,128165],[128168,128170],[128172],[128175,128177],[128187],[128189,128190],[128193,128194],[128197],[128200,128204],[128206],[128214],[128225,128227],[128231,128233],[128241],[128244],[128246],[128250,128252],[128259],[128266,128270],[128273,128276],[128278,128280],[128286],[128293,128299],[128302,128303],[128509,128565],[128640],[128659],[128681],[128684,128685],[128701]];

    for (var i=0; i<codes.length; i++) { if (codes[i].length > 1) { for (var j=codes[i][0]; j<=codes[i][1]; j++) { smiles[smiles.length] = String.fromCodePoint(j); } } else { smiles[smiles.length] = String.fromCodePoint(codes[i][0]); } } // Populate smiles array with code ranges converted to individual characters

    smiles = smiles.concat(["xD",":-)",":^)","(^_^;)","(\u00A0\u0361\u00B0\u00A0\u035C\u0296\u00A0\u0361\u00B0)","(\u00A0\u0361\u007E\u00A0\u035C\u0296\u00A0\u0361\u00B0)\uFEFF","\u00AF\u005C\u005F(\u30C4)\u005F\u002F\u00AF","(\u256F\u00B0\u25A1\u00B0\uFF09\u256F\uFE35\u00A0\u253B\u2501\u253B","(\u30CE\u0CA0\u76CA\u0CA0)\u30CE\u5F61\u253B\u2501\u253B","(\u0060\uFF65\u03C9\uFF65\u00B4)","\u0CA0_\u0CA0","\u0295\u2022\u1D25\u2022\u0294","(\u3065\uFFE3\u00A0\u00B3\uFFE3)\u3065","\u0669(\u204E\u275B\u1D17\u275B\u204E)\u06F6","\u30FD\u0F3C\u0E88\u0644\u035C\u0E88\u0F3D\uFF89","(\uB208\u2038\uB208)","\u006F(\u3003\uFF3E\u25BD\uFF3E\u3003)\u006F","\u0028\u0028\u30FE\u0028\u2267\u76BF\u2266\uFF1B\u0029\u30CE\uFF3F\u0029\u0029","\u30FD\u0028\u002A\u2312\u2207\u2312\u002A\u0029\uFF89","\u0028\u2267\u2207\u2266\u0029\u002F","\u0028\u0E07\u00A0\u0360\u00B0\u00A0\u035F\u0644\u035C\u00A0\u0361\u00B0\u0029\u0E07"]); // Add in arbitrary emoticons
    // Note: \u00A0 is a non-breaking space character.

    for (var i=0; i<smiles.length; i++)
    {
        var smile = document.createElement("span");
        smile.setAttribute("style","cursor:pointer; padding:2px; white-space:nowrap;");
        smile.setAttribute("onclick","addSmile(document.getElementsByTagName('textarea')["+x+"],'"+smiles[i].replace("\u005C","\u005C\u005C")+"');");
        smile.appendChild(document.createTextNode(smiles[i]));
        smilebar.appendChild(smile);
        if (i<smiles.length) // A space is added after every symbol including the final one
        {
            smilebar.appendChild(document.createTextNode(" "));
        }
    }

    var flags = [];
    flags = flags.concat([[[127462,127467],"Afghanistan"]]); // AF/Afghanistan
    flags = flags.concat([[[127462,127478],"Antarctica"]]); // AQ/Antarctica
    flags = flags.concat([[[127462,127482],"Australia"]]); // AU/Australia
    flags = flags.concat([[[127463,127465],"Bangladesh"]]); // BD/Bangladesh
    flags = flags.concat([[[127463,127479],"Brazil"]]); // BR/Brazil
    flags = flags.concat([[[127464,127462],"Canada"]]); // CA/Canada
    flags = flags.concat([[[127464,127475],"China"]]); // CN/China
    flags = flags.concat([[[127464,127476],"Colombia"]]); // CO/Colombia
    flags = flags.concat([[[127464,127482],"Cuba"]]); // CU/Cuba
    flags = flags.concat([[[127465,127466],"Germany"]]); // DE/Germany
    flags = flags.concat([[[127466,127468],"Egypt"]]); // EG/Egypt
    flags = flags.concat([[[127466,127480],"Spain"]]); // ES/Spain
    flags = flags.concat([[[127988,917605,917619,917603,917620,917631],"Catalonia"]]); // ES-CT/Catalonia
    flags = flags.concat([[[127466,127482],"European Union"]]); // EU/European Union
    flags = flags.concat([[[127467,127479],"France"]]); // FR/France
    flags = flags.concat([[[127468,127463],"United Kingdom"]]); // GB/United Kingdom
    flags = flags.concat([[[127988,917607,917602,917605,917614,917607,917631],"England"]]); // GB-ENG/England
    flags = flags.concat([[[127988,917607,917602,917619,917603,917620,917631],"Scotland"]]); // GB-SCT/Scotland
    flags = flags.concat([[[127988,917607,917602,917623,917612,917619,917631],"Wales"]]); // GB-WLS/Wales
    flags = flags.concat([[[127468,127479],"Greece"]]); // GR/Greece
    flags = flags.concat([[[127469,127472],"Hong Kong"]]); // HK/Hong Kong
    flags = flags.concat([[[127470,127465],"Indonesia"]]); // ID/Indonesia
    flags = flags.concat([[[127470,127466],"Ireland"]]); // IE/Ireland
    flags = flags.concat([[[127470,127473],"Israel"]]); // IL/Israel
    flags = flags.concat([[[127470,127475],"India"]]); // IN/India
    flags = flags.concat([[[127470,127478],"Iraq"]]); // IQ/Iraq
    flags = flags.concat([[[127470,127479],"Iran"]]); // IR/Iran
    flags = flags.concat([[[127470,127481],"Italy"]]); // IT/Italy
    flags = flags.concat([[[127471,127474],"Jamaica"]]); // JM/Jamaica
    flags = flags.concat([[[127471,127477],"Japan"]]); // JP/Japan
    flags = flags.concat([[[127472,127466],"Kenya"]]); // KE/Kenya
    flags = flags.concat([[[127472,127477],"North Korea"]]); // KP/North Korea
    flags = flags.concat([[[127472,127479],"South Korea"]]); // KR/South Korea
    flags = flags.concat([[[127473,127463],"Lebanon"]]); // LB/Lebanon
    flags = flags.concat([[[127473,127486],"Libya"]]); // LY/Libya
    flags = flags.concat([[[127474,127475],"Mongolia"]]); // MN/Mongolia
    flags = flags.concat([[[127474,127485],"Mexico"]]); // MX/Mexico
    flags = flags.concat([[[127475,127468],"Nigeria"]]); // NG/Nigeria
    flags = flags.concat([[[127477,127466],"Peru"]]); // PE/Peru
    flags = flags.concat([[[127477,127472],"Pakistan"]]); // PK/Pakistan
    flags = flags.concat([[[127477,127479],"Puerto Rico"]]); // PR/Puerto Rico
    flags = flags.concat([[[127477,127480],"Palestinian Territory"]]); // PS/Palestinian Territory
    flags = flags.concat([[[127479,127482],"Russia"]]); // RU/Russia
    flags = flags.concat([[[127480,127462],"Saudi Arabia"]]); // SA/Saudi Arabia
    flags = flags.concat([[[127480,127465],"Sudan"]]); // SD/Sudan
    flags = flags.concat([[[127480,127466],"Sweden"]]); // SE/Sweden
    flags = flags.concat([[[127480,127468],"Singapore"]]); // SG/Singapore
    flags = flags.concat([[[127480,127476],"Somalia"]]); // SO/Somalia
    flags = flags.concat([[[127481,127469],"Thailand"]]); // TH/Thailand
    flags = flags.concat([[[127481,127479],"Turkey"]]); // TR/Turkey
    flags = flags.concat([[[127481,127484],"Taiwan"]]); // TW/Taiwan
    flags = flags.concat([[[127482,127468],"Uganda"]]); // UG/Uganda
    flags = flags.concat([[[127482,127480],"United States"]]); // US/United States
    flags = flags.concat([[[127483,127462],"Vatican City"]]); // VA/Vatican City
    flags = flags.concat([[[127483,127466],"Venezuela"]]); // VE/Venezuela
    flags = flags.concat([[[127487,127462],"South Africa"]]); // ZA/South Africa
    flags = flags.concat([[[127487,127484],"Zimbabwe"]]); // ZW/Zimbabwe
    flags = flags.concat([[[127987],"White Flag"]]); // Waving White Flag
    flags = flags.concat([[[127988],"Black Flag"]]); // Waving Black Flag
    flags = flags.concat([[[127987,65039,8205,127752],"Rainbow Flag"]]); // Waving White Flag + Rainbow
    flags = flags.concat([[[127988,8205,9760,65039],"Pirate Flag"]]); // Waving Black Flag + Skull and Crossbones
    //flags = flags.concat([[[000000,000000],"STRING"]]); // STRING

    for (var i=0; i<flags.length; i++)
    {
        var flag = document.createElement("span");
        flag.setAttribute("style","cursor:pointer; padding:2px; white-space:nowrap;");
        var s1 = "", s2 = "";
        for (var j=0; j<flags[i][0].length; j++)
        {
            s1 += String.fromCodePoint(flags[i][0][j]);
            s2 += "&#"+flags[i][0][j]+";";
        }
        flag.setAttribute("onclick","addSmile(document.getElementsByTagName('textarea')["+x+"],'"+s2+"');");
        flag.setAttribute("title",flags[i][1]);
        flag.appendChild(document.createTextNode(s1));
        smilebar.appendChild(flag);
        if (i+1<flags.length)
        {
            smilebar.appendChild(document.createTextNode(" "));
        }
    }

    toolbar.parentNode.insertBefore(smilebar, toolbar.nextSibling);

    // Create macro configuration interface
    var macrobar = document.createElement("div");
    macrobar.setAttribute("style","display:none; padding:0.5em;");
    macrobar.setAttribute("id","macrobar"+x);
    var table = document.createElement("table");
    var tr = document.createElement("tr");
    var th = document.createElement("th");
    th.appendChild(document.createTextNode("Name"));
    tr.appendChild(th);
    var th = document.createElement("th");
    th.appendChild(document.createTextNode("Type"));
    tr.appendChild(th);
    var th = document.createElement("th");
    th.appendChild(document.createTextNode("String | Expression"));
    tr.appendChild(th);
    var th = document.createElement("th");
    th.setAttribute("title","Only used with expressions. Parenthesized substring matches (e.g. '$1') can be used.");
    th.setAttribute("style","cursor:help;");
    th.appendChild(document.createTextNode("Expression Replace"));
    tr.appendChild(th);
    table.appendChild(tr);
    for (var i=1; i<=7; i++)
    {
        var tr = document.createElement("tr");

        // Macro name
        var td = document.createElement("td");
        var name = document.createElement("input");
        name.setAttribute("type","text");
        name.setAttribute("id","soymacros"+x+"name"+i);
        td.appendChild(name);
        tr.appendChild(td);

        // Macro type
        var td = document.createElement("td");
        var rad = document.createElement("input");
        rad.setAttribute("type","radio");
        rad.setAttribute("name","soymacros"+x+"type"+i);
        rad.setAttribute("id","soymacros"+x+"type"+i+"S");
        td.appendChild(rad);
        td.appendChild(document.createTextNode(" String "));
        var rad = document.createElement("input");
        rad.setAttribute("type","radio");
        rad.setAttribute("name","soymacros"+x+"type"+i);
        rad.setAttribute("id","soymacros"+x+"type"+i+"E");
        td.appendChild(rad);
        td.appendChild(document.createTextNode(" Expression "));
        tr.appendChild(td);

        // Field A
        var td = document.createElement("td");
        var f1 = document.createElement("input");
        f1.setAttribute("type","text");
        f1.setAttribute("id","soymacros"+x+"fieldA"+i);
        td.appendChild(f1);
        tr.appendChild(td);

        // Field B
        var td = document.createElement("td");
        var f1 = document.createElement("input");
        f1.setAttribute("type","text");
        f1.setAttribute("id","soymacros"+x+"fieldB"+i);
        td.appendChild(f1);
        tr.appendChild(td);

        table.appendChild(tr);
    }
    macrobar.appendChild(table);

    var p = document.createElement("p");
    var save = document.createElement("input");
    save.setAttribute("type","button");
    save.setAttribute("value","Save");
    save.setAttribute("title","Save any edits to the macro configuration.");
    save.setAttribute("onclick","macrobarSave("+x+");");
    p.appendChild(save);
    p.appendChild(document.createTextNode(" "));
    var guide = document.createElement("a");
    guide.setAttribute("href","https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions");
    guide.setAttribute("target","_blank");
    guide.appendChild(document.createTextNode("Regexp Guide"));
    p.appendChild(guide);
    macrobar.appendChild(p);

    toolbar.parentNode.insertBefore(macrobar, toolbar.nextSibling);
}

// Change Stories link to regular admin.pl on breakingnews, meta, politics, and communityreviews nexii
if (window.location.href.search(/https?\:\/\/.*soylentnews\.org.*?\/(breakingnews|meta|politics|communityreviews)\//)!=-1)
{
    if (document.getElementById("adminmenu"))
    {
        var t = document.getElementById("adminmenu").getElementsByTagName("a");
        for (var i=0; i<t.length; i++)
        {
            if (t[i].innerText == "Stories")
            {
                t[i].setAttribute("href","//soylentnews.org/admin.pl");
            }
        }
    }
}

// Easily cycle through *New* comments
if (!disableCycler && (document.querySelector(".newBadge") || (document.querySelector(".dimmed") && document.querySelector(".comment > div.commentDiv:not(.dimmed)"))))
{
    var temp = document.getElementById("links");
    var temp2 = document.createElement("div");
    temp2.setAttribute("style","position:fixed; bottom:15px; z-index:-100;");
    var temp3 = document.createElement("input");
    temp3.setAttribute("type","button");
    temp3.setAttribute("value","New Comment \u00BB");
    temp3.setAttribute("onclick","cycleNew();");
    temp2.appendChild(temp3);
    temp.appendChild(temp2);
}

var temp = document.createElement("script");

// Add selection handling function
temp.appendChild(document.createTextNode("function getSelection(textarea) { if ('selectionStart' in textarea) { if (textarea.selectionStart != textarea.selectionEnd) { return [textarea.selectionStart,textarea.selectionEnd]; } } } "));

// Add comment formatting buttons
temp.appendChild(document.createTextNode("function addBlockquote(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<blockquote>'+area.value.substring(sel[0],sel[1])+'<\/blockquote>' + area.value.substring(sel[1]); } } function addPara(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<p>'+area.value.substring(sel[0],sel[1])+'<\/p>' + area.value.substring(sel[1]); } } function addBreak(area) { if ('selectionStart' in area) { var pos = area.selectionStart; area.value = area.value.substring(0,area.selectionStart) + '<br>' + area.value.substring(pos); area.focus(); area.setSelectionRange(pos+4,pos+4) } } function addHRule(area) { if ('selectionStart' in area) { var pos = area.selectionStart; area.value = area.value.substring(0,area.selectionStart) + '<hr>' + area.value.substring(pos); area.focus(); area.setSelectionRange(pos+4,pos+4) } } function addHyperlink(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { url = prompt('URL:', 'https://'); if (url==null) {return false;} area.value = area.value.substring(0,sel[0]) + '<a href=\"'+url+'\">'+area.value.substring(sel[0],sel[1])+'<\/a>' + area.value.substring(sel[1]); } } function addBold(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<b>'+area.value.substring(sel[0],sel[1])+'<\/b>' + area.value.substring(sel[1]); } } function addItalic(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<em>'+area.value.substring(sel[0],sel[1])+'<\/em>' + area.value.substring(sel[1]); } } function addStrike(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<del>'+area.value.substring(sel[0],sel[1])+'<\/del>' + area.value.substring(sel[1]); } } function addEcode(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<ecode>'+area.value.substring(sel[0],sel[1])+'<\/ecode>' + area.value.substring(sel[1]); } } function addTT(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<tt>'+area.value.substring(sel[0],sel[1])+'<\/tt>' + area.value.substring(sel[1]); } } function addSpoiler(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<spoiler>'+area.value.substring(sel[0],sel[1])+'<\/spoiler>' + area.value.substring(sel[1]); } } function addSmall(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<small>'+area.value.substring(sel[0],sel[1])+'<\/small>' + area.value.substring(sel[1]); } } function addSuper(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<sup>'+area.value.substring(sel[0],sel[1])+'<\/sup>' + area.value.substring(sel[1]); } } function addSubsc(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + '<sub>'+area.value.substring(sel[0],sel[1])+'<\/sub>' + area.value.substring(sel[1]); } } "));

// Add list creation functions
temp.appendChild(document.createTextNode("function addOrdlist(area,type) { if ('selectionStart' in area) { if (area.selectionStart != area.selectionEnd) { area.value = area.value.substring(0,area.selectionStart) + '<ol type=\\\"' + type + '\\\"><li>' + area.value.substring(area.selectionStart,area.selectionEnd).replace(/\\n/g,'<\/li>\\n<li>').replace(/\\n<li><\\/li>/g,'') + '<\/li><\/ol>' + area.value.substring(area.selectionEnd); } else { temp = '<ol type=\\\"' + type + '\\\">'; while(listitem = prompt('Enter a list item. Leave the box empty or press Cancel to complete the list:', '')) { temp += '<li>' + listitem + '<\/li>\\n'; } if (temp=='<ol type=\\\"' + type + '\\\">') {return;} area.value = area.value.substring(0,area.selectionStart) + temp.substring(0,temp.length-1) + '<\/ol>' + area.value.substring(area.selectionStart); } } } function addUnordlist(area) { if ('selectionStart' in area) { if (area.selectionStart != area.selectionEnd) { area.value = area.value.substring(0,area.selectionStart) + '<ul><li>' + area.value.substring(area.selectionStart,area.selectionEnd).replace(/\\n/g,'<\/li>\\n<li>').replace(/\\n<li><\\/li>/g,'') + '<\/li><\/ul>' + area.value.substring(area.selectionEnd); } else { temp = '<ul>'; while(listitem = prompt('Enter a list item. Leave the box empty or press Cancel to complete the list:', '')) { temp += '<li>' + listitem + '<\/li>\\n'; } if (temp=='<ul>') {return;} area.value = area.value.substring(0,area.selectionStart) + temp.substring(0,temp.length-1) + '<\/ul>' + area.value.substring(area.selectionStart); } } }"));

// Add macro functions
temp.appendChild(document.createTextNode("function macroChoose(area,x) { if (JSON.parse(localStorage.getItem('soymacro'+x))[1]=='string') { macroString(area,x); } else { macroRegexp(area,x); } }"));
temp.appendChild(document.createTextNode("function macroString(area,x) { var sel = getSelection(area); if (sel && sel[0] != sel[1]) { area.value = area.value.substring(0,sel[0]) + JSON.parse(localStorage.getItem('soymacro'+x))[2] + area.value.substring(sel[1]); } else if ('selectionStart' in area) { var pos = area.selectionStart; area.value = area.value.substring(0,area.selectionStart) + JSON.parse(localStorage.getItem('soymacro'+x))[2] + area.value.substring(pos); area.focus(); area.setSelectionRange(pos+JSON.parse(localStorage.getItem('soymacro'+x))[2].length,pos+JSON.parse(localStorage.getItem('soymacro'+x))[2].length); } }"));
temp.appendChild(document.createTextNode("function macroRegexp(area,x) { var sel = getSelection(area); if (sel && sel[0] != sel[1]) { var reg = JSON.parse(localStorage.getItem('soymacro'+x))[2]; area.value = area.value.substring(0,sel[0]) + area.value.substring(sel[0],sel[1]).replace(new RegExp(reg.substring(reg.indexOf('/')+1,reg.lastIndexOf('/')), reg.substring(reg.lastIndexOf('/')+1)),JSON.parse(localStorage.getItem('soymacro'+x))[3]) + area.value.substring(sel[1]); } }"));
temp.appendChild(document.createTextNode("function macrobarInit(x) { for (var y=1; y<=7; y++) { document.getElementById('soymacros'+x+'name'+y).value = JSON.parse(localStorage.getItem('soymacro'+y))[0]; if (JSON.parse(localStorage.getItem('soymacro'+y))[1]=='string') { document.getElementById('soymacros'+x+'type'+y+'S').checked = true; } else { document.getElementById('soymacros'+x+'type'+y+'E').checked = true; } document.getElementById('soymacros'+x+'fieldA'+y).value = JSON.parse(localStorage.getItem('soymacro'+y))[2]; if (JSON.parse(localStorage.getItem('soymacro'+y))[1]!='string') { document.getElementById('soymacros'+x+'fieldB'+y).value = JSON.parse(localStorage.getItem('soymacro'+y))[3]; } else { document.getElementById('soymacros'+x+'fieldB'+y).value = ''; } } }"));
temp.appendChild(document.createTextNode("function macrobarSave(x) { for (var y=1; y<=7; y++) { if (document.getElementById('soymacros'+x+'type'+y+'S').checked == true) { localStorage.setItem('soymacro'+y,JSON.stringify([document.getElementById('soymacros'+x+'name'+y).value,'string',document.getElementById('soymacros'+x+'fieldA'+y).value])); } else { localStorage.setItem('soymacro'+y,JSON.stringify([document.getElementById('soymacros'+x+'name'+y).value,'regexp',document.getElementById('soymacros'+x+'fieldA'+y).value,document.getElementById('soymacros'+x+'fieldB'+y).value])); } } document.getElementById('macrobar'+x).style.display = 'none'; var boxes = document.getElementsByTagName('textarea'); for (var z=0; z<boxes.length; z++) { for (var y=1; y<=7; y++) { document.getElementById('soymacros'+z+'button'+y).value = JSON.parse(localStorage.getItem('soymacro'+y))[0]; if (JSON.parse(localStorage.getItem('soymacro'+y))[1]=='string') { if (JSON.parse(localStorage.getItem('soymacro'+y))[2].length < 40) { document.getElementById('soymacros'+z+'button'+y).title = 'Insert or replace selected text with: ' + JSON.parse(localStorage.getItem('soymacro'+y))[2]; } else { document.getElementById('soymacros'+z+'button'+y).title = 'Insert or replace selected text with: ' + JSON.parse(localStorage.getItem('soymacro'+y))[2].substring(0,40)+'...'; } } else { document.getElementById('soymacros'+z+'button'+y).title = 'Replace text matched by the regular expression: ' + JSON.parse(localStorage.getItem('soymacro'+y))[2] + ' with: ' + JSON.parse(localStorage.getItem('soymacro'+y))[3]; } } } }"));

// Add despace function
temp.appendChild(document.createTextNode("function despace(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { area.value = area.value.substring(0,sel[0]) + area.value.substring(sel[0],sel[1]).replace(/\\r/g,' ').replace(/\\n/g,' ').replace(/\\s\\s/g,' ').replace(/\\s\\s/g,' ').replace(/\\s\\s/g,' ').replace(/\\s\\s/g,' ').replace(/\\s\\s/g,' ') + area.value.substring(sel[1]); } }"));

// Add unicode insertion function
temp.appendChild(document.createTextNode("function addSmile(area, smile) { if ('selectionStart' in area) { var pos = area.selectionStart; area.value = area.value.substring(0,pos) + smile + area.value.substring(pos); area.focus(); area.setSelectionRange(pos+smile.length,pos+smile.length) } }"));

// Add save submission function
temp.appendChild(document.createTextNode("function saveSoydraft() { try {window.clearTimeout(timer);} catch(e){} var boxes = document.getElementsByTagName('textarea'); for (var x=0; x<boxes.length; x++) { if (boxes[x].name == 'story') { if (document.getElementById('storyTitle').value!=''||boxes[x].value!='') { document.getElementById('autosaveBar').style.visibility='visible'; document.getElementById('autosaveState').style.transition='opacity 0s'; document.getElementById('autosaveState').style.opacity='1'; document.getElementById('autosaveState').offsetWidth = document.getElementById('autosaveState').offsetWidth; document.getElementById('autosaveState').style.transition='opacity 1s'; document.getElementById('autosaveState').style.opacity='0'; var y=0; for (y=0; y<document.getElementsByClassName('fullbox').length; y++) { if (document.getElementsByClassName('fullbox')[y].name == 'dept') { break; } } localStorage.setItem('soydraft',JSON.stringify([encodeURI(document.getElementById('storyTitle').value),encodeURI(document.getElementsByClassName('fullbox')[y].value),document.getElementById('primaryskid').value,document.getElementById('tid').value,encodeURI(boxes[x].value)])); document.getElementById('discardDraft').removeAttribute('disabled'); document.getElementById('discardDraft').setAttribute('onclick','discardSoydraft();'); } else { alert('There is no title or story to save.'); } break; } } }"));

// Add discard submission function
temp.appendChild(document.createTextNode("function discardSoydraft() { autosaveOff(); document.getElementById('autosave').checked=false; document.getElementById('autosaveBar').style.visibility='hidden'; localStorage.removeItem('soydraft'); document.getElementById('discardDraft').setAttribute('disabled','disabled'); document.getElementById('discardDraft').removeAttribute('onclick'); }"));

// Add autosave functions
temp.appendChild(document.createTextNode("function autosaveOn() { var boxes = document.getElementsByTagName('textarea'); for (var x=0; x<boxes.length; x++) { if (boxes[x].name == 'story') { boxes[x].onkeydown = function() {try {window.clearTimeout(timer);} catch(e){} timer = window.setTimeout(function() { if(document.getElementById(\"autosaveBar\").style.visibility==\"visible\") {saveSoydraft();} }, 3000);}; } } document.getElementById('storyTitle').onkeydown = function() {try {window.clearTimeout(timer);} catch(e){} timer = window.setTimeout(function() { if(document.getElementById(\"autosaveBar\").style.visibility==\"visible\") {saveSoydraft();} }, 3000);}; }"));
temp.appendChild(document.createTextNode("function autosaveOff() { var boxes = document.getElementsByTagName('textarea'); for (var x=0; x<boxes.length; x++) { if (boxes[x].name == 'story') { try {window.clearTimeout(timer);} catch(e){} boxes[x].onkeydown = null; } } document.getElementById('storyTitle').onkeydown = null; }"));

// Add new comment cycling function
// Credit: charon
temp.appendChild(document.createTextNode("var newComN = 0; var newComments = document.querySelector('.newBadge') ? document.querySelectorAll('.newBadge') : document.querySelectorAll('.comment > div:not(.dimmed)'); function cycleNew() {if (!newComments[newComN]) {return;} if (newComN != 0 && window.pageYOffset > newComments[newComN].offsetTop + 100) {while (newComments[newComN].offsetTop <= window.pageYOffset){newComN++;}} var p = newComments[newComN++]; var y = p.offsetTop; while (p = p.offsetParent) {y += p.offsetLeft;} window.scrollTo(0,y); if(newComN>=newComments.length-1){newComN=0;}}"));

document.getElementsByTagName('head')[0].appendChild(temp); // Add script to page

74-Year-Old "Ninja" Cat Burglar Caught

Posted by takyon on Wednesday October 25 2017, @01:35PM (#2708)
4 Comments
/dev/random

To catch a ‘ninja’ thief: Osaka police unmask 74-year-old cat burglar

Police in Osaka have finally nabbed a nimble “ninja” thief who dressed in black and scrambled over walls to commit scores of break-ins over an eight-year career — and were astonished to find he was 74.

Police had been stumped by a string of burglaries, their only lead being security camera footage showing an agile thief with a black neck-warmer pulled up to the nose and a parker hood down to the eyebrows.

“He was dressed all in black just like a ninja,” a senior official at the Kawachi Police Station said.

But the master thief made a mistake in May — his neck-warmer slipped and his identity was revealed on camera.

Police recognized their man as Mitsuaki Tanigawa, 74, who had a previous record of thefts.

Pimax 8K VR Headset and Threadripper 1900X

Posted by takyon on Wednesday October 25 2017, @01:32AM (#2705)
0 Comments
Hardware

Watch someone else play with a high end VR headset:

Getting Fully Immersed With Pimax's 8K VR Headset (Hands On)

The lowest core count Threadripper reviewed:

AMD Ryzen Threadripper 1900X CPU Review

JFK Documents on (or by) October 26?

Posted by takyon on Thursday October 19 2017, @02:49PM (#2695)
9 Comments
News

This is a reminder for me (or you) to check back in a week, assuming it is overshadowed by other news:

The JFK Document Dump Could Be a Fiasco

Trump, no stranger to conspiracy theories, including totally unsubstantiated theories about a link between Ted Cruz’s father and JFK’s death, has not yet revealed his plans for the documents. His friend and political adviser Roger Stone, the Republican consultant who is the author of a book claiming that President Lyndon Johnson was the mastermind of the Kennedy assassination, said last week that he has been informed authoritatively that the CIA is urging Trump to delay the release of some of the JFK documents for another 25 years. “They must reflect badly on the CIA even though virtually everyone involved is long dead,” Stone said in a statement on his website.

The CIA has not confirmed or denied reports that it has appealed to Trump to block the release of some of the files on grounds that the documents might still somehow endanger national security if made public. In a cryptic statement last week, the spy agency said only that it “continues to engage in the process to determine the appropriate next steps with respect to any previously unreleased CIA information.”

As it stands now, the document release this month will be a logistical nightmare, with the public suddenly flooded with a huge online library of documents—tens of thousands in total—that will be, at first, mostly incomprehensible even to experienced students of the assassination. The National Archives, abandoning its plans to release the documents in batches over the course of several months, said this week that it will instead release everything at once—all on the same day—sometime between now and the deadline on October 26.

I'd sub but it's pre-news again.

President Trump's Least Presidential Moment?

Posted by takyon on Thursday October 19 2017, @02:24AM (#2694)
3 Comments

Choose Your Dumb Flag Emojis + Soylent Upgrade

Posted by takyon on Tuesday October 17 2017, @11:41AM (#2690)
28 Comments
Code

Regional Indicator Symbol

I am adding some flag emoji to the Soylent Upgrade extension. It seems to work although they don't render as anything other than letters or boxes on my main system. I'm sure that 95% of them will work on my Chromebook, however.

I don't want to include every possible flag on the list (sorry Lesotho, New Caledonia, Svalbard and Jan Mayen...). I included the ten that were proposed as part of a draft standard in 2007, flags of the ten most populous countries (Bangladesh, Nigeria, and Indonesia OMG), the EU flag, Puerto Rico, and a number of other territories that are in the news often or are amusing.

Fun fact, separate emoji for England, Scotland, and Wales were added to Unicode in 2017. Good timing! I added England to my list below, but it renders very differently from the other symbols, showing up as one box instead of two boxes, "GBENG", or whatever.

There is no Nazi flag in Unicode, aristarchus, I already checked. However, it might be fun to speculate on what unreserved regional indicator (of the 26x26) could be used. NZ = New Zealand and SS = South Sudan so those are out. Actually, given that GB-ENG, GB-SCT, and GB-WLS were added, you are no longer constrained by 676 choices (is it 26^5 or 11,881,376 now?) and DE-NZI might be the best option. US-NZI? US-CSA?

Should the flag of Antarctica be orange?

Here's what I have included so far:

🇦🇫 - \uD83C\uDDE6\uD83C\uDDEB - AF / Afghanistan
🇦🇶 - \uD83C\uDDE6\uD83C\uDDF6 - AQ / Antarctica
🇦🇺 - \uD83C\uDDE6\uD83C\uDDFA - AU / Australia
🇧🇩 - \uD83C\uDDE7\uD83C\uDDE9 - BD / Bangladesh
🇧🇷 - \uD83C\uDDE7\uD83C\uDDF7 - BR / Brazil
🇨🇦 - \uD83C\uDDE8\uD83C\uDDE6 - CA / Canada
🇨🇳 - \uD83C\uDDE8\uD83C\uDDF3 - CN / China
🇨🇺 - \uD83C\uDDE8\uD83C\uDDFA - CU / Cuba
🇩🇪 - \uD83C\uDDE9\uD83C\uDDEA - DE / Germany
🇪🇬 - \uD83C\uDDEA\uD83C\uDDEC - EG / Egypt
🇪🇸 - \uD83C\uDDEA\uD83C\uDDF8 - ES / Spain
🇪🇺 - \uD83C\uDDEA\uD83C\uDDFA - EU / European Union
🇫🇷 - \uD83C\uDDEB\uD83C\uDDF7 - FR / France
🇬🇧 - \uD83C\uDDEC\uD83C\uDDE7 - GB / United Kingdom
🏴󠁧󠁢󠁥󠁮󠁧󠁿 - \uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67\uDB40\uDC7F - GB-ENG / England
🇮🇩 - \uD83C\uDDEE\uD83C\uDDE9 - ID / Indonesia
🇮🇪 - \uD83C\uDDEE\uD83C\uDDEA - IE / Ireland
🇮🇱 - \uD83C\uDDEE\uD83C\uDDF1 - IL / Israel
🇮🇳 - \uD83C\uDDEE\uD83C\uDDF3 - IN / India
🇮🇶 - \uD83C\uDDEE\uD83C\uDDF6 - IQ / Iraq
🇮🇷 - \uD83C\uDDEE\uD83C\uDDF7 - IR / Iran
🇮🇹 - \uD83C\uDDEE\uD83C\uDDF9 - IT / Italy
🇯🇵 - \uD83C\uDDEF\uD83C\uDDF5 - JP / Japan
🇰🇵 - \uD83C\uDDF0\uD83C\uDDF5 - KP / North Korea
🇰🇷 - \uD83C\uDDF0\uD83C\uDDF7 - KR / South Korea
🇲🇽 - \uD83C\uDDF2\uD83C\uDDFD - MX / Mexico
🇳🇬 - \uD83C\uDDF3\uD83C\uDDEC - NG / Nigeria
🇵🇰 - \uD83C\uDDF5\uD83C\uDDF0 - PK / Pakistan
🇵🇷 - \uD83C\uDDF5\uD83C\uDDF7 - PR / Puerto Rico
🇵🇸 - \uD83C\uDDF5\uD83C\uDDF8 - PS / Palestinian Territory
🇷🇺 - \uD83C\uDDF7\uD83C\uDDFA - RU / Russia
🇸🇦 - \uD83C\uDDF8\uD83C\uDDE6 - SA / Saudi Arabia
🇸🇪 - \uD83C\uDDF8\uD83C\uDDEA - SE / Sweden
🇹🇷 - \uD83C\uDDF9\uD83C\uDDF7 - TR / Turkey
🇺🇸 - \uD83C\uDDFA\uD83C\uDDF8 - US / United States
🇻🇦 - \uD83C\uDDFB\uD83C\uDDE6 - VA / Vatican City
🇻🇪 - \uD83C\uDDFB\uD83C\uDDEA - VE / Venezuela
🇿🇦 - \uD83C\uDDFF\uD83C\uDDE6 - ZA / South Africa

If you think a country should be included, comment and make your case.

South American representation is looking particularly bad.

Antarctica, England, and Puerto Rico and others should probably be removed if they just don't render anywhere.

One stupid thing is that there is currently no way for me to add a tooltip that identifies the flag your are hovering over. I will think about the best way to add this.

-----

New ordered list buttons will be added. Now the type attribute can be changed (discussed here). Clicking the "1. List" button will output <ol type="1">. "A. List" adds type="A", and "I. List" adds type="I" (Roman numerals). I could make two more buttons for the lowercase versions, but that seems excessive. Having the two new options should be a good enough reminder that you can change the look of your ordered list.

  1. Wow
  2. Who
  3. Even
  4. Uses
  5. Roman
  6. Numerals
  7. Anymore
  8. Latin
  9. Is
  10. A
  11. Dead
  12. Language
  13. Plus
  14. What
  15. Happened
  16. To
  17. The
  18. Zero?

  1. This
  2. Is
  3. A
  4. Test

  1. This
  2. Is
  3. Another
  4. Test

Too bad we can't access the incredible variety added by CSS3 and later's list-style-type.

Also on the agenda:

  • Title case fix(es) such as "IPhone" to "iPhone".
  • Fix so the title case button appears even after you have previewed a journal.
  • Recognize the poll results/comments page so commenting features are added. The URL in question is https://soylentnews.org/pollBooth.pl?qid=110&aid=-1 where QID is the number of the poll.
  • Take a look at *New* comment cycling. The button appears on some individual thread pages where there are no actual new comments (but there were new comments on the overall story).

These are just ideas:

Maybe a "Now" button on admin.pl?op=edit so editors can set the story release time to the current time. Not sure about this, would entertain other ideas about the release time field, such as manipulation of the time using [+60m] and [+90m] buttons (including correct handling of the date change). The only thing the extension currently does with this field is add a check to make sure whether or not you want to post a story in the past (typically because you forgot to add a day).

If I missed anything or you have any ideas, let me know.

Jango Raid: The Unofficial Music Player of SoylentNews

Posted by takyon on Sunday October 15 2017, @01:54AM (#2686)
20 Comments
/dev/random

Jango Raid.

Made by an AC. Explained here.

Jango is a free online music streaming service that allows users to create and share custom radio stations. Users choose artists to stream, and the station plays music from similar artists. Users can further refine their stations by rating songs and artists in their feed to play less or more frequently.

The Fever (Aye Aye)
Blackout City
Hot Head
Green Onions
Eh
BTTF
RR

McDonald's Rick and Morty Szechuan Sauce Stunt Backfires

Posted by takyon on Wednesday October 11 2017, @07:49PM (#2680)
7 Comments