Skip to content

Commit 4b3985b

Browse files
committed
Merge branch 'develop' containing the new version for deployment
2 parents 57fdbac + ca19358 commit 4b3985b

6 files changed

Lines changed: 133 additions & 110 deletions

File tree

Code.gs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2015 University of Passau
1+
/* Copyright 2016 University of Passau
22
Licensed under the Apache License, Version 2.0 (the "License");
33
you may not use this file except in compliance with the License.
44
You may obtain a copy of the License at
@@ -42,6 +42,7 @@ function onInstall(e) {
4242
*/
4343
function showSidebar() {
4444
var ui = HtmlService.createTemplateFromFile('Sidebar').evaluate()
45+
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
4546
.setTitle('E-Explorer');
4647
DocumentApp.getUi().showSidebar(ui);
4748
}
@@ -52,7 +53,9 @@ function showSidebar() {
5253
* @return {string} The file's content.
5354
*/
5455
function include(file) {
55-
return HtmlService.createTemplateFromFile(file).evaluate().getContent();
56+
return HtmlService.createTemplateFromFile(file).evaluate()
57+
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
58+
.getContent();
5659
}
5760

5861
/**
@@ -194,8 +197,13 @@ var defaultMessages;
194197
*/
195198
function msg(key) {
196199
if (!messages){
197-
messages = JSON.parse(HtmlService.createTemplateFromFile('messages_' + getLocale()).evaluate().getContent());
198-
defaultMessages = JSON.parse(HtmlService.createTemplateFromFile('messages_' + DEFAULT_LOCALE).evaluate().getContent());
200+
messages = JSON.parse(
201+
HtmlService.createTemplateFromFile('messages_' + getLocale()).evaluate()
202+
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
203+
.getContent());
204+
defaultMessages = JSON.parse(HtmlService.createTemplateFromFile('messages_' + DEFAULT_LOCALE).evaluate()
205+
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
206+
.getContent());
199207
}
200208

201209
var msg = messages[key];

Help.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
![EEXCESS](http://eexcess.eu/wp-content/uploads/2013/04/eexcess_Logo_neu1.jpg "EEXCESS")
2+
3+
# Troubleshooting
4+
In case the menu only shows "E-Explorer->Help" and "Start" is missing, do the following:
5+
6+
- click on "Addons->Manage Add-ons"
7+
- Select E-Explorer and "Use in this document"
8+
- RELOAD the document in the browser

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ The add-on installation is tied to your Google Account, so it works in all your
2929
3. Select a piece of text or use the search bar to search for recommendations. After a short while the recommendations will be displayed in the sidebar.
3030
4. To submit multiple words as one keyword surround them with "
3131

32-
## Troubleshooting
33-
In case the menu only shows "E-Explorer->Help" and "Start" is missing, do the following:
34-
35-
- click on "Addons->Manage Add-ons"
36-
- Select E-Explorer and "Activate for this document"
37-
- RELOAD the document in the browser
38-
3932
## Source Code
4033

4134
The source code can be found (and edited) directly inside the browser. If you want to do this, you have to open the Script Editor (Top Menu: Tools -> Script Editor).

SearchResultList.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
// messages
1919
this._messages = $('<div id="messages"></div>');
20-
this._loader = $('<img id="ajax-loader" src="http://www.dimis.fim.uni-passau.de/eexcess/ajax-loader.gif" alt="<?!= msg('LOADING') ?>" />');
20+
this._loader = $('<img id="ajax-loader" src="https://www.dimis.fim.uni-passau.de/eexcess/ajax-loader.gif" alt="<?!= msg('LOADING') ?>" />');
2121
this._error = $('<span id="error-msg" class="error"></span>');
2222
this._info = $('<span id="info-msg"></span>');
2323

@@ -179,7 +179,7 @@
179179
// insert link buttons
180180
var insertAsLinkButton = $(
181181
'<div class="image-button">' +
182-
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_LINK') ?>" src="http://www.dimis.fim.uni-passau.de/eexcess/link.png">' +
182+
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_LINK') ?>" src="https://www.dimis.fim.uni-passau.de/eexcess/link.png">' +
183183
'</div>');
184184
insertAsLinkButton.data('displayName', title);
185185
insertAsLinkButton.data('documentBadge', item.documentBadge);
@@ -202,12 +202,12 @@
202202
if (typeof image === 'undefined' || image === '') {
203203
image = previewImageUrl + mediaType;
204204
} else { // add item to image gallery and insert button
205-
this._addImageToGallery(image, title, item.documentBadge);
205+
this._addImageToGallery(image, title, item.documentBadge, queryID);
206206

207207
// insert image button
208208
var insertImageButton = $(
209209
'<div class="image-button result-btn-insert-image">' +
210-
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_IMAGE') ?>" src="http://www.dimis.fim.uni-passau.de/eexcess/photo.png">' +
210+
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_IMAGE') ?>" src="https://www.dimis.fim.uni-passau.de/eexcess/photo.png">' +
211211
'</div>');
212212
insertImageButton.data('image', image);
213213
insertImageButton.data('documentBadge', item.documentBadge);
@@ -322,7 +322,7 @@
322322
* @param title recommendation's title
323323
* @param documentBadge recommendation's document badge
324324
*/
325-
SearchResultList.prototype._addImageToGallery = function(image, title, documentBadge) {
325+
SearchResultList.prototype._addImageToGallery = function(image, title, documentBadge, queryID) {
326326
var uri = documentBadge.uri;
327327
var div = $('<div class="gallery-item"></div>');
328328

@@ -349,7 +349,7 @@
349349
// add insert button
350350
var insertButton = $(
351351
'<div class="image-button gallery-btn-insert-image">' +
352-
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_IMAGE') ?>" src="http://www.dimis.fim.uni-passau.de/eexcess/photo.png">' +
352+
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_IMAGE') ?>" src="https://www.dimis.fim.uni-passau.de/eexcess/photo.png">' +
353353
'</div>');
354354
insertButton.data('image', image);
355355
insertButton.data('documentBadge', documentBadge);

SettingsDialog.html

Lines changed: 94 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,58 @@
1-
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css">
2-
<!-- The CSS package above applies Google styling to buttons and other elements. -->
3-
4-
<style>
5-
.settings-label {
6-
font-size: 1.1em;
7-
margin-bottom: 10px;
8-
}
9-
10-
#input-result-number {
11-
margin-right: 5px;
12-
width: 60px;
13-
}
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<base target="_top">
5+
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css">
6+
<!-- The CSS package above applies Google styling to buttons and other elements. -->
7+
8+
<style>
9+
.settings-label {
10+
font-size: 1.1em;
11+
margin-bottom: 10px;
12+
}
1413

15-
.provider-settings {
16-
position: absolute;
17-
top: 83px;
18-
right: 8px;
19-
left: 8px;
20-
width: auto;
21-
}
14+
#input-result-number {
15+
margin-right: 5px;
16+
width: 60px;
17+
}
2218

23-
#ajax-loader {
24-
width: 16px;
25-
height: 16px;
26-
margin-left: auto;
27-
margin-right: auto;
28-
display: block;
29-
padding: 10px;
30-
}
19+
.provider-settings {
20+
position: absolute;
21+
top: 83px;
22+
right: 8px;
23+
left: 8px;
24+
width: auto;
25+
}
3126

32-
#providers {
33-
position: absolute;
34-
top: 111px;
35-
bottom: 67px;
36-
overflow-y: auto;
37-
left: 8px;
38-
right: 8px;
39-
overflow-x: hidden;
40-
}
27+
#ajax-loader {
28+
width: 16px;
29+
height: 16px;
30+
margin-left: auto;
31+
margin-right: auto;
32+
display: block;
33+
padding: 10px;
34+
}
4135

42-
.settings-buttons {
43-
position: absolute;
44-
bottom: 8px;
45-
left: 8px;
46-
height: 29px;
47-
right: 8px;
48-
}
49-
</style>
36+
#providers {
37+
position: absolute;
38+
top: 111px;
39+
bottom: 67px;
40+
overflow-y: auto;
41+
left: 8px;
42+
right: 8px;
43+
overflow-x: hidden;
44+
}
5045

46+
.settings-buttons {
47+
position: absolute;
48+
bottom: 8px;
49+
left: 8px;
50+
height: 29px;
51+
right: 8px;
52+
}
53+
</style>
54+
</head>
55+
<body>
5156
<div class="modal-dialog-content script-prompt-contents">
5257
<div class="settings-label"><?!= msg('SETTINGS_RESULT_NUM') ?>:</div>
5358
<div>
@@ -57,7 +62,7 @@
5762

5863
<div class="settings-label provider-settings"><?!= msg('SETTINGS_PROVIDERS') ?>:</div>
5964
<div id="providers">
60-
<img id="ajax-loader" src="http://www.dimis.fim.uni-passau.de/eexcess/ajax-loader.gif" alt="<?!= msg('LOADING') ?>" />
65+
<img id="ajax-loader" src="https://www.dimis.fim.uni-passau.de/eexcess/ajax-loader.gif" alt="<?!= msg('LOADING') ?>" />
6166
</div>
6267
</div>
6368

@@ -75,46 +80,46 @@
7580
// load settings
7681
google.script.run
7782
.withSuccessHandler(
78-
function (settings) {
79-
try {
80-
settings = JSON.parse(settings);
81-
} catch (e) {
82-
settings = [];
83-
}
84-
85-
$('#ajax-loader').hide();
86-
87-
for (var i = 0; i < settings.length; i++) {
88-
var partner = settings[i];
89-
var div = $('<div></div>');
90-
91-
if (partner.active) {
92-
div.append('<input type="checkbox" id="checkbox' + i + '" checked>');
93-
} else {
94-
div.append('<input type="checkbox" id="checkbox' + i + '">');
95-
}
96-
97-
div.append('<label for="checkbox' + i + '">' + partner.name + '</label>');
98-
$('#providers').append(div);
99-
}
100-
})
83+
function (settings) {
84+
try {
85+
settings = JSON.parse(settings);
86+
} catch (e) {
87+
settings = [];
88+
}
89+
90+
$('#ajax-loader').hide();
91+
92+
for (var i = 0; i < settings.length; i++) {
93+
var partner = settings[i];
94+
var div = $('<div></div>');
95+
96+
if (partner.active) {
97+
div.append('<input type="checkbox" id="checkbox' + i + '" checked>');
98+
} else {
99+
div.append('<input type="checkbox" id="checkbox' + i + '">');
100+
}
101+
102+
div.append('<label for="checkbox' + i + '">' + partner.name + '</label>');
103+
$('#providers').append(div);
104+
}
105+
})
101106
.withFailureHandler(
102-
function (error) {
103-
// ignore errors
104-
alert(error); // TODO rm
105-
})
107+
function (error) {
108+
// ignore errors
109+
alert(error); // TODO rm
110+
})
106111
.getPartnerSettings();
107112

108113
google.script.run
109114
.withSuccessHandler(
110-
function (resultNumber) {
111-
$('#input-result-number').val(resultNumber);
112-
})
115+
function (resultNumber) {
116+
$('#input-result-number').val(resultNumber);
117+
})
113118
.withFailureHandler(
114-
function (error) {
115-
// ignore errors
116-
alert(error); // TODO rm
117-
})
119+
function (error) {
120+
// ignore errors
121+
alert(error); // TODO rm
122+
})
118123
.getResultNumber();
119124

120125
// store settings
@@ -147,13 +152,13 @@
147152
// make settings persistent on server
148153
google.script.run
149154
.withSuccessHandler(
150-
function () {
151-
google.script.host.close();
152-
})
155+
function () {
156+
google.script.host.close();
157+
})
153158
.withFailureHandler(
154-
function () {
155-
showError('<?!= msg('ERROR') ?>');
156-
})
159+
function () {
160+
showError('<?!= msg('ERROR') ?>');
161+
})
157162
.saveSettings(resultNumber, partnerSettings);
158163
}
159164

@@ -166,4 +171,6 @@
166171
function hideError() {
167172
$('#result-number-error').hide();
168173
}
169-
</script>
174+
</script>
175+
</body>
176+
</html>

Sidebar.html

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
<?!= include('Stylesheet') ?>
2-
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<base target="_top">
5+
<?!= include('Stylesheet') ?>
6+
</head>
7+
<body>
38
<div id="header" class="sidebar fixed-top">
49
<div id="search-container" class="form-group inline-form">
5-
<input id="eexcess-search" placeholder="Search" aria-label="<?!= msg('SEARCHBAR_SEARCH') ?>" type="text" />
10+
<input id="eexcess-search" placeholder="Search" aria-label="<?!= msg('SEARCHBAR_SEARCH') ?>" type="text"/>
611
<button class="action" id="btn-search"><?!= msg('SEARCHBAR_SEARCH') ?></button>
712
</div>
813
<div class="tab-container">
@@ -21,7 +26,7 @@
2126
</li>
2227
</ul>
2328
<div id="settings-button" class="image-button">
24-
<img title="<?!= msg('SETTINGS') ?>" src="http://www.dimis.fim.uni-passau.de/eexcess/settings.png">
29+
<img title="<?!= msg('SETTINGS') ?>" src="https://www.dimis.fim.uni-passau.de/eexcess/settings.png">
2530
</div>
2631
</div>
2732
</div>
@@ -32,7 +37,7 @@
3237
<div class="block"></div>
3338
<a href="http://eexcess.eu/" title="EEXCESS" target="_blank">
3439
<div class="branding-container">
35-
<img alt="Add-on logo" class="logo" src="http://dimis.fim.uni-passau.de/eexcess/eexcess_Logo_neu1.jpg">
40+
<img alt="Add-on logo" class="logo" src="https://www.dimis.fim.uni-passau.de/eexcess/eexcess_Logo_neu1.jpg">
3641
</div>
3742
<div class="branding-text">
3843
<span class="gray"><?!= msg('BRANDING_TEXT') ?></span>
@@ -41,4 +46,6 @@
4146
</div>
4247

4348
<?!= include('SearchResultList') ?>
44-
<?!= include('Scripts') ?>
49+
<?!= include('Scripts') ?>
50+
</body>
51+
</html>

0 commit comments

Comments
 (0)