Last active
April 5, 2024 07:57
-
-
Save monokano/2e635c572357482112d8cce4fe2245d8 to your computer and use it in GitHub Desktop.
コメント末尾の改行を削除するAcrobatのJavaScript
This file contains 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
app.addMenuItem({ | |
cName: "Remove newlines at the end of comments", | |
cUser: "\u30B3\u30E1\u30F3\u30C8\u672B\u5C3E\u306E\u6539\u884C\u3092\u524A\u9664", | |
cParent: "Edit", | |
nPos:-1, | |
cEnable:!1, | |
cExec: "Remove_newlines()" | |
}); | |
app.addMenuItem({ | |
cName: "Bar", | |
cUser:"-", | |
cParent: "Edit", | |
nPos:0, | |
cEnable:!1, | |
cExec: "" | |
}); | |
Remove_newlines = app.trustedFunction(function (){ | |
try{ | |
this.syncAnnotScan(); | |
var annots = this.getAnnots(); | |
if (annots!=null) { | |
for (var i in annots) { | |
var annot = annots[i]; | |
annot.contents = annot.contents.replace(/\r+$/, ""); | |
} | |
} | |
}catch(e){} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
注意
実行するとコメントの文字が真っ白に変わってしまう(視認できなくなる)ケースがまれにありました…。
原因がまったく分からず、対処できない状況です。