PageSourceSearch

https://www.risiko-freiheit.de/js/model/content.js

js risiko-freiheit.de collected 2026-10-02 19:16:13 UTC 7,921 bytes, 223 lines download raw bytes

1/**
2 * Created by em on 07.05.15.
3 */
4//var fileProxy = "http://localhost/exhib.danielfinke.eu/fileProxy/?token=07231c781c2cc59a12c7743cf6ef2d98&uuid=af337e06-1f47-5cdc-a173-1045f86a51eb&filename=";
5var fileProxy = "https://exhib.danielfinke.eu/fileProxy/?token=07231c781c2cc59a12c7743cf6ef2d98&uuid=af337e06-1f47-5cdc-a173-1045f86a51eb&filename=";
6var exhibitionUUID = "af337e06-1f47-5cdc-a173-1045f86a51eb";
7
8
9function Story(position, eiid, title, quelle, tourText, vertiefungText, img, images ,media, type, info){
10    this.position = position;
11    this.eiid = eiid;
12    this.title = title;
13    this.quelle = quelle;
14    this.tourText = tourText;
15    this.vertiefungText = vertiefungText;
16    this.img = img;
17    this.images = images;
18    this.media = media;
19    this.type = type;
20    this.info = info;
21}
22
23
24function getSelectedTourEiid(){
25    if(document.location.toString().indexOf('?') !== -1) {
26        var search = document.location.search
27        var tour = decodeURIComponent(search).split('=');
28        var tourId = tour[1];
29        return tourId;
30    }
31}
32
33function getStory(contentId, contentLanguage, requestedAllFields){
34    var storyVo;
35    var hasSubImages = ["0","4","1"];
36    var deferred = $.Deferred();
37    amfphp.services.ContentService.getContent(function retrieveContentResult(result){
38        storyVo = result.content;
39        if($.inArray(storyVo.int1, hasSubImages) != -1){
40            $.when( getAllImages(storyVo.eiid, "de", true)).done(
41                function (content) {
42                    storyVo.images = content;
43                    deferred.resolve(storyVo);
44                });
45        }else{
46            deferred.resolve(storyVo);
47        }
48    }, onError, exhibitionUUID, contentId, contentLanguage, requestedAllFields);
49    return deferred.promise();
50}
51
52
53function getTermialContent(terminalId, contentLanguage, requestedAllFields){
54    var content = [];
55    var deferred = $.Deferred();
56    amfphp.services.TerminalService.listContents(function retrieveListResults(result){
57        content = result.content;
58        deferred.resolve(content);
59    }, onError, exhibitionUUID, terminalId, contentLanguage, requestedAllFields);
60    return deferred.promise();
61}
62
63function getTourByEiid(tourEiid, contentLanguage, requestedAllFields){
64    var tourVo;
65    var deferred = $.Deferred();
66    amfphp.services.ContentService.getContent(function retrieveContentResult(result){
67        tourVo = result.content;
68        deferred.resolve(tourVo);
69    }, onError, exhibitionUUID, tourEiid, contentLanguage, requestedAllFields);
70    return deferred.promise();
71}
72
73function getEiidsOfAllStories(tourEiid, contentLanguage, requestedAllFields){
74    var deferred = $.Deferred();
75    amfphp.services.ContentService.listContents(function retrieveListResults(result){
76        $.when(retrieveEiidsFromStories(result.content)).done(
77            function(eiids){
78                deferred.resolve(eiids);
79            }
80        );
81    }, onError, exhibitionUUID, tourEiid, contentLanguage, requestedAllFields);
82    return deferred.promise();
83}
84
85function retrieveEiidsFromStories(stories){
86    var eiids = [];
87    var deferred = $.Deferred();
88    stories.forEach(function(story){
89        eiids.push(story.eiid);
90        deferred.resolve(eiids)
91    });
92    return deferred.promise();
93}
94
95function onError(error){
96    console.log(error.message);
97}
98
99function getCurrentStoryPosFromURI(){
100    if(document.location.toString().indexOf('#') !== -1) {
101        var hash = document.location.hash;
102        var story = decodeURIComponent(hash).split('#');
103        return story[1];
104    }
105}
106
107function getCurrentTourPosFromURI(){
108    if(document.location.toString().indexOf('?') !== -1) {
109        var hash = document.location.hash;
110        var story = decodeURIComponent(hash).split('?');
111        return story[1];
112    }
113}
114
115function setCurrentStoryPosInURI(){
116    var location = document.location.pathname + document.location.search;
117    document.location.href = location + '#' + currentStory.position;
118}
119
120function getTourTags(){
121    var infoObj = JSON.parse(currentStory.info);
122    return infoObj.tags;
123}
124
125function getVertiefungsTags(object){
126    var infoObj = JSON.parse(object);
127    return infoObj.tags;
128}
129
130function getNextStory(){
131    var currentPosition = parseInt(currentStory.position);
132    if(currentPosition + 1 <= eiidsOfAllStories.length){
133        var nextPosition = currentPosition + 1;
134        var nextEiid = eiidsOfAllStories[nextPosition - 1];
135        var deferred = $.Deferred();
136        $.when(getStory(nextEiid, "de", true)).done(
137            function(content){
138                currentStory.eiid = content.eiid;
139                currentStory.title = content.title;
140                currentStory.quelle = content.short1;
141                currentStory.tourText = content.short2;
142                currentStory.vertiefungText = content.fulltext;
143                currentStory.position = currentPosition + 1;
144                currentStory.img = content.path1;
145                currentStory.images = content.images;
146                currentStory.media = content.path2;
147                currentStory.type = content.int1;
148                currentStory.info = content.varchar1;
149                deferred.resolve();
150            }
151        );
152        return deferred.promise();
153    }
154}
155
156
157function getPreviousStory(){
158    var currentPosition = parseInt(currentStory.position);
159    if(currentPosition - 1 >= 0){
160        var prevPosition = currentPosition - 1;
161        var prevEiid = eiidsOfAllStories[prevPosition - 1];
162        var deferred = $.Deferred();
163        $.when(getStory(prevEiid, "de", true)).done(
164            function(content){
165                currentStory.eiid = content.eiid;
166                currentStory.title = content.title;
167                currentStory.quelle = content.short1;
168                currentStory.tourText = content.short2;
169                currentStory.vertiefungText = content.fulltext;
170                currentStory.position = currentPosition - 1;
171                currentStory.img = content.path1;
172                currentStory.images = content.images;
173                currentStory.media = content.path2;
174                currentStory.type = content.int1;
175                currentStory.info = content.varchar1;
176                deferred.resolve();
177            }
178        );
179        return deferred.promise();
180    }
181}
182
183function getAllImages(storyEiid, contentLanguage, requestedAllFields){
184    var images = [];
185    var deferred = $.Deferred();
186    amfphp.services.ContentService.listContents(function retrieveListResults(result){
187        images = result.content;
188        deferred.resolve(images);
189    }, onError, exhibitionUUID, storyEiid, contentLanguage, requestedAllFields);
190    return deferred.promise();
191}
192
193
194function getTerminalContent(terminalId, contentLanguage, requestedAllFields){
195    var content = [];
196    var deferred = $.Deferred();
197    amfphp.services.ContentService.listContents(function retrieveListResults(result){
198        content = result.content;
199        deferred.resolve(content);
200    }, onError, exhibitionUUID, terminalId, contentLanguage, requestedAllFields);
201    return deferred.promise();
202}
203
204
205function getVertiefungByEiid(eiid, contentLanguage, requestedAllFields){
206    var vertiefungsVo;
207    var deferred = $.Deferred();
208    amfphp.services.ContentService.getContent(function retrieveContentResult(result){
209        vertiefungsVo = result.content;
210        deferred.resolve(vertiefungsVo);
211    }, onError, exhibitionUUID, eiid, contentLanguage, requestedAllFields);
212    return deferred.promise();
213}
214
215function getContentByEiid(eiid, contentLanguage, requestedAllFields){
216    var contentVo;
217    var deferred = $.Deferred();
218    amfphp.services.ContentService.getContent(function retrieveContentResult(result){
219        contentVo = result.content;
220        deferred.resolve(contentVo);
221    }, onError, exhibitionUUID, eiid, contentLanguage, requestedAllFields);
222    return deferred.promise();
223}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.