lookbook 2.3.6 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lookbook/version.rb +1 -1
- data/public/lookbook-assets/css/lookbook.css +31 -37
- data/public/lookbook-assets/css/lookbook.css.map +1 -1
- data/public/lookbook-assets/css/themes/blue.css +0 -1
- data/public/lookbook-assets/css/themes/green.css +0 -1
- data/public/lookbook-assets/css/themes/indigo.css +0 -1
- data/public/lookbook-assets/css/themes/rose.css +0 -1
- data/public/lookbook-assets/css/themes/zinc.css +0 -1
- data/public/lookbook-assets/js/iframe.js +193 -193
- data/public/lookbook-assets/js/index.js +821 -821
- data/public/lookbook-assets/js/index.js.map +1 -1
- data/public/lookbook-assets/js/lookbook-core.js +0 -37
- data/public/lookbook-assets/js/lookbook.js +252 -289
- metadata +2 -378
- data/assets/icons/activity-square.svg +0 -1
- data/assets/icons/ampersand.svg +0 -1
- data/assets/icons/ampersands.svg +0 -1
- data/assets/icons/antenna.svg +0 -1
- data/assets/icons/app-window.svg +0 -1
- data/assets/icons/archive-x.svg +0 -1
- data/assets/icons/area-chart.svg +0 -1
- data/assets/icons/arrow-big-down-dash.svg +0 -1
- data/assets/icons/arrow-big-left-dash.svg +0 -1
- data/assets/icons/arrow-big-right-dash.svg +0 -1
- data/assets/icons/arrow-big-up-dash.svg +0 -1
- data/assets/icons/arrow-down-0-1.svg +0 -1
- data/assets/icons/arrow-down-1-0.svg +0 -1
- data/assets/icons/arrow-down-a-z.svg +0 -1
- data/assets/icons/arrow-down-from-line.svg +0 -1
- data/assets/icons/arrow-down-left-from-circle.svg +0 -1
- data/assets/icons/arrow-down-left-square.svg +0 -1
- data/assets/icons/arrow-down-narrow-wide.svg +0 -1
- data/assets/icons/arrow-down-right-from-circle.svg +0 -1
- data/assets/icons/arrow-down-right-square.svg +0 -1
- data/assets/icons/arrow-down-square.svg +0 -1
- data/assets/icons/arrow-down-to-dot.svg +0 -1
- data/assets/icons/arrow-down-to-line.svg +0 -1
- data/assets/icons/arrow-down-up.svg +0 -1
- data/assets/icons/arrow-down-wide-narrow.svg +0 -1
- data/assets/icons/arrow-down-z-a.svg +0 -1
- data/assets/icons/arrow-left-from-line.svg +0 -1
- data/assets/icons/arrow-left-square.svg +0 -1
- data/assets/icons/arrow-left-to-line.svg +0 -1
- data/assets/icons/arrow-right-from-line.svg +0 -1
- data/assets/icons/arrow-right-left.svg +0 -1
- data/assets/icons/arrow-right-square.svg +0 -1
- data/assets/icons/arrow-right-to-line.svg +0 -1
- data/assets/icons/arrow-up-0-1.svg +0 -1
- data/assets/icons/arrow-up-1-0.svg +0 -1
- data/assets/icons/arrow-up-a-z.svg +0 -1
- data/assets/icons/arrow-up-from-dot.svg +0 -1
- data/assets/icons/arrow-up-from-line.svg +0 -1
- data/assets/icons/arrow-up-left-from-circle.svg +0 -1
- data/assets/icons/arrow-up-left-square.svg +0 -1
- data/assets/icons/arrow-up-narrow-wide.svg +0 -1
- data/assets/icons/arrow-up-right-from-circle.svg +0 -1
- data/assets/icons/arrow-up-right-square.svg +0 -1
- data/assets/icons/arrow-up-square.svg +0 -1
- data/assets/icons/arrow-up-to-line.svg +0 -1
- data/assets/icons/arrow-up-wide-narrow.svg +0 -1
- data/assets/icons/arrow-up-z-a.svg +0 -1
- data/assets/icons/arrows-up-from-line.svg +0 -1
- data/assets/icons/atom.svg +0 -1
- data/assets/icons/badge-alert.svg +0 -1
- data/assets/icons/badge-cent.svg +0 -1
- data/assets/icons/badge-check.svg +0 -1
- data/assets/icons/badge-dollar-sign.svg +0 -1
- data/assets/icons/badge-euro.svg +0 -1
- data/assets/icons/badge-help.svg +0 -1
- data/assets/icons/badge-indian-rupee.svg +0 -1
- data/assets/icons/badge-info.svg +0 -1
- data/assets/icons/badge-japanese-yen.svg +0 -1
- data/assets/icons/badge-minus.svg +0 -1
- data/assets/icons/badge-percent.svg +0 -1
- data/assets/icons/badge-plus.svg +0 -1
- data/assets/icons/badge-pound-sterling.svg +0 -1
- data/assets/icons/badge-russian-ruble.svg +0 -1
- data/assets/icons/badge-swiss-franc.svg +0 -1
- data/assets/icons/badge-x.svg +0 -1
- data/assets/icons/badge.svg +0 -1
- data/assets/icons/ban.svg +0 -1
- data/assets/icons/bar-chart-big.svg +0 -1
- data/assets/icons/bar-chart-horizontal-big.svg +0 -1
- data/assets/icons/bell-dot.svg +0 -1
- data/assets/icons/biohazard.svg +0 -1
- data/assets/icons/blocks.svg +0 -1
- data/assets/icons/book-copy.svg +0 -1
- data/assets/icons/book-down.svg +0 -1
- data/assets/icons/book-key.svg +0 -1
- data/assets/icons/book-lock.svg +0 -1
- data/assets/icons/book-marked.svg +0 -1
- data/assets/icons/book-minus.svg +0 -1
- data/assets/icons/book-plus.svg +0 -1
- data/assets/icons/book-template.svg +0 -1
- data/assets/icons/book-up-2.svg +0 -1
- data/assets/icons/book-up.svg +0 -1
- data/assets/icons/book-x.svg +0 -1
- data/assets/icons/bookmark-check.svg +0 -1
- data/assets/icons/bookmark-x.svg +0 -1
- data/assets/icons/boom-box.svg +0 -1
- data/assets/icons/braces.svg +0 -1
- data/assets/icons/brackets.svg +0 -1
- data/assets/icons/brain-circuit.svg +0 -1
- data/assets/icons/brain-cog.svg +0 -1
- data/assets/icons/brain.svg +0 -1
- data/assets/icons/bring-to-front.svg +0 -1
- data/assets/icons/bug-off.svg +0 -1
- data/assets/icons/bug-play.svg +0 -1
- data/assets/icons/bus-front.svg +0 -1
- data/assets/icons/cable-car.svg +0 -1
- data/assets/icons/cable.svg +0 -1
- data/assets/icons/cake-slice.svg +0 -1
- data/assets/icons/candlestick-chart.svg +0 -1
- data/assets/icons/candy-cane.svg +0 -1
- data/assets/icons/car-front.svg +0 -1
- data/assets/icons/car-taxi-front.svg +0 -1
- data/assets/icons/case-lower.svg +0 -1
- data/assets/icons/case-sensitive.svg +0 -1
- data/assets/icons/case-upper.svg +0 -1
- data/assets/icons/cassette-tape.svg +0 -1
- data/assets/icons/castle.svg +0 -1
- data/assets/icons/chevron-down-circle.svg +0 -1
- data/assets/icons/chevron-down-square.svg +0 -1
- data/assets/icons/chevron-left-circle.svg +0 -1
- data/assets/icons/chevron-left-square.svg +0 -1
- data/assets/icons/chevron-right-circle.svg +0 -1
- data/assets/icons/chevron-right-square.svg +0 -1
- data/assets/icons/chevron-up-circle.svg +0 -1
- data/assets/icons/chevron-up-square.svg +0 -1
- data/assets/icons/church.svg +0 -1
- data/assets/icons/circle-dashed.svg +0 -1
- data/assets/icons/circle-dollar-sign.svg +0 -1
- data/assets/icons/circle-dot-dashed.svg +0 -1
- data/assets/icons/circle-equal.svg +0 -1
- data/assets/icons/circle-off.svg +0 -1
- data/assets/icons/circle-slash-2.svg +0 -1
- data/assets/icons/circle-slash.svg +0 -1
- data/assets/icons/circuit-board.svg +0 -1
- data/assets/icons/clipboard-paste.svg +0 -1
- data/assets/icons/club.svg +0 -1
- data/assets/icons/combine.svg +0 -1
- data/assets/icons/computer.svg +0 -1
- data/assets/icons/contact-2.svg +0 -1
- data/assets/icons/container.svg +0 -1
- data/assets/icons/copy-check.svg +0 -1
- data/assets/icons/copy-minus.svg +0 -1
- data/assets/icons/copy-plus.svg +0 -1
- data/assets/icons/copy-slash.svg +0 -1
- data/assets/icons/copy-x.svg +0 -1
- data/assets/icons/database-zap.svg +0 -1
- data/assets/icons/dessert.svg +0 -1
- data/assets/icons/disc-2.svg +0 -1
- data/assets/icons/disc-3.svg +0 -1
- data/assets/icons/donut.svg +0 -1
- data/assets/icons/door-closed.svg +0 -1
- data/assets/icons/door-open.svg +0 -1
- data/assets/icons/dot.svg +0 -1
- data/assets/icons/drama.svg +0 -1
- data/assets/icons/ferris-wheel.svg +0 -1
- data/assets/icons/file-code-2.svg +0 -1
- data/assets/icons/file-stack.svg +0 -1
- data/assets/icons/fish-symbol.svg +0 -1
- data/assets/icons/fold-horizontal.svg +0 -1
- data/assets/icons/fold-vertical.svg +0 -1
- data/assets/icons/folder-dot.svg +0 -1
- data/assets/icons/folder-git-2.svg +0 -1
- data/assets/icons/folder-git.svg +0 -1
- data/assets/icons/folder-kanban.svg +0 -1
- data/assets/icons/folder-open-dot.svg +0 -1
- data/assets/icons/folder-root.svg +0 -1
- data/assets/icons/folder-sync.svg +0 -1
- data/assets/icons/gallery-horizontal-end.svg +0 -1
- data/assets/icons/gallery-horizontal.svg +0 -1
- data/assets/icons/gallery-thumbnails.svg +0 -1
- data/assets/icons/gallery-vertical-end.svg +0 -1
- data/assets/icons/gallery-vertical.svg +0 -1
- data/assets/icons/gantt-chart-square.svg +0 -1
- data/assets/icons/gantt-chart.svg +0 -1
- data/assets/icons/gauge-circle.svg +0 -1
- data/assets/icons/goal.svg +0 -1
- data/assets/icons/grid-2x2.svg +0 -1
- data/assets/icons/grid-3x3.svg +0 -1
- data/assets/icons/group.svg +0 -1
- data/assets/icons/hard-drive-download.svg +0 -1
- data/assets/icons/hard-drive-upload.svg +0 -1
- data/assets/icons/hdmi-port.svg +0 -1
- data/assets/icons/hotel.svg +0 -1
- data/assets/icons/iteration-ccw.svg +0 -1
- data/assets/icons/iteration-cw.svg +0 -1
- data/assets/icons/kanban-square-dashed.svg +0 -1
- data/assets/icons/kanban-square.svg +0 -1
- data/assets/icons/kanban.svg +0 -1
- data/assets/icons/key-round.svg +0 -1
- data/assets/icons/key-square.svg +0 -1
- data/assets/icons/layout-panel-left.svg +0 -1
- data/assets/icons/layout-panel-top.svg +0 -1
- data/assets/icons/leafy-green.svg +0 -1
- data/assets/icons/ligature.svg +0 -1
- data/assets/icons/list-filter.svg +0 -1
- data/assets/icons/list-restart.svg +0 -1
- data/assets/icons/list-todo.svg +0 -1
- data/assets/icons/list-tree.svg +0 -1
- data/assets/icons/lollipop.svg +0 -1
- data/assets/icons/m-square.svg +0 -1
- data/assets/icons/mailbox.svg +0 -1
- data/assets/icons/memory-stick.svg +0 -1
- data/assets/icons/menu-square.svg +0 -1
- data/assets/icons/merge.svg +0 -1
- data/assets/icons/message-square-dashed.svg +0 -1
- data/assets/icons/message-square-plus.svg +0 -1
- data/assets/icons/messages-square.svg +0 -1
- data/assets/icons/monitor-check.svg +0 -1
- data/assets/icons/monitor-dot.svg +0 -1
- data/assets/icons/monitor-down.svg +0 -1
- data/assets/icons/monitor-pause.svg +0 -1
- data/assets/icons/monitor-play.svg +0 -1
- data/assets/icons/monitor-stop.svg +0 -1
- data/assets/icons/monitor-up.svg +0 -1
- data/assets/icons/monitor-x.svg +0 -1
- data/assets/icons/moon-star.svg +0 -1
- data/assets/icons/mouse-pointer-square-dashed.svg +0 -1
- data/assets/icons/mouse-pointer-square.svg +0 -1
- data/assets/icons/move-down-left.svg +0 -1
- data/assets/icons/move-down-right.svg +0 -1
- data/assets/icons/move-down.svg +0 -1
- data/assets/icons/move-left.svg +0 -1
- data/assets/icons/move-right.svg +0 -1
- data/assets/icons/move-up-left.svg +0 -1
- data/assets/icons/move-up-right.svg +0 -1
- data/assets/icons/move-up.svg +0 -1
- data/assets/icons/orbit.svg +0 -1
- data/assets/icons/panel-bottom-close.svg +0 -1
- data/assets/icons/panel-bottom-inactive.svg +0 -1
- data/assets/icons/panel-bottom-open.svg +0 -1
- data/assets/icons/panel-bottom.svg +0 -1
- data/assets/icons/panel-left-close.svg +0 -1
- data/assets/icons/panel-left-inactive.svg +0 -1
- data/assets/icons/panel-left-open.svg +0 -1
- data/assets/icons/panel-left.svg +0 -1
- data/assets/icons/panel-right-close.svg +0 -1
- data/assets/icons/panel-right-inactive.svg +0 -1
- data/assets/icons/panel-right-open.svg +0 -1
- data/assets/icons/panel-right.svg +0 -1
- data/assets/icons/panel-top-close.svg +0 -1
- data/assets/icons/panel-top-inactive.svg +0 -1
- data/assets/icons/panel-top-open.svg +0 -1
- data/assets/icons/panel-top.svg +0 -1
- data/assets/icons/parentheses.svg +0 -1
- data/assets/icons/parking-circle-off.svg +0 -1
- data/assets/icons/parking-circle.svg +0 -1
- data/assets/icons/parking-meter.svg +0 -1
- data/assets/icons/parking-square-off.svg +0 -1
- data/assets/icons/parking-square.svg +0 -1
- data/assets/icons/paw-print.svg +0 -1
- data/assets/icons/pc-case.svg +0 -1
- data/assets/icons/pen-line.svg +0 -1
- data/assets/icons/pen-square.svg +0 -1
- data/assets/icons/pen.svg +0 -1
- data/assets/icons/pencil-line.svg +0 -1
- data/assets/icons/pencil-ruler.svg +0 -1
- data/assets/icons/percent-circle.svg +0 -1
- data/assets/icons/percent-diamond.svg +0 -1
- data/assets/icons/percent-square.svg +0 -1
- data/assets/icons/pi-square.svg +0 -1
- data/assets/icons/pi.svg +0 -1
- data/assets/icons/pilcrow-square.svg +0 -1
- data/assets/icons/plane-landing.svg +0 -1
- data/assets/icons/plane-takeoff.svg +0 -1
- data/assets/icons/play-square.svg +0 -1
- data/assets/icons/plug-zap-2.svg +0 -1
- data/assets/icons/pocket-knife.svg +0 -1
- data/assets/icons/popcorn.svg +0 -1
- data/assets/icons/popsicle.svg +0 -1
- data/assets/icons/presentation.svg +0 -1
- data/assets/icons/projector.svg +0 -1
- data/assets/icons/rabbit.svg +0 -1
- data/assets/icons/radar.svg +0 -1
- data/assets/icons/radiation.svg +0 -1
- data/assets/icons/radio-tower.svg +0 -1
- data/assets/icons/rail-symbol.svg +0 -1
- data/assets/icons/rainbow.svg +0 -1
- data/assets/icons/rat.svg +0 -1
- data/assets/icons/ratio.svg +0 -1
- data/assets/icons/receipt.svg +0 -1
- data/assets/icons/redo-dot.svg +0 -1
- data/assets/icons/refresh-ccw-dot.svg +0 -1
- data/assets/icons/refresh-cw-off.svg +0 -1
- data/assets/icons/repeat-2.svg +0 -1
- data/assets/icons/replace-all.svg +0 -1
- data/assets/icons/replace.svg +0 -1
- data/assets/icons/roller-coaster.svg +0 -1
- data/assets/icons/rows.svg +0 -1
- data/assets/icons/satellite-dish.svg +0 -1
- data/assets/icons/satellite.svg +0 -1
- data/assets/icons/save-all.svg +0 -1
- data/assets/icons/scatter-chart.svg +0 -1
- data/assets/icons/school-2.svg +0 -1
- data/assets/icons/school.svg +0 -1
- data/assets/icons/scissors-line-dashed.svg +0 -1
- data/assets/icons/scissors-square-dashed-bottom.svg +0 -1
- data/assets/icons/scissors-square.svg +0 -1
- data/assets/icons/scroll-text.svg +0 -1
- data/assets/icons/search-check.svg +0 -1
- data/assets/icons/search-code.svg +0 -1
- data/assets/icons/search-slash.svg +0 -1
- data/assets/icons/search-x.svg +0 -1
- data/assets/icons/send-horizontal.svg +0 -1
- data/assets/icons/send-to-back.svg +0 -1
- data/assets/icons/shapes.svg +0 -1
- data/assets/icons/shell.svg +0 -1
- data/assets/icons/shield-ban.svg +0 -1
- data/assets/icons/shield-ellipsis.svg +0 -1
- data/assets/icons/shield-half.svg +0 -1
- data/assets/icons/shield-minus.svg +0 -1
- data/assets/icons/shield-plus.svg +0 -1
- data/assets/icons/shield-question.svg +0 -1
- data/assets/icons/shield-x.svg +0 -1
- data/assets/icons/ship-wheel.svg +0 -1
- data/assets/icons/shopping-basket.svg +0 -1
- data/assets/icons/sigma-square.svg +0 -1
- data/assets/icons/snail.svg +0 -1
- data/assets/icons/space.svg +0 -1
- data/assets/icons/spade.svg +0 -1
- data/assets/icons/sparkle.svg +0 -1
- data/assets/icons/sparkles.svg +0 -1
- data/assets/icons/speech.svg +0 -1
- data/assets/icons/spell-check-2.svg +0 -1
- data/assets/icons/spell-check.svg +0 -1
- data/assets/icons/split.svg +0 -1
- data/assets/icons/spray-can.svg +0 -1
- data/assets/icons/square-asterisk.svg +0 -1
- data/assets/icons/square-code.svg +0 -1
- data/assets/icons/square-dashed-bottom-code.svg +0 -1
- data/assets/icons/square-dashed-bottom.svg +0 -1
- data/assets/icons/square-dot.svg +0 -1
- data/assets/icons/square-equal.svg +0 -1
- data/assets/icons/square-slash.svg +0 -1
- data/assets/icons/square-stack.svg +0 -1
- data/assets/icons/squirrel.svg +0 -1
- data/assets/icons/step-back.svg +0 -1
- data/assets/icons/step-forward.svg +0 -1
- data/assets/icons/store.svg +0 -1
- data/assets/icons/table-properties.svg +0 -1
- data/assets/icons/tablet-smartphone.svg +0 -1
- data/assets/icons/tally-1.svg +0 -1
- data/assets/icons/tally-2.svg +0 -1
- data/assets/icons/tally-3.svg +0 -1
- data/assets/icons/tally-4.svg +0 -1
- data/assets/icons/tally-5.svg +0 -1
- data/assets/icons/test-tube-2.svg +0 -1
- data/assets/icons/test-tube.svg +0 -1
- data/assets/icons/test-tubes.svg +0 -1
- data/assets/icons/text-quote.svg +0 -1
- data/assets/icons/text-select.svg +0 -1
- data/assets/icons/text.svg +0 -1
- data/assets/icons/theater.svg +0 -1
- data/assets/icons/touchpad-off.svg +0 -1
- data/assets/icons/touchpad.svg +0 -1
- data/assets/icons/tractor.svg +0 -1
- data/assets/icons/traffic-cone.svg +0 -1
- data/assets/icons/train-front-tunnel.svg +0 -1
- data/assets/icons/train-front.svg +0 -1
- data/assets/icons/train-track.svg +0 -1
- data/assets/icons/tram-front.svg +0 -1
- data/assets/icons/triangle-right.svg +0 -1
- data/assets/icons/turtle.svg +0 -1
- data/assets/icons/undo-dot.svg +0 -1
- data/assets/icons/unfold-horizontal.svg +0 -1
- data/assets/icons/unfold-vertical.svg +0 -1
- data/assets/icons/ungroup.svg +0 -1
- data/assets/icons/unplug.svg +0 -1
- data/assets/icons/user-2.svg +0 -1
- data/assets/icons/user-check-2.svg +0 -1
- data/assets/icons/user-circle-2.svg +0 -1
- data/assets/icons/user-circle.svg +0 -1
- data/assets/icons/user-cog-2.svg +0 -1
- data/assets/icons/user-minus-2.svg +0 -1
- data/assets/icons/user-plus-2.svg +0 -1
- data/assets/icons/user-square-2.svg +0 -1
- data/assets/icons/user-square.svg +0 -1
- data/assets/icons/user-x-2.svg +0 -1
- data/assets/icons/users-2.svg +0 -1
- data/assets/icons/variable.svg +0 -1
- data/assets/icons/videotape.svg +0 -1
- data/assets/icons/wallet-2.svg +0 -1
- data/assets/icons/wallet-cards.svg +0 -1
- data/assets/icons/wallpaper.svg +0 -1
- data/assets/icons/warehouse.svg +0 -1
- data/assets/icons/whole-word.svg +0 -1
- data/assets/icons/workflow.svg +0 -1
@@ -1,124 +1,4 @@
|
|
1
1
|
(() => {
|
2
|
-
|
3
|
-
var $parcel$global = globalThis;
|
4
|
-
|
5
|
-
var $parcel$modules = {};
|
6
|
-
var $parcel$inits = {};
|
7
|
-
|
8
|
-
var parcelRequire = $parcel$global["parcelRequirea49c"];
|
9
|
-
|
10
|
-
if (parcelRequire == null) {
|
11
|
-
parcelRequire = function(id) {
|
12
|
-
if (id in $parcel$modules) {
|
13
|
-
return $parcel$modules[id].exports;
|
14
|
-
}
|
15
|
-
if (id in $parcel$inits) {
|
16
|
-
var init = $parcel$inits[id];
|
17
|
-
delete $parcel$inits[id];
|
18
|
-
var module = {id: id, exports: {}};
|
19
|
-
$parcel$modules[id] = module;
|
20
|
-
init.call(module.exports, module, module.exports);
|
21
|
-
return module.exports;
|
22
|
-
}
|
23
|
-
var err = new Error("Cannot find module '" + id + "'");
|
24
|
-
err.code = 'MODULE_NOT_FOUND';
|
25
|
-
throw err;
|
26
|
-
};
|
27
|
-
|
28
|
-
parcelRequire.register = function register(id, init) {
|
29
|
-
$parcel$inits[id] = init;
|
30
|
-
};
|
31
|
-
|
32
|
-
$parcel$global["parcelRequirea49c"] = parcelRequire;
|
33
|
-
}
|
34
|
-
|
35
|
-
var parcelRegister = parcelRequire.register;
|
36
|
-
parcelRegister("6RQZy", function(module, exports) {
|
37
|
-
window.Lookbook = window.Lookbook || {};
|
38
|
-
window.Lookbook.initEmbeds = $5000cc5d1e9e824a$var$initEmbeds;
|
39
|
-
const $5000cc5d1e9e824a$var$embedUrlPrefix = "embed";
|
40
|
-
const $5000cc5d1e9e824a$var$whiteListedAttributes = [
|
41
|
-
"preview",
|
42
|
-
"scenario",
|
43
|
-
"panels",
|
44
|
-
"actions",
|
45
|
-
"param-*"
|
46
|
-
];
|
47
|
-
function $5000cc5d1e9e824a$var$initEmbeds(root = document) {
|
48
|
-
if (typeof window.iFrameResize !== "function") {
|
49
|
-
console.error("Lookbook embeds require the 'iframe-resizer' library to be available. Skipping embed instantiation.");
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
if (typeof root === "string") root = document.querySelector(root);
|
53
|
-
if (!root) return console.error("Could not initialize Lookbook embeds. Root node not found.");
|
54
|
-
const embeds = Array.from(root.querySelectorAll("lookbook-embed"));
|
55
|
-
embeds.forEach((embed)=>{
|
56
|
-
const attrs = Array.from(embed.attributes);
|
57
|
-
const wrapper = $5000cc5d1e9e824a$var$createWrapper();
|
58
|
-
const iframe = $5000cc5d1e9e824a$var$createIframe(attrs);
|
59
|
-
wrapper.appendChild(iframe);
|
60
|
-
embed.replaceWith(wrapper);
|
61
|
-
});
|
62
|
-
window.iFrameResize({
|
63
|
-
checkOrigin: false
|
64
|
-
}, "[data-lookbook-embed-iframe]");
|
65
|
-
}
|
66
|
-
function $5000cc5d1e9e824a$var$createWrapper() {
|
67
|
-
const wrapper = document.createElement("div");
|
68
|
-
wrapper.setAttribute("data-lookbook-embed", "");
|
69
|
-
wrapper.classList.add("lookbook-embed");
|
70
|
-
return wrapper;
|
71
|
-
}
|
72
|
-
function $5000cc5d1e9e824a$var$createIframe(attrs) {
|
73
|
-
const src = $5000cc5d1e9e824a$var$buildSrc(attrs);
|
74
|
-
const id = $5000cc5d1e9e824a$var$attrValue(attrs, "id");
|
75
|
-
const styles = $5000cc5d1e9e824a$var$attrValue(attrs, "style");
|
76
|
-
const classes = $5000cc5d1e9e824a$var$attrValue(attrs, "class", "").split(" ").map((c)=>c.trim()).filter((c)=>c.length);
|
77
|
-
const iframe = document.createElement("iframe");
|
78
|
-
iframe.src = src;
|
79
|
-
if (id) iframe.id = id;
|
80
|
-
iframe.setAttribute("frameborder", 0);
|
81
|
-
iframe.setAttribute("data-lookbook-embed-iframe", "");
|
82
|
-
if (classes.length) iframe.classList.add(...classes);
|
83
|
-
if (styles) iframe.style.cssText = styles;
|
84
|
-
iframe.style.width = "100%";
|
85
|
-
iframe.style.transition = "height 0.3s";
|
86
|
-
return iframe;
|
87
|
-
}
|
88
|
-
function $5000cc5d1e9e824a$var$buildSrc(attrs) {
|
89
|
-
const appPath = $5000cc5d1e9e824a$var$attrValue(attrs, "app") || $5000cc5d1e9e824a$var$guessBasePath();
|
90
|
-
const props = {};
|
91
|
-
$5000cc5d1e9e824a$var$permittedAttrs(attrs).forEach(({ name: name, value: value })=>{
|
92
|
-
name = name.replace("-", "_").toLowerCase();
|
93
|
-
props[name] = value;
|
94
|
-
});
|
95
|
-
return encodeURI([
|
96
|
-
appPath,
|
97
|
-
$5000cc5d1e9e824a$var$embedUrlPrefix
|
98
|
-
].join("/") + `?props=${JSON.stringify(props)}`);
|
99
|
-
}
|
100
|
-
function $5000cc5d1e9e824a$var$attrValue(attrs, name, fallback = null) {
|
101
|
-
const attr = attrs.find((attr)=>attr.name === name);
|
102
|
-
return attr ? attr.value : fallback;
|
103
|
-
}
|
104
|
-
function $5000cc5d1e9e824a$var$permittedAttrs(attrs) {
|
105
|
-
return attrs.filter((attr)=>{
|
106
|
-
return $5000cc5d1e9e824a$var$whiteListedAttributes.find((key)=>{
|
107
|
-
const name = attr.name;
|
108
|
-
return key === name || key.includes("*") && name.startsWith(key.replace("*", ""));
|
109
|
-
});
|
110
|
-
});
|
111
|
-
}
|
112
|
-
function $5000cc5d1e9e824a$var$guessBasePath() {
|
113
|
-
const script = document.currentScript || document.querySelector('script[src*="lookbook.js"]');
|
114
|
-
const scriptSrc = script.src;
|
115
|
-
if (scriptSrc && scriptSrc.includes("lookbook-assets")) return scriptSrc.split("?")[0].replace("lookbook-assets/js/lookbook.js", "lookbook");
|
116
|
-
return `//${location.host}/lookbook`;
|
117
|
-
}
|
118
|
-
document.addEventListener("DOMContentLoaded", ()=>$5000cc5d1e9e824a$var$initEmbeds());
|
119
|
-
|
120
|
-
});
|
121
|
-
|
122
2
|
var $5180433265c858be$exports = {};
|
123
3
|
/*
|
124
4
|
* File: iframeResizer.js
|
@@ -130,8 +10,8 @@ var $5180433265c858be$exports = {};
|
|
130
10
|
* Contributor: Reed Dadoune - reed@dadoune.com
|
131
11
|
*/ // eslint-disable-next-line sonarjs/cognitive-complexity, no-shadow-restricted-names
|
132
12
|
(function(undefined) {
|
133
|
-
if (typeof window ===
|
134
|
-
var count = 0, logEnabled = false, hiddenCheckEnabled = false, msgHeader =
|
13
|
+
if (typeof window === 'undefined') return; // don't run for server side render
|
14
|
+
var count = 0, logEnabled = false, hiddenCheckEnabled = false, msgHeader = 'message', msgHeaderLen = msgHeader.length, msgId = '[iFrameSizer]', msgIdLen = msgId.length, pagePosition = null, requestAnimationFrame = window.requestAnimationFrame, resetRequiredMethods = Object.freeze({
|
135
15
|
max: 1,
|
136
16
|
scroll: 1,
|
137
17
|
bodyScroll: 1,
|
@@ -145,8 +25,8 @@ var $5180433265c858be$exports = {};
|
|
145
25
|
checkOrigin: true,
|
146
26
|
inPageLinks: false,
|
147
27
|
enablePublicMethods: true,
|
148
|
-
heightCalculationMethod:
|
149
|
-
id:
|
28
|
+
heightCalculationMethod: 'bodyOffset',
|
29
|
+
id: 'iFrameResizer',
|
150
30
|
interval: 32,
|
151
31
|
log: false,
|
152
32
|
maxHeight: Infinity,
|
@@ -154,20 +34,20 @@ var $5180433265c858be$exports = {};
|
|
154
34
|
minHeight: 0,
|
155
35
|
minWidth: 0,
|
156
36
|
mouseEvents: true,
|
157
|
-
resizeFrom:
|
37
|
+
resizeFrom: 'parent',
|
158
38
|
scrolling: false,
|
159
39
|
sizeHeight: true,
|
160
40
|
sizeWidth: false,
|
161
41
|
warningTimeout: 5000,
|
162
42
|
tolerance: 0,
|
163
|
-
widthCalculationMethod:
|
43
|
+
widthCalculationMethod: 'scroll',
|
164
44
|
onClose: function() {
|
165
45
|
return true;
|
166
46
|
},
|
167
47
|
onClosed: function() {},
|
168
48
|
onInit: function() {},
|
169
49
|
onMessage: function() {
|
170
|
-
warn(
|
50
|
+
warn('onMessage function not defined');
|
171
51
|
},
|
172
52
|
onMouseEnter: function() {},
|
173
53
|
onMouseLeave: function() {},
|
@@ -187,42 +67,42 @@ var $5180433265c858be$exports = {};
|
|
187
67
|
}
|
188
68
|
function setupRequestAnimationFrame() {
|
189
69
|
var vendors = [
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
70
|
+
'moz',
|
71
|
+
'webkit',
|
72
|
+
'o',
|
73
|
+
'ms'
|
194
74
|
];
|
195
75
|
var x;
|
196
76
|
// Remove vendor prefixing if prefixed and break early if not
|
197
|
-
for(x = 0; x < vendors.length && !requestAnimationFrame; x += 1)requestAnimationFrame = window[vendors[x] +
|
77
|
+
for(x = 0; x < vendors.length && !requestAnimationFrame; x += 1)requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
198
78
|
if (requestAnimationFrame) // Firefox extension content-scripts have a globalThis object that is not the same as window.
|
199
79
|
// Binding `requestAnimationFrame` to window allows the function to work and prevents errors
|
200
80
|
// being thrown when run in that context, and should be a no-op in every other context.
|
201
81
|
requestAnimationFrame = requestAnimationFrame.bind(window);
|
202
|
-
else log(
|
82
|
+
else log('setup', 'RequestAnimationFrame not supported');
|
203
83
|
}
|
204
84
|
function getMyID(iframeId) {
|
205
|
-
var retStr =
|
206
|
-
if (window.top !== window.self) retStr = window.parentIFrame && window.parentIFrame.getId ? window.parentIFrame.getId() +
|
85
|
+
var retStr = 'Host page: ' + iframeId;
|
86
|
+
if (window.top !== window.self) retStr = window.parentIFrame && window.parentIFrame.getId ? window.parentIFrame.getId() + ': ' + iframeId : 'Nested host page: ' + iframeId;
|
207
87
|
return retStr;
|
208
88
|
}
|
209
89
|
function formatLogHeader(iframeId) {
|
210
|
-
return msgId +
|
90
|
+
return msgId + '[' + getMyID(iframeId) + ']';
|
211
91
|
}
|
212
92
|
function isLogEnabled(iframeId) {
|
213
93
|
return settings[iframeId] ? settings[iframeId].log : logEnabled;
|
214
94
|
}
|
215
95
|
function log(iframeId, msg) {
|
216
|
-
output(
|
96
|
+
output('log', iframeId, msg, isLogEnabled(iframeId));
|
217
97
|
}
|
218
98
|
function info(iframeId, msg) {
|
219
|
-
output(
|
99
|
+
output('info', iframeId, msg, isLogEnabled(iframeId));
|
220
100
|
}
|
221
101
|
function warn(iframeId, msg) {
|
222
|
-
output(
|
102
|
+
output('warn', iframeId, msg, true);
|
223
103
|
}
|
224
104
|
function output(type, iframeId, msg, enabled) {
|
225
|
-
if (true === enabled &&
|
105
|
+
if (true === enabled && 'object' === typeof window.console) // eslint-disable-next-line no-console
|
226
106
|
console[type](formatLogHeader(iframeId), msg);
|
227
107
|
}
|
228
108
|
function iFrameListener(event) {
|
@@ -230,14 +110,14 @@ var $5180433265c858be$exports = {};
|
|
230
110
|
function resize() {
|
231
111
|
setSize(messageData);
|
232
112
|
setPagePosition(iframeId);
|
233
|
-
on(
|
113
|
+
on('onResized', messageData);
|
234
114
|
}
|
235
|
-
ensureInRange(
|
236
|
-
ensureInRange(
|
237
|
-
syncResize(resize, messageData,
|
115
|
+
ensureInRange('Height');
|
116
|
+
ensureInRange('Width');
|
117
|
+
syncResize(resize, messageData, 'init');
|
238
118
|
}
|
239
119
|
function processMsg() {
|
240
|
-
var data = msg.slice(msgIdLen).split(
|
120
|
+
var data = msg.slice(msgIdLen).split(':');
|
241
121
|
var height = data[1] ? parseInt(data[1], 10) : 0;
|
242
122
|
var iframe = settings[data[0]] && settings[data[0]].iframe;
|
243
123
|
var compStyle = getComputedStyle(iframe);
|
@@ -250,35 +130,35 @@ var $5180433265c858be$exports = {};
|
|
250
130
|
};
|
251
131
|
}
|
252
132
|
function getPaddingEnds(compStyle) {
|
253
|
-
if (compStyle.boxSizing !==
|
133
|
+
if (compStyle.boxSizing !== 'border-box') return 0;
|
254
134
|
var top = compStyle.paddingTop ? parseInt(compStyle.paddingTop, 10) : 0;
|
255
135
|
var bot = compStyle.paddingBottom ? parseInt(compStyle.paddingBottom, 10) : 0;
|
256
136
|
return top + bot;
|
257
137
|
}
|
258
138
|
function getBorderEnds(compStyle) {
|
259
|
-
if (compStyle.boxSizing !==
|
139
|
+
if (compStyle.boxSizing !== 'border-box') return 0;
|
260
140
|
var top = compStyle.borderTopWidth ? parseInt(compStyle.borderTopWidth, 10) : 0;
|
261
141
|
var bot = compStyle.borderBottomWidth ? parseInt(compStyle.borderBottomWidth, 10) : 0;
|
262
142
|
return top + bot;
|
263
143
|
}
|
264
144
|
function ensureInRange(Dimension) {
|
265
|
-
var max = Number(settings[iframeId][
|
266
|
-
log(iframeId,
|
145
|
+
var max = Number(settings[iframeId]['max' + Dimension]), min = Number(settings[iframeId]['min' + Dimension]), dimension = Dimension.toLowerCase(), size = Number(messageData[dimension]);
|
146
|
+
log(iframeId, 'Checking ' + dimension + ' is in range ' + min + '-' + max);
|
267
147
|
if (size < min) {
|
268
148
|
size = min;
|
269
|
-
log(iframeId,
|
149
|
+
log(iframeId, 'Set ' + dimension + ' to min value');
|
270
150
|
}
|
271
151
|
if (size > max) {
|
272
152
|
size = max;
|
273
|
-
log(iframeId,
|
153
|
+
log(iframeId, 'Set ' + dimension + ' to max value');
|
274
154
|
}
|
275
|
-
messageData[dimension] =
|
155
|
+
messageData[dimension] = '' + size;
|
276
156
|
}
|
277
157
|
function isMessageFromIFrame() {
|
278
158
|
function checkAllowedOrigin() {
|
279
159
|
function checkList() {
|
280
160
|
var i = 0, retCode = false;
|
281
|
-
log(iframeId,
|
161
|
+
log(iframeId, 'Checking connection is from allowed list of origins: ' + checkOrigin);
|
282
162
|
for(; i < checkOrigin.length; i++)if (checkOrigin[i] === origin) {
|
283
163
|
retCode = true;
|
284
164
|
break;
|
@@ -287,17 +167,17 @@ var $5180433265c858be$exports = {};
|
|
287
167
|
}
|
288
168
|
function checkSingle() {
|
289
169
|
var remoteHost = settings[iframeId] && settings[iframeId].remoteHost;
|
290
|
-
log(iframeId,
|
170
|
+
log(iframeId, 'Checking connection is from: ' + remoteHost);
|
291
171
|
return origin === remoteHost;
|
292
172
|
}
|
293
173
|
return checkOrigin.constructor === Array ? checkList() : checkSingle();
|
294
174
|
}
|
295
175
|
var origin = event.origin, checkOrigin = settings[iframeId] && settings[iframeId].checkOrigin;
|
296
|
-
if (checkOrigin &&
|
176
|
+
if (checkOrigin && '' + origin !== 'null' && !checkAllowedOrigin()) throw new Error('Unexpected message received from: ' + origin + ' for ' + messageData.iframe.id + '. Message was: ' + event.data + '. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.');
|
297
177
|
return true;
|
298
178
|
}
|
299
179
|
function isMessageForUs() {
|
300
|
-
return msgId === (
|
180
|
+
return msgId === ('' + msg).slice(0, msgIdLen) && msg.slice(msgIdLen).split(':')[0] in settings // ''+Protects against non-string msg
|
301
181
|
;
|
302
182
|
}
|
303
183
|
function isMessageFromMetaParent() {
|
@@ -308,19 +188,19 @@ var $5180433265c858be$exports = {};
|
|
308
188
|
false: 1,
|
309
189
|
undefined: 1
|
310
190
|
};
|
311
|
-
if (retCode) log(iframeId,
|
191
|
+
if (retCode) log(iframeId, 'Ignoring init message from meta parent page');
|
312
192
|
return retCode;
|
313
193
|
}
|
314
194
|
function getMsgBody(offset) {
|
315
|
-
return msg.slice(msg.indexOf(
|
195
|
+
return msg.slice(msg.indexOf(':') + msgHeaderLen + offset);
|
316
196
|
}
|
317
197
|
function forwardMsgFromIFrame(msgBody) {
|
318
|
-
log(iframeId,
|
319
|
-
on(
|
198
|
+
log(iframeId, 'onMessage passed: {iframe: ' + messageData.iframe.id + ', message: ' + msgBody + '}');
|
199
|
+
on('onMessage', {
|
320
200
|
iframe: messageData.iframe,
|
321
201
|
message: JSON.parse(msgBody)
|
322
202
|
});
|
323
|
-
log(iframeId,
|
203
|
+
log(iframeId, '--');
|
324
204
|
}
|
325
205
|
function getPageInfo() {
|
326
206
|
var bodyPosition = document.body.getBoundingClientRect(), iFramePosition = messageData.iframe.getBoundingClientRect();
|
@@ -341,7 +221,7 @@ var $5180433265c858be$exports = {};
|
|
341
221
|
}
|
342
222
|
function sendPageInfoToIframe(iframe, iframeId) {
|
343
223
|
function debouncedTrigger() {
|
344
|
-
trigger(
|
224
|
+
trigger('Send Page Info', 'pageInfo:' + getPageInfo(), iframe, iframeId);
|
345
225
|
}
|
346
226
|
debounceFrameEvents(debouncedTrigger, 32, iframeId);
|
347
227
|
}
|
@@ -352,18 +232,18 @@ var $5180433265c858be$exports = {};
|
|
352
232
|
else stop();
|
353
233
|
}
|
354
234
|
[
|
355
|
-
|
356
|
-
|
235
|
+
'scroll',
|
236
|
+
'resize'
|
357
237
|
].forEach(function(evt) {
|
358
|
-
log(id, type + evt +
|
238
|
+
log(id, type + evt + ' listener for sendPageInfo');
|
359
239
|
func(window, evt, sendPageInfo);
|
360
240
|
});
|
361
241
|
}
|
362
242
|
function stop() {
|
363
|
-
setListener(
|
243
|
+
setListener('Remove ', removeEventListener);
|
364
244
|
}
|
365
245
|
function start() {
|
366
|
-
setListener(
|
246
|
+
setListener('Add ', addEventListener);
|
367
247
|
}
|
368
248
|
var id = iframeId // Create locally scoped copy of iFrame ID
|
369
249
|
;
|
@@ -379,7 +259,7 @@ var $5180433265c858be$exports = {};
|
|
379
259
|
function checkIFrameExists() {
|
380
260
|
var retBool = true;
|
381
261
|
if (null === messageData.iframe) {
|
382
|
-
warn(iframeId,
|
262
|
+
warn(iframeId, 'IFrame (' + messageData.id + ') not found');
|
383
263
|
retBool = false;
|
384
264
|
}
|
385
265
|
return retBool;
|
@@ -397,7 +277,7 @@ var $5180433265c858be$exports = {};
|
|
397
277
|
function reposition() {
|
398
278
|
pagePosition = newPosition;
|
399
279
|
scrollTo();
|
400
|
-
log(iframeId,
|
280
|
+
log(iframeId, '--');
|
401
281
|
}
|
402
282
|
function calcOffset() {
|
403
283
|
return {
|
@@ -406,45 +286,45 @@ var $5180433265c858be$exports = {};
|
|
406
286
|
};
|
407
287
|
}
|
408
288
|
function scrollParent() {
|
409
|
-
if (window.parentIFrame) window.parentIFrame[
|
410
|
-
else warn(iframeId,
|
289
|
+
if (window.parentIFrame) window.parentIFrame['scrollTo' + (addOffset ? 'Offset' : '')](newPosition.x, newPosition.y);
|
290
|
+
else warn(iframeId, 'Unable to scroll to requested position, window.parentIFrame not found');
|
411
291
|
}
|
412
292
|
var offset = addOffset ? getElementPosition(messageData.iframe) : {
|
413
293
|
x: 0,
|
414
294
|
y: 0
|
415
295
|
}, newPosition = calcOffset();
|
416
|
-
log(iframeId,
|
296
|
+
log(iframeId, 'Reposition requested from iFrame (offset x:' + offset.x + ' y:' + offset.y + ')');
|
417
297
|
if (window.top === window.self) reposition();
|
418
298
|
else scrollParent();
|
419
299
|
}
|
420
300
|
function scrollTo() {
|
421
|
-
if (false === on(
|
301
|
+
if (false === on('onScroll', pagePosition)) unsetPagePosition();
|
422
302
|
else setPagePosition(iframeId);
|
423
303
|
}
|
424
304
|
function findTarget(location) {
|
425
305
|
function jumpToTarget() {
|
426
306
|
var jumpPosition = getElementPosition(target);
|
427
|
-
log(iframeId,
|
307
|
+
log(iframeId, 'Moving to in page link (#' + hash + ') at x: ' + jumpPosition.x + ' y: ' + jumpPosition.y);
|
428
308
|
pagePosition = {
|
429
309
|
x: jumpPosition.x,
|
430
310
|
y: jumpPosition.y
|
431
311
|
};
|
432
312
|
scrollTo();
|
433
|
-
log(iframeId,
|
313
|
+
log(iframeId, '--');
|
434
314
|
}
|
435
315
|
function jumpToParent() {
|
436
316
|
if (window.parentIFrame) window.parentIFrame.moveToAnchor(hash);
|
437
|
-
else log(iframeId,
|
317
|
+
else log(iframeId, 'In page link #' + hash + ' not found and window.parentIFrame not found');
|
438
318
|
}
|
439
|
-
var hash = location.split(
|
319
|
+
var hash = location.split('#')[1] || '', hashData = decodeURIComponent(hash), target = document.getElementById(hashData) || document.getElementsByName(hashData)[0];
|
440
320
|
if (target) jumpToTarget();
|
441
|
-
else if (window.top === window.self) log(iframeId,
|
321
|
+
else if (window.top === window.self) log(iframeId, 'In page link #' + hash + ' not found');
|
442
322
|
else jumpToParent();
|
443
323
|
}
|
444
324
|
function onMouse(event) {
|
445
325
|
var mousePos = {};
|
446
326
|
if (Number(messageData.width) === 0 && Number(messageData.height) === 0) {
|
447
|
-
var data = getMsgBody(9).split(
|
327
|
+
var data = getMsgBody(9).split(':');
|
448
328
|
mousePos = {
|
449
329
|
x: data[1],
|
450
330
|
y: data[0]
|
@@ -466,46 +346,46 @@ var $5180433265c858be$exports = {};
|
|
466
346
|
function actionMsg() {
|
467
347
|
if (settings[iframeId] && settings[iframeId].firstRun) firstRun();
|
468
348
|
switch(messageData.type){
|
469
|
-
case
|
349
|
+
case 'close':
|
470
350
|
closeIFrame(messageData.iframe);
|
471
351
|
break;
|
472
|
-
case
|
352
|
+
case 'message':
|
473
353
|
forwardMsgFromIFrame(getMsgBody(6));
|
474
354
|
break;
|
475
|
-
case
|
476
|
-
onMouse(
|
355
|
+
case 'mouseenter':
|
356
|
+
onMouse('onMouseEnter');
|
477
357
|
break;
|
478
|
-
case
|
479
|
-
onMouse(
|
358
|
+
case 'mouseleave':
|
359
|
+
onMouse('onMouseLeave');
|
480
360
|
break;
|
481
|
-
case
|
361
|
+
case 'autoResize':
|
482
362
|
settings[iframeId].autoResize = JSON.parse(getMsgBody(9));
|
483
363
|
break;
|
484
|
-
case
|
364
|
+
case 'scrollTo':
|
485
365
|
scrollRequestFromChild(false);
|
486
366
|
break;
|
487
|
-
case
|
367
|
+
case 'scrollToOffset':
|
488
368
|
scrollRequestFromChild(true);
|
489
369
|
break;
|
490
|
-
case
|
370
|
+
case 'pageInfo':
|
491
371
|
sendPageInfoToIframe(settings[iframeId] && settings[iframeId].iframe, iframeId);
|
492
372
|
startPageInfoMonitor();
|
493
373
|
break;
|
494
|
-
case
|
374
|
+
case 'pageInfoStop':
|
495
375
|
stopPageInfoMonitor();
|
496
376
|
break;
|
497
|
-
case
|
377
|
+
case 'inPageLink':
|
498
378
|
findTarget(getMsgBody(9));
|
499
379
|
break;
|
500
|
-
case
|
380
|
+
case 'reset':
|
501
381
|
resetIFrame(messageData);
|
502
382
|
break;
|
503
|
-
case
|
383
|
+
case 'init':
|
504
384
|
resizeIFrame();
|
505
|
-
on(
|
385
|
+
on('onInit', messageData.iframe);
|
506
386
|
break;
|
507
387
|
default:
|
508
|
-
if (Number(messageData.width) === 0 && Number(messageData.height) === 0) warn(
|
388
|
+
if (Number(messageData.width) === 0 && Number(messageData.height) === 0) warn('Unsupported message received (' + messageData.type + '), this is likely due to the iframe containing a later ' + 'version of iframe-resizer than the parent page');
|
509
389
|
else resizeIFrame();
|
510
390
|
}
|
511
391
|
}
|
@@ -513,35 +393,35 @@ var $5180433265c858be$exports = {};
|
|
513
393
|
var retBool = true;
|
514
394
|
if (!settings[iframeId]) {
|
515
395
|
retBool = false;
|
516
|
-
warn(messageData.type +
|
396
|
+
warn(messageData.type + ' No settings for ' + iframeId + '. Message was: ' + msg);
|
517
397
|
}
|
518
398
|
return retBool;
|
519
399
|
}
|
520
400
|
function iFrameReadyMsgReceived() {
|
521
401
|
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
522
|
-
for(var iframeId in settings)trigger(
|
402
|
+
for(var iframeId in settings)trigger('iFrame requested init', createOutgoingMsg(iframeId), settings[iframeId].iframe, iframeId);
|
523
403
|
}
|
524
404
|
function firstRun() {
|
525
405
|
if (settings[iframeId]) settings[iframeId].firstRun = false;
|
526
406
|
}
|
527
407
|
var msg = event.data, messageData = {}, iframeId = null;
|
528
|
-
if (
|
408
|
+
if ('[iFrameResizerChild]Ready' === msg) iFrameReadyMsgReceived();
|
529
409
|
else if (isMessageForUs()) {
|
530
410
|
messageData = processMsg();
|
531
411
|
iframeId = messageData.id;
|
532
412
|
if (settings[iframeId]) settings[iframeId].loaded = true;
|
533
413
|
if (!isMessageFromMetaParent() && hasSettings(iframeId)) {
|
534
|
-
log(iframeId,
|
414
|
+
log(iframeId, 'Received: ' + msg);
|
535
415
|
if (checkIFrameExists() && isMessageFromIFrame()) actionMsg();
|
536
416
|
}
|
537
|
-
} else info(iframeId,
|
417
|
+
} else info(iframeId, 'Ignored: ' + msg);
|
538
418
|
}
|
539
419
|
function chkEvent(iframeId, funcName, val) {
|
540
420
|
var func = null, retVal = null;
|
541
421
|
if (settings[iframeId]) {
|
542
422
|
func = settings[iframeId][funcName];
|
543
|
-
if (
|
544
|
-
else throw new TypeError(funcName +
|
423
|
+
if ('function' === typeof func) retVal = func(val);
|
424
|
+
else throw new TypeError(funcName + ' on iFrame[' + iframeId + '] is not a function');
|
545
425
|
}
|
546
426
|
return retVal;
|
547
427
|
}
|
@@ -551,19 +431,19 @@ var $5180433265c858be$exports = {};
|
|
551
431
|
}
|
552
432
|
function closeIFrame(iframe) {
|
553
433
|
var iframeId = iframe.id;
|
554
|
-
if (chkEvent(iframeId,
|
555
|
-
log(iframeId,
|
434
|
+
if (chkEvent(iframeId, 'onClose', iframeId) === false) {
|
435
|
+
log(iframeId, 'Close iframe cancelled by onClose event');
|
556
436
|
return;
|
557
437
|
}
|
558
|
-
log(iframeId,
|
438
|
+
log(iframeId, 'Removing iFrame: ' + iframeId);
|
559
439
|
try {
|
560
440
|
// Catch race condition error with React
|
561
441
|
if (iframe.parentNode) iframe.parentNode.removeChild(iframe);
|
562
442
|
} catch (error) {
|
563
443
|
warn(error);
|
564
444
|
}
|
565
|
-
chkEvent(iframeId,
|
566
|
-
log(iframeId,
|
445
|
+
chkEvent(iframeId, 'onClosed', iframeId);
|
446
|
+
log(iframeId, '--');
|
567
447
|
removeIframeListeners(iframe);
|
568
448
|
}
|
569
449
|
function getPagePosition(iframeId) {
|
@@ -572,13 +452,13 @@ var $5180433265c858be$exports = {};
|
|
572
452
|
x: window.pageXOffset === undefined ? document.documentElement.scrollLeft : window.pageXOffset,
|
573
453
|
y: window.pageYOffset === undefined ? document.documentElement.scrollTop : window.pageYOffset
|
574
454
|
};
|
575
|
-
log(iframeId,
|
455
|
+
log(iframeId, 'Get page position: ' + pagePosition.x + ',' + pagePosition.y);
|
576
456
|
}
|
577
457
|
}
|
578
458
|
function setPagePosition(iframeId) {
|
579
459
|
if (null !== pagePosition) {
|
580
460
|
window.scrollTo(pagePosition.x, pagePosition.y);
|
581
|
-
log(iframeId,
|
461
|
+
log(iframeId, 'Set page position: ' + pagePosition.x + ',' + pagePosition.y);
|
582
462
|
unsetPagePosition();
|
583
463
|
}
|
584
464
|
}
|
@@ -588,29 +468,29 @@ var $5180433265c858be$exports = {};
|
|
588
468
|
function resetIFrame(messageData) {
|
589
469
|
function reset() {
|
590
470
|
setSize(messageData);
|
591
|
-
trigger(
|
471
|
+
trigger('reset', 'reset', messageData.iframe, messageData.id);
|
592
472
|
}
|
593
|
-
log(messageData.id,
|
473
|
+
log(messageData.id, 'Size reset requested by ' + ('init' === messageData.type ? 'host page' : 'iFrame'));
|
594
474
|
getPagePosition(messageData.id);
|
595
|
-
syncResize(reset, messageData,
|
475
|
+
syncResize(reset, messageData, 'reset');
|
596
476
|
}
|
597
477
|
function setSize(messageData) {
|
598
478
|
function setDimension(dimension) {
|
599
479
|
if (!messageData.id) {
|
600
|
-
log(
|
480
|
+
log('undefined', 'messageData id not set');
|
601
481
|
return;
|
602
482
|
}
|
603
|
-
messageData.iframe.style[dimension] = messageData[dimension] +
|
604
|
-
log(messageData.id,
|
483
|
+
messageData.iframe.style[dimension] = messageData[dimension] + 'px';
|
484
|
+
log(messageData.id, 'IFrame (' + iframeId + ') ' + dimension + ' set to ' + messageData[dimension] + 'px');
|
605
485
|
}
|
606
486
|
function chkZero(dimension) {
|
607
487
|
// FireFox sets dimension of hidden iFrames to zero.
|
608
488
|
// So if we detect that set up an event to check for
|
609
489
|
// when iFrame becomes visible.
|
610
490
|
/* istanbul ignore next */ // Not testable in PhantomJS
|
611
|
-
if (!hiddenCheckEnabled &&
|
491
|
+
if (!hiddenCheckEnabled && '0' === messageData[dimension]) {
|
612
492
|
hiddenCheckEnabled = true;
|
613
|
-
log(iframeId,
|
493
|
+
log(iframeId, 'Hidden iFrame detected, creating visibility listener');
|
614
494
|
fixHiddenIFrames();
|
615
495
|
}
|
616
496
|
}
|
@@ -620,29 +500,29 @@ var $5180433265c858be$exports = {};
|
|
620
500
|
}
|
621
501
|
var iframeId = messageData.iframe.id;
|
622
502
|
if (settings[iframeId]) {
|
623
|
-
if (settings[iframeId].sizeHeight) processDimension(
|
624
|
-
if (settings[iframeId].sizeWidth) processDimension(
|
503
|
+
if (settings[iframeId].sizeHeight) processDimension('height');
|
504
|
+
if (settings[iframeId].sizeWidth) processDimension('width');
|
625
505
|
}
|
626
506
|
}
|
627
507
|
function syncResize(func, messageData, doNotSync) {
|
628
508
|
/* istanbul ignore if */ // Not testable in PhantomJS
|
629
509
|
if (doNotSync !== messageData.type && requestAnimationFrame && // including check for jasmine because had trouble getting spy to work in unit test using requestAnimationFrame
|
630
510
|
!window.jasmine) {
|
631
|
-
log(messageData.id,
|
511
|
+
log(messageData.id, 'Requesting animation frame');
|
632
512
|
requestAnimationFrame(func);
|
633
513
|
} else func();
|
634
514
|
}
|
635
515
|
function trigger(calleeMsg, msg, iframe, id, noResponseWarning) {
|
636
516
|
function postMessageToIFrame() {
|
637
517
|
var target = settings[id] && settings[id].targetOrigin;
|
638
|
-
log(id,
|
518
|
+
log(id, '[' + calleeMsg + '] Sending msg to iframe[' + id + '] (' + msg + ') targetOrigin: ' + target);
|
639
519
|
iframe.contentWindow.postMessage(msgId + msg, target);
|
640
520
|
}
|
641
521
|
function iFrameNotFound() {
|
642
|
-
warn(id,
|
522
|
+
warn(id, '[' + calleeMsg + '] IFrame(' + id + ') not found');
|
643
523
|
}
|
644
524
|
function chkAndSend() {
|
645
|
-
if (iframe &&
|
525
|
+
if (iframe && 'contentWindow' in iframe && null !== iframe.contentWindow) // Null test for PhantomJS
|
646
526
|
postMessageToIFrame();
|
647
527
|
else iFrameNotFound();
|
648
528
|
}
|
@@ -650,7 +530,7 @@ var $5180433265c858be$exports = {};
|
|
650
530
|
function warning() {
|
651
531
|
if (settings[id] && !settings[id].loaded && !errorShown) {
|
652
532
|
errorShown = true;
|
653
|
-
warn(id,
|
533
|
+
warn(id, 'IFrame has not responded within ' + settings[id].warningTimeout / 1000 + ' seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning.');
|
654
534
|
}
|
655
535
|
}
|
656
536
|
if (!!noResponseWarning && settings[id] && !!settings[id].warningTimeout) settings[id].msgTimeout = setTimeout(warning, settings[id].warningTimeout);
|
@@ -663,29 +543,29 @@ var $5180433265c858be$exports = {};
|
|
663
543
|
}
|
664
544
|
}
|
665
545
|
function createOutgoingMsg(iframeId) {
|
666
|
-
return iframeId +
|
546
|
+
return iframeId + ':' + settings[iframeId].bodyMarginV1 + ':' + settings[iframeId].sizeWidth + ':' + settings[iframeId].log + ':' + settings[iframeId].interval + ':' + settings[iframeId].enablePublicMethods + ':' + settings[iframeId].autoResize + ':' + settings[iframeId].bodyMargin + ':' + settings[iframeId].heightCalculationMethod + ':' + settings[iframeId].bodyBackground + ':' + settings[iframeId].bodyPadding + ':' + settings[iframeId].tolerance + ':' + settings[iframeId].inPageLinks + ':' + settings[iframeId].resizeFrom + ':' + settings[iframeId].widthCalculationMethod + ':' + settings[iframeId].mouseEvents;
|
667
547
|
}
|
668
548
|
function isNumber(value) {
|
669
|
-
return typeof value ===
|
549
|
+
return typeof value === 'number';
|
670
550
|
}
|
671
551
|
function setupIFrame(iframe, options) {
|
672
552
|
function setLimits() {
|
673
553
|
function addStyle(style) {
|
674
554
|
var styleValue = settings[iframeId][style];
|
675
555
|
if (Infinity !== styleValue && 0 !== styleValue) {
|
676
|
-
iframe.style[style] = isNumber(styleValue) ? styleValue +
|
677
|
-
log(iframeId,
|
556
|
+
iframe.style[style] = isNumber(styleValue) ? styleValue + 'px' : styleValue;
|
557
|
+
log(iframeId, 'Set ' + style + ' = ' + iframe.style[style]);
|
678
558
|
}
|
679
559
|
}
|
680
560
|
function chkMinMax(dimension) {
|
681
|
-
if (settings[iframeId][
|
561
|
+
if (settings[iframeId]['min' + dimension] > settings[iframeId]['max' + dimension]) throw new Error('Value for min' + dimension + ' can not be greater than max' + dimension);
|
682
562
|
}
|
683
|
-
chkMinMax(
|
684
|
-
chkMinMax(
|
685
|
-
addStyle(
|
686
|
-
addStyle(
|
687
|
-
addStyle(
|
688
|
-
addStyle(
|
563
|
+
chkMinMax('Height');
|
564
|
+
chkMinMax('Width');
|
565
|
+
addStyle('maxHeight');
|
566
|
+
addStyle('minHeight');
|
567
|
+
addStyle('maxWidth');
|
568
|
+
addStyle('minWidth');
|
689
569
|
}
|
690
570
|
function newId() {
|
691
571
|
var id = options && options.id || defaults.id + count++;
|
@@ -693,38 +573,38 @@ var $5180433265c858be$exports = {};
|
|
693
573
|
return id;
|
694
574
|
}
|
695
575
|
function ensureHasId(iframeId) {
|
696
|
-
if (typeof iframeId !==
|
697
|
-
if (
|
576
|
+
if (typeof iframeId !== 'string') throw new TypeError('Invaild id for iFrame. Expected String');
|
577
|
+
if ('' === iframeId) {
|
698
578
|
// eslint-disable-next-line no-multi-assign
|
699
579
|
iframe.id = iframeId = newId();
|
700
580
|
logEnabled = (options || {}).log;
|
701
|
-
log(iframeId,
|
581
|
+
log(iframeId, 'Added missing iframe ID: ' + iframeId + ' (' + iframe.src + ')');
|
702
582
|
}
|
703
583
|
return iframeId;
|
704
584
|
}
|
705
585
|
function setScrolling() {
|
706
|
-
log(iframeId,
|
707
|
-
iframe.style.overflow = false === (settings[iframeId] && settings[iframeId].scrolling) ?
|
586
|
+
log(iframeId, 'IFrame scrolling ' + (settings[iframeId] && settings[iframeId].scrolling ? 'enabled' : 'disabled') + ' for ' + iframeId);
|
587
|
+
iframe.style.overflow = false === (settings[iframeId] && settings[iframeId].scrolling) ? 'hidden' : 'auto';
|
708
588
|
switch(settings[iframeId] && settings[iframeId].scrolling){
|
709
|
-
case
|
589
|
+
case 'omit':
|
710
590
|
break;
|
711
591
|
case true:
|
712
|
-
iframe.scrolling =
|
592
|
+
iframe.scrolling = 'yes';
|
713
593
|
break;
|
714
594
|
case false:
|
715
|
-
iframe.scrolling =
|
595
|
+
iframe.scrolling = 'no';
|
716
596
|
break;
|
717
597
|
default:
|
718
|
-
iframe.scrolling = settings[iframeId] ? settings[iframeId].scrolling :
|
598
|
+
iframe.scrolling = settings[iframeId] ? settings[iframeId].scrolling : 'no';
|
719
599
|
}
|
720
600
|
}
|
721
601
|
// The V1 iFrame script expects an int, where as in V2 expects a CSS
|
722
602
|
// string value such as '1px 3em', so if we have an int for V2, set V1=V2
|
723
603
|
// and then convert V2 to a string PX value.
|
724
604
|
function setupBodyMarginValues() {
|
725
|
-
if (
|
605
|
+
if ('number' === typeof (settings[iframeId] && settings[iframeId].bodyMargin) || '0' === (settings[iframeId] && settings[iframeId].bodyMargin)) {
|
726
606
|
settings[iframeId].bodyMarginV1 = settings[iframeId].bodyMargin;
|
727
|
-
settings[iframeId].bodyMargin =
|
607
|
+
settings[iframeId].bodyMargin = '' + settings[iframeId].bodyMargin + 'px';
|
728
608
|
}
|
729
609
|
}
|
730
610
|
function checkReset() {
|
@@ -736,20 +616,20 @@ var $5180433265c858be$exports = {};
|
|
736
616
|
iframe: iframe,
|
737
617
|
height: 0,
|
738
618
|
width: 0,
|
739
|
-
type:
|
619
|
+
type: 'init'
|
740
620
|
});
|
741
621
|
}
|
742
622
|
function setupIFrameObject() {
|
743
623
|
if (settings[iframeId]) settings[iframeId].iframe.iFrameResizer = {
|
744
624
|
close: closeIFrame.bind(null, settings[iframeId].iframe),
|
745
625
|
removeListeners: removeIframeListeners.bind(null, settings[iframeId].iframe),
|
746
|
-
resize: trigger.bind(null,
|
626
|
+
resize: trigger.bind(null, 'Window resize', 'resize', settings[iframeId].iframe),
|
747
627
|
moveToAnchor: function(anchor) {
|
748
|
-
trigger(
|
628
|
+
trigger('Move to anchor', 'moveToAnchor:' + anchor, settings[iframeId].iframe, iframeId);
|
749
629
|
},
|
750
630
|
sendMessage: function(message) {
|
751
631
|
message = JSON.stringify(message);
|
752
|
-
trigger(
|
632
|
+
trigger('Send Message', 'message:' + message, settings[iframeId].iframe, iframeId);
|
753
633
|
}
|
754
634
|
};
|
755
635
|
}
|
@@ -758,7 +638,7 @@ var $5180433265c858be$exports = {};
|
|
758
638
|
// event listener also catches the page changing in the iFrame.
|
759
639
|
function init(msg) {
|
760
640
|
function iFrameLoaded() {
|
761
|
-
trigger(
|
641
|
+
trigger('iFrame.onload', msg, iframe, undefined, true);
|
762
642
|
checkReset();
|
763
643
|
}
|
764
644
|
function createDestroyObserver(MutationObserver) {
|
@@ -778,23 +658,23 @@ var $5180433265c858be$exports = {};
|
|
778
658
|
}
|
779
659
|
var MutationObserver = getMutationObserver();
|
780
660
|
if (MutationObserver) createDestroyObserver(MutationObserver);
|
781
|
-
addEventListener(iframe,
|
782
|
-
trigger(
|
661
|
+
addEventListener(iframe, 'load', iFrameLoaded);
|
662
|
+
trigger('init', msg, iframe, undefined, true);
|
783
663
|
}
|
784
664
|
function checkOptions(options) {
|
785
|
-
if (
|
665
|
+
if ('object' !== typeof options) throw new TypeError('Options is not an object');
|
786
666
|
}
|
787
667
|
function copyOptions(options) {
|
788
668
|
// eslint-disable-next-line no-restricted-syntax
|
789
669
|
for(var option in defaults)if (Object.prototype.hasOwnProperty.call(defaults, option)) settings[iframeId][option] = Object.prototype.hasOwnProperty.call(options, option) ? options[option] : defaults[option];
|
790
670
|
}
|
791
671
|
function getTargetOrigin(remoteHost) {
|
792
|
-
return
|
672
|
+
return '' === remoteHost || null !== remoteHost.match(/^(about:blank|javascript:|file:\/\/)/) ? '*' : remoteHost;
|
793
673
|
}
|
794
674
|
function depricate(key) {
|
795
|
-
var splitName = key.split(
|
675
|
+
var splitName = key.split('Callback');
|
796
676
|
if (splitName.length === 2) {
|
797
|
-
var name =
|
677
|
+
var name = 'on' + splitName[0].charAt(0).toUpperCase() + splitName[0].slice(1);
|
798
678
|
this[name] = this[key];
|
799
679
|
delete this[key];
|
800
680
|
warn(iframeId, "Deprecated: '" + key + "' has been renamed '" + name + "'. The old method will be removed in the next major version.");
|
@@ -806,17 +686,17 @@ var $5180433265c858be$exports = {};
|
|
806
686
|
;
|
807
687
|
settings[iframeId].iframe = iframe;
|
808
688
|
settings[iframeId].firstRun = true;
|
809
|
-
settings[iframeId].remoteHost = iframe.src && iframe.src.split(
|
689
|
+
settings[iframeId].remoteHost = iframe.src && iframe.src.split('/').slice(0, 3).join('/');
|
810
690
|
checkOptions(options);
|
811
691
|
Object.keys(options).forEach(depricate, options);
|
812
692
|
copyOptions(options);
|
813
|
-
if (settings[iframeId]) settings[iframeId].targetOrigin = true === settings[iframeId].checkOrigin ? getTargetOrigin(settings[iframeId].remoteHost) :
|
693
|
+
if (settings[iframeId]) settings[iframeId].targetOrigin = true === settings[iframeId].checkOrigin ? getTargetOrigin(settings[iframeId].remoteHost) : '*';
|
814
694
|
}
|
815
695
|
function beenHere() {
|
816
|
-
return iframeId in settings &&
|
696
|
+
return iframeId in settings && 'iFrameResizer' in iframe;
|
817
697
|
}
|
818
698
|
var iframeId = ensureHasId(iframe.id);
|
819
|
-
if (beenHere()) warn(iframeId,
|
699
|
+
if (beenHere()) warn(iframeId, 'Ignored iFrame, already setup.');
|
820
700
|
else {
|
821
701
|
processOptions(options);
|
822
702
|
setScrolling();
|
@@ -844,23 +724,23 @@ var $5180433265c858be$exports = {};
|
|
844
724
|
function checkIFrames() {
|
845
725
|
function checkIFrame(settingId) {
|
846
726
|
function chkDimension(dimension) {
|
847
|
-
return
|
727
|
+
return '0px' === (settings[settingId] && settings[settingId].iframe.style[dimension]);
|
848
728
|
}
|
849
729
|
function isVisible(el) {
|
850
730
|
return null !== el.offsetParent;
|
851
731
|
}
|
852
|
-
if (settings[settingId] && isVisible(settings[settingId].iframe) && (chkDimension(
|
732
|
+
if (settings[settingId] && isVisible(settings[settingId].iframe) && (chkDimension('height') || chkDimension('width'))) trigger('Visibility change', 'resize', settings[settingId].iframe, settingId);
|
853
733
|
}
|
854
734
|
Object.keys(settings).forEach(function(key) {
|
855
735
|
checkIFrame(key);
|
856
736
|
});
|
857
737
|
}
|
858
738
|
function mutationObserved(mutations) {
|
859
|
-
log(
|
739
|
+
log('window', 'Mutation observed: ' + mutations[0].target + ' ' + mutations[0].type);
|
860
740
|
debouce(checkIFrames, 16);
|
861
741
|
}
|
862
742
|
function createMutationObserver() {
|
863
|
-
var target = document.querySelector(
|
743
|
+
var target = document.querySelector('body'), config = {
|
864
744
|
attributes: true,
|
865
745
|
attributeOldValue: false,
|
866
746
|
characterData: true,
|
@@ -875,42 +755,42 @@ var $5180433265c858be$exports = {};
|
|
875
755
|
}
|
876
756
|
function resizeIFrames(event) {
|
877
757
|
function resize() {
|
878
|
-
sendTriggerMsg(
|
758
|
+
sendTriggerMsg('Window ' + event, 'resize');
|
879
759
|
}
|
880
|
-
log(
|
760
|
+
log('window', 'Trigger event: ' + event);
|
881
761
|
debouce(resize, 16);
|
882
762
|
}
|
883
763
|
// Not testable in PhantomJS
|
884
764
|
/* istanbul ignore next */ function tabVisible() {
|
885
765
|
function resize() {
|
886
|
-
sendTriggerMsg(
|
766
|
+
sendTriggerMsg('Tab Visible', 'resize');
|
887
767
|
}
|
888
|
-
if (
|
889
|
-
log(
|
768
|
+
if ('hidden' !== document.visibilityState) {
|
769
|
+
log('document', 'Trigger event: Visibility change');
|
890
770
|
debouce(resize, 16);
|
891
771
|
}
|
892
772
|
}
|
893
773
|
function sendTriggerMsg(eventName, event) {
|
894
774
|
function isIFrameResizeEnabled(iframeId) {
|
895
|
-
return settings[iframeId] &&
|
775
|
+
return settings[iframeId] && 'parent' === settings[iframeId].resizeFrom && settings[iframeId].autoResize && !settings[iframeId].firstRun;
|
896
776
|
}
|
897
777
|
Object.keys(settings).forEach(function(iframeId) {
|
898
778
|
if (isIFrameResizeEnabled(iframeId)) trigger(eventName, event, settings[iframeId].iframe, iframeId);
|
899
779
|
});
|
900
780
|
}
|
901
781
|
function setupEventListeners() {
|
902
|
-
addEventListener(window,
|
903
|
-
addEventListener(window,
|
904
|
-
resizeIFrames(
|
782
|
+
addEventListener(window, 'message', iFrameListener);
|
783
|
+
addEventListener(window, 'resize', function() {
|
784
|
+
resizeIFrames('resize');
|
905
785
|
});
|
906
|
-
addEventListener(document,
|
907
|
-
addEventListener(document,
|
786
|
+
addEventListener(document, 'visibilitychange', tabVisible);
|
787
|
+
addEventListener(document, '-webkit-visibilitychange', tabVisible);
|
908
788
|
}
|
909
789
|
function factory() {
|
910
790
|
function init(options, element) {
|
911
791
|
function chkType() {
|
912
|
-
if (!element.tagName) throw new TypeError(
|
913
|
-
else if (
|
792
|
+
if (!element.tagName) throw new TypeError('Object is not a valid DOM element');
|
793
|
+
else if ('IFRAME' !== element.tagName.toUpperCase()) throw new TypeError('Expected <IFRAME> tag, found <' + element.tagName + '>');
|
914
794
|
}
|
915
795
|
if (element) {
|
916
796
|
chkType();
|
@@ -919,7 +799,7 @@ var $5180433265c858be$exports = {};
|
|
919
799
|
}
|
920
800
|
}
|
921
801
|
function warnDeprecatedOptions(options) {
|
922
|
-
if (options && options.enablePublicMethods) warn(
|
802
|
+
if (options && options.enablePublicMethods) warn('enablePublicMethods option has been removed, public methods are now always available in the iFrame');
|
923
803
|
}
|
924
804
|
var iFrames;
|
925
805
|
setupRequestAnimationFrame();
|
@@ -929,36 +809,119 @@ var $5180433265c858be$exports = {};
|
|
929
809
|
;
|
930
810
|
warnDeprecatedOptions(options);
|
931
811
|
switch(typeof target){
|
932
|
-
case
|
933
|
-
case
|
934
|
-
Array.prototype.forEach.call(document.querySelectorAll(target ||
|
812
|
+
case 'undefined':
|
813
|
+
case 'string':
|
814
|
+
Array.prototype.forEach.call(document.querySelectorAll(target || 'iframe'), init.bind(undefined, options));
|
935
815
|
break;
|
936
|
-
case
|
816
|
+
case 'object':
|
937
817
|
init(options, target);
|
938
818
|
break;
|
939
819
|
default:
|
940
|
-
throw new TypeError(
|
820
|
+
throw new TypeError('Unexpected data type (' + typeof target + ')');
|
941
821
|
}
|
942
822
|
return iFrames;
|
943
823
|
};
|
944
824
|
}
|
945
825
|
function createJQueryPublicMethod($) {
|
946
|
-
if (!$.fn) info(
|
826
|
+
if (!$.fn) info('', 'Unable to bind to jQuery, it is not fully loaded.');
|
947
827
|
else if (!$.fn.iFrameResize) $.fn.iFrameResize = function $iFrameResizeF(options) {
|
948
828
|
function init(index, element) {
|
949
829
|
setupIFrame(element, options);
|
950
830
|
}
|
951
|
-
return this.filter(
|
831
|
+
return this.filter('iframe').each(init).end();
|
952
832
|
};
|
953
833
|
}
|
954
834
|
if (window.jQuery !== undefined) createJQueryPublicMethod(window.jQuery);
|
955
|
-
if (typeof define ===
|
956
|
-
else if (typeof $5180433265c858be$exports ===
|
835
|
+
if (typeof define === 'function' && define.amd) define([], factory);
|
836
|
+
else if (typeof $5180433265c858be$exports === 'object') // Node for browserfy
|
957
837
|
$5180433265c858be$exports = factory();
|
958
838
|
window.iFrameResize = window.iFrameResize || factory();
|
959
839
|
})();
|
960
840
|
|
961
841
|
|
962
|
-
|
842
|
+
window.Lookbook = window.Lookbook || {};
|
843
|
+
window.Lookbook.initEmbeds = $5000cc5d1e9e824a$var$initEmbeds;
|
844
|
+
const $5000cc5d1e9e824a$var$embedUrlPrefix = "embed";
|
845
|
+
const $5000cc5d1e9e824a$var$whiteListedAttributes = [
|
846
|
+
"preview",
|
847
|
+
"scenario",
|
848
|
+
"panels",
|
849
|
+
"actions",
|
850
|
+
"param-*"
|
851
|
+
];
|
852
|
+
function $5000cc5d1e9e824a$var$initEmbeds(root = document) {
|
853
|
+
if (typeof window.iFrameResize !== "function") {
|
854
|
+
console.error("Lookbook embeds require the 'iframe-resizer' library to be available. Skipping embed instantiation.");
|
855
|
+
return;
|
856
|
+
}
|
857
|
+
if (typeof root === "string") root = document.querySelector(root);
|
858
|
+
if (!root) return console.error("Could not initialize Lookbook embeds. Root node not found.");
|
859
|
+
const embeds = Array.from(root.querySelectorAll("lookbook-embed"));
|
860
|
+
embeds.forEach((embed)=>{
|
861
|
+
const attrs = Array.from(embed.attributes);
|
862
|
+
const wrapper = $5000cc5d1e9e824a$var$createWrapper();
|
863
|
+
const iframe = $5000cc5d1e9e824a$var$createIframe(attrs);
|
864
|
+
wrapper.appendChild(iframe);
|
865
|
+
embed.replaceWith(wrapper);
|
866
|
+
});
|
867
|
+
window.iFrameResize({
|
868
|
+
checkOrigin: false
|
869
|
+
}, "[data-lookbook-embed-iframe]");
|
870
|
+
}
|
871
|
+
function $5000cc5d1e9e824a$var$createWrapper() {
|
872
|
+
const wrapper = document.createElement("div");
|
873
|
+
wrapper.setAttribute("data-lookbook-embed", "");
|
874
|
+
wrapper.classList.add("lookbook-embed");
|
875
|
+
return wrapper;
|
876
|
+
}
|
877
|
+
function $5000cc5d1e9e824a$var$createIframe(attrs) {
|
878
|
+
const src = $5000cc5d1e9e824a$var$buildSrc(attrs);
|
879
|
+
const id = $5000cc5d1e9e824a$var$attrValue(attrs, "id");
|
880
|
+
const styles = $5000cc5d1e9e824a$var$attrValue(attrs, "style");
|
881
|
+
const classes = $5000cc5d1e9e824a$var$attrValue(attrs, "class", "").split(" ").map((c)=>c.trim()).filter((c)=>c.length);
|
882
|
+
const iframe = document.createElement("iframe");
|
883
|
+
iframe.src = src;
|
884
|
+
if (id) iframe.id = id;
|
885
|
+
iframe.setAttribute("frameborder", 0);
|
886
|
+
iframe.setAttribute("data-lookbook-embed-iframe", "");
|
887
|
+
if (classes.length) iframe.classList.add(...classes);
|
888
|
+
if (styles) iframe.style.cssText = styles;
|
889
|
+
iframe.style.width = "100%";
|
890
|
+
iframe.style.transition = "height 0.3s";
|
891
|
+
return iframe;
|
892
|
+
}
|
893
|
+
function $5000cc5d1e9e824a$var$buildSrc(attrs) {
|
894
|
+
const appPath = $5000cc5d1e9e824a$var$attrValue(attrs, "app") || $5000cc5d1e9e824a$var$guessBasePath();
|
895
|
+
const props = {};
|
896
|
+
$5000cc5d1e9e824a$var$permittedAttrs(attrs).forEach(({ name: name, value: value })=>{
|
897
|
+
name = name.replace("-", "_").toLowerCase();
|
898
|
+
props[name] = value;
|
899
|
+
});
|
900
|
+
return encodeURI([
|
901
|
+
appPath,
|
902
|
+
$5000cc5d1e9e824a$var$embedUrlPrefix
|
903
|
+
].join("/") + `?props=${JSON.stringify(props)}`);
|
904
|
+
}
|
905
|
+
function $5000cc5d1e9e824a$var$attrValue(attrs, name, fallback = null) {
|
906
|
+
const attr = attrs.find((attr)=>attr.name === name);
|
907
|
+
return attr ? attr.value : fallback;
|
908
|
+
}
|
909
|
+
function $5000cc5d1e9e824a$var$permittedAttrs(attrs) {
|
910
|
+
return attrs.filter((attr)=>{
|
911
|
+
return $5000cc5d1e9e824a$var$whiteListedAttributes.find((key)=>{
|
912
|
+
const name = attr.name;
|
913
|
+
return key === name || key.includes("*") && name.startsWith(key.replace("*", ""));
|
914
|
+
});
|
915
|
+
});
|
916
|
+
}
|
917
|
+
function $5000cc5d1e9e824a$var$guessBasePath() {
|
918
|
+
const script = document.currentScript || document.querySelector('script[src*="lookbook.js"]');
|
919
|
+
const scriptSrc = script.src;
|
920
|
+
if (scriptSrc && scriptSrc.includes("lookbook-assets")) return scriptSrc.split("?")[0].replace("lookbook-assets/js/lookbook.js", "lookbook");
|
921
|
+
return `//${location.host}/lookbook`;
|
922
|
+
}
|
923
|
+
document.addEventListener("DOMContentLoaded", ()=>$5000cc5d1e9e824a$var$initEmbeds());
|
924
|
+
|
925
|
+
|
963
926
|
|
964
927
|
})();
|