d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Can Someone Help Me With A Greasemonkey Script?
123Next
Closed New Topic New Poll
Member
Posts: 22,328
Joined: Jul 23 2008
Gold: 0.00
Dec 3 2012 01:57pm
Quote (HulaHoopChicka @ Dec 1 2012 05:17pm)
// ==UserScript==
// @name D2JSP custom bbcode button
// @namespace MEH
// @description adds custom bbcode buttons
// @author ikusus
// @license wtfpl
// @include http://forums.d2jsp.org/*.php*
// @version  1
// ==/UserScript==

function __insf() {
var buttons = [
{
"name": "color",
"html": "<img src='http://forums.d2jsp.org/html/emoticons/ph34r.gif' />",
"code": {
"click": function() {
  bbcode_in("", "");
}
}
}
]

var box = document.createElement("div");
box.setAttribute("class", "bbcodebox" );

for( i in buttons ) {
var a = document.createElement("a");
qc = buttons[i]["code"];
for( j in qc )
a.addEventListener( j, qc[j], false );
a.innerHTML = buttons[i]["html"];
a.title = buttons[i]["name"];
box.appendChild( a );
}

document.body.appendChild( box );
}

function bbcode_in(_o,_c) {
_t = "";
var ppx = document.getElementsByName('Post');
if (ppx.length == 0) {
ppx = document.getElementsByName("note");
}
for(iq in ppx) {
p = ppx[iq];
if( p )
p.focus();

ms=_o.length;
if(document.selection && document.selection.createRange) {
var s = document.selection.createRange();
_x=s.text!=""?s.text:_t;
s.text = txt = _o+_x+_c;
s.moveStart('character',-txt.length+ms);
s.moveEnd('character',-txt.length+ms+_x.length);
s.select();
} else if(p.selectionStart!='undefined') {
_s=p.selectionStart;
_e=p.selectionEnd;
_x=p.value.substring(_s,_e);
if(_x=="")_x=_t;
txt = _o+_x+_c;
p.value=p.value.substr(0,_s)+txt+p.value.substr(_e);
p.selectionEnd=p.selectionStart=_s+ms;
p.selectionEnd+=_x.length;
} else{
p.value+=_o+_c;
}
}
}

function link_in(url) {
document.location = url;
}


var style = document.createElement("style");
style.type = "text/css";
style.innerHTML = "div.bbcodebox{ color: #000; width: 30px; position: fixed; top: 0px; left: 0px; opacity: 0.1; z-index: 9999999; }\n";
style.innerHTML += "div.bbcodebox:hover{ opacity: 1; }\n";
style.innerHTML += "div.bbcodebox a{ color: #fff;cursor: pointer; display: block;}\n";
document.getElementsByTagName("head")[0].appendChild(style);


var __insb = document.createElement("script");
__insb.textContent = "\n" + bbcode_in + "\n" + link_in + "\n" + __insf + "\n\n__insf();";
__insb.type = "text/javascript";
document.getElementsByTagName('head')[0].appendChild(__insb);


how do you add this to greasemonkey?


paying 200 fg for help

This post was edited by SweetDisposition on Dec 3 2012 02:25pm
Member
Posts: 12,057
Joined: May 6 2012
Gold: 11,690.55
Warn: 10%
Dec 3 2012 02:06pm
Jesus I just need somebody on aim to help me with this
Member
Posts: 2,778
Joined: Aug 1 2012
Gold: 0.00
Warn: 20%
Dec 3 2012 02:28pm
Quote (SweetDisposition @ Dec 3 2012 12:57pm)
how do you add this to greasemonkey?


paying 200 fg for help



Quote (HulaHoopChicka @ Dec 3 2012 01:06pm)
Jesus I just need somebody on aim to help me with this



multi?
Member
Posts: 115,888
Joined: Oct 10 2012
Gold: 0.00
Dec 3 2012 02:28pm
i cant help u :wub:
Member
Posts: 12,057
Joined: May 6 2012
Gold: 11,690.55
Warn: 10%
Dec 3 2012 02:35pm
Quote (MrUK1 @ Dec 3 2012 03:28pm)
multi?


failed troll effort

Quote (RainyDay1 @ Dec 3 2012 03:28pm)
i cant help u  :wub:


then why post?
Member
Posts: 22,328
Joined: Jul 23 2008
Gold: 0.00
Dec 3 2012 02:36pm
Quote (MrUK1 @ Dec 3 2012 03:28pm)
multi?


cute guess

Quote (RainyDay1 @ Dec 3 2012 03:28pm)
i cant help u  :wub:


lol pls sum help someone
Member
Posts: 115,888
Joined: Oct 10 2012
Gold: 0.00
Dec 3 2012 02:38pm
Quote (HulaHoopChicka @ Dec 3 2012 10:35pm)
failed troll effort



then why post?


cus i would ;)
Member
Posts: 23,023
Joined: Jul 6 2012
Gold: 269.00
Dec 17 2012 12:42pm
umm... ya multi, reported. prob neither are female.
Member
Posts: 34,522
Joined: Apr 28 2010
Gold: Locked
Dec 17 2012 12:49pm
reported for multi
numone does most of the scripts in betting forums so id pm him
Member
Posts: 13,630
Joined: Dec 4 2009
Gold: 0.00
Dec 17 2012 03:45pm
You can't figure out how to add it to Greasemonkey? I assume you didn't write the script lol.

Just look at the settings for greasemonkey for two seconds, and you'll figure it out.
Go Back To Programming & Development Topic List
123Next
Closed New Topic New Poll