Advertisement
simpleruser

Untitled

Aug 18th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. // ==UserScript==
  2. // @name tmp txt adder ext
  3. // @namespace http://pastebin.com/PCzcThci
  4. // @version 1.0
  5. // @description hopefully does a thing
  6. // @author icie
  7. // @match *.dreamwidth.org/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11.  
  12. // a function that loads jQuery and calls a callback function when jQuery has finished loading
  13. function addJQuery(callback) {
  14. var script = document.createElement("script");
  15. script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
  16. script.addEventListener('load', function() {
  17. var script = document.createElement("script");
  18. script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
  19. document.body.appendChild(script);
  20. }, false);
  21. document.body.appendChild(script);
  22. }
  23.  
  24.  
  25.  
  26.  
  27.  
  28. function main(){
  29. var textcodestart = '<span style="font-family:courier new">';
  30. var textcodeend = '</span>';
  31. var actioncodestart = '<small>[';
  32. var actioncodeend = ']</small>';
  33. var count = 0;
  34.  
  35. function addText(sStartTag, sEndTag) {
  36. var bDouble = arguments.length > 1, oMsgInput = jQ('[name="body"]:first')[0], nSelStart = oMsgInput.selectionStart, nSelEnd = oMsgInput.selectionEnd, sOldText = oMsgInput.value;
  37. oMsgInput.value = sOldText.substring(0, nSelStart) + (bDouble ? sStartTag + sOldText.substring(nSelStart, nSelEnd) + sEndTag : sStartTag) + sOldText.substring(nSelEnd);
  38. oMsgInput.setSelectionRange(bDouble || nSelStart === nSelEnd ? nSelStart + sStartTag.length : nSelStart, (bDouble ? nSelEnd : nSelStart) + sStartTag.length);
  39. oMsgInput.focus();
  40. }
  41.  
  42. function addtextcode(){
  43. addText(textcodestart, textcodeend);
  44. }
  45.  
  46. function addactioncode(){
  47. addText(actioncodestart, actioncodeend);
  48. }
  49.  
  50. jQ('#subject').after(jQ('<button></button>').prop('id','txtbtn').prop('type','button').text('TXT').click(addtextcode));
  51. jQ('#subject').after(jQ('<button></button>').prop('id','actionbtn').prop('type','button').text('ACTION').click(addactioncode));
  52.  
  53. jQ('img').css('max-width','100%');
  54. $('.dwexpcomment').css('margin-left','0');
  55. jQ('head').append(jQ('<meta name="viewport" content="width=device-width, initial-scale=1.0"> '));
  56.  
  57. jQ('.appwidget').css('margin-left','0');
  58.  
  59. jQ('nav').css('display','-webkit-flex').css('-webkit-flex-wrap','wrap');
  60.  
  61. jQ('table[width]').prop('width',0);
  62.  
  63. jQ('td input').removeProp('size');
  64.  
  65. jQ('td input').removeAttr('size');
  66.  
  67. jQ('img').css('max-size','100%');
  68. jQ('#canvas').css('width','100%').css('padding',0);
  69. jQ('footer').css('border','0px solid black');
  70. // #canvas width and padding = 0
  71. // nav display flex wrap
  72. // .appwidget margin left 0
  73. // Footer padding
  74. // Remove width attrs
  75.  
  76. }
  77.  
  78. addJQuery(main);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement