// ==UserScript==
// @name Blur Title Reddit
// @namespace https://greasyfork.org/users/102866
// @description Blurring a title which marked as spoiler in reddit, just like in fallout subreddit.
// @include https://*.reddit.com/*
// @include http://*.reddit.com/*
// @exclude https://*.reddit.com/r/fallout/*
// @exclude http://*.reddit.com/r/fallout/*
// @exclude https://*.reddit.com/r/*/comments/*
// @exclude http://*.reddit.com/r/*/comments/*
// @require https://code.jquery.com/jquery-3.1.1.min.js
// @author TieL
// @version 0.2.00
// @grant GM_addStyle
// @grant GM_listValues
// @grant GM_getValue
// @grant GM_setValue
// @downloadURL none
// ==/UserScript==
// Append some text to the element with id someText using the jQuery library. TEST JQUERY
//$("#hsts_pixel").append(" more text.");
//Add css
//console.log("Begin");
GM_addStyle ( " \
bdi.btr_title \
{ \
color:rgba(255,60,231,0) !important; \
text-shadow: 0px 0px 1em black; \
padding: 0 2px; \
} \
");
//GM_addStyle(" \
//bdi.btr_title:hover,bdi.btr_title:focus \
//{ \
// color:black!important; \
// background:transparent!important; \
// text-decoration:none!important; \
// text-shadow:0 0.1px 0 #dcddce \
//} \
//");
GM_addStyle ( " \
bdi.btr_trans \
{ \
transition: all 0.5s ease; \
} \
");
GM_addStyle(" \
.btr_closeButton \
{ \
cursor: pointer; \
text-align: center; \
font-size: 16px; \
float:right; \
margin-top:0px; \
border:1px solid #AAA; \
width:24px; \
height:24px; \
} \
");
GM_addStyle(" \
.btr_closeButton:hover \
{ \
border:1px solid #FFF; \
background-color: #fff; \
} \
");
GM_addStyle ( " \
.title \
{ \
overflow: visible !important; \
} \
" );
//end of css
//console.log("its working styles");
var res;
var currentLocation;
var titles = document.querySelectorAll("a.title");
//var titlesDiv = document.querySelectorAll("div.spoiler");
var titlesDiv = [];
var titlesDivO = document.querySelectorAll("div.spoiler");
var titlesTitle = [];
//var color = document.querySelectorAll("a.title").style.color;
var stringArr = [];
var stringOri = [];
var string;
var stringStartbdi = '';
var stringEndbdi = '';
var stringCSS;
var originStrings = [];
var len = [];
var i;
var firstB;
var lastB;
var col;
var lengthOfIndexes;
var arrBeg = [];
var arrEnd = [];
var settingsDiv;
//prefs
var btr_pTitle;
var btr_pUsers;
if (currentLocation === undefined) {
currentLocation = window.location;
}
Main();
function Main() {
//$(document).ready(function () {
// checkRES();
//});
if (titlesDivO.length != 0) {
console.log(titlesDivO);
//titlesDiv[1].parentNode.removeChild(titlesDiv[1]);
for (i = 0; i < titlesDivO.length; i++) {
titlesDiv[i] = titlesDivO[i];
}
console.log(titlesDiv);
if (GM_getValue("btr_GMTitle")) {
btr_pTitle = GM_getValue("btr_GMTitle");
myFunction();
} else
{
GM_setValue("btr_GMTitle", false);
btr_pTitle = GM_getValue("btr_GMTitle");
myFunction();
}
}
optionsUI();
//console.log(GM_listValues());
}
//Check Reddit Enhancement Suite
function checkRES()
{
if ($(".neverEndingReddit").length === 0) {
console.log($(".neverEndingReddit"));
if ($(".neverEndingReddit").length === 0) {
console.log($(".neverEndingReddit"));
if ($(".neverEndingReddit").length === 0) {
console.log($(".neverEndingReddit"));
if ($(".neverEndingReddit").length === 0) {
setTimeout(function () {
console.log($(".neverEndingReddit"));
if ($(".neverEndingReddit").length === 0) {
setTimeout(function () {
console.log($(".neverEndingReddit"));
if ($(".neverEndingReddit").length === 0) {
return;
} else {
res = $(".neverEndingReddit");
console.log("Check current RES : " + res[0]);
return;
}
}, 7000);
} else {
res = $(".neverEndingReddit");
console.log("Check current RES : " + res[0]);
return;
}
}, 3000);
} else {
res = $(".neverEndingReddit");
console.log("Check current RES : " + res[0]);
return;
}
} else {
res = $(".neverEndingReddit");
console.log("Check current RES : " + res[0]);
return;
}
} else
{
res = $(".neverEndingReddit");
console.log("Check current RES : " + res[0]);
return;
}
//console.log("Check current RES : " + res[0]);
}
//console.log("Check current RES : " + res[0]);
}
//UI FOR SETTINGS
function optionsUI()
{
// $("head").append($("").text("div.btr_opt { \
// height: 300px; \
// width: 300px;\
// background: #f0f0f0;\
// position: fixed; bottom: 0; right: 0; border: 0; \
// margin: 0px 5px 0px 5px;\
// padding: 10px 0px 10px 0px;\
// text-align: center;\
// border: 1px solid #AAA;\
// overflow: scroll;\
//}"));
$("head").append($("").text("div.btr_opt { \
position: fixed; bottom: 0; right: 0; border: 0; \
}"));
//var t = document.createTextNode("btr_opt {font: 20px verdana;}");
//x.appendChild(t);
//document.head.appendChild(x);
if (btr_pTitle === true) {
check = "Show brackets
\
Hide brackets
";
} else
{
check = "Show brackets
\
Hide brackets
";
}
// settingsDiv = $("