This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
/
deco.overlaytriggers.js
70 lines (57 loc) · 2.33 KB
/
deco.overlaytriggers.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
/**
* This plugin is used to trigger the editing of tiles in an overlay
*
* @author Rob Gietema
* @licstart The following is the entire license notice for the JavaScript
* code in this page.
*
* Copyright (C) 2010 Plone Foundation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @licend The above is the entire license notice for the JavaScript code in
* this page.
* @version 0.1
*/
"use strict";
/*global tiledata: false, jQuery: false, window: false */
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true,
eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true,
immed: true, strict: true, maxlen: 80, maxerr: 9999 */
(function ($) {
// Init Deco on load
$(window).load(function () {
// Check if tiledata is available and valid
if (typeof(tiledata) !== 'undefined') {
// Check action
if (tiledata.action === 'cancel') {
// Close overlay
window.parent.frames['plone-toolbar'].jQuery.deco.overlay.close();
} else if (tiledata.action === 'save') {
// Check mode
if (tiledata.mode === 'add') {
// Check url
if (typeof(tiledata.url) !== 'undefined') {
// Insert app tile
window.parent.frames['plone-toolbar'].jQuery.deco.addAppTile(tiledata.tile_type,
tiledata.url, tiledata.id);
}
} else {
// Update app tile
window.parent.frames['plone-toolbar'].jQuery.deco.editAppTile(tiledata.url);
}
}
}
});
}(jQuery));