anwendungen_und_sonstiges:greasemonkey_-_blizzard-forumbeitrag_zu_zwischenablage
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
anwendungen_und_sonstiges:greasemonkey_-_blizzard-forumbeitrag_zu_zwischenablage [2015/09/21 18:21] – ronny | anwendungen_und_sonstiges:greasemonkey_-_blizzard-forumbeitrag_zu_zwischenablage [2016/04/02 00:48] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Greasemonkey - Blizzard-Forumsbeitrag zu Zwischenablage ====== | ====== Greasemonkey - Blizzard-Forumsbeitrag zu Zwischenablage ====== | ||
- | **Noch unfertig!** | + | ===== Fertig ===== |
+ | |||
+ | ==== Wohin mit dem transferierten Text? ==== | ||
+ | |||
+ | Das ganze ist komplizierter als ich dachte - die Funktion läuft zwar und konvertiert auch den Eingabestring (den eigentlichen Post), allerdings lädt sich dieser Teil der Seite danach nicht neu. | ||
+ | |||
+ | Es gibt nun zwei Möglichkeiten, | ||
+ | - Mithilfe von Ajax das Neuladen des Elements im Browser triggern | ||
+ | - Das ganze nur als Prompt-Box annehmen, mit allen dazugehörigen Nachteilen :( | ||
+ | |||
+ | **Update**: Es gibt noch eine weitere Möglichkeit, | ||
+ | |||
+ | ===== ToDo ===== | ||
+ | |||
+ | - Quellenangabe | ||
+ | - Titelzeile | ||
+ | - Das Fenster hört nicht auf zu laden. Möglicherweise braucht das Ding ein sauberes HTML-Gerüst | ||
+ | ===== Sourcecode ===== | ||
<code Javascript> | <code Javascript> | ||
Zeile 25: | Zeile 42: | ||
if (varDebug == true) console.log(' | if (varDebug == true) console.log(' | ||
varStringToCopy = varSinglePost.children[1].children[1].children[0].innerHTML; | varStringToCopy = varSinglePost.children[1].children[1].children[0].innerHTML; | ||
+ | varStringToCopy = varStringToCopy.replace(/'/ | ||
varATag = document.createElement(' | varATag = document.createElement(' | ||
varATag.setAttribute(' | varATag.setAttribute(' | ||
Zeile 34: | Zeile 52: | ||
varScript = document.createElement(' | varScript = document.createElement(' | ||
varScript.setAttribute(' | varScript.setAttribute(' | ||
- | varScript.innerHTML = " | + | varScript.innerHTML = " |
+ | varPostList.appendChild(varScript); | ||
+ | varScript = document.createElement('script' | ||
+ | varScript.setAttribute(' | ||
+ | varScript.innerHTML = " | ||
+ | varPostList.appendChild(varScript); | ||
+ | varScript = document.createElement(' | ||
+ | varScript.setAttribute(' | ||
+ | varScript.innerHTML = " | ||
varPostList.appendChild(varScript); | varPostList.appendChild(varScript); | ||
</ | </ | ||
- | tablefunctions.js | + | ===== Interessante Infos ===== |
+ | |||
+ | ==== Neues Fenster in Javascript öffnen ==== | ||
+ | |||
+ | Vielleicht hilft dieser Code-Schnipsel weiter: | ||
<code Javascript> | <code Javascript> | ||
- | function | + | function |
- | { | + | { |
- | | + | |
- | do { | + | |
- | FoundSomething = false; | + | |
- | positionBR = -1; | + | |
- | positionBR = varText.indexOf("< | + | |
- | // | + | |
- | if (positionBR != -1) | + | |
- | { | + | |
- | FoundSomething = true; | + | |
- | positionBREnd = varText.indexOf("> | + | |
- | Substring = varText.substring(positionBR, | + | |
- | varText = varText.replace(Substring, "\\\\ "); | + | |
- | } | + | |
- | positionBlockQuote | + | |
- | positionBlockQuote = varText.indexOf("< | + | |
- | if (positionBlockQuote != -1) | + | |
- | { | + | |
- | FoundSomething = true; | + | |
- | BlockQuoteCounter = 0; | + | |
- | positionBlockQuote2 = varText.indexOf(">" | + | |
- | positionBlockQuote3 | + | |
- | BlockQuoteEndFound = false; | + | |
- | do { | + | |
- | positionNextBlockQuote = varText.indexOf("< | + | |
- | positionBlockQuoteEnd | + | |
- | if (positionNextBlockQuote != -1 && positionNextBlockQuote < positionBlockQuoteEnd) | + | |
- | { | + | |
- | varText = varText.replace("</ | + | |
- | | + | |
- | } else | + | |
- | { | + | |
- | varText = varText.replace("</ | + | |
- | for (i = BlockQuoteCounter; | + | |
- | { | + | |
- | varText = varText.replace(" | + | |
- | } | + | |
- | BlockQuoteEndFound = true; | + | |
- | } | + | |
- | } while (BlockQuoteEndFound == false); | + | |
- | Substring = varText.substring(positionBlockQuote, | + | |
- | varText = varText.replace(Substring, | + | |
- | } | + | |
- | positionDiv = -1; | + | |
- | positionDiv = varText.indexOf(" | + | |
- | if (positionDiv != -1) | + | |
- | { | + | |
- | FoundSomething = true; | + | |
- | positionDivEnd = varText.indexOf(" | + | |
- | Substring = varText.substring(positionDiv, | + | |
- | varText = varText.replace(Substring, | + | |
- | } | + | |
- | positionDivE = -1; | + | |
- | positionDivE = varText.indexOf("</ | + | |
- | if (positionDivE | + | |
- | { | + | |
- | FoundSomething = true; | + | |
- | varText = varText.replace(" | + | |
- | } | + | |
- | console.log(varText); | + | |
- | i++; | + | |
- | // | + | |
- | } | + | |
- | while (FoundSomething == true); | + | |
- | return varText; | + | |
} | } | ||
- | |||
- | console.log(" | ||
- | varContent = convertText(document.getElementById(" | ||
- | document.getElementById(" | ||
- | console.log(" | ||
</ | </ | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | <div id=" | ||
- | <script type=" | ||
- | </ | ||
- | </ | ||
- | < | ||
+ | Quelle: [[https:// | ||
+ | |||
+ | ==== Alle Single-Quotes in einem String Escapen ==== | ||
+ | |||
+ | <code Javascript> | ||
+ | varStringToCopy = varStringToCopy.replace(/'/ | ||
</ | </ | ||
+ | |||
+ | Quelle: [[http:// | ||
{{tag> | {{tag> |
anwendungen_und_sonstiges/greasemonkey_-_blizzard-forumbeitrag_zu_zwischenablage.1442852492.txt.gz · Zuletzt geändert: 2016/04/02 00:37 (Externe Bearbeitung)