1var $ae = new function () { 2 this.applyAwesomeStyles = function () { 3 $(".ae-lookup-openbtn").empty().prepend('<span class="ui-icon ui-icon-newwin"></span>'); 4 $(".ae-lookup-clearbtn").empty().prepend('<span class="ui-icon ui-icon-gear"></span>'); 5 $ae.mybutton(".ae-lookup-openbtn"); 6 $ae.mybutton(".ae-lookup-clearbtn"); 7 } 8 9 this.mybutton = function (sel) { 10 $(sel).unbind('mousedown mouseup mouseleave') 11 .hover(function () { $(this).addClass("ui-state-hover"); }, 12 function () { $(this).removeClass("ui-state-hover"); }) 13 .bind({ 'mousedown mouseup': function () { $(this).toggleClass('ui-state-active'); } }) 14 .addClass("ui-state-default").addClass("ui-corner-all") 15 .bind('mouseleave', function () { $(this).removeClass('ui-state-active') }); 16 } 17 18 this.interactive = function (o) { 19 $(o + ' input:text').keyup(function (e) { 20 if ($ae.isKeyChange(e.which)) { 21 $(o).submit(); 22 } 23 }); 24 $(o + ' input[type="hidden"], ' + o + ' .ae-array').change(function () { 25 $(o).submit(); 26 }); 27 } 28 29 this.isKeyChange = function (w) { 30 if (w < 9 || w > 45 && w < 91 || w > 93 && w < 112 || w > 185 || w == 32) return true; 31 return false; 32 } 33 34 this.fullscreen = function (o) { 35 $(window).bind("resize", function (e) { $(o).dialog("option", { height: $(window).height() - 50, width: $(window).width() - 50 }).trigger('dialogresize'); }); 36 } 37 38 loadRadioList = function (o, url, parent) { 39 var data = new Array(); 40 addval(data, parent, "parent"); 41 addval(data, o, "key"); 42 $.post(url, data, 43 function (d) { 44 $("#" + o + "list").empty(); 45 if (typeof (d) == 'object') { 46 var found = false; 47 $.each(d, function (i, j) { 48 var sel = ""; 49 if (j.Selected == true) { sel = "checked = 'checked'"; $('#' + o).val(j.Value).change(); found = true; }; 50 $("#" + o + "list").append("<li><input type='radio' " + sel + " value='" + j.Value + "' name='ae" + o + "' id='ae" + o + i + "'/><label for='ae" + o + i + "' >" + j.Text + "</label></li>"); 51 if (!found) $('#' + o).val('').change(); 52 }); 53 } 54 else { $('#' + o).val('').change(); } 55 }); 56 } 57 58 this.radioList = function (o, url, parent) { 59 loadRadioList(o, url, parent); 60 $('#' + o + 'list').on('change', 'input', 61 function () { 62 $('#' + o).val($('#' + o + 'list input:checked').val()).change(); 63 }); 64 if (parent) $('#' + parent).change(function () { loadRadioList(o, url, parent); }); 65 } 66 67 this.checkBoxList = function (o, url, parent, prop, htmlAttributes, pkeys, pvals) { 68 loadCheckBoxList(o, url, parent, prop, htmlAttributes, pkeys, pvals); 69 // 2012-3-6 zhx è°æ´ä¸ºclickäºä»¶ å 为使ç¨changeå¨360åie䏿 æ 70 //$('#' + o + 'list input').live('change', function () { syncCheckBoxList(o, prop); }); 71 $('#' + o + 'list').on('click', 'input', function () { linkAgeCheckAll(this,prop);syncCheckBoxList(o, prop); }); 72 if (parent) $('#' + parent).change(function () { loadCheckBoxList(o, url, parent, prop, htmlAttributes, pkeys, pvals); }); 73 } 74 75 syncCheckBoxList = function (o, prop) { 76 $('#' + o).empty(); 77 var ids = ''; 78 $('#' + o + 'list input:checked').each(function () { 79 if (ids.length > 0) 80 ids += ","; 81 ids += $(this).val(); 82 }); 83 $('#' + o).prepend('<input type="hidden" name="' + prop + '" value="' + ids + '" />'); 84 // 2011-11-11 zhx è°æ´ 忥çé项å表åå°è·å å ¨æ¯å份 85 // $('#' + o + 'list input:checked').each(function () { 86 // $('#' + o).prepend('<input type="hidden" name="' + prop + '" value="' + $(this).val() + '" />'); 87 // }); 88 $('#' + o).change(); 89 } 90 91 loadCheckBoxList = function (o, url, parent, prop, htmlAttributes, pkeys, pvals) { 92 var data = new Array(); 93 addval(data, o, "keys"); 94 addval(data, parent, "parent"); 95 $.each(pkeys, function (i, k) { 96 data.push({ name: k, value: pvals[i] }); 97 }); 98 $.post(url, data, function (d) { 99 $('#' + o + 'list').empty(); 100 if (typeof d == 'object') { 101 $.each(d, function (i, j) { 102 var sel = j.Selected ? 'checked="checked"' : ""; 103 $('#' + o + 'list').append('<li><input type="checkbox" name="chk' + prop + '" value="' + j.Value + '" ' + sel + ' id="ae' + o + i + '" ' + htmlAttributes + ' /><label for="ae' + o + i + '">' + j.Text + '</label></li>'); 104 //$('#' + o + 'list').append('<li><input type="checkbox" name="' + prop + '" value="' + j.Value + '" ' + sel + ' id="ae' + o + i + '" ' + htmlAttributes + ' /><label for="ae' + o + i + '">' + j.Text + '</label></li>'); 105 }); 106 } 107 $('#' + o + 'list').change(); 108 syncCheckBoxList(o, prop); 109 }); 110 } 111 112 addval = function (arr, id, key) { 113 if (!id) return; 114 var o = $('#' + id); 115 if (o.hasClass('ae-array')) { 116 $('#' + id + ' input').each(function () { arr.push({ name: key, value: $(this).val() }); }); 117 } 118 else { 119 arr.push({ name: key, value: o.val() }); 120 } 121 } 122 123 124 this.ajaxDropdown = function (o, p, url, keys, values, pkeys, pvals) { 125 this.loadAjaxDropdown(o, p, url, false, keys, values, pkeys, pvals); 126 127 $("#" + o + "dropdown").keyup(function () { $(this).change(); }).change(function () { $('#' + o).val($('#' + o + 'dropdown').val()).trigger('change'); }); 128 129 if (p) $('#' + p).change(function () { $ae.loadAjaxDropdown(o, p, url, true, keys, values, pkeys, pvals); }); 130 $.each(keys, function (i, k) { 131 $('#' + k).change(function () { $ae.loadAjaxDropdown(o, p, url, true, keys, values, pkeys, pvals); }); 132 }); 133 //if keys foreach key change same 134 } 135
136 this.loadAjaxDropdown = function (o, p, url, c, keys, values, pkeys, pvals) { 137 if (c) $('#' + o).val(null); 138 var data = new Array(); 139 addval(data, o, "key"); 140 addval(data, p, "parent"); 141 142 $.each(pkeys, function (i, k) { 143 data.push({ name: k, value: pvals[i] }); 144 }); 145 146 $.each(keys, function (i, k) { 147 addval(data, k, values[i]); 148 }); 149 150 $.post(url, data, 151 function (d) { 152 $("#" + o + "dropdown").empty(); 153 if (typeof (d) == 'object') 154 $.each(d, function (i, j) { 155 var sel = ""; 156 if (j.Selected == true) sel = "selected = 'selected'"; 157 $("#" + o + "dropdown").append("<option " + sel + " value=\"" + j.Value + "\">" + j.Text + "</option>"); 158 }); 159 if (c) $("#" + o + "dropdown").trigger('change'); 160 }); 161 } 162 163 this.autocomplete = function (o, k, p, u, mr, delay, minLen, keys, values, pkeys, pvals) { 164 $('#' + o).autocomplete({ 165 delay: delay, 166 minLength: minLen, 167 source: function (request, response) { 168 var data = new Array(); 169 data.push({ name: 'searchText', value: request.term }); 170 data.push({ name: 'maxResults', value: mr }); 171 addval(data, p, "parent"); 172 173 $.each(keys, function (i, k) { 174 addval(data, k, values[i]); 175 }); 176 177 $.each(pkeys, function (i, k) { 178 data.push({ name: k, value: pvals[i] }); 179 }); 180 181 $.ajax({
182 url: u, type: "POST", dataType: "json", 183 data: data, 184 success: function (d) { response($.map(d, function (o) { return { label: o.Text, value: o.Text, id: o.Id} })); } 185 }); 186 } 187 }); 188 189 $('#' + o).bind("autocompleteselect", function (e, ui) { 190 $('#' + k).val(ui.item ? ui.item.id : null).trigger('change'); 191 $('#' + o).trigger('change'); 192 }); 193 194 //ç«ç䏿è¾å ¥å®æ¯æ¶ä¸ä¼è§¦åKeyDown æä»¥å¨è¾å ¥å®æ¯ä¼è§¦åçKeyUpäºä»¶ä¸ 触åKeyDown 195 $('#' + o).keyup(function (e) { if (e.which != '13') $("#" + k).val(null).trigger('change'); $('#' + o).trigger('keydown'); }); 196 197 } 198 199 this.popup = function (o, w, h, title, modal, pos, res, btns, fulls, isHelp, helpParameters) { 200 var dragg = true; 201 if (fulls) { res = false; modal = true; dragg = false; } 202 $("#" + o).dialog({ 203 show: "fade", 204 width: fulls ? $(window).width() - 50 : w, 205 height: fulls ? $(window).height() - 50 : h, 206 title: title, 207 modal: modal, 208 position: { my: pos, at: pos, of: window }, 209 resizable: res, 210 draggable: dragg, 211 buttons: btns, 212 autoOpen: false, 213 close: function (e, ui) { $("#" + o).find('*').remove(); }, 214 isHelp: isHelp, 215 helpParameters: helpParameters 216 }); 217 if (modal || fulls) $("#" + o).dialog("option", { dialogClass: 'ae-fixed' }); 218 if (fulls) this.fullscreen("#" + o); 219 } 220 221 this.loadLookupDisplay = function (o, url, isChange) { 222 $('#ld' + o).val(''); 223 var id = $('#' + o).val(); 224 if (id) $.get(url, { id: id }, function (d) { 225 $("#ld" + o).val(d); 226 if (isChange) { 227 // 2011-11-10 zhx å¢å è§¦åæ¹åäºä»¶ 228 $("#ld" + o).change(); 229 } 230 }); 231 } 232 233 this.loadMultiLookupDisplay = function (o, url, isChange, pkeys, pvals) { 234 var data = new Array(); 235 $.each(pkeys, function (i, k) { 236 data.push({ name: k, value: pvals[i] }); 237 }); 238 var ids = $("#" + o + " input").map(function () { return $(this).attr("value"); }).get(); 239 $("#ld" + o).html(''); 240 if (ids.length != 0) { 241 $.post(url, $.param({ selected: ids }, true) + "&" + $.param(data), 242 function (d) { 243 $.each(d, function () { $("#ld" + o).append('<li>' + this.Text + '</li>') }); 244 if (isChange) { 245 // 2011-11-10 zhx å¢å è§¦åæ¹åäºä»¶ 246 $("#ld" + o).change(); 247 } 248 }); 249 } 250 } 251 252 this.lookupChoose = function (o, url, sel) { 253 $('#' + o).val(''); 254 $('#' + o).val($('#' + o + 'ls .' + sel).attr("data-value")).change(); 255 this.loadLookupDisplay(o, url, true); 256 $("#lp" + o).dialog('close'); 257 } 258 259 this.multiLookupChoose = function (o, loadUrl, prop, pkeys, pvals) { 260 $("#" + o).empty(); 261 $.each($("#" + o + "se li").map(function () { return $(this).attr("data-value"); }).get(), function () { 262 $("#" + o).append($("<input type='hidden' name='" + prop + "' \>").attr("value", this)); 263 }); 264 $("#" + o).change(); 265 this.loadMultiLookupDisplay(o, loadUrl, true, pkeys, pvals); 266 $("#lp" + o).dialog('close'); 267 } 268 269 this.lookupClear = function (o) { 270 $("#lc" + o).click(function () { 271 $("#" + o).val("").change(); 272 $("#ld" + o).val(""); 273 }); 274 } 275 276 this.multiLookupClear = function (o) { 277 $("#lc" + o).click(function () { 278 $("#" + o + ",#ld" + o).empty(); 279 $("#" + o).change(); 280 }); 281 } 282 283 this.confirm = function (o, f, h, w, yes, no) { 284 $("#dialog-confirm-" + o).dialog({ 285 show: "fade", 286 hide: "fade", 287 resizable: false, 288 height: h, 289 width: w, 290 modal: true, 291 autoOpen: false, 292 dialogClass: 'ae-fixed' 293 }) 294 .dialog("option", "buttons", [ 295 { 296 text: yes, 297 click: function () { $(this).dialog("close"); f.submit(); } 298 299 }, 300 { 301 text: no, 302 click: function () { $(this).dialog("close"); return false; } 303 }, 304 ]); 305 306 $("body").on('click', "." + o, function () { 307 f = $(this).closest('form'); 308 $("#dialog-confirm-" + o).dialog('open'); 309 return false; 310 }); 311 } 312 313 this.lookupPopupOpenClick = function (o, lck, url, getUrl, isShowCreate, paging, multi, datak, datav, park, parv, p, p2) { 314 $("#lpo" + o + ",#ld" + o).click(function (e) { 315 e.preventDefault(); 316 if (lck != null) return; 317 lck = true; 318 var data = [{ name: 'prop', value: o}]; 319 data.push({ name: 'getUrl', value: getUrl }); 320 data.push({ name: 'isShowCreate', value: isShowCreate }); 321 data.push({ name: 'paging', value: paging });
322 data.push({ name: 'multi', value: multi }); 323 324 if (p != null && p.length > 0) 325 addval(data, p, "parent"); 326 327 if (p2 != null && p2.length > 0) 328 addval(data, p2, "parent2"); 329 330 addarr(data, datak, "datak"); 331 addarr(data, datav, "datav"); 332 addarr(data, park, "park"); 333 addarr(data, parv, "parv"); 334 335 $.get(url, $.param(data), function (d) { 336 $("#lp" + o).html(d).dialog('open'); lck = null; 337 }); 338 }); 339 } 340 341 addarr = function (arr, v, k) { 342 for (var i in v) arr.push({ name: k, value: v[i] }); 343 } 344 345 this.takevals = function (a, b, w) { 346 $.each(a, function (i, v) { 347 var e = $('#' + v); 348 var t = e.hasClass('ae-array') ? e.find('input') : e; 349 t.clone().removeAttr('id').attr('name', b[i]).appendTo('#' + w); 350 }); 351 } 352 353 // 2012-11-6 zhx ç»è®¡å±ç¤º 354 this.ajaxStatistics = function (o, p, title, titleColor, isShowText, isShowNumber, isShowTotal, isShowPercentage, itelIndex, width, url, keys, values, pkeys, pvals) { 355 var data = new Array(); 356 addval(data, o, "key"); 357 addval(data, p, "parent"); 358 359 $.each(pkeys, function (i, k) { 360 data.push({ name: k, value: pvals[i] }); 361 }); 362 363 $.each(keys, function (i, k) { 364 addval(data, k, values[i]); 365 }); 366 367 var defaults = { 368 title: null, //䏿¹çæ é¢ 369 titleWidth: 30, //䏿¹çæ é¢ 370 titleColor: '#F37214', 371 titleFontSize: '15px', 372 titleAlign: 'center', 373 width: '500px', //ä¸å ±ç宽度 374 speed: 1000, //æ¾ç¤ºææçæ¶é´ï¼æ¯«ç§ï¼ 375 bgImg: '../../Content/Awesome/images/statistics_poll_bg.gif', //èæ¯ 376 itelTotal: 6, //ä¸å ±æ¯æçé¢è²æ°é 377 isShowText: "True", 378 isShowNumber: "True", 379 isShowTotal: "False", 380 isShowPercentage: "True", 381 itemStyle: { 382 fontSize: '12px', //æ¯æ¡æåçå¤§å° 383 bgColor: '#E2FBF9'//æ¯æ¡çèæ¯é¢è² 384 } 385 }; 386 387 if (null != title && "" != title) 388 defaults.title = title; 389 if (null != titleColor && "" != titleColor) 390 defaults.titleColor = titleColor; 391 if (null != width && "" != width) 392 defaults.width = width + "px"; 393 if (null != isShowText && "" != isShowText) 394 defaults.isShowText = isShowText; 395 if (null != isShowNumber && "" != isShowNumber) 396 defaults.isShowNumber = isShowNumber; 397 if (null != isShowTotal && "" != isShowTotal) 398 defaults.isShowTotal = isShowTotal; 399 if (null != isShowPercentage && "" != isShowPercentage) 400 defaults.isShowPercentage = isShowPercentage; 401 402 var itelIndex_int = parseInt(itelIndex); 403 404 var opoll = $("#" + o + "poll"); 405 406 $(opoll).append("<table id='" + o + "' border='0' style='font-size:" + defaults.itemStyle.fontSize + ";' width='" + defaults.width + "'></table>"); //设置TABLEçé¿åº¦ 407 if (null != title && "" != title) //æ¯å¦æ¾ç¤ºæ é¢ 408 $("table", opoll).append("<tr><td colspan=3 align='" + defaults.titleAlign + "' ><span style='color:" + defaults.titleColor + ";font-size:" + defaults.titleFontSize + ";'><b>" + defaults.title + "</b></span></td></tr>"); 409 var itemDiv; 410 $.post(url, data, 411 function (d) { 412 if (typeof (d) == 'object') 413 $.each(d, function (i, j) { 414 var index = 0; //å½åé¢è²ä¸ªæ° 415 var percentage = (j.Number / j.Total * 100).toFixed(2); //åå两ä½ç¾åæ¯ 416 if (isNaN(percentage)) { 417 percentage = 0; 418 } 419 var imgWidth = parseFloat(percentage); 420 if (imgWidth > 0) { 421 if ((i + itelIndex_int) > (defaults.itelTotal - 1)) 422 index = (i + itelIndex_int) - (defaults.itelTotal - 1); 423 else 424 index = (i + itelIndex_int); 425 itemDiv = "<div style='background-color:" + defaults.itemStyle.bgColor + ";font-size:" + defaults.itemStyle.fontSize + "'><div divWidth='" + imgWidth + "' style='width:0%;background-image:url(" + defaults.bgImg + ");' class='poll_plan" + index + "' ><div class='plan_e' style='background-image:url(" + defaults.bgImg + ");'><div class='plan_c' style='background-image:url(" + defaults.bgImg + ");'>"; 426 if (defaults.isShowPercentage == "True") 427 itemDiv += percentage + "%"; 428 itemDiv += "</div></div></div></div>"; 429 } 430 else { 431 itemDiv = "<div style='background-color:" + defaults.itemStyle.bgColor + ";font-size:" + defaults.itemStyle.fontSize + "'><div divWidth='" + imgWidth + "' style='width:0%;background-image:url(" + defaults.bgImg + ");' class='poll_plan" + index + "' ><div class='plan_c' style='background-image:url(" + defaults.bgImg + ");'>"; 432 if (defaults.isShowPercentage == "True") 433 itemDiv += percentage + "%"; 434 itemDiv += "</div></div></div>"; 435 } 436 var tr = ""; 437 if (defaults.isShowText == "True") 438 tr += "<tr class='tr_statistics'>
438<td width='20%' align='right' >" + j.Text + ":</td><td width='80%'>" + itemDiv + "</td><td width='10%' nowrap >"; 439 else 440 tr += "<tr class='tr_statistics'><td colspan=2 width='100%'>" + itemDiv + "</td><td width='10%' nowrap >"; 441 if (defaults.isShowNumber == "True") 442 tr += j.Number; 443 if (defaults.isShowNumber == "True" && defaults.isShowTotal == "True") 444 tr += "/"; 445 if (defaults.isShowTotal == "True") 446 tr += j.Total; 447 tr += "</td></tr>"; 448 $("table", opoll).append(tr); 449 }); 450 451 $("div", opoll).each(function (i, n) { 452 if ($(n).attr('divWidth')) { 453 $(n).animate({ width: $(n).attr('divWidth') + '%' }, defaults.speed); 454 $(n).removeAttr("divWidth"); 455 } 456 }); 457 }); 458 } 459 460 linkAgeCheckAll = function (that,prop) { 461 jQuery("#clickVoteItem" + prop.charAt(prop.length - 1) + "NoAll").prop("checked", false); 462 var nocheckedList = new Array(); 463 jQuery("input", jQuery(that).parent().parent()).each(function () { 464 if (jQuery(this).prop("checked")) { 465 nocheckedList.push($(this).val()); 466 } 467 }); 468 if (nocheckedList.length == jQuery("input", jQuery(that).parent().parent()).length) { 469 jQuery("#clickVoteItem" + prop.charAt(prop.length - 1) + "All").prop("checked", true); 470 } 471 else { 472 jQuery("#clickVoteItem" + prop.charAt(prop.length - 1) + "All").prop("checked", false); 473 } 474 } 475}; 476 477$(function () { 478 $(".ae-pagination-current").addClass('ui-state-highlight'); 479 $ae.mybutton(".ae-pagination a"); 480 $ae.applyAwesomeStyles(); 481 $("body").ajaxComplete($ae.applyAwesomeStyles); 482 483 $('a[href*="/Move/"]').each(function () { 484 // è·åå½åç href 屿§ 485 var href = $(this).attr('href'); 486 // ä½¿ç¨æ£å表达å¼å¹é æ°å 487 var match = href.match(/\/Move\/(\d+)/); 488 // æ£æ¥æ¯å¦æ¾å°äºå¹é 项 489 if (match && match.length > 1) { 490 // æåæ°åå¹¶çææ°ç id 491 var id = match[1]; 492 // å¨ href å颿·»å # å id 493 var newHref = href + '#o' + id; 494 // 设置æ°ç href 屿§ 495 $(this).attr('href', newHref); 496 } 497 }); 498}); 499
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.