-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToggleCover.js
97 lines (89 loc) · 6.19 KB
/
ToggleCover.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* @title : ToggleCover
* @description : Acrobat script to toggle easily between different views, with or without the cover page, in the frontmost PDF.
* @author : Tobias Wantzen <[email protected]>
* @date : 2017-03-17
* @version : v01
* @todo :
*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// GENERAL INSTALLATION INSTRUCTIONS:
//
// This Acrobat Automation Script will only work when
// placed in one of the Acrobat JavaScript Folders. Execute
// the following code from the Acrobat JavaScript Console to find
// the location of the JavaScript folders.
//
// To display the Acrobat JavaScript Console use Ctrl+J on
// Windows and Command+J on the Mac, does not work properly on newer Mac Books
//
// app.getPath("app","javascript");
//
// app.getPath("user");
// [You may have to add a folder called "JavaScripts" to this folder manually.]
//
// You may place this script file in either one of the folders.
// However, the "user" folder is shared by both Acrobat and Reader
// Placing the file in the user folder will make the menu item
// availible to both Acrobat and Reader
//
// localization
var _lang = app.language;
//
///////
// Logic
//
var twaToggleCover = app.trustedFunction( function() {
app.beginPriv();
var _doc = this;
_doc.zoomType = zoomtype.fitP;
if ( _doc.layout == "TwoPageRight" ) {
_doc.layout = "TwoPageLeft";
} else if ( _doc.layout == "TwoPageLeft" ) {
_doc.layout = "SinglePage";
} else {
_doc.layout = "TwoPageRight";
}
app.endPriv();
});
///////
// User Interface: menu items (View menu)
//
// localization
var twa_addMenuItem_ToggleCover_cUser = { ENU: "Two page view: &Toggle Cover Page View", DEU: "Zweiseitenansicht: &Deckblatt umschalten" };
//
app.addMenuItem({
cName:"twaToggleCoverMen",
cUser:twa_addMenuItem_ToggleCover_cUser[_lang],
cParent:"View",
// nPos:"Rotate",
nPos:"PageLayout",
bPrepend:true,
cExec:"twaToggleCover()",
cEnable:"event.rc = app.doc != null"
});
///////
// User Interface: buttons in toolbar
//
// localization
var twa_addToolButton_ToggleCover_cTooltext = { ENU: "Toggles the cover page on or off in two page layout.", DEU: "Schaltet das Deckblatt in der Zweiseitenansicht an oder aus." };
var twa_addToolButton_ToggleCover_cLabel = { ENU: "Toggle Cover Page View", DEU: "Deckblatt-Ansicht umschalten" };
//
var strDataToggleCover = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5F5F5FFE6E6E6FFE6E6E6FFE6E6E6FFE6E6E6FFF5F5F5FFFFFFFFFFFFFFFFFFE4E4E4FFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFE4E4E4FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5F5F5FFB4B4B4FFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFFBFBFBFFF8F8F8FF595959FF595959FF595959FF595959FF595959FF737373FFABABABFFFFFFFFFFFFFFFFFFFFFFFFFFF5F5F5FFB4B4B4FFAEAEAEFFB1B1B1FFB1B1B1FFAEAEAEFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FF595959FF595959FF595959FF595959FF737373FFABABABFFFFFFFFFFF5F5F5FFB7B7B7FFAEAEAEFFCCCCCCFFCCCCCCFFAEAEAEFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFF595959FFABABABFFABABABFF595959FF737373FFE4E4E4FFB7B7B7FFAEAEAEFFCCCCCCFFF5F5F5FFCCCCCCFFAEAEAEFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFF595959FFABABABFFE4E4E4FFABABABFF595959FF737373FFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFF595959FF595959FF595959FF595959FF595959FF595959FFAEAEAEFFAEAEAEFFCCCCCCFFCCCCCCFFCCCCCCFFCCCCCCFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFFABABABFFABABABFFABABABFFABABABFF595959FF595959FFAEAEAEFFAEAEAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF595959FF595959FFAEAEAEFFAEAEAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFFFFFFFFFFABABABFF7F7F7FFFFFFFFFFF595959FF595959FFAEAEAEFFAEAEAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFF595959FF595959FF595959FFFFFFFFFF595959FF595959FFAEAEAEFFAEAEAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFEFEFEFFC5C5C5FF595959FF595959FFFFFFFFFF595959FF595959FFAEAEAEFFAEAEAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFFFFFFFFFF595959FF595959FFFFFFFFFF595959FF595959FFAEAEAEFFAEAEAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFFFFFFFFFF595959FF595959FFFFFFFFFF595959FF595959FFAEAEAEFFAEAEAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFFFFFFFFFF595959FF595959FFFFFFFFFF595959FF595959FFAEAEAEFFAEAEAEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF595959FF595959FFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFFAFAFAFFF5F5F5FF595959FF595959FF595959FF595959FF595959FF595959FF595959FF595959FF595959FFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFAEAEAEFFFDFDFDFFFCFCFCFF595959FF595959FF595959FF595959FF595959FF595959FF595959FF595959FF595959FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
var oIconToggleCover = null;
oIconToggleCover = {count: 0, width: 20, height: 20, read: function(nBytes){return strDataToggleCover.slice(this.count, this.count += nBytes);}};
try { app.removeToolButton("twaToggleCoverBtn"); } catch(e) {}
try {
app.addToolButton({
cName: "twaToggleCoverBtn",
cExec: "twaToggleCover()",
cEnable: "event.rc = (app.doc != null)",
cMarked: "event.rc = false",
cTooltext: twa_addToolButton_ToggleCover_cTooltext[_lang],
oIcon: oIconToggleCover,
nPos: 1,
cLabel: twa_addToolButton_ToggleCover_cLabel[_lang]
});
} catch(e) {}