PageSourceSearch

https://meritbox.app/assets/js/common.js

js meritbox.app collected 2026-09-24 11:01:14 UTC 7,255 bytes, 287 lines download raw bytes

1function flashMessage(msg,classdata){
2    flashMessageNew(msg,classdata);
3
4}
5
6function flashMessageNew(msg,classdata){
7    errorType = ""
8    if(classdata == "danger"){
9        errorType = "danger";
10    }else{
11          errorType = "success";
12
13    }
14    $("body .dismiss_cus").parents('.alert').remove();
15
16    $.notify('<div class="dismiss_cus">'+msg+'</div>', {
17        allow_dismiss: true,
18        type:errorType,
19
20    placement: {
21        from: 'bottom',
22        align: 'right'
23    }
24});
25
26
27}
28
29
30
31
32
33
34function removeLastComma(strng){
35    var n=strng.lastIndexOf(",");
36    var a=strng.substring(0,n)
37    return a;
38}
39
40
41function replaceAll(str, find, replace) {
42    return str.replace(new RegExp(find, 'g'), replace);
43}
44
45
46function isEmpty(obj) {
47    for(var key in obj) {
48        if(obj.hasOwnProperty(key))
49            return false;
50    }
51    return true;
52}
53
54function activaTab(tab){
55   
56    $('a[href="#' + tab + '"]').tab('show');
57};
58
59function createCookie(name, value, days) {
60    if (days) {
61        var date = new Date();
62        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
63        var expires = "; expires=" + date.toGMTString();
64    }
65    else var expires = "";               
66
67    document.cookie = name + "=" + value + expires + "; path=/";
68}
69
70function readCookie(name) {
71    var nameEQ = name + "=";
72    var ca = document.cookie.split(';');
73    for (var i = 0; i < ca.length; i++) {
74        var c = ca[i];
75        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
76        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
77    }
78    return null;
79}
80
81
82
83
84
85function eraseCookie(name) {
86    createCookie(name, "", -1);
87}
88
89function readUserData(){
90    try{
91    var getUserData = readCookie('user');
92    return JSON.parse(getUserData);
93    }catch(e){
94        return [];
95    }
96}
97
98 if(readCookie('forbidden')){
99    msg = readCookie('forbidden')
100    flashMessageNew(msg,'danger')
101    eraseCookie('forbidden')
102 }
103
104 if(readCookie('success')){
105    msg = readCookie('success')
106    flashMessageNew(msg,'success')
107    eraseCookie('success')
108 }
109
110 /**************************************************
111     * Numeric Data Only Enter
112     **************************************************/
113    $("body").on('keypress', '.numeric', function (e) {
114        //$(this).attr("maxlength","8");
115        //if the letter is not digit then display error and don't type anything
116        if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
117            return false;
118        }
119
120    });
121    
122function encodeData(iddata){
123    return btoa(iddata);
124}
125
126function decodeData(iddata){
127    return atob(iddata);
128}
129
130function isInArray(value, array) {
131    try{
132        return array.indexOf(value) > -1;
133    }catch(e){
134        //console.log()
135        return 1
136    }
137}
138//if array key is not found
139function isInArrayNon(value, array) {
140    try{
141        return array.indexOf(value) > -1;
142    }catch(e){
143        //console.log()
144        return 0
145    }
146}
147
148/***************************Remove Select2 Error Class *********************/
149$("body").on('click', '.slerror', function () {
150    var errid = $(this).attr('id');
151
152    try {
153        var datas = $("#" + errid).val();
154        if (datas != '')
155        {
156            $("#" + errid + "-error").hide();
157        }
158    } catch (e)
159    {
160
161    }
162})
163
164
165/*remove element from array*/
166function removeFrmArray(array, element) {
167    return array.filter(e => e !== element);
168};
169
170function reloadJs(src) {
171    src = $('script[src$="' + src + '"]').attr("src");
172    $('script[src$="' + src + '"]').remove();
173    $('<script/>').attr('src', src).appendTo('body');
174}
175
176
177/*#############################################################################################
178# Desc : makeEmptyDiv function used to remove all data base on ID.
179# Param : None
180# Return Value  :None;
181#############################################################################################*/
182function makeEmptyDiv(divId) {
183    $("#" + divId).empty()
184}
185
186function getAllKeysList(obj) {
187    return Object.keys(obj)
188}
189
190function getAllValuesList(obj) {
191    return Object.values(obj)
192}
193/*#############################################################################################
194# Desc :contructData function used to convert list of dictonaries data to list of value(Column label)
195# Return Value  :tempData :dictonaries(Key-> column name,value-> list of values);
196#############################################################################################*/
197function contructData(data, columnList) {
198    var getData = jsonQ(JSON.parse(data));
199    var tempData = {}
200    $.each(columnList, function (key, d) {
201        dataGet = getData.find(d);
202        tempData[d] = dataGet.value()
203    })
204    return tempData
205}
206
207function isInt(n) { 
208    if(typeof n == 'number' && Math.Round(n) % 1 == 0) {
209        return true;
210    } else {
211        return false;
212    }
213 }
214
215
216  function submitVirtualForm(url,dictData, new_tab = false){
217    createForm = "<form method='POST' action='"+url+"' "+ (new_tab ? "target='_blank'" : '') +" >";
218    $.each(dictData,function(key,data){
219      createForm+=`<input name='`+key+`' value="`+data+`">`;
220    })
221    createForm+="</form>";
222    $(createForm).appendTo('body').submit().remove();
223  }
224
225try{
226 
227CKEDITOR.on('instanceReady', function () {
228    $.each(CKEDITOR.instances, function (instance) {
229        CKEDITOR.instances[instance].document.on("keyup", CK_jQ);
230        CKEDITOR.instances[instance].document.on("paste", CK_jQ);
231        CKEDITOR.instances[instance].document.on("keypress", CK_jQ);
232        CKEDITOR.instances[instance].document.on("blur", CK_jQ);
233        CKEDITOR.instances[instance].document.on("change", CK_jQ);
234    });
235});
236}catch(e){}
237function CK_jQ() {
238    for (instance in CKEDITOR.instances) {
239        CKEDITOR.instances[instance].updateElement();
240    }
241}
242
243
244
245function send(country_phn_code,phn,message)
246{
247    var send_msg = {
248        "number":country_phn_code+phn,
249        "message":message,
250    }
251    // alert(send_msg.message);alert(send_msg.number);
252    var option = { url:"http://192.169.23.152:8001/sendmessage/", method: "post" }
253    option["data"] = send_msg;
254    ajaxCall(option, function (response) {
255        if(!response.status){
256            flashMessage(response.message,'danger');
257        }else{
258           flashMessage("Message send to your registerd mobile number",'success');
259           return 1;
260           //window.location.href=site_url+"dashboard/";
261       }
262   });
263}
264
265
266$(".toggle-password").click(function() {
267
268  $(this).toggleClass("fa-eye fa-eye-slash");
269  var input = $($(this).attr("toggle"));
270  if (input.attr("type") == "password") {
271    input.attr("type", "text");
272  } else {
273    input.attr("type", "password");
274  }
275});
276
277
278$(".toggle-password2").click(function() {
279
280  $(this).toggleClass("fa-eye fa-eye-slash");
281  var input = $($(this).attr("toggle"));
282  if (input.attr("type") == "password") {
283    input.attr("type", "text");
284  } else {
285    input.attr("type", "password");
286  }
287});

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.