#1✎ 258Y____Head AdminGardeningI like to garden!HobbiesReadingI like to read books!HobbiesDrawingI like to draw!HobbiesLike before but different.
if(document.querySelector("message-box")) {
var messages = document.getElementsByTagName("message-content");
var reg = new RegExp("((?:[A-Za-z]+:\\/\\/)?[A-Za-z0-9-_]+\\.[A-Za-z0-9][A-Za-z0-9-_:%&;\\?#/.=]+)","g");
for (var m = 0; m < messages.length; m++) {
messages[m].innerHTML = messages[m].innerHTML.replace(reg, "<a href=\"$1\">$1</a>");
}
}
(not perfect but some mistakes is better than copy-pasting everything, I suppose.)
Posted
Edited
by Y____
#2✎ 149randomouscrap98OwnerTouhou Project Is Awesome!I love Touhou Project!Express YourselfSecond YearMy account is over 2 years oldWebsiteGardeningI like to garden!HobbiesWait... why didn't you just request this? I can just run the autolinker on messages! Do you want me to do that, or...?
Posted
#3✎ 38snail_Avatar TabooI didn't change my avatar for 180 daysWebsiteDeep SleepHiddenWebsiteMinecraft Is Awesome!I love Minecraft!Express YourselfReplace "homebrew" with "marijuana". Ignores case, but properly sets the case of the first letter.
document.body.innerHTML = document.body.innerHTML.replace(/(h)omebrew/gi, (m, p) => {
if(p === "H")
return "Marijuana";
else
return "marijuana";
});
Only runs on page load.
Posted
Edited
by snail_
#4✎ 10ShadowCX13Avatar TabooI didn't change my avatar for 180 daysWebsiteAdds Markdown to Profile bios and fixes line breaks in profiles.
// BetterBios
// Fixes linebreaks, and adds Markdown formatting to profile bios
// By ShadowCX11
// Uses Showdown: [url=https://github.com/showdownjs/showdown]https://github.com/showdownjs/showdown[/url]
var path = window.location.pathname.split("/");
path.shift();
if(path[0] === "user"){
var bio = document.getElementsByTagName("bio-section")[0];
if(bio.textContent.indexOf("=-MD-=") !== -1){
var rtf = bio.innerHTML.split("=-MD-=").slice(1).join("=-MD-=");
bio.textContent = "Parsing Markdown, please wait...";
var s = document.createElement("script");
var onload = function(){
try {
window.converter = new showdown.Converter;
bio.innerHTML = converter.makeHtml(rtf).replace(/\n/g, "<br/>");
bio.style.fontStyle = "normal";
} catch(e){alert(e.stack);}
};
s.src = "[url=https://cdn.rawgit.com/showdownjs/showdown/1.4.2/dist/showdown.min.js"]https://cdn.rawgit.com/showdownjs/showdown/1.4.2/dist/showdown.min.js"[/url];;
s.addEventListener("load", onload);
document.getElementsByTagName("head")[0].appendChild(s);
} else {
bio.innerHTML = bio.innerHTML.replace(/\n/g, "<br/>");
};
}
To add a Markdown profile, add:
=-MD-=
# Markdown!
to the bottom of your profile bio. Your Markdown profile is separate from your normal profile.
Don't forget to fix line 22, caused by autolinker (facepalm)
Posted
Edited
by ShadowCX13
#5✎ 258Y____Head AdminGardeningI like to garden!HobbiesReadingI like to read books!HobbiesDrawingI like to draw!Hobbies
Replace "homebrew" with "marijuana". Ignores case, but properly sets the case of the first letter.
document.body.innerHTML = document.body.innerHTML.replace(/(h)omebrew/gi, (m, p) => {
if(p === "H")
return "Marijuana";
else
return "marijuana";
});
Only runs on page load.
Crapware. Detaches all JS events on all pages.
Posted
#6✎ 32Chemicale//var urlString = window.location.pathname;
// urlParams = parseURLParams(urlString);
function $_GET(q,s) {
s = (s) ? s : window.location.search;
var re = new RegExp('&'+q+'=([^&]*)','i');
return (s=s.replace(/^\?/,'&').match(re)) ?s=s[1] :s='';
}
var isiframe=$_GET("i");
var x = document.getElementsByTagName("BODY")[0];
systemMessage(isiframe);
x.style.overflow="hidden";
if(isiframe===""){
var body=x.innerHTML;
x.innerHTML="<iframe src='http://smilebasicsource.com/chat?i=1' style='width:60%; height:100%; left:0%; top:0%; position:absolute;'></iframe> <iframe src='http://smilebasicsource.com' style='width:40%; height:100%; left:60%; top:0%; position:absolute;'></iframe>";
}
have fun.
NOTE: This causes you to leave and join 2 times.
Posted
Edited
by Chemicale
#7✎ 258Y____Head AdminGardeningI like to garden!HobbiesReadingI like to read books!HobbiesDrawingI like to draw!Hobbies
//var urlString = window.location.pathname;
// urlParams = parseURLParams(urlString);
function $_GET(q,s) {
s = (s) ? s : window.location.search;
var re = new RegExp('&'+q+'=([^&]*)','i');
return (s=s.replace(/^\?/,'&').match(re)) ?s=s[1] :s='';
}
var isiframe=$_GET("i");
var x = document.getElementsByTagName("BODY")[0];
systemMessage(isiframe);
x.style.overflow="hidden";
if(isiframe===""){
var body=x.innerHTML;
x.innerHTML="<iframe src='http://smilebasicsource.com/chat?i=1' style='width:60%; height:100%; left:0%; top:0%; position:absolute;'></iframe> <iframe src='http://smilebasicsource.com' style='width:40%; height:100%; left:60%; top:0%; position:absolute;'></iframe>";
}
have fun.
NOTE: This causes you to leave and join 2 times.
Crapware. This will get you banned because of a faulty implementation.
Posted
#8✎ 38snail_Avatar TabooI didn't change my avatar for 180 daysWebsiteDeep SleepHiddenWebsiteMinecraft Is Awesome!I love Minecraft!Express Yourself
Replace "homebrew" with "marijuana". Ignores case, but properly sets the case of the first letter.
document.body.innerHTML = document.body.innerHTML.replace(/(h)omebrew/gi, (m, p) => {
if(p === "H")
return "Marijuana";
else
return "marijuana";
});
Only runs on page load.
Crapware. Detaches all JS events on all pages.
mmm
why does web have to be such a fickle platform
Posted
#9✎ 10312Me21Forum ModeratorNight PersonI like the quiet night and sleep late.Express Yourselfvar userNav=document.querySelector("user-area user-nav");
function addToUserNav(name,url,src) {
var newLink=document.createElement("a");
newLink.title=name;
newLink.href=url;
newLink.style.backgroundImage="url('"+src+"')";
newLink.innerHTML=name;
userNav.insertBefore(newLink,userNav.querySelector("a#sign-out"));
}
addToUserNav("Chat JS Editor","/editor?type=chat","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAJNJREFUOE/NlFsKwCAMBHM+7+xV+uk1Wla6VNNEfBUqDIlJGIKUCk4I4VwhS3isgRlu3SNM6RimFILtQvAvIYgxZkwhG4yoWT3WSXmvhIxl7kUrB02h7pV3b/7bDVtvqKOVg0q4QreQPW7tzbLXLWzNAHqGN+R3qKHHFbKme9Ys68AV6o04N73hKC/hLqp/4ioiIheOJzuqdlcdtQAAAABJRU5ErkJggg==");
addToUserNav("Site JS Editor","/editor?type=site","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuOWwzfk4AAACfSURBVDhPzZTLDYAwDEMzX3fuKhxZA2SEhUlT1N+BSk9tHGOFjzCslNIxwxXCFRlGuOOewH3futFAsDwQ/CsQ5JwvwkBtoNbd61qr9gpUg69rZ9VAOCF2mvQCPatPtfAZsla9dlYNFLcMWieMtHDCEZoD2fNfgIe95sAvD2BO94T6ZhXmVAOp+V7kpQ6qgX4i+oYn7KUIXMXrnziLmdkJyRJDTUcl0dkAAAAASUVORK5CYII=");
Posted
Edited
by 12Me21
#10✎ 258Y____Head AdminGardeningI like to garden!HobbiesReadingI like to read books!HobbiesDrawingI like to draw!Hobbiesvar link=document.createElement("a");
link.title="Pixel-Voxel";
link.href="/user?uid=24";
link.style.backgroundImage="url('/styles/themes/smile/images/userpageiconbig.png')";
link.innerHTML="Pixel-Voxel";
var userNav=document.querySelector("user-area user-nav");
userNav.appendChild(link);
Posted
#11✎ 10312Me21Forum ModeratorNight PersonI like the quiet night and sleep late.Express Yourselfvar bio=document.querySelector(".user bio-section");
if (bio) bio.style.whiteSpace="pre-wrap";(original by BrokenR3C0RD)
Posted
Edited
by 12Me21
#12✎ 10312Me21Forum ModeratorNight PersonI like the quiet night and sleep late.Express Yourselfvar bads=document.querySelectorAll("img.badge[src^='/static_images/badges/first']");
if (bads) for (var i=0;i<bads.length;i++) bads[i ].parentNode.remove();
Posted
Edited
by 12Me21
#13✎ 258Y____Head AdminGardeningI like to garden!HobbiesReadingI like to read books!HobbiesDrawingI like to draw!Hobbiesunfinished
var tasks = [];
function addTask(name, date) {
if (!name)
throw new TypeError("Task name invalid or unspecified");
tasks.push([]);
tasks[tasks.length - 1].push(name);
if(date)
tasks[tasks.length - 1].push(date);
tasks.sort(compareTaskDates);
}
function updateTask(name, date, status, index) {
taskIndex = index || findTaskByName(name);
if (taskIndex < 0)
throw TaskNotFoundException(name);
if(index && name)
tasks[taskIndex][0] = name;
if(date)
tasks[taskIndex][1] = date;
if(status)
tasks[taskIndex][2] = status;
}
function compareTaskDates(a, b) {
if (a[1] && b[1])
return Math.sign(a[1] - b[1]);
else //whichever (if any) DOES have a date goes first
return b.length - a.length;
}
function findTaskByName(name) {
return tasks.findIndex(function(element){return element[0] === name});
}
function TaskNotFoundException(name){
this.message = "The task specified could not be found or does not exist.";
this.name = name;
}
addTask("maek buzlbasor lol", new Date(2016, 11, 5));
addTask("maek pikeachoo lol", new Date(2015, 11, 5));
updateTask("maek buzlbasor lol", new Date(2016, 10, 30));
//writePersistent("tasks", JSON.stringify(tasks));
/*readPersistent("tasks", function(value) {
tasks = value;
console.log(tasks);
});*/
function submitUserTask() {
try {
if (document.querySelector("#task-date-input").value)
addTask(document.querySelector("#task-name-input").value, new Date(document.querySelector("#task-date-input").value));
else
addTask(document.querySelector("#task-name-input").value);
document.querySelector("#task-name-input").value = "";
} catch(e) {
//TODO
console.log(e);
} finally {
console.log(tasks);
}
}
function snatchFocus() {
document.querySelector("#task-name-input").focus();
}
function createTaskUI() {
var UIToggle = document.createElement("input");
UIToggle.type = "checkbox";
UIToggle.id = "task-toggle";
UIToggle.accessKey = "/";
UIToggle.addEventListener("change", function(e){if (e.target.checked) snatchFocus()});
var UIDrawer = document.createElement("aside");
UIDrawer.id = "task-container";
var UI = document.createElement("simple-block");
UI.id = "task-ui";
var taskInput = document.createElement("input");
taskInput.type = "text";
taskInput.name = "new-task-input";
taskInput.id = "task-name-input";
taskInput.placeholder = "Schedule a new task";
taskInput.tabIndex = 1;
taskInput.onkeydown = function(e) {if (e.keyCode === 13) submitUserTask()};
var taskDate = document.createElement("input");
taskDate.type = "date";
taskDate.id = "task-date-input";
taskDate.tabIndex = 2;
taskDate.onkeydown = function(e) {if (e.keyCode === 13) submitUserTask()};
var taskStyles = document.createElement("style");
taskStyles.innerHTML = `#task-container {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 0;
z-index: 10;
}
#task-toggle:checked ~ #task-container {
height: calc(2.5rem + 2px);
}
#task-toggle:checked ~ label[for="top-nav-toggle"] {
bottom: calc(2.5rem + 2px);
}
#task-ui {
box-sizing: border-box;
width: 100%;
margin: none;
}`;
document.body.appendChild(taskStyles);
UI.appendChild(taskInput);
UI.appendChild(taskDate);
UIDrawer.appendChild(UI);
var header = document.querySelector("header");
header.insertBefore(UIToggle, header.querySelector("#top-nav-toggle"));
header.insertBefore(UIDrawer, header.querySelector("#top-nav-toggle"));
}
createTaskUI();
Posted
#14✎ 28PerskaCthulhuJoin the cultEaster EggsBeesHiddenEaster Eggsdocument.body.getElementsByTagName("span")[0].innerHTML+=" - "+document.body.dataset.views+" views";
Posted