1(function($) { 2 core = { 3 verticalOffset: -390, 4 horizontalOffset: 0, 5 repositionOnResize: true, 6 draggable: true, 7 dialogClass: null, 8 alert: function(message, title, callback) { 9 if( title == null ) title = LANG_ATTENTION; 10 this._show_mess(title, message, null, 'alert', function(result) { 11 if(callback) callback(result); 12 }); 13 }, 14 confirm: function(message, title, callback) { 15 if(title == null) title = LANG_CONFIRM; 16 this._show_mess(title, message, null, 'confirm', function(result) { 17 if(result) callback(result); 18 }); 19 }, 20 prompt: function(message, value, title, callback) { 21 if( title == null ) title = 'Prompt'; 22 this._show_mess(title, message, value, 'prompt', callback); 23 }, 24 message: function(title){ 25 if(title == null) title = ''; 26 this._show_mess(title, '', '', 'message'); 27 }, 28 box_close: function() { 29 $('#popup_container').fadeOut(200, function(){ 30 $('#popup_overlay, #popup_container').remove(); 31 }); 32 }, 33 _show_mess: function(title, msg, value, type, callback) { 34 if ($('#popup_container').length > 0) { 35 $('#popup_overlay, #popup_container').remove(); 36 } 37 var html = "<div id='popup_container'>" + 38 "<div class='popup_body'>" + 39 "<div class='popup_title_wrap'><div class='popup_x_button'/><div id='popup_title'/></div>" + 40 "<div id='popup_progress'><img src='/images/progress.gif' alt="+LANG_LOADING+"'...' /></div>" + 41 "<div id='popup_content'/>" + 42 "<div id='popup_message'/>" + 43 "<div id='popup_panel'>" + 44 "<span class='ajax-loader'> </span>" + 45 "<div id='popup_info'/>" + 46 "<input id='popup_ok' type='button' class='button_yes' value='" + LANG_CONTINUE + "'/>" + 47 "<input id='popup_cancel' type='button' class='button_no' value='" + LANG_CANCEL + "'/>" + 48 "<input id='popup_close' type='button' class='button_no' value='" + LANG_CLOSE + "'/>" + 49 "</div>" + 50 "</div>"; 51 52 this._overlay('show'); 53 $('body').append(html); 54 $('#popup_panel input').hide(); 55 if(this.dialogClass) { 56 $('#popup_container').addClass(this.dialogClass); 57 } 58 var browser = navigator.userAgent; 59 var version = 0; 60 var msie = false; 61 if( browser.indexOf("MSIE") != -1 ) { 62 msie = true; 63 var re = /.+(MSIE)\s(\d\d?)(\.?\d?).+/i; 64 version = browser.replace(re, "$2"); 65 } 66 67 var pos = ((msie && version <= 6 )||(($(window).height()<480)||($(window).width()<700))) ? 'absolute' : 'fixed'; 68 $('#popup_container').css({ position: pos }); 69 $('#popup_title').text(title); 70 $('#popup_content').addClass(type); 71 $('#popup_message').text('<span class="box_message_content">' + msg + '</span>'); 72 $('#popup_message').html($('#popup_message').text().replace(/\n/g, '<br />')); 73 $('#popup_container').css({ 74 minWidth: $('#popup_container').outerWidth(), 75 maxWidth: $('#popup_container').outerWidth() 76 }); 77 this._reposition(); 78 this._maintainPosition(true); 79 80 switch(type) { 81 case 'alert': 82 $('#popup_close').show(); 83 $('#popup_overlay, #popup_close, .popup_x_button').click(function() { 84 core.box_close(); 85 callback(true); 86 }); 87 $('#popup_close').keypress(function(e) { 88 if(e.keyCode == 27 || e.keyCode == 13) { 89 $('#popup_close').trigger('click'); 90 } 91 }); 92 $('#popup_close').focus().select(); 93 break; 94 case 'confirm': 95 $('#popup_ok, #popup_cancel').show(); 96 $('#popup_ok').click(function() { 97 if( callback ) callback(true); 98 }); 99 $('#popup_overlay, #popup_cancel ,#popup_close, .popup_x_button').click(function() { 100 core.box_close(); 101 callback(false); 102 }); 103 $('#popup_ok').click(function() { 104 core.box_close(); 105 }); 106 $('#popup_cancel').focus().select(); 107 break; 108 case 'prompt': 109 $('#popup_message').append('<input id="popup_prompt" name="popup_prompt" value="' + value + '"/>'); 110 $('#popup_prompt').width($('#popup_message').width()); 111 $('#popup_ok').val(LANG_SEND); 112 $('#popup_ok, #popup_cancel').show(); 113 $('#popup_ok').click(function() { 114 var val = $('#popup_prompt').val(); 115 if (val){ 116 if(callback) callback(val); 117 } 118 }); 119 $('#popup_overlay, #popup_cancel, .popup_x_button').click(function() { 120 core.box_close(); 121 if(callback) callback(null); 122 }); 123 $('#popup_prompt, #popup_ok, #popup_close').keypress(function(e) { 124 if(e.keyCode == 27) $('#popup_cancel').trigger('click'); 125 }); 126 $('#popup_prompt').focus().select(); 127 break; 128 case 'message': 129 $('#popup_cancel, #popup_progress').show(); 130 $('#popup_overlay, #popup_cancel ,#popup_close, .popup_x_button').focus().select().click(function(){ 131 core.box_close(); 132 }); 133 break; 134 } 135 }, 136 _overlay: function(status) { 137 switch(status) { 138 case 'show': 139 this._overlay('hide'); 140 $('body').append('<div id="popup_overlay"></div>'); 141 $('#popup_overlay').css({ 142 height: $(document).height() 143 }); 144 break; 145 case 'hide': 146 $('#popup_overlay').remove(); 147 break; 148 } 149 }, 150 _reposition: function() { 151 var top = ((window.screen.availHeight / 2)) + this.verticalOffset; 152 var left = (($(window).width() / 2) - ($('#popup_container').outerWidth() / 2)) + this.horizontalOffset; 153 if(top < 0) top = 0; 154 if(left < 0) left = 0; 155 156 $('#popup_container').css({ 157 top: top, 158 left: left 159 }); 160 161 // IE6 fix 162 var browser = navigator.userAgent; 163 var version = 0; 164 var msie = false;
165 if( browser.indexOf("MSIE") != -1 ) { 166 msie = true; 167 var re = /.+(MSIE)\s(\d\d?)(\.?\d?).+/i; 168 version = browser.replace(re, "$2"); 169 } 170 171 if((msie && version <= 6 )||(($(window).height()<480)||($(window).width()<700))) top = top + $(window).scrollTop(); 172 $('#popup_overlay').height($(document).height()); 173 }, 174 _maintainPosition: function(status) { 175 if(this.repositionOnResize) { 176 switch(status) { 177 case true: 178 $(window).bind('resize', this._reposition); 179 break; 180 case false: 181 $(window).unbind('resize', this._reposition); 182 break; 183 } 184 } 185 }, 186 show_popup_info: function(text, type) { 187 this._popup_info(type); 188 $('#popup_info').html(text).show().delay(4000).fadeOut('slow'); 189 }, 190 hide_popup_info: function() { 191 this.show_popup_info(''); 192 $('#popup_info').text('').hide(); 193 }, 194 _popup_info: function(type) { 195 $('#popup_info').hide(); 196 $('#popup_info').attr('class', type); 197 }, 198 show_error_field: function(obj) { 199 obj.animate({backgroundColor:"#e6a4a4"}, {duration:200}); 200 obj.animate({backgroundColor:"#ffffff"}, {duration:200}); 201 obj.css({border:'1px solid red'}); 202 }, 203 hide_error_field: function(obj) { 204 obj.css({border:'1px solid #aaa'}); 205 } 206 }; 207 208 jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ 209 jQuery.fx.step[attr] = function(fx){ 210 if ( fx.state == 0 ) { 211 fx.start = getColor( fx.elem, attr ); 212 fx.end = getRGB( fx.end ); 213 } 214 215 fx.elem.style[attr] = "rgb(" + [ 216 Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), 217 Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), 218 Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) 219 ].join(",") + ")"; 220 } 221 }); 222 function getRGB(color) { 223 var result; 224 if ( color && color.constructor == Array && color.length == 3 ) 225 return color; 226 227 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 228 return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; 229 230 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 231 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; 232 233 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 234 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; 235 236 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 237 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; 238 239 return colors[jQuery.trim(color).toLowerCase()]; 240 } 241 function getColor(elem, attr) { 242 var color; 243 do { 244 color = jQuery.curCSS(elem, attr); 245 if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) 246 break; 247 attr = "backgroundColor"; 248 } while ( elem = elem.parentNode ); 249 return getRGB(color); 250 }; 251})(jQuery); 252 253function centerLink(href){ 254 $('div.component').css({opacity:0.4, filter:'alpha(opacity=40)'}); 255 $.post(href, function(data){ 256 $('div.component').html(data); 257 $('div.component').css({opacity:1.0, filter:'alpha(opacity=100)'}); 258 }); 259} 260function deleteWallRecord(component, target_id, record_id, csrf_token){ 261 core.confirm(LANG_CONFIRM_DEL_POST_ON_WALL, null, function(){ 262 $('#wall_entry_'+record_id).css('background', '#FFAEAE').fadeOut(); 263 $.post('/core/ajax/wall.php', {target_id: target_id, component: component, do_wall: 'delete', csrf_token: csrf_token, record_id: record_id}, function(result){ 264 if(result){ 265 wallPage(1); 266 } 267 }); 268 }); 269} 270function addWall(component, target_id){ 271 272 core.message(LANG_NEW_POST_ON_WALL); 273 $.post('/core/ajax/wall.php', {target_id: target_id, component: component, do_wall: 'add'}, function(data){
274 if(data.error == false){ 275 $('#popup_message').html(data.html); 276 $('#popup_progress').hide(); 277 $('#popup_ok').val(LANG_ADD).show(); 278 $('#popup_ok').click(function(){ 279 $('#popup_ok').prop('disabled', true); 280 $('#popup_panel .ajax-loader').show(); 281 var options = { 282 success: doaddWall 283 }; 284 $('#add_wall_form').ajaxSubmit(options); 285 }); 286 } else { 287 core.alert(data.text, LANG_ERROR); 288 } 289 }, 'json'); 290 291} 292 293function doaddWall(result, statusText, xhr, $form){ 294 $('.ajax-loader').hide(); 295 if(statusText == 'success'){ 296 if(result.error == false){ 297 core.box_close(); 298 wallPage(1); 299 } else { 300 core.show_popup_info(result.text, 'error'); 301 $('#popup_ok').prop('disabled', false); 302 } 303 } else { 304 core.alert(statusText, LANG_ERROR); 305 } 306} 307function wallPage(page){ 308 309 var target_id = $('div.wall_body input[name=target_id]').val(); 310 var component = $('div.wall_body input[name=component]').val(); 311 312 $('div.wall_body').css({opacity:0.5, filter:'alpha(opacity=50)'}); 313 $.post('/core/ajax/wall.php', {'target_id': target_id, 'component': component, 'page':page}, function(data){ 314 $('div.wall_body').html(data); 315 $('div.wall_body').css({opacity:1.0, filter:'alpha(opacity=100)'}); 316 }); 317 318} 319function setLang(lang){ 320 $('body').append('<form id="lform" style="display:none" method="post" action="/set_lang.php"><input type="hidden" name="lang" value="'+lang+'"/></form>'); 321 $('#lform').submit(); 322}
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.