PageSourceSearch

https://www.liferadio.at/external/flipboard/pdf-flip.js?v=1.1.1.1.1.1

js liferadio.at collected 2026-10-02 03:08:33 UTC 12,058 bytes, 328 lines download raw bytes

1var PdfFlip = {
2    magazineMode: true,
3    oldScale: 1,
4    currentPage: 1,
5    currentScale: 1,
6    layout: 'double',
7    maxScale: 2,
8    audioSrc: "sound/page-flip.mp3",
9    init: function () {
10
11        $(window).unbind('keydown');
12        $(window).bind('keydown', function (e) {
13            if (e.target && e.target.tagName.toLowerCase() != 'input') {
14                if (e.keyCode == 37 || e.keyCode == 38) {
15                    $('.directions .prev-button').click();
16                }
17                else if (e.keyCode == 39 || e.keyCode == 40) {
18                    $('.directions .next-button').click();
19                }
20            }
21        });
22
23        $(document).off('click','#firstPage');
24        $(document).on('click','#firstPage',function(){
25            $("#magazine").turn('page', 1);
26        });
27
28        $(document).off('click','#lastPage');
29        $(document).on('click','#lastPage',function(){
30            $("#magazine").turn('page', PDFViewerApplication.pagesCount);
31        });
32
33        $(document).off('click','#thumbnailView a');
34        $(document).on('click','#thumbnailView a',function(){
35          $('.toolbar .pageNumber').trigger('change');
36        });
37
38        $(document).off('change', '.toolbar .pageNumber');
39        $(document).on('change', '.toolbar .pageNumber', function (e) {
40            $("#magazine").turn('page', $(this).val());
41        });
42
43        $(document).off('click', '.toolbar #previous , .directions .prev-button');
44        $(document).on('click', '.toolbar #previous , .directions .prev-button', function (e) {
45            $("#magazine").turn('previous');
46            return false;
47        });
48
49        $(document).off('click', '.toolbar #next, .directions .next-button');
50        $(document).on('click', '.toolbar #next, .directions .next-button', function (e) {
51            $("#magazine").turn('next');
52            return false;
53        });
54        
55        document.addEventListener("pagesloaded", PdfFlip.launchMagazineMode, true);
56    },
57    launchMagazineMode: function (e) {
58        document.removeEventListener("pagesloaded", PdfFlip.launchMagazineMode, true);
59        PdfFlip.start();
60    },
61    start: function () {
62        PDFViewerApplication.disableWorker = true;
63
64        PdfFlip.magazineMode = true;
65        PdfFlip.oldScale = PDFViewerApplication.pdfViewer.currentScale;
66        PDFViewerApplication.pdfViewer.currentScaleValue = 'page-fit';
67
68        $('#viewerContainer').after('<div id="magazineContainer"><div id="magazine"></div></div>');
69        $('.flipboard').append('<div class="directions"><button class="prev-button"></button><button class="next-button"></button></div>')
70        $("#viewerContainer").hide();
71        $("#viewer").hide();
72        $(".se-pre-con").hide();
73        $("#magazine").show();
74
75        PdfFlip.currentPage = PDFViewerApplication.page;
76
77
78        var pages = [1];
79
80        PdfFlip.loadTurnJsPages(pages, $('#magazine'), true, true).then(function () {
81
82            $("#magazine").turn({
83                autoCenter: true,
84                display: 'single',
85                width: $("#viewer .canvasWrapper canvas")[0].width,
86                height: $("#viewer .canvasWrapper canvas")[0].height,
87                pages: PDFViewerApplication.pdfDocument.numPages,
88                page: 1,
89                elevation: 100,
90                duration: 600,
91                acceleration: !PdfFlip.isChrome(),
92                when: {
93                    missing: function (event, pages) {
94                        PdfFlip.loadTurnJsPages(pages, this, false, false);
95                    },
96                    turning: function (event, page, view) {
97                        if (!$('#magazine').turn('hasPage', page)) {
98
99                            PdfFlip.loadTurnJsPages([page], this, false, true).then(function () {
100                                $('#magazine').turn('page', page);
101                            });
102
103                            event.preventDefault();
104                        }
105                        PdfFlip.startTurnSound();
106                        PdfFlip.currentPage = page;
107                        PDFViewerApplication.page = page;
108                    },
109                    turned: function(event, page, view){
110
111                    }
112                }
113            });
114
115
116            setTimeout(function () {
117                $("#magazine").turn("display", PdfFlip.layout);
118
119                var multiplier = PdfFlip.layout == 'double' ? 2 : 1;
120
121                $("#magazine").turn("size",
122                    $("#magazine canvas")[0].width * multiplier,
123                    $("#magazine canvas")[0].height);
124
125                if (PdfFlip.currentPage > 1)
126                    $("#magazine").turn("page", PdfFlip.currentPage);
127
128
129                $("#magazineContainer").zoom({
130                    max: PdfFlip.maxScale,
131                    flipbook: $('#magazine'),
132                    when: {
133                        tap: function (event) {
134
135                            if ($(this).zoom('value') == 1) {
136                                $('#magazine').
137                                    removeClass('animated').
138                                    addClass('zoom-in');
139                                $(this).zoom('zoomIn', event);
140                            } else {
141                                $(this).zoom('zoomOut');
142                            }
143                        },
144                        resize: function (event, scale, page, pageElement) {
145                            PdfFlip.currentScale = scale;
146                            PdfFlip.loadTurnJsPages($('#magazine').turn('view'), $('#magazine'), false, false);
147
148                        },
149                        zoomIn: function () {
150                            $('.zoom-icon').removeClass('zoom-icon-in').addClass('zoom-icon-out');
151                            $('#magazine').addClass('zoom-in');
152                            PdfFlip.resizeViewport();
153                        },
154                        zoomOut: function () {
155                            $('.zoom-icon').removeClass('zoom-icon-out').addClass('zoom-icon-in');
156                            setTimeout(function () {
157                                $('#magazine').addClass('animated').removeClass('zoom-in');
158                                PdfFlip.resizeViewport();
159                            }, 0);
160
161                        },
162                        swipeLeft: function () {
163                            $('#magazine').turn('next');
164                        },
165                        swipeRight: function () {
166                            $('#magazine').turn('previous');
167                        }
168                    }
169                });
170
171                $('.zoom-icon').bind('click', function () {
172                    if ($(this).hasClass('zoom-icon-in'))
173                        $('#magazineContainer').zoom('zoomIn');
174                    else if ($(this).hasClass('zoom-icon-out'))
175                        $('#magazineContainer').zoom('zoomOut');
176
177                });
178
179            }, 10);
180        });
181    },
182    resizeViewport: function () {
183
184        var width = $(window).width(),
185            height = $(window).height(),
186            options = $('#magazine').turn('options');
187
188        $('#magazine').removeClass('animated');
189
190        $('#magazineContainer').css({
191            width: width,
192            height: height - $('.toolbar').height()
193        }).zoom('resize');
194
195
196        if ($('#magazine').turn('zoom') == 2) {
197            var bound = PdfFlip.calculateBound({
198                width: options.width,
199                height: options.height,
200                boundWidth: Math.min(options.width, width),
201                boundHeight: Math.min(options.height, height)
202            });
203
204            if (bound.width % 2 !== 0)
205                bound.width -= 1;
206
207
208            if (bound.width != $('#magazine').width() || bound.height != $('#magazine').height()) {
209
210                $('#magazine').turn('size', bound.width, bound.height);
211
212                if ($('#magazine').turn('page') == 1)
213                    $('#magazine').turn('peel', 'br');
214            }
215
216            $('#magazine').css({top: -bound.height / 2, left: -bound.width / 2});
217        }
218
219        $('#magazine').addClass('animated');
220
221    },
222    calculateBound: function (d) {
223
224        var bound = {width: d.width, height: d.height};
225
226        if (bound.width > d.boundWidth || bound.height > d.boundHeight) {
227
228            var rel = bound.width / bound.height;
229
230            if (d.boundWidth / rel > d.boundHeight && d.boundHeight * rel <= d.boundWidth) {
231
232                bound.width = Math.round(d.boundHeight * rel);
233                bound.height = d.boundHeight;
234
235            } else {
236
237                bound.width = d.boundWidth;
238                bound.height = Math.round(d.boundWidth / rel);
239
240            }
241        }
242
243        return bound;
244    },
245    calculateTotalPages: function () {
246        return $('#viewer .page').length;
247    },
248    startTurnSound: function () {
249        var audio = new Audio(PdfFlip.audioSrc);
250        audio.play();
251    },
252
253    loadTurnJsPages: function (pages, magazine, isInit, defer, scale) {
254        var deferred = null;
255
256        if (defer)
257            deferred = $.Deferred();
258
259        var pagesRendered = 0;
260        for (var i = 0; i < pages.length; i++) {
261            PDFViewerApplication.pdfDocument.getPage(pages[i]).then(function (page) {
262
263                var destinationCanvas = document.createElement('canvas');
264
265                var unscaledViewport = page.getViewport(1);
266                var divider = PdfFlip.layout == 'double' ? 2 : 1;
267
268                var scale = Math.min((($('#mainContainer').height() - 20) / unscaledViewport.height), ((($('#mainContainer').width() - 80) / divider) / unscaledViewport.width));
269
270                var viewport = page.getViewport(scale);
271
272
273                if (PdfFlip.currentScale > 1)
274                    viewport = page.getViewport(PdfFlip.currentScale);
275
276                destinationCanvas.height = viewport.height; // - ((viewport.height / 100) * 10);
277                destinationCanvas.width = viewport.width; // - ((viewport.width / 100) * 10);
278
279
280                var renderContext = {
281                    canvasContext: destinationCanvas.getContext("2d"),
282                    viewport: viewport
283                };
284
285                page.render(renderContext).promise.then(function () {
286                    pagesRendered++;
287
288                    destinationCanvas.setAttribute('data-page-number', page.pageNumber);
289                    destinationCanvas.id = 'magCanvas' + page.pageNumber;
290
291
292                    if (!isInit) {
293                        if ($(magazine).turn('hasPage', page.pageNumber)) {
294
295                            var oldCanvas = $('#magCanvas' + page.pageNumber)[0];
296                            oldCanvas.width = destinationCanvas.width;
297                            oldCanvas.height = destinationCanvas.height;
298
299                            var oldCtx = oldCanvas.getContext("2d");
300
301
302                            oldCtx.drawImage(destinationCanvas, 0, 0);
303
304
305                        }
306                        else {
307                            $(magazine).turn('addPage', $(destinationCanvas), page.pageNumber);
308                        }
309                    }
310                    else {
311                        $("#magazine").append($(destinationCanvas));
312                    }
313
314                    if (pagesRendered == pages.length)
315                        if (deferred)
316                            deferred.resolve();
317                });
318            });
319        }
320
321        if (deferred)
322            return deferred;
323
324    },
325    isChrome: function () {
326        return navigator.userAgent.indexOf('Chrome') != -1;
327    }
328};

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.