PageSourceSearch

https://edicola.buonasera24.it/tarantobuonasera/assets/js/core.js?v=4

js buonasera24.it collected 2026-10-02 12:25:23 UTC 15,045 bytes, 598 lines download raw bytes

1/*
2 * Components at disposal:
3 *
4 *   bootstrap
5 *   eModal = helper for bootstrap modal
6 *   validator = class used for validate forms
7 *
8 * */
9
10var VNP = new function () {
11
12  var self = this;
13  var debug = false;
14  var environment = "production"; // test / development / production
15  var edition = null; //20170918
16  var editionId = null; //20170918
17  var titleId = null; //20170918
18  var pageflip = "pageflip"; // for routing
19  var title;
20  var isMobile;
21  var titleType; // possible values are virtualnewspaper, virtualmagazine, virtualcomics, virtualbook
22
23  var editionSlug = null;
24  var titleSlug = null;
25  var editionLabel = null;
26
27  self.baseUrl = ""; // baseUrl is the same of ${baseUrl} freemarker
28  self.globalTitle = ""; // testata in java
29  self.formatDate = "DD/MM/YYYY"; // get value from settings backoffice
30  self.getLanguagesKey = {}; // get value from settings backoffice
31  self.isDoublePage;
32  self.editionDateFourDigit;
33  self.linkEvoStream = null;
34  self.isDigitalEdition = false;
35  self.isAdmin = false;
36  self.isAnApp = false;
37  var disableContextMenu = false;
38  self.platform; // possible values are newspaper, virtualmagazine, virtualcomics, virtualbook
39
40  self.getDisableContextMenu = function() {
41    return disableContextMenu;
42  };
43
44  self.setDisableContextMenu = function(isDisabled) {
45    disableContextMenu = isDisabled;
46  };
47
48  self.setPlatform = function(platform){
49    self.platform = platform;
50  };
51
52  self.getPlatform = function(){
53    return self.platform;
54  };
55
56  self.setTitleType = function(type){
57    titleType = type;
58  };
59
60  self.getTitleType = function(){
61    return titleType;
62  };
63
64
65  self.setEditionSlug = function (ediSlug) {
66    editionSlug = ediSlug;
67  }
68  self.setTitleSlug = function (titSlug) {
69    titleSlug = titSlug;
70  }
71  self.setEditionLabel = function (ediLabel) {
72    editionLabel = ediLabel;
73  }
74
75  self.getEditionSlug = function () {
76    return editionSlug;
77  }
78  self.getTitleSlug = function () {
79    return titleSlug;
80  }
81  self.getEditionLabel = function () {
82    return editionLabel;
83  }
84
85  /*
86   * set environment
87   * @param environment {String} : possible values are test, development or production
88   * */
89  self.setEnvironment = function(env){
90    if(env !== "production" || env !== "development" || env !== "test"){
91      environment = "development";
92    } else {
93      environment = env;
94    }
95  };
96
97  /*
98   * get environment
99   * @param environment {String} : possible values are test, development or production
100   * */
101  self.getEnvironment = function(){
102    return environment;
103  };
104
105  /*
106   * set debug mode
107   * @param mode {Boolean} : true or false, enable / disable debug mode
108   */
109  self.setDebug = function () {
110    debug = !debug;
111  };
112
113  /*
114   * get debug mode
115   * @return mode {Boolean} : true or false, enable / disable debug mode
116   */
117  self.getDebug = function () {
118    return debug;
119  };
120
121  /*
122   * get the edition
123   * @return edition {String} : YYYYMMDDdirectory
124   * */
125  self.getEdition = function () {
126    return edition;
127  };
128
129  /*
130   * set the edition
131   * @param edition {String} : YYYYMMDDdirectory
132   * */
133  self.setEdition = function (edi) {
134    edition = edi;
135  };
136
137  self.setEditionId = function (ediId) {
138
139    editionId = ediId;
140  };
141
142  self.setTitleId = function (titId) {
143    titleId = titId;
144  };
145
146  self.getEditionId = function () {
147
148    return editionId;
149  };
150
151  self.getTitleId = function () {
152    return titleId;
153  };
154
155  /*
156   * get the title
157   * @return title {String} : directory
158   * */
159  self.getTitle = function () {
160    return title;
161  };
162
163
164  /*
165   * set the title
166   * @param title {String} : directory
167   * */
168  self.setTitle = function (ti) {
169    title = ti;
170  };
171
172  /*
173   * get if is mobile version
174   * @return isMobile {Boolean} : true or false
175   */
176  self.getIsMobile = function () {
177    return isMobile;
178  };
179
180  /*
181   * set mobile version
182   * @param mode {Boolean} : true or false, enable / disable mobile views
183   */
184  self.setIsMobile = function (mode) {
185    isMobile = mode;
186  };
187
188  /*
189   * To change title when we click on calendar
190   * @param url {String} : title/editionName   eg. quattrozampe/20160701quattrozampe
191   * @param target {String}: _blank, to open in a new window
192   */
193  self.openEdition = function ( url, target ) {
194
195    if( url !== null && typeof url !== "undefined" && url !== "undefined" ){
196
197      var realUrl = VNP.baseUrl + "/" + pageflip + "/" + VNP.Areas.Reader.getReader() + "/" + url;
198
199      if( target !== null && target == "_blank"){
200        window.open(realUrl);
201      } else {
202        location.href = realUrl;
203      }
204
205
206    } else {
207
208      var options = {
209        classname:"alert-danger", // bootstrap class [ alert-danger, alert-info, alert-success, alert-warning ]
210        message :"Insert a valid url", // message to show
211        close : {
212          auto :true
213        }// auto hide
214      };
215
216      VNP.setNotifications(options);
217
218      console.log("create message error");
219
220    }
221    return false;
222  };
223
224
225  /*
226   *  set and show notifications
227   * @param options {Object} : possibles parameters are: classname and message
228   * options.classname // bootstrap class [ alert-danger, alert-info, alert-success, alert-warning ]
229   * options.message // message to show
230   * options.close.auto // auto hide
231   * options.close.delay // auto hide after (speed) milliseconds default 2000
232   * */
233  self.setNotifications = function(options){
234    var $template = document.querySelector("#vc_template_notifications").content.cloneNode(true);
235    var $notification = $("#vc_notifications");
236
237    if( typeof options == "object" && options !== "undefined" && $.trim(options) !== "" && options !== null ){
238
239      $notification.empty();
240      $($template).find(".alert").addClass(options.classname);
241      $($template).find(".vc_message").html(options.message);
242
243      document.querySelector("#vc_notifications").appendChild(
244          document.importNode($template, true));
245
246      if(options.close && options.close.auto){
247        var speed = (options.close.delay) ? options.close.delay : "2000";
248        $notification.show();
249        $notification.delay(speed).slideUp(function(){
250          $notification.empty();
251        });
252      } else {
253        $notification.show();
254      }
255
256    }
257
258  };
259
260  /*
261   * open popup login
262   * @param e {Object} : the event to reset the default event of the <a>
263   */
264  self.openLogin = function (e) {
265
266    var options = {
267      url: self.baseUrl + '/customer/login',
268      title: VNP.getLanguagesKey["login_title"],
269      useBin: true,
270      classname: "vc_no_footer_dg",
271      buttons: []
272    };
273
274    eModal.ajax(options);
275
276    // stop event propagation
277    if (e == null || e == undefined || e == "undefined" || typeof e != "object") {
278      return false;
279    } else {
280      e.preventDefault();
281    }
282  };
283
284  /*
285   * open helper
286   * @param e {Object} : the event to reset the default event of the <a>
287   * @param element {String} : class or id of the tag
288   */
289  self.openHelper = function (e, element) {
290
291    if (element == null || element == undefined || element == "undefined") {
292      var element = ".vc_open_helper";
293    }
294
295    var href = $(element).attr('href');
296
297    var options = {
298      url: href + "?ajaxCall",
299      title: self.getLanguagesKey["faq_title"],
300      size: eModal.size.lg,
301      buttons: []
302    };
303
304    eModal.ajax(options);
305
306    // stop event propagation
307    if (e == null || e == undefined || e == "undefined" || typeof e != "object") {
308      return false;
309    } else {
310      e.preventDefault();
311    }
312  };
313
314  /*
315   * open terms and conditions
316   * @param e {Object} : the event to reset the default event of the <a>
317   * @param element {String} : class or id of the tag
318   */
319  self.openTerms = function (e, element) {
320
321    if (element == null || element == undefined || element == "undefined") {
322      var element = ".vc_open_terms";
323    }
324
325    var href = $(element).attr('href');
326
327    var options = {
328      url: href + "?ajaxCall",
329      title: self.getLanguagesKey["cflcleggitermsandconditions"],
330      size: eModal.size.lg,
331      buttons: []
332    };
333
334    eModal.ajax(options);
335
336    // stop event propagation
337    if (e == null || e == undefined || e == "undefined" || typeof e != "object") {
338      return false;
339    } else {
340      e.preventDefault();
341    }
342  };
343
344  /*
345   * open Privacy Policies
346   * @param e {Object} : the event to reset the default event of the <a>
347   * @param element {String} : class or id of the tag
348   */
349  self.openPolicies = function (e, element) {
350
351    if (element == null || element == undefined || element == "undefined") {
352      var element = ".vc_open_policies";
353    }
354
355    var href = $(element).attr('href');
356
357    var options = {
358      url: href + "?ajaxCall",
359      title: self.getLanguagesKey["privacypolicy"],
360      size: eModal.size.lg,
361      buttons: []
362    };
363
364    eModal.ajax(options);
365
366    // stop event propagation
367    if (e == null || e == undefined || e == "undefined" || typeof e != "object") {
368      return false;
369    } else {
370      e.preventDefault();
371    }
372  };
373
374
375  /*
376   * open Feed Rss
377   * @param e {Object} : the event to reset the default event of the <a>
378   * @param element {String} : class or id of the tag
379   */
380  self.openRss = function (e, element) {
381    // stop event propagation
382    if (e == null || e == undefined || e == "undefined" || typeof e != "object") {
383      return false;
384    } else {
385      e.preventDefault();
386    }
387
388    if (element == null || element == undefined || element == "undefined") {
389      var element = ".vc_open_rss";
390    }
391
392    var href = $(element).attr('href');
393
394    var options = {
395      url: href,
396      title: self.getLanguagesKey["rssPopupTitle"],
397      classname: "vc_no_footer_dg",
398      useBin: true,
399      size: eModal.size.lg,
400      buttons: []
401    };
402
403    eModal.iframe(options);
404
405  };
406
407
408  /*
409   *	Enable tooltip
410   *  it should use if the footer is inserted
411   *  or if is used data-toggle = "tooltip"
412   *
413   */
414  self.tooltip = function () {
415    if ( !self.getDevice().isMobile ) {
416      $('[data-toggle="tooltip"]').tooltip();
417    }
418  };
419
420  /*
421   * Get the info of the device
422   * @return device {Object} :
423   *  mq : {String} mediaquery eg. (max-width:480px)
424   *  orientation : {String} portrait or landscape
425   *  isMobile : {Boolean} true / false
426   *  isDoublePage : {Boolean} true / false
427   * */
428  self.getDevice = function() {
429
430    var deviceOrientation = {};
431    var device = {};
432    deviceOrientation.isMobile = ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1));
433    deviceOrientation.isTablet = (navigator.userAgent.match(/Tablet|iPad|iPod/i) != null && window.innerWidth <= 1366 && window.innerHeight <= 1366);
434
435
436    if ( deviceOrientation.isMobile ) {
437
438      deviceOrientation.orientation = (window.matchMedia("(orientation: portrait)").matches) ? "portrait" : "landscape";
439      deviceOrientation.isDoublePage = (deviceOrientation.orientation === "landscape" ) ? true : false;
440
441      device = {
442        orientation: deviceOrientation.orientation,
443        isMobile: deviceOrientation.isMobile,
444        isTablet: deviceOrientation.isTablet,
445        isDoublePage: deviceOrientation.isDoublePage
446      };
447
448    } else {
449
450      var mediaqueries = [
451        {
452          mq: "(max-width:480px)",
453          orientation: "portrait",
454          isMobile: true,
455          isTablet: false,
456          isDoublePage: false
457        },
458        {
459          //smartphone landscape
460          mq: "(min-width:481px) and (max-width:568px)",
461          orientation: "landscape",
462          isMobile: true,
463          isTablet: false,
464          isDoublePage: true
465        },
466        {
467          //iphone landscape
468          mq: "(min-width:569px) and (max-width:666px)",
469          orientation: "landscape",
470          isMobile: true,
471          isTablet: false,
472          isDoublePage: true
473        },
474        {
475          //nexus tablet
476          mq: "(min-width:600px) and (max-width:959px)",
477          orientation: "portrait",
478          isMobile: true,
479          isTablet: true,
480          isDoublePage: false
481        },
482        {
483          // smartphone landscape
484          mq: "(min-width:640px) and (max-width:800px)",
485          orientation: "landscape",
486          isMobile: true,
487          isTablet: false,
488          isDoublePage: true
489        },
490        {
491          //iphone landscape
492          mq: "(min-width:667px) and (max-width:767px)",
493          orientation: "landscape",
494          isMobile: true,
495          isTablet: false,
496          isDoublePage: true
497        },
498        {
499          //ipad portrait
500          mq: "(min-width:768px) and (max-width:899px)",
501          orientation: "portrait",
502          isMobile: true,
503          isTablet: true,
504          isDoublePage: false
505        },
506        {
507          //desktop and tablet landscape
508          mq: "(min-width:900px)",
509          orientation: "landscape",
510          isMobile: true,
511          isTablet: true,
512          isDoublePage: true
513        },
514        {
515          //desktop and tablet landscape
516          mq: "(min-width:1189px)",
517          orientation: "landscape",
518          isMobile: false,
519          isTablet: deviceOrientation.isTablet,
520          isDoublePage: true
521        }
522      ];
523
524      for (var i = 0; i < mediaqueries.length; i++) {
525          // set the right info for the device detected
526          if ( window.matchMedia(mediaqueries[i].mq).matches ) {
527            device = mediaqueries[i];
528          }
529        }
530    }
531
532
533    return device;
534
535  };
536
537  var isRoute = function(route){
538    return ( ("" + document.location).indexOf(route) > -1 );
539  };
540
541  self.Areas = (function () {
542    // Area JS
543  });
544
545  self.init = function () {
546
547    self.tooltip();
548
549    //don't init in archive because it has own search module
550    if ( isRoute("search") && !isRoute("newsstandarchive") ) {
551      VNP.Areas.Search.init();
552    }
553
554    //stats for open newsstand
555    if ( isRoute("newsstand") ) {
556      self.Areas.Newsstand.init();
557      //load
558      $(window).on('load', function(e) {
559        // don't set stats if it is search route
560        if ( !isRoute("search") ) {
561          push_stats(stats.category.title, stats.event.open_newsstand, '');
562        }
563
564      });
565    }
566
567    //stats for open archive
568    if ( isRoute("newsstandarchive") && !isRoute("search") ) {
569      self.Areas.Archive.init();
570      //load
571      $(window).on('load', function(e) {
572        // don't set stats if it is search route
573        //if ( !isRoute("search") ) {
574          push_stats(stats.category.title, stats.event.open_archive, '');
575        //}
576      });
577    }
578
579
580    //stats for open edition
581    if ( isRoute(pageflip) ) {
582      self.Areas.Reader.init();
583      $(window).on("load",function(e) {
584        push_stats(stats.category.title, stats.event.open_edition + '-' + EDITION_LABEL, hasAccess_label);
585      });
586    }
587
588    //stats for open my profile
589    if ( isRoute("customer") ) {
590      self.Areas.Customer.init();
591      $(window).on("load",function(e) {
592        push_stats(stats.category.title, stats.event.open_myprofile,'');
593      });
594    }
595
596  };
597
598};

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.