Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name TheCelebrityCity - Add Reply Buttons
- // @namespace http://userscripts.org/users/23652
- // @description Adds some reply buttons, like IMG
- // @include http://*.thecelebritycity.com/forum/viewtopic.php*t=*
- // @copyright JoeSimmons
- // @version 1.0.4
- // @license http://creativecommons.org/licenses/by-nc-nd/3.0/us/
- // @require https://raw.github.com/joesimmons/jsl/master/jsl.user.js
- // @grant GM_addStyle
- // ==/UserScript==
- +function () {
- var buttons = {
- // -------- INSERT BUTTONS HERE --------
- '[img]' : [ '[img]' , '[/img]' ],
- 'text [img]' : [ 'text [img]' , '[/img]' ],
- 'text only' : [ 'text only' , '' ],
- // -------------------------------------
- '_b' : ''};
- // Make sure the page is not in a frame
- if (window.self !== window.top) { return; }
- JSL.runAt('end', function () {
- var holder = JSL('#qr_editor_div .inner fieldset dl dd'),
- autopost = true, autoprompt = true, button;
- JSL.addStyle('' +
- '.b1 { ' +
- 'margin: 0 10px;' +
- '}' +
- '');
- if (holder.exists) {
- holder.append(
- JSL.create('label', {'class' : 'b1', textContent : 'Auto-post? '}, [
- JSL.create('input', {type : 'checkbox', id : 'b1autopost'})
- ])
- );
- holder.append(
- JSL.create('label', {'class' : 'b1', textContent : 'Prompt? '}, [
- JSL.create('input', {type : 'checkbox', id : 'b1autoprompt'})
- ])
- );
- JSL('#b1autopost')
- .prop('checked', true)
- .addEvent('change', function () {
- autopost = this.checked;
- });
- JSL('#b1autoprompt')
- .prop('checked', true)
- .addEvent('change', function () {
- autoprompt = this.checked;
- });
- for (button in buttons) {
- if ( button !== '_b' && buttons.hasOwnProperty(button) ) {
- holder.append(
- JSL.create('input', {type : 'button', 'class' : 'button1 b1', value : button, onclick : function (event) {
- var box = JSL('#message-box textarea[name="message"]')[0],
- name = this.value,
- val = buttons[name],
- pr = autoprompt === true ? prompt('URL Link') : '';
- event.preventDefault();
- if (typeof pr === 'string') {
- box.value += val[0] + pr + val[1];
- box.focus();
- if (autopost === true && name !== '[img]') {
- JSL('#qr_editor_div input[type="submit"][name="post"]')[0].click();
- }
- }
- }})
- );
- }
- }
- }
- });
- }();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement