1- $ . app . initializeMethods = {
1+ ; $ . app = $ . app || { } ;
2+ $ . app . initializeMethods = {
23 /**
34 * runs all the methods after initialize method.
45 */
1415 $ . executeFunction ( functionsOrMethods ) ;
1516 }
1617 }
18+ } ,
19+ toasterComponentSetup : function ( ) {
20+ if ( ! $ . isEmpty ( toastr ) ) {
21+ toastr . options = {
22+ "closeButton" : false ,
23+ "debug" : false ,
24+ "newestOnTop" : true ,
25+ "progressBar" : true ,
26+ "positionClass" : "toast-bottom-left" ,
27+ "preventDuplicates" : true ,
28+ "showDuration" : "300" ,
29+ "hideDuration" : "1000" ,
30+ "timeOut" : "5000" ,
31+ "extendedTimeOut" : "1000" ,
32+ "showEasing" : "swing" ,
33+ "hideEasing" : "linear" ,
34+ "showMethod" : "fadeIn" ,
35+ "hideMethod" : "fadeOut"
36+ }
37+ }
38+ } ,
39+ toolTipShow : function ( ) {
40+ var $tooltipItems = $ ( '.tooltip-show' ) ;
41+ if ( $tooltipItems . length > 0 ) {
42+ $tooltipItems . tooltip ( { container : 'body' } ) ;
43+ }
44+
45+ } ,
46+ seoHide : function ( ) {
47+ var $seoHideItems = $ ( ".seo-hide" ) ;
48+ if ( $seoHideItems . length > 0 ) {
49+ $seoHideItems . hide ( ) ;
50+ }
51+ } ,
52+ menuEnable : function ( ) {
53+ $ ( ) . jetmenu ( ) ;
54+ var menuPage = $ ( "#menu-item-edit-page" ) ;
55+ if ( menuPage . length > 0 ) {
56+ var div = $ ( "#hasDropdownDiv" ) ;
57+ div . hide ( ) ;
58+ $ ( "#HasDropDown" ) . click ( function ( ) {
59+ if ( this . checked ) {
60+ div . show ( 'slow' ) ;
61+ } else {
62+ div . hide ( 'slow' ) ;
63+ }
64+ } ) ;
65+ }
66+ } ,
67+ bootstrapTableComponentEnable : function ( ) {
68+ var $tables = $ ( "table.bootstrap-table-do" ) ;
69+ if ( $tables . length > 0 ) {
70+ $tables . bootstrapTable ( ) ;
71+ }
72+ } ,
73+ datePickerComponentEnable : function ( ) {
74+ if ( $ . isFunc ( $ . datetimepicker ) ) {
75+ $ ( ".datetimepicker-start" ) . datetimepicker ( {
76+ pickDate : true , //en/disables the date picker
77+ pickTime : true , //en/disables the time picker
78+ useMinutes : true , //en/disables the minutes picker
79+ useSeconds : true , //en/disables the seconds picker
80+ useCurrent : true , //when true, picker will set the value to the current date/time
81+ minuteStepping : 1 , //set the minute stepping
82+ defaultDate : "" , //sets a default date, accepts js dates, strings and moment objects
83+ disabledDates : [ ] , //an array of dates that cannot be selected
84+ enabledDates : [ ] , //an array of dates that can be selected
85+ sideBySide : true //show the date and time picker side by side
86+
87+ } ) ;
88+
89+ $ ( ".datepicker-start" ) . datetimepicker ( {
90+ pickDate : true , //en/disables the date picker
91+ pickTime : false , //en/disables the time picker
92+ useMinutes : false , //en/disables the minutes picker
93+ useSeconds : false , //en/disables the seconds picker
94+ useCurrent : true , //when true, picker will set the value to the current date/time
95+ minuteStepping : 1 , //set the minute stepping
96+ defaultDate : "" , //sets a default date, accepts js dates, strings and moment objects
97+ disabledDates : [ ] , //an array of dates that cannot be selected
98+ enabledDates : [ ] , //an array of dates that can be selected
99+ sideBySide : true //show the date and time picker side by side
100+ } ) ;
101+ }
102+ } ,
103+ tagComponentEnable : function ( ) {
104+ var $processForm = $ . byId ( "server-validation-form" ) ;
105+ if ( $processForm . length > 0 ) {
106+ var $createdTags = $ ( ".tag-inputs" ) ;
107+ if ( $createdTags . length > 0 ) {
108+ var $tokenField = $processForm . find ( "[name='__RequestVerificationToken']" ) ,
109+ token = $tokenField . val ( ) ;
110+ for ( var i = 0 ; i < $createdTags . length ; i ++ ) {
111+ var $tagsInput = $ ( $createdTags [ 0 ] ) ,
112+ urlToPost = $tagsInput . attr ( "data-url" ) ;
113+ //
114+ $tagsInput . tagsinput ( {
115+ freeInput : true ,
116+ trimValue : true ,
117+ typeahead : {
118+ source : function ( query ) {
119+ return $ . post ( urlToPost , { id : query , __RequestVerificationToken : token } ) . done ( function ( response ) {
120+ //console.log("tags:");
121+ //console.log("response:");
122+ //console.log(response);
123+ } ) ;
124+ }
125+ } ,
126+ onTagExists : function ( item , $tag ) {
127+ if ( $ . isEmpty ( $tag ) ) {
128+ $tag . hide . fadeIn ( ) ;
129+ }
130+ }
131+ } ) ;
132+ }
133+ }
134+
135+ }
136+ } ,
137+ transactionStatusEnable : function ( ) {
138+ var $transaction = $ . byId ( "transaction-container" ) ,
139+ hideTimeOut = parseInt ( $transaction . attr ( "data-hide-duration" ) ) ;
140+
141+ var hideStatus = function ( ) {
142+ $transaction . attr ( "data-shown" , "true" ) ;
143+ $transaction . hide ( 500 ) ;
144+ } ;
145+ var timer = setTimeout ( hideStatus , hideTimeOut ) ;
146+
147+ var stopTimer = function ( ) {
148+ clearTimeout ( timer ) ;
149+ }
150+
151+ $transaction . click ( function ( ) {
152+ stopTimer ( ) ;
153+ hideStatus ( ) ;
154+ } ) ;
155+ } ,
156+ loadWow : function ( ) {
157+ //var options = {
158+ // scaleColor: false,
159+ // trackColor: 'rgba(266,144,0,0.0)',
160+ // barColor: '#ff7200',
161+ // lineWidth: 2,
162+ // lineCap: 'butt',
163+ // size: 253
164+ //};
165+
166+
167+ var wow = new WOW ( {
168+ boxClass : 'wow' , // animated element css class (default is wow)
169+ animateClass : 'animated' , // animation css class (default is animated)
170+ offset : 100 , // distance to the element when triggering the animation (default is 0)
171+ mobile : false // trigger animations on mobile devices (true is default)
172+ } ) ;
173+ wow . init ( ) ;
17174 }
18- }
175+ } ;
0 commit comments