--- /dev/null
+// ==UserScript==\r
+// @name debianforum.de-nopaste-addition\r
+// @namespace org.free.for.all\r
+// @require http://code.jquery.com/jquery-latest.min.js\r
+// @include /^https?://debianforum\.de/forum/posting\.php.*/\r
+// @author Thorsten Sperber\r
+// @version 0.3\r
+// ==/UserScript==\r
+\r
+\r
+_log = console.log;\r
+ \r
+$("#format-buttons").append('<input type="button" class="button2" name="addbbcodeNOPASTE" value="NoPaste" id="nopaster" title="Pasta">');\r
+\r
+function replaceIt(txtarea, newtxt) {\r
+ $(txtarea).val(\r
+ $(txtarea).val().substring(0, txtarea.selectionStart)+\r
+ newtxt+\r
+ $(txtarea).val().substring(txtarea.selectionEnd)\r
+ ); \r
+}\r
+function getMessageText (ta) { return ta.value.substring(ta.selectionStart, ta.selectionEnd); }\r
+function successPost(data, textStatus, jqXHR)\r
+ {\r
+ var pasteID = $(data).find('a[href^="./pastebin.php?mode=view"]');\r
+ pasteID = pasteID.attr("href").substr(pasteID.attr("href").lastIndexOf("=")+1);\r
+ // _log("pasteID: " + pasteID);\r
+ replaceIt($('#message')[0], '[np]' + pasteID + '[/np]');\r
+ }\r
+ \r
+$("#nopaster").click(function()\r
+ {\r
+ var url = "//debianforum.de/forum/pastebin.php";\r
+ var data =\r
+ {\r
+ snippet_title: $("#subject").val(),\r
+ snippet_desc: window.location.href,\r
+ snippet_highlight: "text",\r
+ fileupload: null,\r
+ snippet_text: getMessageText($("#message")[0]),\r
+ mode: "post",\r
+ submit: "Absenden"\r
+ };\r
+ \r
+ // _log(data);\r
+ \r
+ $.ajax(\r
+ {\r
+ type: 'POST',\r
+ url: url,\r
+ data: data,\r
+ dataType: "html",\r
+ success: successPost\r
+ })\r
+ });\r