// ==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*
// @match https://soylentnews.org/comments.pl*
// @match http://soylentnews.org/journal.pl?op=edit
// @match https://soylentnews.org/journal.pl?op=edit
// ==/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" || boxes[x].name == "story")
{
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(/<p>\[...\]/g,"<p>[...] ");
while (temp.indexOf(" ")!=-1)
{
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");
// 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").selectedIndex == 0)
{
tempspan.setAttribute("style","display:none;");
}
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'}});
var tempbutton = document.createElement("input");
tempbutton.setAttribute("type","button");
tempbutton.setAttribute("value","P");
tempbutton.setAttribute("title","Insert \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);
// URL button
var tempbutton = document.createElement("input");
tempbutton.setAttribute("type","button");
tempbutton.setAttribute("value","URL");
tempbutton.setAttribute("title","Insert 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(" "));
// 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);
toolbar.appendChild(document.createTextNode(" "));
// 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);
//Ordered list
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+"]);");
toolbar.appendChild(tempbutton);
//Unordered list
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"));
// Despace button
var tempbutton = document.createElement("input");
tempbutton.setAttribute("type","button");
tempbutton.setAttribute("value","Despace");
tempbutton.setAttribute("title","Delete line breaks 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').style.display == 'none') {document.getElementById('smilebar').style.display = 'block'} else {document.getElementById('smilebar').style.display = 'none'}");
toolbar.appendChild(tempbutton);
boxes[x].parentNode.insertBefore(toolbar, boxes[x].nextSibling);
var smilebar = document.createElement("div");
smilebar.setAttribute("style","display:none; font-size:16pt; padding:0.5em;");
smilebar.setAttribute("id","smilebar");
var smiles = ["\u00A1","\u00A2","\u00A3","\u00A5","\u00A7","\u00A9","\u00AB","\u00AE","\u00B0","\u00B1","\u00B4","\u00B5","\u00B6","\u00B7","\u00BB","\u00BC","\u00BD","\u00BE","\u00BF","\u00D7","\u00E0","\u00E1","\u00E2","\u00E6","\u00E7","\u00E8","\u00E9","\u00EA","\u00EE","\u00F1","\u00F7","\u2022","\u20AC","\u211E","\u2122","\u03A9","\u2208","\u2209","\u220B","\u220C","\u2211","\u221A","\u221D","\u221E","\u2220","\u2227","\u2228","\u2229","\u222A","\u222B","\u222C","\u222D","\u2234","\u2235","\u2245","\u2248","\u2260","\u2261","\u2262","\u2263","\u2264","\u2265","\u2282","\u2283","\u2284","\u2285","\u2318","\u2620","\u2622","\u2623","\u2624","\u2625","\u262A","\u262D","\u262E","\u262F","\u2638","\u2639","\u263A","\u263B","\u263C","\u263D","\u263E","\u263F","\u2640","\u2641","\u2642","\u2654","\u2655","\u2656","\u2657","\u2658","\u2659","\u265A","\u265B","\u265C","\u265D","\u265E","\u265F","\u2660","\u2661","\u2662","\u2663","\u2664","\u2665","\u2666","\u2667","\u2669","\u266A","\u266B","\u266C","\u266D","\u266E","\u266F","\u2670","\u2671","\u2672","\u267A","\u267F","\u2680","\u2681","\u2682","\u2683","\u2684","\u2685","\u2692","\u2693","\u2694","\u2695","\u269A","\u269B","\u269C","\u269D","\u26A0","\u26A1","\u26A2","\u26A3","\u26A4","\u26A5","\u26B9","\u26D4","\u26EA","\u26F3","\u26FD","\u2713","\uD83C\uDF35","\uD83C\uDF39","\uD83C\uDF3C","\uD83C\uDF40","\uD83C\uDF41","\uD83C\uDF4E","\uD83C\uDF54","\uD83C\uDF55","\uD83C\uDF5F","\uD83C\uDF63","\uD83C\uDF6F","\uD83C\uDF75","\uD83C\uDF76","\uD83C\uDF77","\uD83C\uDF78","\uD83C\uDF79","\uD83C\uDF7A","\uD83C\uDF7B","\uD83C\uDF93","\uD83C\uDFAE","\uD83C\uDFC3","\uD83C\uDFC6","\uD83D\uDC4A","\uD83D\uDC4C","\uD83D\uDC4D","\uD83D\uDC4E","\uD83D\uDC7D","\uD83D\uDC89","\uD83D\uDC8A","\uD83D\uDC94","\uD83D\uDC96","\uD83D\uDCA3","\uD83D\uDCA4","\uD83D\uDCA9","\uD83D\uDCAC","\uD83D\uDCB0","\uD83D\uDCBB","\uD83D\uDCBD","\uD83D\uDCBE","\uD83D\uDCC1","\uD83D\uDCC2","\uD83D\uDCC5","\uD83D\uDCCB","\uD83D\uDCCC","\uD83D\uDCCE","\uD83D\uDCD6","\uD83D\uDCE1","\uD83D\uDCE2","\uD83D\uDCE3","\uD83D\uDCE7","\uD83D\uDCE8","\uD83D\uDCE9","\uD83D\uDCF1","\uD83D\uDCF4","\uD83D\uDCF6","\uD83D\uDCFC","\uD83D\uDD03","\uD83D\uDD0A","\uD83D\uDD0B","\uD83D\uDD0C","\uD83D\uDD0D","\uD83D\uDD0E","\uD83D\uDD11","\uD83D\uDD12","\uD83D\uDD13","\uD83D\uDD14","\uD83D\uDD16","\uD83D\uDD17","\uD83D\uDD18","\uD83D\uDD1E","\uD83D\uDD25","\uD83D\uDD27","\uD83D\uDD28","\uD83D\uDD2B","\uD83D\uDE93",":-)","(^_^;)","\u0028\u00A0\u0361\u00B0\u00A0\u035C\u0296\u00A0\u0361\u00B0\u0029","\u0028\u00A0\u0361\u007E\u00A0\u035C\u0296\u00A0\u0361\u00B0\u0029\uFEFF","\u00AF\u005C\u005F\u0028\u30C4\u0029\u005F\u002F\u00AF","\u0028\u30CE\u0CA0\u76CA\u0CA0\u0029\u30CE\u5F61\u253B\u2501\u253B","\u0028\u0060\uFF65\u03C9\uFF65\u00B4\u0029","\u0CA0_\u0CA0"];
for (var i=0; i<smiles.length; i++)
{
var smile = document.createElement("span");
smile.setAttribute("style","cursor:pointer; padding:2px;");
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+1<smiles.length)
{
smilebar.appendChild(document.createTextNode(" "));
}
}
toolbar.parentNode.insertBefore(smilebar, toolbar.nextSibling);
}var temp = document.createElement("script");
temp.appendChild(document.createTextNode("function getSelection(textarea) { if ('selectionStart' in textarea) { if (textarea.selectionStart != textarea.selectionEnd) { return [textarea.selectionStart,textarea.selectionEnd]; } } } "));
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) { area.value = area.value.substring(0,area.selectionStart) + '<br>' + area.value.substring(area.selectionStart); } } function addHyperlink(area) { var sel = getSelection(area); if (!(sel[0] == 0 && sel[1] == 0)) { url = prompt('URL:', 'https://'); 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]) + '<strike>'+area.value.substring(sel[0],sel[1])+'<\/strike>' + 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 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]); } } "));
temp.appendChild(document.createTextNode("function addOrdlist(area) { if ('selectionStart' in area) { if (area.selectionStart != area.selectionEnd) { area.value = area.value.substring(0,area.selectionStart) + '<ol><li>' + area.value.substring(area.selectionStart,area.selectionEnd).replace(/\\n/g,'<\/li>\\n<li>') + '<\/li><\/ol>' + area.value.substring(area.selectionEnd); } else { temp = '<ol>'; while(listitem = prompt('Enter a list item. Leave the box empty or press Cancel to complete the list:', '')) { temp += '<li>' + listitem + '<\/li>'; } area.value = area.value.substring(0,area.selectionStart) + temp + '<\/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>') + '<\/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>'; } area.value = area.value.substring(0,area.selectionStart) + temp + '<\/ul>' + area.value.substring(area.selectionStart); } } }"));
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]); } }"));
temp.appendChild(document.createTextNode("function addSmile(area, smile) { if ('selectionStart' in area) { area.value = area.value.substring(0,area.selectionStart) + smile + area.value.substring(area.selectionStart); } }"));
document.getElementsByTagName('head')[0].appendChild(temp);
// ==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*
// @match https://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" || boxes[x].name == "story")
{
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(/<p>\[...\]/g,"<p>[...] ");
while (temp.indexOf(" ")!=-1)
{
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");
// Blockquote button
var tempbutton = document.createElement("input");
tempbutton.setAttribute("type","button");
tempbutton.setAttribute("value","Blockquote");
tempbutton.setAttribute("onmousedown","addBlockquote(document.getElementsByTagName('textarea')["+x+"]);");
toolbar.appendChild(tempbutton);
// Bold button
var tempbutton = document.createElement("input");
tempbutton.setAttribute("type","button");
tempbutton.setAttribute("value","B");
tempbutton.setAttribute("style","font-weight:bold;");
tempbutton.setAttribute("onmousedown","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("style","font-style:italic;");
tempbutton.setAttribute("onmousedown","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("style","text-decoration:line-through;");
tempbutton.setAttribute("onmousedown","addStrike(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>'); } } function addBold(area) { var sel = getSelection(); if (sel.length != 0) { area.value = area.value.replace(sel,'<b>'+sel+'<\/b>'); } } function addItalic(area) { var sel = getSelection(); if (sel.length != 0) { area.value = area.value.replace(sel,'<em>'+sel+'<\/em>'); } } function addStrike(area) { var sel = getSelection(); if (sel.length != 0) { area.value = area.value.replace(sel,'<strike>'+sel+'<\/strike>'); } }"));
document.getElementsByTagName('head')[0].appendChild(temp);function getSelection() {
return (!!document.getSelection) ? document.getSelection() :
(!!window.getSelection) ? window.getSelection() :
document.selection.createRange().text;
}
// ==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;
}
blockquote {border-left:3px solid #0F0 !important; padding-left:1em !important;}
/* Submissions */
.data .status0 {background:#FFF !important; color:#080 !important;}
.data .status0 a {color:#080 !important;}
.data .status0 a:visited {color:#0A0 !important;}
.data .status0 a:hover {color:#0C0 !important;}
.data .status1 {background:#800 !important;}
.data .status2 {background:#256625 !important;}
I don't spend much money, and I seldom give any to online people. But - yeah, I'm aware that Soylent is in need of money. Then I saw it - an UNOBTAINIUM KEY CHAIN!! I'll be the first kid on my block to acquire unobtainium! I'll save my pennies and nickles, and discretely order a few more of these over the next months - and I can then build my UNOBTAINIUM BOMB!
Ooooh, I haven't been this excited since I ordered that little battery powered submarine when I was six or seven years old!
Copyrights and patents are bad. They are monopolies. They lead to incorrect thinking about property and ownership. They appeal to the bad in our natures. They provide opportunities for the anti-social to shakedown legitimate businesses. To restrict copying is to restrict sharing of knowledge, and teaching and education. Restrictions take away a natural right that is crucial to the existence and advancement of our civilizations. They are unenforceable. They cannot be enforced through technology such as DRM and copy protection, and they cannot be enforced through policing and legal means. Trying to enforce them is very costly and futile. Copyrights are also not the least of all evils. We have better ways to promote the progress of science and art, we do not need to live with copyright.
Intellectual Property plays on our bad instincts.
A strong emotion that intellectual property wrongly engages is Fear of Loss. We know through experimentation that when presented with a choice in which people already have something but must risk its loss in order to gamble for a much larger gain, at good odds, most people will refuse to take the chance. But when presented with the identical choice except that they do not already possess the things to be risked, more will take the chance. Those who possess copyrights or patents mislead themselves into thinking they are like physical property which can be stolen, and therefore must be guarded from theft. The greedy have tried to hoard these "properties" as if they are gold. Out of fear of small losses that are not real, we overlook big gains for us all. Copyright plays on our instincts in a negative way.
A bad habit of thought that copyright and patents promote is "mother may I". The system default is "no", unless "permission is obtained". This slows down progress both directly because even if permission is freely granted it takes more time and effort just to check, and indirectly by conditioning the public to be compliant and submissive, which makes people less adventurous and therefore less innovative.
Even our language hurts our understanding. Languages reflect the fears of a people, and one fear present in many languages is fear of loss. Many English phrases are needlessly possessive. "I have an idea" or "I've got an idea" could make it sound like I have property rights over the idea, as if I had said "I have a car." Same with "my idea". The language uses the same words for these different cases. It does not make sufficient distinction between the material and the immaterial.
Intellectual Property denies to us the right to share knowledge.
Sharing of knowledge is a right that should be every bit as fundamental as Freedom of Speech and Religion.
The sharing of knowledge, particularly the education and teaching of our young, and our ability to do so far better than any other animal is what lifted us to the top of the animal kingdom. Every ancient civilization employed a writing system. Their value was so obvious and large that no civilized society could do without. The feature we use to distinguish the civilized from the uncivilized is records and record keeping.
While it could be possible to do some record keeping through memory alone, in practice that is impossible. To be remembered, records have to be written.
Now, today, for hustlers to try to tell everyone that knowledge should be kept locked away because it is valuable, is outrageous. They are only trying to set up or maintain a racket with themselves as the kingpins. They would shut down the public library and used book store and ban them if they could.
Copyrights and patents are monopolies, and monopolies are bad.
Monopolies of all kinds share some common features. A monopoly always results in higher prices, poorer goods and services, and slower progress. In recognition of the harm that monopolies cuase, we have outlawed some monopolistic practices.
Opportunists have seen the current system as a chance to engage in Rent Seeking, and have tried to be first to monopolize every idea. The result is a mess in which the truly original ideas must be navigated through a minefield of dubious claims from patent trolls. Because it is far too burdensome to check all existing patents for possible infringements, it forces us to violate rights and risk punishment in order to get anywhere. In a day's work, a software engineer may violate hundreds of patents. Occasionally, the explorers have to take time out to soothe the fears of the uninformed who have only heard that somehow the law is being broken, and to deal with accusations from competitors and enemies seeking to use patents not to claim their just rewards, but to extort victims for money and to stifle competition. All this makes patent and copyright ironic, working against the purpose for which they were enacted, which is "To promote the Progress of Science and useful Arts"
Copyrights and patents are an unnatural kind of monopoly in that they can exist only through force of law and custom. Technological means such as copy protection and Digital Rights Management have failed to do more than inconvenience customers, some of whom find it faster and easier to pay the blackmail. To force compliance from the unwilling through technological means is simply impossible. Even those willing to comply cannot always do so, any more than anyone can choose to stop breathing. That leaves legal means, which take a great deal of effort and expense to attempt, and these efforts are not successful either. Nor can they be.
Copyrights and patents are not the only way to promote the arts and sciences.
This simple fact is often quickly overlooked in arguments over the law. Upon hearing that copyrights should be abolished, many people jump to the conclusion that artists will starve and we'll have no more art. This of course presumes a lot of things that simply are not true. Most of all, it presumes that copyright is the only way for artists to make a living.
So, what else is there? We could have nothing. No rewards, but also no restrictions. Art would still be created under those conditions. However the more desirable option would be some form of patronage. Patronage is not a new idea, it has existed for centuries. With current technology we are already doing patronage far better than it could be done in past centuries. There is also advertising, the model that works for broadcast radio and TV. And there are other ways. They are not perfect, but they do not have to be. They only have to be better than copyright, a low bar indeed.
Wonder how much I would have to bribe someone to get an insanely high user number. Some number in the hundreds of billions would do. Trillions or more would be better, but it would need to be in scientific notation. Damn near NO ONE would actually count the zeros. Errr - wait - there probably are anal retentive geeks out there. Or obsessive compulsive nerds. Yeah, some few would count the digits.
Anyway - with some crazy high number, I can post from the far distant future. Infuriating nonsense, like, "Yes, Apple is still around today. They haven't innovated anything for centuries though. About all that's left of Apple, is their manufacturing facility in orbit around Mars, where they make a few specialty items for the Chinese Space Marines."