PageSourceSearch

https://www.localconditions.com/lib/helpers.js

js localconditions.com collected 2026-10-03 21:41:45 UTC 3,929 bytes, 144 lines download raw bytes

1var lcwxHelpers = function () {
2
3  "use strict"
4
5  var initFormValidation = function( ) {
6    if ($.fn.parsley) {
7      $('.parsley-form').each (function () {
8        $(this).parsley ({
9          trigger: 'change'
10          , errorsContainer: function (el) {            
11            if (el.$element.parents ('form').is ('.form-horizontal')) {
12              return el.$element.parents ("*[class^='col-']")
13            }     
14                    
15            return el.$element.parents ('.form-group')            
16          }
17          , errorsWrapper: '<ul class="parsley-error-list"></ul>'
18        })
19      })
20    }
21  }
22
23  var initAccordions = function () {
24    $('.accordion-simple, .accordion-panel').each (function (i) {
25      var accordion = $(this)
26          , toggle = accordion.find ('.accordion-toggle')
27          , activePanel = accordion.find ('.panel-collapse.in').parent ()
28
29      activePanel.addClass ('is-open')
30
31      toggle.prepend('<i class="fa accordion-caret"></i>')
32
33      toggle.on ('click', function (e) {
34        var panel = $(this).parents ('.panel')
35
36        panel.toggleClass ('is-open')
37        panel.siblings ().removeClass ('is-open')
38      })
39    })
40  }
41
42  var initTooltips = function () {
43    if ($.fn.tooltip) { $('.ui-tooltip').tooltip ({ container: 'body' }) }
44    if ($.fn.popover) { $('.ui-popover').popover ({ container: 'body' }) }
45  }
46
47  var initLightbox = function () {
48    if ($.fn.magnificPopup) {
49      $('.ui-lightbox').magnificPopup ({
50        type: 'image'
51        , closeOnContentClick: false
52        , closeBtnInside: true
53        , fixedContentPos: true
54        , mainClass: 'mfp-no-margins mfp-with-zoom'
55        , image: {
56          verticalFit: true
57          , tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
58        }
59      })
60
61      $('.ui-lightbox-video, .ui-lightbox-iframe').magnificPopup ({
62        disableOn: 700
63        , type: 'iframe'
64        , mainClass: 'mfp-fade'
65        , removalDelay: 160
66        , preloader: false
67        , fixedContentPos: false
68      })
69
70      $('.ui-lightbox-gallery').magnificPopup ({
71        delegate: 'a'
72        , type: 'image'
73        , tLoading: 'Loading image #%curr%...'
74        , mainClass: 'mfp-img-mobile'
75        , gallery: {
76          enabled: true
77          , navigateByImgClick: true
78          , preload: [0,1]
79        },
80        image: {
81          tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
82          , titleSrc: function(item) {
83            return item.el.attr('title') + '<small></small>'
84          }
85        }
86      })
87    }
88  }
89
90  var initSelect = function () {
91    if ($.fn.select2) {
92      $('.ui-select').select2({ 
93        allowClear: true 
94        , placeholder: "Select..." })
95    }
96  }
97
98  var initIcheck = function () {
99    if ($.fn.iCheck) {
100      $('.ui-check').iCheck ({
101        checkboxClass: 'ui-icheck icheckbox_minimal-grey'
102        , radioClass: 'ui-icheck iradio_minimal-grey'
103        , inheritClass: true
104      }).on ('ifChanged', function (e) {
105        $(e.currentTarget).trigger ('change')
106      })
107    }
108  }
109
110  var initDataTableHelper = function () {
111    if ($.fn.dataTableHelper) {
112      $('.ui-datatable').dataTableHelper ()
113    }
114  }
115
116  var initiTimePicker = function () {
117    if ($.fn.timepicker) {
118      $('.ui-timepicker').timepicker ()
119      $('.ui-timepicker-modal').timepicker ({ template: 'modal' })
120    }      
121  }
122
123  var initDatePicker = function () {
124    if ($.fn.datepicker) {
125      $('.ui-datepicker').datepicker({
126        autoclose: true
127        , todayHighlight: true
128      })
129    }
130  }
131
132  return {
133    initAccordions: initAccordions
134    , initFormValidation: initFormValidation
135    , initTooltips: initTooltips
136    , initLightbox: initLightbox
137    , initSelect: initSelect
138    , initIcheck: initIcheck
139    , initDataTableHelper: initDataTableHelper
140    , initiTimePicker: initiTimePicker
141    , initDatePicker: initDatePicker
142  }
143
144}()

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.