Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name tmp txt adder ext
- // @namespace http://pastebin.com/PCzcThci
- // @version 1.0
- // @description hopefully does a thing
- // @author icie
- // @match *.dreamwidth.org/*
- // @grant none
- // ==/UserScript==
- // a function that loads jQuery and calls a callback function when jQuery has finished loading
- function addJQuery(callback) {
- var script = document.createElement("script");
- script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
- script.addEventListener('load', function() {
- var script = document.createElement("script");
- script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
- document.body.appendChild(script);
- }, false);
- document.body.appendChild(script);
- }
- function main(){
- var textcodestart = '<span style="font-family:courier new">';
- var textcodeend = '</span>';
- var actioncodestart = '<small>[';
- var actioncodeend = ']</small>';
- var count = 0;
- function addText(sStartTag, sEndTag) {
- var bDouble = arguments.length > 1, oMsgInput = jQ('[name="body"]:first')[0], nSelStart = oMsgInput.selectionStart, nSelEnd = oMsgInput.selectionEnd, sOldText = oMsgInput.value;
- oMsgInput.value = sOldText.substring(0, nSelStart) + (bDouble ? sStartTag + sOldText.substring(nSelStart, nSelEnd) + sEndTag : sStartTag) + sOldText.substring(nSelEnd);
- oMsgInput.setSelectionRange(bDouble || nSelStart === nSelEnd ? nSelStart + sStartTag.length : nSelStart, (bDouble ? nSelEnd : nSelStart) + sStartTag.length);
- oMsgInput.focus();
- }
- function addtextcode(){
- addText(textcodestart, textcodeend);
- }
- function addactioncode(){
- addText(actioncodestart, actioncodeend);
- }
- jQ('#subject').after(jQ('<button></button>').prop('id','txtbtn').prop('type','button').text('TXT').click(addtextcode));
- jQ('#subject').after(jQ('<button></button>').prop('id','actionbtn').prop('type','button').text('ACTION').click(addactioncode));
- jQ('img').css('max-width','100%');
- $('.dwexpcomment').css('margin-left','0');
- jQ('head').append(jQ('<meta name="viewport" content="width=device-width, initial-scale=1.0"> '));
- jQ('.appwidget').css('margin-left','0');
- jQ('nav').css('display','-webkit-flex').css('-webkit-flex-wrap','wrap');
- jQ('table[width]').prop('width',0);
- jQ('td input').removeProp('size');
- jQ('td input').removeAttr('size');
- jQ('img').css('max-size','100%');
- jQ('#canvas').css('width','100%').css('padding',0);
- jQ('footer').css('border','0px solid black');
- // #canvas width and padding = 0
- // nav display flex wrap
- // .appwidget margin left 0
- // Footer padding
- // Remove width attrs
- }
- addJQuery(main);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement