Project

General

Profile

1
    function include_file(filename, filetype) {
2
        if(!filetype)
3
            var filetype = 'js'; //js default filetype
4
        var th = document.getElementsByTagName('head')[0];
5
        var s  = document.createElement((filetype == "js") ? 'script' : 'link');
6
        s.setAttribute('type',(filetype == "js") ? 'text/javascript' : 'text/css');
7
        if (filetype == "css")
8
            s.setAttribute('rel','stylesheet');
9
        s.setAttribute((filetype == "js") ? 'src' : 'href', filename);
10
        th.appendChild(s);
11
    }
12

    
13
    function redirect_to_page (url, timer) {
14
        if (timer < 0 ) {
15
            self.location.replace (url);
16
        } else {
17
            setTimeout('self.location.href="'+url+'"', timer);
18
        }
19
    }
20

    
21
function replaceAllBackSlash(targetStr){
22
      var index=targetStr.indexOf("\\");
23
      while(index >= 0){
24
          targetStr=targetStr.replace("\\","");
25
          index=targetStr.indexOf("\\");
26
      }
27
      return targetStr;
28
  }
29

    
30
    function loadErrorFile() {
31
        var errorModal = $('#errorModal');
32
//console.info(errorModal);
33
        $('#ErrorIFrameBox').load( (THEME_URL+"/LoadErrorlog.php") )
34
    }
35

    
36
    function delete_error_log(ev){
37
        var errorModal = $('#errorModal');
38
        var iframe = $('#ErrorIFrameBox');
39
        var action = '0';
40
        var img = $('#deleteImg');
41
//console.info(iframe);
42
//console.info(img);
43
        if( img.attr("src") == THEME_URL+"images/remove_0.png") {
44
            var action = "show";
45
            var src = THEME_URL+"images/remove_1.png";
46
        } else {
47
            var action = "0";
48
            var src = THEME_URL+"images/remove_0.png";
49
        }
50
       $.ajax({
51
            url: THEME_URL+"/delete_errorlog.php",
52
            type: "POST",
53
            data: 'action='+action,
54
            dataType: 'json',
55
            success: function(data) {
56
                if(data.success == "true") {
57
                    $('#ErrorIFrameBox').empty();
58
                    $('#ErrorIFrameBox').load(THEME_URL+"/LoadErrorlog.php")
59
                    src = THEME_URL+'/images/remove_0.png'
60
                    img.attr("src", src);
61
                    img.attr("title", data.message);
62
                } else {
63
                    alert(data.message);
64
                }
65
            },
66
            complete: function() {}
67
        });
68
    }
69
/*
70
*/
71
    domReady(function(){
72

    
73
//        var matches = document.querySelectorAll(".jcalendar");
74
        if( document.querySelectorAll(".jcalendar").length > 0 ) {
75
            var JCalendarCss = WB_URL+"/include/jscalendar/calendar-system.css";
76
            if (typeof LoadOnFly ==='undefined'){
77
              $.insert(JCalendarCss);
78
            } else {
79
              LoadOnFly('head', JCalendarCss);
80
            }
81
        }
82

    
83
        if( document.querySelectorAll(".jsadmin").length > 0 ) {
84
            var JsAdminCss = WB_URL+"/modules/jsadmin/backend.css";
85
            if (typeof LoadOnFly ==='undefined'){
86
              $.insert(JsAdminCss);
87
            } else {
88
              LoadOnFly('head', JsAdminCss);
89
            }
90
        }
91

    
92
        elm = document.getElementsByTagName('form');
93
//console.info(elm);
94
          for (i=0; elm[i]; i++) {
95
            if ( (elm[i].className.indexOf('autocomplete') == -1) ) {
96
                elm[i].setAttribute('autocomplete', 'off');
97
            }
98
            if ( (elm[i].className.indexOf('accept-charset') == -1) ) {
99
                elm[i].setAttribute('accept-charset', 'utf-8');
100
            }
101
          }
102
/*
103
*/
104
        var errorlog = document.getElementById('delete_php_error-log');
105
            errorlog.addEventListener('click', delete_error_log);
106

    
107
/**
108
 *
109
var frm = document.getElementsByName("preferences_save");
110
console.info(frm);
111
   frm.reset();  // Reset
112

    
113
   //Add external link class to external links -
114
   $('a[href^="http://"]').filter(function() {
115
      //Compare the anchor tag's host name with location's host name
116
       return this.hostname && this.hostname !== location.hostname;
117
     }).addClass("external").attr("target", "_blank");
118

    
119
   //* Add internal link class to external links -
120
   $('a[href^="http://"]').filter(function() {
121
      //Compare the anchor tag's host name with location's host name
122
       return this.hostname && this.hostname == location.hostname;
123
     }).addClass("internal");
124
   $('form').attr('autocomplete', 'off');
125
 */
126

    
127
    });
(7-7/10)