Page 1 of 2

WebTease Enhancer

Posted: Sun Jan 05, 2014 8:37 am
by Slutastic
I have been thinking that the web teases lack bbcodes and other types of scripts to make the teases work better.
Such things as being able to link pages together with bbcode (having to copy and paste is t ... p?id=24140

the demo tease will NOT work unless you have the extension installed.

Here is a screenshot of the demo tease:

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 9:07 am
by Azureballs
link to the chrome addon doesnt work. It says something about the addon being published and the add to chrome button doesnt appear.

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 9:09 am
by Slutastic
Sorry think i fixed it now :) forgot to make it visible to everyone

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 9:16 am
by Azureballs
Still didnt work, however I edited the link provided and this https://chrome.google.com/webstore/deta ... koocabmiak got me to the right spot where I could install it.

Edit:
Tested the demo tease. Worked perfectly.

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 9:19 am
by Slutastic
Azureballs wrote:Still didnt work, however I edited the link provided and this https://chrome.google.com/webstore/deta ... koocabmiak got me to the right spot where I could install it.

Edit:
Tested the demo tease. Worked perfectly.
thank you :D - updated the link to the one you have given :)


Edit:

Off to bed now any problems post them here and i will fix them :)

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 10:41 am
by Caius1
Absolutely brilliant work! Also I just noticed myself that Chrome extensions don't work in incognito mode, a pity :-/

Anyway, great job, it works perfectly :smile:

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 10:55 am
by crazyxxx
Caius1 wrote:Also I just noticed myself that Chrome extensions don't work in incognito mode, a pity :-/
They do. You just need to enable them specifically for incognito mode. Go to Settings -> Extensions, find it and click Enable in Incognito mode. That's it :)

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 11:05 am
by kloste
are you going to publish your code, maybe someone can do this for firefox to. or you do it by yourself if you dosnt want this, or there is no firefox extension

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 11:59 am
by cactusman
For a long time, in (classic) webteases, I have used asterisks around text that I wanted to be *italicized*. If the extension could automatically do that, it would enhance my work and presumably that of others.

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 12:44 pm
by inri2k6
Don't see why this couldn't be added to the site code. Don't think it would be too difficult.

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 6:10 pm
by Slutastic
Caius1 wrote:Absolutely brilliant work! Also I just noticed myself that Chrome extensions don't work in incognito mode, a pity :-/

Anyway, great job, it works perfectly :smile:
Thank You :D
kloste wrote:are you going to publish your code, maybe someone can do this for firefox to. or you do it by yourself if you dosnt want this, or there is no firefox extension
I have made a couple extensions for firefox a few years ago but from what i remember they are a nightmare to create as there is so many files you need to create >.<
I will have a try at some point but cant promise as they frustrate me lol
Here is the chrome version script if anyone would like to add it to firefox: (or maybe someone would like to add more functions to it)

Code: Select all

function bbcode_parser(str) {     var url = document.URL;    url = url.replace('/i=(.*?)&/gi', "$1");        var search = new Array    (        /[b](.*?)[/b]/gi,          /[i](.*?)[/i]/gi,        /[u](.*?)[/u]/gi,        /[s](.*?)[/s]/gi,        /[img](.*?)[/img]/gi,        /[url="?(.*?)"?](.*?)[/url]/gi,        /[quote](.*?)[/quote]/gi,        /[list=(.*?)](.*?)[/list]/gi,        /[list]([sS]*?)[/list]/gi,        /[*]s?(.*?)
/gi    );     var replace = new Array    (        "<b>$1</b>",        "<i>$1</i>",        "<u>$1</u>",        "<s>$1</s>",        "<img src="$1" alt="">",        "<a href="$1">$2</a>",        "<blockquote>$1</blockquote>",        "<ol>$2</ol>",        "<ul>$1</ul>",        "<li>$1</li>"    );     for (i = 0; i < search.length; i++)     {        str = str.replace(search[i], replace[i]);    }     return str;} if(document.getElementById('tease_content')) //prevent any js errors{    var tc = document.getElementById('tease_content');    tc.innerHTML = bbcode_parser(tc.innerHTML); } if(document.getElementById('postform')) //prevent any js errors{    var postform = document.getElementById('postform');    function bbcode(tag)    {        var el = document.getElementsByTagName("textarea")[0];        var selectedText = el.value.substring(el.selectionStart, el.selectionEnd);        var newText = '['+tag+']' + selectedText + '[/'+tag+']';        el.value = el.value.substring(0,el.selectionStart) + newText + el.value.substring(el.selectionEnd, el.value.length);    }        var buttons = '<input id="bold" type="button" value="Bold" />';    buttons += '<input id="italic" type="button" value="Italic" />';    buttons += '<input id="underlined" type="button" value="Underlined" />';    buttons += '<input id="strike" type="button" value="Strike" />';    buttons += '<input id="img" type="button" value="Image" />';    buttons += '<input id="url" type="button" value="Url" />';    buttons += '<input id="quote" type="button" value="Quote" />';     postform.insertAdjacentHTML('beforeend',buttons);     var bold = document.getElementById("bold");    bold.addEventListener("click", function() {    bbcode('b');    }, false);    var italic = document.getElementById("italic");    italic.addEventListener("click", function() {    bbcode('i');    }, false);        var underlined = document.getElementById("underlined");    underlined.addEventListener("click", function() {    bbcode('u');    }, false);    var strike = document.getElementById("strike");    strike.addEventListener("click", function() {    bbcode('s');    }, false);    var img = document.getElementById("img");    img.addEventListener("click", function() {    var url = prompt('enter a url', 'http://');     if (url!=null && url!="" && url!="http://")     {         var el = document.getElementsByTagName("textarea")[0];        el.value = el.value + '[img]'%20+%20url%20+%20'[/img]';    }    }, false);    var url = document.getElementById("url");    url.addEventListener("click", function() {    var url = prompt('enter a url', 'http://');     if (url!=null && url!="" && url!="http://")     {         var el = document.getElementsByTagName("textarea")[0];        el.value = el.value + '[url=' + url + ']' + url + '[/url]';    }    }, false);    var quote = document.getElementById("quote");    quote.addEventListener("click", function() {    bbcode('quote');    }, false);    var page = document.getElementById("page");    page.addEventListener("click", function() {    var url = prompt('enter a page number', '');     if (url!=null && url!="")     {         var el = document.getElementsByTagName("textarea")[0];        el.value = el.value + '[page=' + url + ']';    }    }, false);}
cactusman wrote:For a long time, in (classic) webteases, I have used asterisks around text that I wanted to be *italicized*. If the extension could automatically do that, it would enhance my work and presumably that of others.
Yeah can add that - will do it later (going back to bed in a few)
inri2k6 wrote:Don't see why this couldn't be added to the site code. Don't think it would be too difficult.
I already asked for it to be added a few months ago but sepher0x doesn't want to add them - so i thought maybe if sepher0x see's how much it helps to improve web teases then it might get added at a later date (hopefully)

Re: WebTease Enhancer

Posted: Sun Jan 05, 2014 6:20 pm
by Slutastic
Just had another idea - i might be able to use html5 local storage to enable use of stored data - so the web tease can keep score of points etc [save=data to store]varName[/save] [get]varName[/get]

Re: WebTease Enhancer

Posted: Mon Jan 06, 2014 3:19 am
by Slutastic
Version 1.1 just released:

New Codes:

*text* = text

[dice] = rollable dice (limited to 1 roll only to prevent people multiple rolling to cheat)

[time=30]5[/time]
(30 is the time it takes to redirects to a new page, and 5 is the page number to redirect to.

There is a page 2 of the demo webtease: http://www.milovana.com/webteases/showt ... 4140&p=2#t

Current Script:

Code: Select all

var timeid;var countdown = 0;var diceUrl = "";var whichPage = 1; var dPic = new Array(); dPic[0] = chrome.extension.getURL("images/d0.png");dPic[1] = chrome.extension.getURL("images/d1.png");dPic[2] = chrome.extension.getURL("images/d2.png");dPic[3] = chrome.extension.getURL("images/d3.png");dPic[4] = chrome.extension.getURL("images/d4.png");dPic[5] = chrome.extension.getURL("images/d5.png");dPic[6] = chrome.extension.getURL("images/d6.png");///////////////////////////BBCode Parserfunction bbcode_parser(str) {     var url = document.URL;    url = url.replace('/i=(.*?)&/gi', "$1");        var search = new Array    (        /[b](.*?)[/b]/gi,          /[i](.*?)[/i]/gi,        /[u](.*?)[/u]/gi,        /[s](.*?)[/s]/gi,        /[img](.*?)[/img]/gi,        /[url="?(.*?)"?](.*?)[/url]/gi,        /[quote](.*?)[/quote]/gi,        /[list=(.*?)](.*?)[/list]/gi,        /[list]([sS]*?)[/list]/gi,        /[*]s?(.*?)
/gi,        /*(.*?)*/gi,        /[dice]/gi,        /[time=(.*?)](.*?)[/time]/gi    );     var replace = new Array    (        "<b>$1</b>",        "<i>$1</i>",        "<u>$1</u>",        "<s>$1</s>",        "<img src="$1" alt="">",        "<a href="$1">$2</a>",        "<blockquote>$1</blockquote>",        "<ol>$2</ol>",        "<ul>$1</ul>",        "<li>$1</li>",        "<b><i>$1</i></b>",        "<img id="dice" src="" + dPic[0] + """ alt="dice"/><input type="button" id="roll" value="Roll Dice"/>",        "<b id="timeWT">$1||$2</time>"    );     for (i = 0; i < search.length; i++)     {        str = str.replace(search[i], replace[i]);    }     return str;} ///////////////////////////Start count down timerfunction startCountDown(){    document.getElementById("timeWT").innerText = countdown+" Seconds Remaining";    timeid = setInterval(function(){countDown()},1000);} ///////////////////////////count downfunction countDown(){    countdown--;    document.getElementById("timeWT").innerText = countdown + " Seconds Remaining";    if(countdown==0)    {        clearInterval(timeid);        var du = document.URL;        var resu = du.split("#");        if(resu[1]=='t')        {            du = du.replace(/id=(.*?)&p=(.*?)#t/gi, "id=$1&p=" + whichPage + "#t");        }        else        {            du = du.replace(/id=(.*?)&p=(.*?)&/gi, "id=$1&p=" + whichPage + "&");        }        window.location = du;     }} if(document.getElementById('tease_content')) //prevent any js errors{    var tc = document.getElementById('tease_content');    tc.innerHTML = bbcode_parser(tc.innerHTML); } if(document.getElementById('postform')) //prevent any js errors{    var postform = document.getElementById('postform');    function bbcode(tag)    {        var el = document.getElementsByTagName("textarea")[0];        var selectedText = el.value.substring(el.selectionStart, el.selectionEnd);        var newText = '['+tag+']' + selectedText + '[/'+tag+']';        el.value = el.value.substring(0,el.selectionStart) + newText + el.value.substring(el.selectionEnd, el.value.length);    }        var buttons = '<input id="bold" type="button" value="Bold" />';    buttons += '<input id="italic" type="button" value="Italic" />';    buttons += '<input id="underlined" type="button" value="Underlined" />';    buttons += '<input id="strike" type="button" value="Strike" />';    buttons += '<input id="img" type="button" value="Image" />';    buttons += '<input id="url" type="button" value="Url" />';    buttons += '<input id="quote" type="button" value="Quote" />';    buttons += '<input id="dice2roll" type="button" value="Dice" />';    buttons += '<input id="time" type="button" value="Timer" />';        postform.insertAdjacentHTML('beforeend',buttons);         ///////////////////////////event listeners    var bold = document.getElementById("bold");    bold.addEventListener("click", function() {    bbcode('b');    }, false);        var italic = document.getElementById("italic");    italic.addEventListener("click", function() {    bbcode('i');    }, false);        var underlined = document.getElementById("underlined");    underlined.addEventListener("click", function() {    bbcode('u');    }, false);        var strike = document.getElementById("strike");    strike.addEventListener("click", function() {    bbcode('s');    }, false);        var img = document.getElementById("img");    img.addEventListener("click", function() {    var url = prompt('enter a url', 'http://');     if (url!=null && url!="" && url!="http://")     {         var el = document.getElementsByTagName("textarea")[0];        el.value = el.value + '[img]'%20+%20url%20+%20'[/img]';    }    }, false);        var url = document.getElementById("url");    url.addEventListener("click", function() {    var url = prompt('enter a url', 'http://');     if (url!=null && url!="" && url!="http://")     {         var el = document.getElementsByTagName("textarea")[0];        el.value = el.value + '[url=' + url + ']' + url + '[/url]';    }    }, false);        var quote = document.getElementById("quote");    quote.addEventListener("click", function() {    bbcode('quote');    }, false);        /*    var page = document.getElementById("page");    page.addEventListener("click", function() {    var url = prompt('enter a page number', '');     if (url!=null && url!="")     {         var el = document.getElementsByTagName("textarea")[0];        el.value = el.value + '[page=' + url + ']';    }    }, false);*/        var roll = document.getElementById("dice2roll");    roll.addEventListener("click", function() {    document.getElementsByTagName("textarea")[0].value += '[dice]';     }, false);        var time = document.getElementById("time");    time.addEventListener("click", function() {    var tim = prompt('enter a time in seconds', '');     if (tim!=null && tim!="")     {         var page = prompt('enter a page number', '');         if (page!=null && page!="")         {             document.getElementsByTagName("textarea")[0].value += '[time=' + tim + ']' + page + '[/time]';        /*            whichPage = page;            startCountDown(tim);        */                    }    }        }, false);        } if(document.getElementById("timeWT")){    var getTime = document.getElementById("timeWT").innerText;    var res = getTime.split("||");    countdown = res[0];    whichPage = res[1];    startCountDown();} if(document.getElementById("roll")){    var roll = document.getElementById("roll");    roll.addEventListener("click", function() {    document.getElementById('dice').src = dPic[Math.floor(Math.random()*6+1)];    document.getElementById('roll').disabled = true;    }, false);}

Re: WebTease Enhancer

Posted: Tue Jan 07, 2014 2:39 pm
by silenus
Did you make version 1.1 available to the public? It just says 1.0, and dice or time won't work to me.

Re: WebTease Enhancer

Posted: Sat Jan 11, 2014 11:58 am
by Slutastic
Hey silence yes 1.1 should be available on the same link?