This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "translatorID": "bf6b49e3-9198-4fbc-a559-a81fcfcce908", | |
| "label": "World Shakespeare Bibliography Online", | |
| "creator": "Matthias Heim", | |
| "target": "worldshakesbib.org", | |
| "minVersion": "1.0", | |
| "maxVersion": "", | |
| "priority": 100, | |
| "inRepository": true, | |
| "translatorType": 4, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' UnlockEditableRanges: Hebt im aktiven Dokument auf allen Blättern den individuellen Sperrschutz der Zellen auf, die durch bearbeitbare Bereiche freigegeben wurden. | |
| ' Dadurch werden diese Bereiche auch auf Excel Online und auf Tablets beschreibbar, selbst wenn das Blatt geschützt ist. | |
| ' Achtung: bereits entsperrte Zellen werden durch das Skript nicht wieder geschützt, wenn sie sich nicht (mehr) in einem bearbeitbaren Bereich befinden. | |
| Sub UnlockEditableRanges() | |
| Dim Sheet As Excel.Worksheet | |
| Dim EditableRange As Variant | |
| Dim SheetIsProtected As Boolean | |
| Dim cell As Excel.Range |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* see implementation example here: jsfiddle.net/s0etmpnf/ */ | |
| /* checks whether an (empty) text node is ignored by the browser or rendered */ | |
| function isTextNodeUnparsedWhitespace(node) { | |
| if (/[^\t\n\r ]/.test(node.textContent)) return false; | |
| const range = document.createRange(); | |
| range.selectNodeContents(node); | |
| const rects = range.getClientRects(); | |
| if ((rects.length > 0) && (rects[0].width > 0)) return false; | |
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function wrapSelectionTextNodes(id, className) { | |
| let selection = window.getSelection(); | |
| let range = selection.getRangeAt(0); | |
| // if the entire range is contained within one text node, there is a quick fix with surroundContents | |
| if (range.startContainer === range.endContainer && range.endContainer.nodeType === Node.TEXT_NODE) { | |
| let span = document.createElement('span'); | |
| span.id=id; | |
| span.classList.add(className); | |
| range.surroundContents(span); | |
| selection.selectAllChildren(span); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * will search for a string or a regular expression and wrap resulting textnodes in <span class="selection">-elements | |
| * even if the result spans multiple text nodes. | |
| * returns the new span-nodes as a two-dimensional array, where each entry corresponds to all the wrapped text nodes for a result of the search, loop over these to add ids | |
| * (as an added goodie, the returned element contains the 'text' of each result, as well as 'context.before' and 'context.after', a trimmed 100-character string of the surrounding content) | |
| */ | |
| function findText(root, regex) { | |
| if (regex instanceof RegExp) { | |
| if (!regex.flags.includes("g")) regex = new RegExp(regex.source,"g"+regex.flags); | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Use MuPDF's JavaScript API to get "table of contents" / document outline styling information | |
| * Set up an OutlineIterator (as in the main function below) but additionally allows you to retrieve the pdf object for each entry and to get and set style and color | |
| * (Also: full example of an outline parser in MuPDF in main function below) | |
| * v.1 - 27.05.2024 | |
| * run as follows: mutool.exe run document-outline-extension.js filename.pdf | |
| * | |
| * Copyright (C) 2024 Matthias Heim | |
| This program is free software: you can redistribute it and/or modify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Use MuPDF's JavaScript API to copy the "table of contents" / document outline from one pdf file to another | |
| * The script also copies styling information (italics / bold / color), by accessing this information via | |
| * mupdf's PDFObject-API. It is mainly intended as a proof of concept for this type of operation. | |
| * This is useful if you have to versions of the same pdf and want to copy the outline from one version to another | |
| * Warning: the script performs no checks whether the outlined targets exist or make sense in the new document. | |
| * Warning: this script removes existing outlines from the target document and overwrites it in place. | |
| * Always keep a copy of the target document in case something goes horribly wrong. | |
| * v.1 - 13.03.2025 | |
| * run as follows: node copytoc.mjs source.pdf target.pdf |