PageSourceSearch

https://minictalogus-be-2026.minicatalogus.workers.dev/js/flowpaper_handlers.js

js minictalogus-be-2026.minicatalogus.workers.dev collected 2026-10-03 08:08:48 UTC 6,637 bytes, 202 lines download raw bytes

1/**
2 █▒▓▒░ The FlowPaper Project
3
4 This file is part of FlowPaper.
5
6 FlowPaper is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, version 3 of the License.
9
10 FlowPaper is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with FlowPaper.  If not, see <http://www.gnu.org/licenses/>.
17
18 For more information on FlowPaper please see the FlowPaper project
19 home page: https://flowpaper.com
20 */
21
22jQuery(function() {
23    /**
24     * Handles the event of external links getting clicked in the document.
25     *
26     * @example onExternalLinkClicked("http://www.google.com")
27     *
28     * @param String link
29     */
30    jQuery('#documentViewer').bind('onExternalLinkClicked',function(e,link){
31        if(link.indexOf('mailto:')==0){
32            window.parent.location.href = link;
33        }else if(!FLOWPAPER.LinkTarget || (FLOWPAPER.LinkTarget && FLOWPAPER.LinkTarget == 'New window')){
34            if (window.eb && window.eb.platform && window.eb.platform.touchonlydevice) {
35                if (window != window.top) { // in a iframe
36                    window.parent.location.href = link;
37                } else { // loaded as parent
38                    document.location.href = link;
39                }
40            } else {
41                var newWindow = window.open(link, '_flowpaper_exturl');
42
43                if (FLOWPAPER.blockedNewWindow(newWindow)) {
44                    document.location.href = link;
45                }
46            }
47        }else if(FLOWPAPER.LinkTarget){
48            if(FLOWPAPER.LinkTarget == 'Full window'){
49                window.parent.location.href = link;
50            }
51
52            if(FLOWPAPER.LinkTarget == 'Same window'){
53                window.location.href = link;
54            }
55        }
56
57        // record the Google Analytics event
58        TrackFlowPaperEvent(jQuery(this).data('TrackingNumber'),jQuery(this).data('TrackingDocument'),'External Link Clicked',link,null);
59    });
60
61    /**
62     * Handles the event of videos being played in the document.
63     *
64     * @example onVideoStarted("http://youtube.com/abc")
65     *
66     * @param String video url
67     */
68    jQuery('#documentViewer').bind('onVideoStarted',function(e,videoProps){
69        // record the Google Analytics event
70        TrackFlowPaperEvent(jQuery(this).data('TrackingNumber'),jQuery(this).data('TrackingDocument'),'Video Started',videoProps.VideoUrl,videoProps.PageNumber);
71    });
72
73
74    /**
75     * Handles the event of the original document being downloaded.
76     *
77     * @example onDownloadDocument("https://mydomain.com/abc.pdf")
78     *
79     * @param String pdf url
80     */
81    jQuery('#documentViewer').bind('onDownloadDocument',function(e,pdfUrl){
82        // record the Google Analytics event
83        TrackFlowPaperEvent(jQuery(this).data('TrackingNumber'),jQuery(this).data('TrackingDocument'),'Document Downloaded',pdfUrl,null);
84    });
85
86    /**
87     * Recieves progress information about the document being loaded
88     *
89     * @example onProgress( 100,10000 );
90     *
91     * @param int loaded
92     * @param int total
93     */
94    jQuery('#documentViewer').bind('onProgress',function(e,loadedBytes,totalBytes){
95
96    });
97
98    /**
99     * Handles the event of a document is in progress of loading
100     *
101     */
102    jQuery('#documentViewer').bind('onDocumentLoading',function(e){
103
104    });
105
106    /**
107     * Handles the event of a document is in progress of loading
108     *
109     */
110    jQuery('#documentViewer').bind('onPageLoading',function(e,pageNumber){
111
112    });
113
114    /**
115     * Receives messages about the current page being changed
116     *
117     * @example onCurrentPageChanged( 10 );
118     *
119     * @param int pagenum
120     */
121    jQuery('#documentViewer').bind('onCurrentPageChanged',function(e,pagenum){
122        // if GANumber is supplied then lets track this as a Google Analytics event.
123        if(jQuery(this).data('TrackingNumber')){
124            var trackingDoc     = jQuery(this).data('TrackingDocument');
125            var pagelocation    = (document.location.pathname.indexOf('.html')>-1?document.location.pathname.substr(0,document.location.pathname.lastIndexOf('.html'))+'/':document.location.pathname)+'#page='+pagenum;
126
127            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
128                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
129                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
130            })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
131
132            ga('create', jQuery(this).data('TrackingNumber'), 'auto', 'FlowPaperEventTracker');
133            ga('FlowPaperEventTracker.set', 'page', pagelocation);
134            ga('FlowPaperEventTracker.send', 'pageview');
135        }
136    });
137
138    /**
139     * Receives messages about the document being loaded
140     *
141     * @example onDocumentLoaded( 20 );
142     *
143     * @param int totalPages
144     */
145    jQuery('#documentViewer').bind('onDocumentLoaded',function(e,totalPages){
146
147    });
148
149    /**
150     * Receives messages about the page loaded
151     *
152     * @example onPageLoaded( 1 );
153     *
154     * @param int pageNumber
155     */
156    jQuery('#documentViewer').bind('onPageLoaded',function(e,pageNumber){
157
158    });
159
160    /**
161     * Receives messages about the page loaded
162     *
163     * @example onErrorLoadingPage( 1 );
164     *
165     * @param int pageNumber
166     */
167    jQuery('#documentViewer').bind('onErrorLoadingPage',function(e,pageNumber){
168
169    });
170
171    /**
172     * Receives error messages when a document is not loading properly
173     *
174     * @example onDocumentLoadedError( "Network error" );
175     *
176     * @param String errorMessage
177     */
178    jQuery('#documentViewer').bind('onDocumentLoadedError',function(e,errMessage){
179
180    });
181
182    /**
183     * Receives error messages when a document has finished printed
184     *
185     * @example onDocumentPrinted();
186     *
187     */
188    jQuery('#documentViewer').bind('onDocumentPrinted',function(e,numPages){
189
190    });
191
192    /**
193     * Handles the event of a pdf requiring a password
194     *
195     * @example onPasswordNeeded(updatePassword,reason)
196     *
197     * @param updatePassword callback function for setting the password
198     */
199    jQuery('#documentViewer').bind('onPasswordNeeded',function(e,updatePassword){
200
201    });
202});

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.