Discussion Forums > Forum/Thread Games
[Game] ctrl + v
Goroshi-sama:
file:///H:/Omat%20Kuvatiedostot/b/1292664634502.gif
Akecu:
http://www.animesuki.com/
:D
Arc-sama:
http://forums.bakabt.me/index.php?topic=28638.0
Kyrdua:
kyzhucha n:
(click to show/hide)// ==UserScript==
// @name smf your smilies
// @namespace http://userscripts.org
// @include */index.php?action=post;topic=*
// ==/UserScript==
var smiliesUrl = GM_getValue("smilies", "|").split("|");
smiliesUrl.pop();
//////////////// ADD YOUR SMILIES HERE!!!!!!!! ///////////////////
/* To add a smile You just need to copy this code:
smiliesUrl.push("");
and insert the url for the image between the "", like this:
smiliesUrl.push("http://i23.photobucket.com/albums/b371/K0modoDragon/Smileys/nosebleed.gif");
*/
//////////////// UNLESS YOU WANT TO CHANGE THE CODE, DON'T MESS UP WITH WHAT'S BELOW!!!!!!!! ///////////////////
/* Replace a text in the textarea
* @author bakabt
*/
function putInTxtarea(text, textarea) {
// Mozilla text range replace.
if (typeof(textarea.selectionS tart) != "undefined") {
var begin = textarea.value.subs tr(0, textarea.selectionS tart);
var end = textarea.value.subs tr(textarea.selectionE nd);
var scrollPos = textarea.scrollTop;
textarea.value = begin + text + end;
if (textarea.setSelecti onRange)
{
textarea.focus();
textarea.setSelecti onRange(begin.length + text.length, begin.length + text.length);
}
textarea.scrollTop = scrollPos;
}
// Just put it on the end.
else {
textarea.value += text;
textarea.focus(textarea.value.leng th - 1);
}
}
function xpath(query, object) {
if(!object) var object = document;
return document.evaluate(query, object, null, XPathResult.UNORDER ED_NODE_SNAPSHOT_TY PE, null);
}
//Try the path for SMF 1.*
function getXpathRes1(){
var path = xpath("//tr/td/textarea[@name='message']");
return (path.snapshotLength > 0) ? path : false;
}
//Try the path for SMF 2.*
function getXpathRes2(){
var path = xpath("//div/div/textarea[@name='message']");
return (path.snapshotLength > 0) ? path : false;
}
// SMF 1.0.*
var xpathRes = getXpathRes1();
if(xpathRes){
var tr = document.createElem ent("tr");
var td1 = document.createElem ent("td");
td1.setAttribute("valign", "middle");
var td2 = document.createElem ent("td");
td2.setAttribute("align", "right");
var elem = document.createElem ent("div");
elem.id = "mySmilies";
elem.innerHTML = "";
for each (url in smiliesUrl){
var img = document.createElem ent("img");
img.src = url;
img.style.cursor = "pointer";
img.addEventListene r('click', function(){putInTxtarea('', document.getElement sByName('message')[0]); }, false);
elem.appendChild(img);//img);
//elem.innerHTML +='\n<img src="'+url+'" onclick="putInTxtarea(\'\', document.forms.comm ent.main); return false;" style="cursor: pointer;">';
}
td1.appendChild(elem);
tr.appendChild(td2);
tr.appendChild(td1);
xpathRes.snapshotIt em(0).parentNode.parentN ode.parentNode.inse rtBefore(tr, xpathRes.snapshotIt em(0).parentNode.parentN ode);
}else{
// SMF 2.0.*
var xpathRes = getXpathRes2();
if(xpathRes){
var div1 = document.createElem ent("div");
var elem = document.createElem ent("div");
elem.id = "mySmilies";
elem.innerHTML = "";
for each (url in smiliesUrl){
var img = document.createElem ent("img");
img.src = url;
img.style.cursor = "pointer";
img.addEventListene r('click', function(){putInTxtarea('', document.getElement sByName('message')[0]); }, false);
elem.appendChild(img);//img);
//elem.innerHTML +='\n<img src="'+url+'" onclick="putInTxtarea(\'\', document.forms.comm ent.main); return false;" style="cursor: pointer;">';
}
div1.appendChild(elem);
xpathRes.snapshotIt em(0).parentNode.parentN ode.parentNode.inse rtBefore(div1, xpathRes.snapshotIt em(0).parentNode.parentN ode);
}
}
var menu=function() {
var img=prompt("Url for the smilie");
if (img!=null && img != "")
{
GM_setValue("smilies", (GM_getValue("smilies", "") + img + "|") );
alert('smilie added');
}
}
GM_registerMenuComm and("SMF:New smilie", menu);
var menu=function() {
var smilies = GM_getValue("smilies", "").split("|");
smilies.pop();
var promptOut = "";
for (num in smilies){
promptOut +=num + "->" + smilies[num] + "\n";
}
if(smilies.length == 0){
alert("There are no smilies");
return false;
}
var option = prompt("Which one do you want to edit/eliminate?(The number)\n"+promptOut, "");
if(option != null && !isNaN(option) && option < smilies.length ){
var newUrl = prompt("Change the url to edit it or erase it to delete it", smilies[option]);
if(newUrl != null && newUrl.length > 0){
smilies[option] = newUrl;
alert('smilie changed');
}else if(newUrl != null && newUrl.length == 0){
smilies.splice(option,1);
alert('smilie deleted');
}
GM_setValue("smilies",smilies.join("|")+"|" );
}
}
GM_registerMenuComm and("SMF:Edit/Erase Smilie", menu);
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version