-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Default_Frames.html
170 lines (136 loc) · 7.04 KB
/
Default_Frames.html
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!--
Project: Trafilm.Gallery (http://github.com/zoomicon/Trafilm.Gallery)
Filename: default.html
Version: 20200212
-->
<html> <!-- do not use DOCTYPE statement -->
<head>
<title>Trafilm Gallery | The Translation of Multilingual Films in Spain</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=700, user-scalable=yes, initial-scale=0.6" />
<link rel="shortcut icon" type="image/ico" href='favicon.ico' />
<link rel="stylesheet" type="text/css" href="css/gallery.css" />
<script type="text/javascript">
function ready(callback){ //see https://stackoverflow.com/a/7053197
// in case the document is already rendered
if (document.readyState!='loading') callback();
// modern browsers
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', callback);
// IE <= 8
else document.attachEvent('onreadystatechange', function(){
if (document.readyState=='complete') callback();
});
}
// This function ONLY works for iFrames of the same origin as their parent
function iFrameReady(iFrame, fn) { //see https://stackoverflow.com/a/24603642/903783
var timer;
var fired = false;
function ready() {
if (!fired) {
fired = true;
clearTimeout(timer);
fn.call(this);
}
}
function readyState() {
if (this.readyState === "complete") {
ready.call(this);
}
}
// cross platform event handler for compatibility with older IE versions
function addEvent(elem, event, fn) {
if (elem.addEventListener) {
return elem.addEventListener(event, fn);
} else {
return elem.attachEvent("on" + event, function () {
return fn.call(elem, window.event);
});
}
}
// use iFrame load as a backup - though the other events should occur first
addEvent(iFrame, "load", function () {
ready.call(iFrame.contentDocument || iFrame.contentWindow.document);
});
function checkLoaded() {
var doc = iFrame.contentDocument || iFrame.contentWindow.document;
// We can tell if there is a dummy document installed because the dummy document
// will have an URL that starts with "about:". The real document will not have that URL
if (doc.URL.indexOf("about:") !== 0) {
if (doc.readyState === "complete") {
ready.call(doc);
} else {
// set event listener for DOMContentLoaded on the new document
addEvent(doc, "DOMContentLoaded", ready);
addEvent(doc, "readystatechange", readyState);
}
} else {
// still same old original document, so keep looking for content or new document
timer = setTimeout(checkLoaded, 1);
}
}
checkLoaded();
}
////////////////////////////////
var pivotFilms, pivotConversations, pivotL3STinstances, pivotL3TTinstances;
var readyCallback = function(){
iFrameReady(document.getElementById("frameFilms"), function() {
pivotFilms = document.getElementById("frameFilms").contentDocument.getElementsByClassName("pivot_ajax_viewer")[0].pivotViewer;
iFrameReady(document.getElementById("frameConversations"), function() {
pivotConversations = document.getElementById("frameConversations").contentDocument.getElementsByClassName("pivot_ajax_viewer")[0].pivotViewer;
iFrameReady(document.getElementById("frameL3STinstances"), function() {
pivotL3STinstances = document.getElementById("frameL3STinstances").contentDocument.getElementsByClassName("pivot_ajax_viewer")[0].pivotViewer;
iFrameReady(document.getElementById("frameL3TTinstances"), function() {
pivotL3TTinstances = document.getElementById("frameL3TTinstances").contentDocument.getElementsByClassName("pivot_ajax_viewer")[0].pivotViewer;
if (pivotFilms === undefined ||
pivotConversations === undefined ||
pivotL3STinstances === undefined ||
pivotL3TTinstances === undefined)
{
setTimeout(function(){ ready(readyCallback); }, 100);
return;
}
var bind = function(parentPivot, parentFacet, childPivot, childParentFacet) {
var bindOneWay = function(parentPivot, parentFacet, childPivot, childParentFacet) {
parentPivot.addListener("finishedRearrange", function () {
var activeItems = parentPivot.getActiveItems(); //runFiltersWithout(null); //TODO: without getActiveItems can use official seajax distro
var activeValues = activeItems.map(function (item) { return (!parentFacet)?item.id:item.facets[parentFacet][0] });
if (activeValues.length===1) activeValues.push(activeValues[0]); //workarround for filterrequest's special handling of length===1
//activeValues.forEach(function (value) { console.log(value); });
childPivot.trigger("filterrequest", {
facet: childParentFacet,
values: activeValues,
type: "String"
});
});
};
bindOneWay(parentPivot, parentFacet, childPivot, childParentFacet); //propagate from parent to child
//bindOneWay(childPivot, childParentFacet, parentPivot, parentFacet); //propagate from child to parent //TODO: fix, seems to loop (could check at "filterRequest" if items differs from activeItems to propagate further via "filterrrequest"
};
//propagate pivot active items change
bind(pivotFilms, "Reference Id", pivotConversations, "Film Reference Id");
bind(pivotConversations, "Reference Id", pivotL3STinstances, "Conversation Reference Id");
bind(pivotL3STinstances, "Reference Id", pivotL3TTinstances, "L3ST-instance Reference Id");
}); //iFrameReady
}); //iFrameReady
}); //iFrameReady
}); //iFrameReady
}; //readyCallback
ready(readyCallback);
</script>
</head>
<body>
<iframe id="frameFilms" class="container" src="http://gallery.trafilm.net/film">
<a href="http://gallery.trafilm.net/film">Trafilm Gallery | Films</a>
</iframe>
<iframe id="frameConversations" class="container" src="http://gallery.trafilm.net/conversation">
<a href="http://gallery.trafilm.net/conversation">Trafilm Gallery | Conversations</a>
</iframe>
<iframe id="frameL3STinstances" class="container" src="http://gallery.trafilm.net/L3STinstance">
<a href="http://gallery.trafilm.net/L3STinstance">Trafilm Gallery | L3ST-instances</a>
</iframe>
<iframe id="frameL3TTinstances" class="container" src="http://gallery.trafilm.net/L3TTinstance">
<a href="http://gallery.trafilm.net/L3TTinstance">Trafilm Gallery | L3TT-instances</a>
</iframe>
</body>
</html>