code
stringlengths
1
2.08M
language
stringclasses
1 value
;(function($){ /** * jqGrid extension for SubGrid Data * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html **/ $.jgrid.extend({ setSubGrid : function () { return this.each(function (){ var $t = this, cm; $t.p.colNames.unshift(""); $t.p.colModel.unshift({name:'subgrid',width: $.browser.safari ? $t.p.subGridWidth+$t.p.cellLayout : $t.p.subGridWidth,sortable: false,resizable:false,hidedlg:true,search:false,fixed:true}); cm = $t.p.subGridModel; if(cm[0]) { cm[0].align = $.extend([],cm[0].align || []); for(var i=0;i<cm[0].name.length;i++) { cm[0].align[i] = cm[0].align[i] || 'left';} } }); }, addSubGridCell :function (pos,iRow) { var prp='',gv,sid; this.each(function(){ prp = this.formatCol(pos,iRow); gv = this.p.gridview; sid= this.p.id; }); if( gv === false ){ return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" class=\"ui-sgcollapsed sgcollapsed\" "+prp+"><a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a></td>"; } else { return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" " +prp +"></td>"; } }, addSubGrid : function(t,pos) { return this.each(function(){ var ts = this; if (!ts.grid ) { return; } //------------------------- var subGridCell = function(trdiv,cell,pos){ var tddiv = $("<td align='"+ts.p.subGridModel[0].align[pos]+"'></td>").html(cell); $(trdiv).append(tddiv); }; var subGridXml = function(sjxml, sbid){ var tddiv, i, sgmap, dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"), trdiv = $("<tr></tr>"); for (i = 0; i<ts.p.subGridModel[0].name.length; i++) { tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>"); $(tddiv).html(ts.p.subGridModel[0].name[i]); $(tddiv).width( ts.p.subGridModel[0].width[i]); $(trdiv).append(tddiv); } $(dummy).append(trdiv); if (sjxml){ sgmap = ts.p.xmlReader.subgrid; $(sgmap.root+" "+sgmap.row, sjxml).each( function(){ trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>"); if(sgmap.repeatitems === true) { $(sgmap.cell,this).each( function(i) { subGridCell(trdiv, $(this).text() || '&#160;',i); }); } else { var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name; if (f) { for (i=0;i<f.length;i++) { subGridCell(trdiv, $(f[i],this).text() || '&#160;',i); } } } $(dummy).append(trdiv); }); } var pID = $("table:first",ts.grid.bDiv).attr("id")+"_"; $("#"+pID+sbid).append(dummy); ts.grid.hDiv.loading = false; $("#load_"+ts.p.id).hide(); return false; }; var subGridJson = function(sjxml, sbid){ var tddiv,result , i,cur, sgmap,j, dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"), trdiv = $("<tr></tr>"); for (i = 0; i<ts.p.subGridModel[0].name.length; i++) { tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>"); $(tddiv).html(ts.p.subGridModel[0].name[i]); $(tddiv).width( ts.p.subGridModel[0].width[i]); $(trdiv).append(tddiv); } $(dummy).append(trdiv); if (sjxml){ sgmap = ts.p.jsonReader.subgrid; result = sjxml[sgmap.root]; if ( typeof result !== 'undefined' ) { for (i=0;i<result.length;i++) { cur = result[i]; trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>"); if(sgmap.repeatitems === true) { if(sgmap.cell) { cur=cur[sgmap.cell]; } for (j=0;j<cur.length;j++) { subGridCell(trdiv, cur[j] || '&#160;',j); } } else { var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name; if(f.length) { for (j=0;j<f.length;j++) { subGridCell(trdiv, cur[f[j]] || '&#160;',j); } } } $(dummy).append(trdiv); } } } var pID = $("table:first",ts.grid.bDiv).attr("id")+"_"; $("#"+pID+sbid).append(dummy); ts.grid.hDiv.loading = false; $("#load_"+ts.p.id).hide(); return false; }; var populatesubgrid = function( rd ) { var sid,dp, i, j; sid = $(rd).attr("id"); dp = {nd_: (new Date().getTime())}; dp[ts.p.prmNames.subgridid]=sid; if(!ts.p.subGridModel[0]) { return false; } if(ts.p.subGridModel[0].params) { for(j=0; j < ts.p.subGridModel[0].params.length; j++) { for(i=0; i<ts.p.colModel.length; i++) { if(ts.p.colModel[i].name == ts.p.subGridModel[0].params[j]) { dp[ts.p.colModel[i].name]= $("td:eq("+i+")",rd).text().replace(/\&#160\;/ig,''); } } } } if(!ts.grid.hDiv.loading) { ts.grid.hDiv.loading = true; $("#load_"+ts.p.id).show(); if(!ts.p.subgridtype) { ts.p.subgridtype = ts.p.datatype; } if($.isFunction(ts.p.subgridtype)) { ts.p.subgridtype.call(ts, dp); } else { ts.p.subgridtype = ts.p.subgridtype.toLowerCase(); } switch(ts.p.subgridtype) { case "xml": case "json": $.ajax($.extend({ type:ts.p.mtype, url: ts.p.subGridUrl, dataType:ts.p.subgridtype, data: $.isFunction(ts.p.serializeSubGridData)? ts.p.serializeSubGridData.call(ts, dp) : dp, complete: function(sxml) { if(ts.p.subgridtype == "xml") { subGridXml(sxml.responseXML, sid); } else { subGridJson($.jgrid.parse(sxml.responseText),sid); } sxml=null; } }, $.jgrid.ajaxOptions, ts.p.ajaxSubgridOptions || {})); break; } } return false; }; var res,_id, pID,atd, nhc, subdata, bfsc; $("td:eq("+pos+")",t).click( function(e) { if($(this).hasClass("sgcollapsed")) { pID = ts.p.id; res = $(this).parent(); atd = pos >=1 ? "<td colspan='"+pos+"'>&#160;</td>":""; _id = $(res).attr("id"); bfsc =true; if($.isFunction(ts.p.subGridBeforeExpand)) { bfsc = ts.p.subGridBeforeExpand.call(ts, pID+"_"+_id,_id); } if(bfsc === false) {return false;} nhc = 0; $.each(ts.p.colModel,function(i,v){ if(this.hidden === true || this.name == 'rn' || this.name == 'cb') {nhc++;} }); subdata = "<tr role='row' class='ui-subgrid'>"+atd+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon ui-icon-carat-1-sw'/></td><td colspan='"+parseInt(ts.p.colNames.length-1-nhc,10)+"' class='ui-widget-content subgrid-data'><div id="+pID+"_"+_id+" class='tablediv'>"; $(this).parent().after( subdata+ "</div></td></tr>" ); if( $.isFunction(ts.p.subGridRowExpanded)) { ts.p.subGridRowExpanded.call(ts, pID+"_"+ _id,_id); } else { populatesubgrid(res); } $(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-minus'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded"); } else if($(this).hasClass("sgexpanded")) { bfsc = true; if( $.isFunction(ts.p.subGridRowColapsed)) { res = $(this).parent(); _id = $(res).attr("id"); bfsc = ts.p.subGridRowColapsed.call(ts, pID+"_"+_id,_id ); } if(bfsc===false) {return false;} $(this).parent().next().remove(".ui-subgrid"); $(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed"); } return false; }); ts.subGridXml = function(xml,sid) {subGridXml(xml,sid);}; ts.subGridJson = function(json,sid) {subGridJson(json,sid);}; }); }, expandSubGridRow : function(rowid) { return this.each(function () { var $t = this; if(!$t.grid && !rowid) {return;} if($t.p.subGrid===true) { var rc = $(this).jqGrid("getInd",rowid,true); if(rc) { var sgc = $("td.sgcollapsed",rc)[0]; if(sgc) { $(sgc).trigger("click"); } } } }); }, collapseSubGridRow : function(rowid) { return this.each(function () { var $t = this; if(!$t.grid && !rowid) {return;} if($t.p.subGrid===true) { var rc = $(this).jqGrid("getInd",rowid,true); if(rc) { var sgc = $("td.sgexpanded",rc)[0]; if(sgc) { $(sgc).trigger("click"); } } } }); }, toggleSubGridRow : function(rowid) { return this.each(function () { var $t = this; if(!$t.grid && !rowid) {return;} if($t.p.subGrid===true) { var rc = $(this).jqGrid("getInd",rowid,true); if(rc) { var sgc = $("td.sgcollapsed",rc)[0]; if(sgc) { $(sgc).trigger("click"); } else { sgc = $("td.sgexpanded",rc)[0]; if(sgc) { $(sgc).trigger("click"); } } } } }); } }); })(jQuery);
JavaScript
// Grouping module ;(function($){ $.jgrid.extend({ groupingSetup : function () { return this.each(function (){ var $t = this, grp = $t.p.groupingView; if(grp !== null && ( (typeof grp === 'object') || $.isFunction(grp) ) ) { if(!grp.groupField.length) { $t.p.grouping = false; } else { for(var i=0;i<grp.groupField.length;i++) { if(!grp.groupOrder[i]) { grp.groupOrder[i] = 'asc'; } if(!grp.groupText[i]) { grp.groupText[i] = '{0}'; } if( typeof(grp.groupColumnShow[i]) != 'boolean') { grp.groupColumnShow[i] = true; } if( typeof(grp.groupSummary[i]) != 'boolean') { grp.groupSummary[i] = false; } if(grp.groupColumnShow[i] === true) { $($t).jqGrid('showCol',grp.groupField[i]); } else { $($t).jqGrid('hideCol',grp.groupField[i]); } grp.sortitems[i] = []; grp.sortnames[i] = []; grp.summaryval[i] = []; if(grp.groupSummary[i]) { grp.summary[i] =[]; var cm = $t.p.colModel; for(var j=0, cml = cm.length; j < cml; j++) { if(cm[j].summaryType) { grp.summary[i].push({nm:cm[j].name,st:cm[j].summaryType, v:''}); } } } } $t.p.scroll = false; $t.p.rownumbers = false; $t.p.subGrid = false; $t.p.treeGrid = false; $t.p.gridview = true; } } else { $t.p.grouping = false; } }); }, groupingPrepare : function (rData, items, gdata, record) { this.each(function(){ // currently only one level // Is this a good idea to do it so!!!!????? items[0] += ""; var itm = items[0].toString().split(' ').join(''); var grp = this.p.groupingView, $t= this; if(gdata.hasOwnProperty(itm)) { gdata[itm].push(rData); } else { gdata[itm] = []; gdata[itm].push(rData); grp.sortitems[0].push(itm); grp.sortnames[0].push($.trim(items[0].toString())); grp.summaryval[0][itm] = $.extend(true,[],grp.summary[0]); } if(grp.groupSummary[0]) { $.each(grp.summaryval[0][itm],function(i,n) { if ($.isFunction(this.st)) { this.v = this.st.call($t, this.v, this.nm, record); } else { this.v = $($t).jqGrid('groupingCalculations.'+this.st, this.v, this.nm, record); } }); } }); return gdata; }, groupingToggle : function(hid){ this.each(function(){ var $t = this, grp = $t.p.groupingView, strpos = hid.lastIndexOf('_'), uid = hid.substring(0,strpos+1), num = parseInt(hid.substring(strpos+1),10)+1, minus = grp.minusicon, plus = grp.plusicon; if( $("#"+hid+" span").hasClass(minus) ) { if(grp.showSummaryOnHide && grp.groupSummary[0]) { $("#"+hid).nextUntil(".jqfoot").hide(); } else { $("#"+hid).nextUntil("#"+uid+String(num)).hide(); } $("#"+hid+" span").removeClass(minus).addClass(plus); } else { $("#"+hid).nextUntil("#"+uid+String(num)).show(); $("#"+hid+" span").removeClass(plus).addClass(minus); } }); return false; }, groupingRender : function (grdata, colspans ) { return this.each(function(){ var $t = this, grp = $t.p.groupingView, str = "", icon = "", hid, pmrtl ="", gv, cp, ii; //only one level for now if(!grp.groupDataSorted) { // ???? TO BE IMPROVED grp.sortitems[0].sort(); grp.sortnames[0].sort(); if(grp.groupOrder[0].toLowerCase() == 'desc') { grp.sortitems[0].reverse(); grp.sortnames[0].reverse(); } } if(grp.groupCollapse) { pmrtl = grp.plusicon; } else {pmrtl = grp.minusicon;} pmrtl += " tree-wrap-"+$t.p.direction; ii = 0; while(ii < colspans) { if($t.p.colModel[ii].name == grp.groupField[0]) { cp = ii; break; } ii++; } $.each(grp.sortitems[0],function(i,n){ hid = $t.p.id+"ghead_"+i; icon = "<span style='cursor:pointer;' class='ui-icon "+pmrtl+"' onclick=\"jQuery('#"+$t.p.id+"').jqGrid('groupingToggle','"+hid+"');return false;\"></span>"; try { gv = $t.formatter(hid, grp.sortnames[0][i], cp, grp.sortitems[0] ); } catch (egv) { gv = grp.sortnames[0][i]; } str += "<tr id=\""+hid+"\" role=\"row\" class= \"ui-widget-content jqgroup ui-row-"+$t.p.direction+"\"><td colspan=\""+colspans+"\">"+icon+$.jgrid.format(grp.groupText[0], gv, grdata[n].length)+"</td></tr>"; for(var kk=0;kk<grdata[n].length;kk++) { str += grdata[n][kk].join(''); } if(grp.groupSummary[0]) { var hhdr = ""; if(grp.groupCollapse && !grp.showSummaryOnHide) { hhdr = " style=\"display:none;\""; } str += "<tr"+hhdr+" role=\"row\" class=\"ui-widget-content jqfoot ui-row-"+$t.p.direction+"\">"; var fdata = grp.summaryval[0][n], cm = $t.p.colModel, vv, grlen = grdata[n].length; for(var k=0; k<colspans;k++) { var tmpdata = "<td "+$t.formatCol(k,1,'')+">&#160;</td>", tplfld = "{0}"; $.each(fdata,function(){ if(this.nm == cm[k].name) { if(cm[k].summaryTpl) { tplfld = cm[k].summaryTpl; } if(this.st == 'avg') { if(this.v && grlen > 0) { this.v = (this.v/grlen); } } try { vv = $t.formatter('', this.v, k, this); } catch (ef) { vv = this.v; } tmpdata= "<td "+$t.formatCol(k,1,'')+">"+$.jgrid.format(tplfld,vv)+ "</td>"; return false; } }); str += tmpdata; } str += "</tr>"; } }); $("#"+$t.p.id+" tbody:first").append(str); // free up memory str = null; }); }, groupingGroupBy : function (name, options, current) { return this.each(function(){ var $t = this; if(typeof(name) == "string") { name = [name]; } var grp = $t.p.groupingView; $t.p.grouping = true; // show previoous hidden groups if they are hidden for(var i=0;i<grp.groupField.length;i++) { if(!grp.groupColumnShow[i]) { $($t).jqGrid('showCol',grp.groupField[i]); } } $t.p.groupingView = $.extend($t.p.groupingView, options || {}); grp.groupField = name; $($t).trigger("reloadGrid"); }); }, groupingRemove : function (current) { return this.each(function(){ var $t = this; if(typeof(current) == 'undefined') { current = true; } $t.p.grouping = false; if(current===true) { $("tr.jqgroup, tr.jqfoot","#"+$t.p.id+" tbody:first").remove(); $("tr.jqgrow:hidden","#"+$t.p.id+" tbody:first").show(); } else { $($t).trigger("reloadGrid"); } }); }, groupingCalculations : { "sum" : function(v, field, rc) { return parseFloat(v||0) + parseFloat((rc[field]||0)); }, "min" : function(v, field, rc) { if(v==="") { return parseFloat(rc[field]||0); } return Math.min(parseFloat(v),parseFloat(rc[field]||0)); }, "max" : function(v, field, rc) { if(v==="") { return parseFloat(rc[field]||0); } return Math.max(parseFloat(v),parseFloat(rc[field]||0)); }, "count" : function(v, field, rc) { if(v==="") {v=0;} if(rc.hasOwnProperty(field)) { return v+1; } else { return 0; } }, "avg" : function(v, field, rc) { // the same as sum, but at end we divide it return parseFloat(v||0) + parseFloat((rc[field]||0)); } } }); })(jQuery);
JavaScript
/* * jQuery UI Multiselect * * Authors: * Michael Aufreiter (quasipartikel.at) * Yanick Rochon (yanick.rochon[at]gmail[dot]com) * * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://www.quasipartikel.at/multiselect/ * * * Depends: * ui.core.js * ui.sortable.js * * Optional: * localization (http://plugins.jquery.com/project/localisation) * scrollTo (http://plugins.jquery.com/project/ScrollTo) * * Todo: * Make batch actions faster * Implement dynamic insertion through remote calls */ (function($) { $.widget("ui.multiselect", { _init: function() { this.element.hide(); this.id = this.element.attr("id"); this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element); this.count = 0; // number of currently selected options this.selectedContainer = $('<div class="selected"></div>').appendTo(this.container); this.availableContainer = $('<div class="available"></div>').appendTo(this.container); this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+$.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+$.ui.multiselect.locale.removeAll+'</a></div>').appendTo(this.selectedContainer); this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+$.ui.multiselect.locale.addAll+'</a></div>').appendTo(this.availableContainer); this.selectedList = $('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer); this.availableList = $('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer); var that = this; // set dimensions this.container.width(this.element.width()+1); this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation)); this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation))); // fix list height to match <option> depending on their individual header's heights this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1)); this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1)); if ( !this.options.animated ) { this.options.show = 'show'; this.options.hide = 'hide'; } // init lists this._populateLists(this.element.find('option')); // make selection sortable if (this.options.sortable) { $("ul.selected").sortable({ placeholder: 'ui-state-highlight', axis: 'y', update: function(event, ui) { // apply the new sort order to the original selectbox that.selectedList.find('li').each(function() { if ($(this).data('optionLink')) $(this).data('optionLink').remove().appendTo(that.element); }); }, receive: function(event, ui) { ui.item.data('optionLink').attr('selected', true); // increment count that.count += 1; that._updateCount(); // workaround, because there's no way to reference // the new element, see http://dev.jqueryui.com/ticket/4303 that.selectedList.children('.ui-draggable').each(function() { $(this).removeClass('ui-draggable'); $(this).data('optionLink', ui.item.data('optionLink')); $(this).data('idx', ui.item.data('idx')); that._applyItemState($(this), true); }); // workaround according to http://dev.jqueryui.com/ticket/4088 setTimeout(function() { ui.item.remove(); }, 1); } }); } // set up livesearch if (this.options.searchable) { this._registerSearchEvents(this.availableContainer.find('input.search')); } else { $('.search').hide(); } // batch actions $(".remove-all").click(function() { that._populateLists(that.element.find('option').removeAttr('selected')); return false; }); $(".add-all").click(function() { that._populateLists(that.element.find('option').attr('selected', 'selected')); return false; }); }, destroy: function() { this.element.show(); this.container.remove(); $.widget.prototype.destroy.apply(this, arguments); }, _populateLists: function(options) { this.selectedList.children('.ui-element').remove(); this.availableList.children('.ui-element').remove(); this.count = 0; var that = this; var items = $(options.map(function(i) { var item = that._getOptionNode(this).appendTo(this.selected ? that.selectedList : that.availableList).show(); if (this.selected) that.count += 1; that._applyItemState(item, this.selected); item.data('idx', i); return item[0]; })); // update count this._updateCount(); }, _updateCount: function() { this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount); }, _getOptionNode: function(option) { option = $(option); var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide(); node.data('optionLink', option); return node; }, // clones an item with associated data // didn't find a smarter away around this _cloneWithData: function(clonee) { var clone = clonee.clone(); clone.data('optionLink', clonee.data('optionLink')); clone.data('idx', clonee.data('idx')); return clone; }, _setSelected: function(item, selected) { item.data('optionLink').attr('selected', selected); if (selected) { var selectedItem = this._cloneWithData(item); item[this.options.hide](this.options.animated, function() { $(this).remove(); }); selectedItem.appendTo(this.selectedList).hide()[this.options.show](this.options.animated); this._applyItemState(selectedItem, true); return selectedItem; } else { // look for successor based on initial option index var items = this.availableList.find('li'), comparator = this.options.nodeComparator; var succ = null, i = item.data('idx'), direction = comparator(item, $(items[i])); // TODO: test needed for dynamic list populating if ( direction ) { while (i>=0 && i<items.length) { direction > 0 ? i++ : i--; if ( direction != comparator(item, $(items[i])) ) { // going up, go back one item down, otherwise leave as is succ = items[direction > 0 ? i : i+1]; break; } } } else { succ = items[i]; } var availableItem = this._cloneWithData(item); succ ? availableItem.insertBefore($(succ)) : availableItem.appendTo(this.availableList); item[this.options.hide](this.options.animated, function() { $(this).remove(); }); availableItem.hide()[this.options.show](this.options.animated); this._applyItemState(availableItem, false); return availableItem; } }, _applyItemState: function(item, selected) { if (selected) { if (this.options.sortable) item.children('span').addClass('ui-icon-arrowthick-2-n-s').removeClass('ui-helper-hidden').addClass('ui-icon'); else item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon'); item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus'); this._registerRemoveEvents(item.find('a.action')); } else { item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon'); item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus'); this._registerAddEvents(item.find('a.action')); } this._registerHoverEvents(item); }, // taken from John Resig's liveUpdate script _filter: function(list) { var input = $(this); var rows = list.children('li'), cache = rows.map(function(){ return $(this).text().toLowerCase(); }); var term = $.trim(input.val().toLowerCase()), scores = []; if (!term) { rows.show(); } else { rows.hide(); cache.each(function(i) { if (this.indexOf(term)>-1) { scores.push(i); } }); $.each(scores, function() { $(rows[this]).show(); }); } }, _registerHoverEvents: function(elements) { elements.removeClass('ui-state-hover'); elements.mouseover(function() { $(this).addClass('ui-state-hover'); }); elements.mouseout(function() { $(this).removeClass('ui-state-hover'); }); }, _registerAddEvents: function(elements) { var that = this; elements.click(function() { var item = that._setSelected($(this).parent(), true); that.count += 1; that._updateCount(); return false; }) // make draggable .each(function() { $(this).parent().draggable({ connectToSortable: 'ul.selected', helper: function() { var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50); selectedItem.width($(this).width()); return selectedItem; }, appendTo: '.ui-multiselect', containment: '.ui-multiselect', revert: 'invalid' }); }); }, _registerRemoveEvents: function(elements) { var that = this; elements.click(function() { that._setSelected($(this).parent(), false); that.count -= 1; that._updateCount(); return false; }); }, _registerSearchEvents: function(input) { var that = this; input.focus(function() { $(this).addClass('ui-state-active'); }) .blur(function() { $(this).removeClass('ui-state-active'); }) .keypress(function(e) { if (e.keyCode == 13) return false; }) .keyup(function() { that._filter.apply(this, [that.availableList]); }); } }); $.extend($.ui.multiselect, { defaults: { sortable: true, searchable: true, animated: 'fast', show: 'slideDown', hide: 'slideUp', dividerLocation: 0.6, nodeComparator: function(node1,node2) { var text1 = node1.text(), text2 = node2.text(); return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1); } }, locale: { addAll:'Add all', removeAll:'Remove all', itemsCount:'items selected' } }); })(jQuery);
JavaScript
;(function($){ /** * jqGrid Ukrainian Translation v1.0 02.07.2009 * Sergey Dyagovchenko * http://d.sumy.ua * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Перегляд {0} - {1} з {2}", emptyrecords: "Немає записів для перегляду", loadtext: "Завантаження...", pgtext : "Стор. {0} з {1}" }, search : { caption: "Пошук...", Find: "Знайти", Reset: "Скидання", odata : ['рівно', 'не рівно', 'менше', 'менше або рівне','більше','більше або рівне', 'починається з','не починається з','знаходиться в','не знаходиться в','закінчується на','не закінчується на','містить','не містить'], groupOps: [ { op: "AND", text: "все" }, { op: "OR", text: "будь-який" } ], matchText: " збігається", rulesText: " правила" }, edit : { addCaption: "Додати запис", editCaption: "Змінити запис", bSubmit: "Зберегти", bCancel: "Відміна", bClose: "Закрити", saveData: "До данних були внесені зміни! Зберегти зміни?", bYes : "Так", bNo : "Ні", bExit : "Відміна", msg: { required:"Поле є обов'язковим", number:"Будь ласка, введіть правильне число", minValue:"значення повинне бути більше або дорівнює", maxValue:"значення повинно бути менше або дорівнює", email: "некоректна адреса електронної пошти", integer: "Будь ласка, введення дійсне ціле значення", date: "Будь ласка, введення дійсне значення дати", url: "не дійсний URL. Необхідна приставка ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Переглянути запис", bClose: "Закрити" }, del : { caption: "Видалити", msg: "Видалити обраний запис(и)?", bSubmit: "Видалити", bCancel: "Відміна" }, nav : { edittext: " ", edittitle: "Змінити вибраний запис", addtext:" ", addtitle: "Додати новий запис", deltext: " ", deltitle: "Видалити вибраний запис", searchtext: " ", searchtitle: "Знайти записи", refreshtext: "", refreshtitle: "Оновити таблицю", alertcap: "Попередження", alerttext: "Будь ласка, виберіть запис", viewtext: "", viewtitle: "Переглянути обраний запис" }, col : { caption: "Показати/Приховати стовпці", bSubmit: "Зберегти", bCancel: "Відміна" }, errors : { errcap : "Помилка", nourl : "URL не задан", norecords: "Немає записів для обробки", model : "Число полів не відповідає числу стовпців таблиці!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота" ], monthNames: [ "Січ", "Лют", "Бер", "Кві", "Тра", "Чер", "Лип", "Сер", "Вер", "Жов", "Лис", "Гру", "Січень", "Лютий", "Березень", "Квітень", "Травень", "Червень", "Липень", "Серпень", "Вересень", "Жовтень", "Листопад", "Грудень" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd.m.Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n.j.Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y G:i:s", MonthDay: "F d", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Catalan Translation * Traducció jqGrid en Catatà per Faserline, S.L. * http://www.faserline.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Mostrant {0} - {1} de {2}", emptyrecords: "Sense registres que mostrar", loadtext: "Carregant...", pgtext : "Pàgina {0} de {1}" }, search : { caption: "Cerca...", Find: "Cercar", Reset: "Buidar", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "tot" }, { op: "OR", text: "qualsevol" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Afegir registre", editCaption: "Modificar registre", bSubmit: "Guardar", bCancel: "Cancelar", bClose: "Tancar", saveData: "Les dades han canviat. Guardar canvis?", bYes : "Yes", bNo : "No", bExit : "Cancel", msg: { required:"Camp obligatori", number:"Introdueixi un nombre", minValue:"El valor ha de ser major o igual que ", maxValue:"El valor ha de ser menor o igual a ", email: "no és una direcció de correu vàlida", integer: "Introdueixi un valor enter", date: "Introdueixi una data correcta ", url: "no és una URL vàlida. Prefix requerit ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Veure registre", bClose: "Tancar" }, del : { caption: "Eliminar", msg: "¿Desitja eliminar els registres seleccionats?", bSubmit: "Eliminar", bCancel: "Cancelar" }, nav : { edittext: " ", edittitle: "Modificar fila seleccionada", addtext:" ", addtitle: "Agregar nova fila", deltext: " ", deltitle: "Eliminar fila seleccionada", searchtext: " ", searchtitle: "Cercar informació", refreshtext: "", refreshtitle: "Refrescar taula", alertcap: "Avís", alerttext: "Seleccioni una fila", viewtext: " ", viewtitle: "Veure fila seleccionada" }, // setcolumns module col : { caption: "Mostrar/ocultar columnes", bSubmit: "Enviar", bCancel: "Cancelar" }, errors : { errcap : "Error", nourl : "No s'ha especificat una URL", norecords: "No hi ha dades per processar", model : "Les columnes de noms són diferents de les columnes del model" }, formatter : { integer : {thousandsSeparator: ".", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds", "Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte" ], monthNames: [ "Gen", "Febr", "Març", "Abr", "Maig", "Juny", "Jul", "Ag", "Set", "Oct", "Nov", "Des", "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd-m-Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: 'show', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Hebrew Translation * Shuki Shukrun shukrun.shuki@gmail.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "מציג {0} - {1} מתוך {2}", emptyrecords: "אין רשומות להציג", loadtext: "טוען...", pgtext : "דף {0} מתוך {1}" }, search : { caption: "מחפש...", Find: "חפש", Reset: "התחל", odata : ['שווה', 'לא שווה', 'קטן', 'קטן או שווה','גדול','גדול או שווה', 'מתחיל ב','לא מתחיל ב','נמצא ב','לא נמצא ב','מסתיים ב','לא מסתיים ב','מכיל','לא מכיל'], groupOps: [ { op: "AND", text: "הכל" }, { op: "OR", text: "אחד מ" } ], matchText: " תואם", rulesText: " חוקים" }, edit : { addCaption: "הוסף רשומה", editCaption: "ערוך רשומה", bSubmit: "שלח", bCancel: "בטל", bClose: "סגור", saveData: "נתונים השתנו! לשמור?", bYes : "כן", bNo : "לא", bExit : "בטל", msg: { required:"שדה חובה", number:"אנא, הכנס מספר תקין", minValue:"ערך צריך להיות גדול או שווה ל ", maxValue:"ערך צריך להיות קטן או שווה ל ", email: "היא לא כתובת איימל תקינה", integer: "אנא, הכנס מספר שלם", date: "אנא, הכנס תאריך תקין", url: "הכתובת אינה תקינה. דרושה תחילית ('http://' או 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "הצג רשומה", bClose: "סגור" }, del : { caption: "מחק", msg: "האם למחוק את הרשומה/ות המסומנות?", bSubmit: "מחק", bCancel: "בטל" }, nav : { edittext: "", edittitle: "ערוך שורה מסומנת", addtext:"", addtitle: "הוסף שורה חדשה", deltext: "", deltitle: "מחק שורה מסומנת", searchtext: "", searchtitle: "חפש רשומות", refreshtext: "", refreshtitle: "טען גריד מחדש", alertcap: "אזהרה", alerttext: "אנא, בחר שורה", viewtext: "", viewtitle: "הצג שורה מסומנת" }, col : { caption: "הצג/הסתר עמודות", bSubmit: "שלח", bCancel: "בטל" }, errors : { errcap : "שגיאה", nourl : "לא הוגדרה כתובת url", norecords: "אין רשומות לעבד", model : "אורך של colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "א", "ב", "ג", "ד", "ה", "ו", "ש", "ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת" ], monthNames: [ "ינו", "פבר", "מרץ", "אפר", "מאי", "יונ", "יול", "אוג", "ספט", "אוק", "נוב", "דצמ", "ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר" ], AmPm : ["לפני הצהרים","אחר הצהרים","לפני הצהרים","אחר הצהרים"], S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Spanish Translation * Traduccion jqGrid en Español por Yamil Bracho * Traduccion corregida y ampliada por Faserline, S.L. * http://www.faserline.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Mostrando {0} - {1} de {2}", emptyrecords: "Sin registros que mostrar", loadtext: "Cargando...", pgtext : "Página {0} de {1}" }, search : { caption: "Búsqueda...", Find: "Buscar", Reset: "Limpiar", odata : ['igual ', 'no igual a', 'menor que', 'menor o igual que','mayor que','mayor o igual a', 'empiece por','no empiece por','está en','no está en','termina por','no termina por','contiene','no contiene'], groupOps: [ { op: "AND", text: "todo" }, { op: "OR", text: "cualquier" } ], matchText: " match", rulesText: " reglas" }, edit : { addCaption: "Agregar registro", editCaption: "Modificar registro", bSubmit: "Guardar", bCancel: "Cancelar", bClose: "Cerrar", saveData: "Se han modificado los datos, ¿guardar cambios?", bYes : "Si", bNo : "No", bExit : "Cancelar", msg: { required:"Campo obligatorio", number:"Introduzca un número", minValue:"El valor debe ser mayor o igual a ", maxValue:"El valor debe ser menor o igual a ", email: "no es una dirección de correo válida", integer: "Introduzca un valor entero", date: "Introduza una fecha correcta ", url: "no es una URL válida. Prefijo requerido ('http://' or 'https://')", nodefined : " no está definido.", novalue : " valor de retorno es requerido.", customarray : "La función personalizada debe devolver un array.", customfcheck : "La función personalizada debe estar presente en el caso de validación personalizada." } }, view : { caption: "Consultar registro", bClose: "Cerrar" }, del : { caption: "Eliminar", msg: "¿Desea eliminar los registros seleccionados?", bSubmit: "Eliminar", bCancel: "Cancelar" }, nav : { edittext: " ", edittitle: "Modificar fila seleccionada", addtext:" ", addtitle: "Agregar nueva fila", deltext: " ", deltitle: "Eliminar fila seleccionada", searchtext: " ", searchtitle: "Buscar información", refreshtext: "", refreshtitle: "Recargar datos", alertcap: "Aviso", alerttext: "Seleccione una fila", viewtext: "", viewtitle: "Ver fila seleccionada" }, col : { caption: "Mostrar/ocultar columnas", bSubmit: "Enviar", bCancel: "Cancelar" }, errors : { errcap : "Error", nourl : "No se ha especificado una URL", norecords: "No hay datos para procesar", model : "Las columnas de nombres son diferentes de las columnas de modelo" }, formatter : { integer : {thousandsSeparator: ".", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado" ], monthNames: [ "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd-m-Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Polish Translation * Łukasz Schab * http://FreeTree.pl * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Pokaż {0} - {1} z {2}", emptyrecords: "Brak rekordów do pokazania", loadtext: "\u0142adowanie...", pgtext : "Strona {0} z {1}" }, search : { caption: "Wyszukiwanie...", Find: "Szukaj", Reset: "Czyść", odata : ['dok\u0142adnie', 'różne od', 'mniejsze od', 'mniejsze lub równe','większe od','większe lub równe', 'zaczyna się od','nie zaczyna się od','zawiera','nie zawiera','kończy się na','nie kończy się na','zawiera','nie zawiera'], groupOps: [ { op: "ORAZ", text: "wszystkie" }, { op: "LUB", text: "każdy" } ], matchText: " pasuje", rulesText: " regu\u0142y" }, edit : { addCaption: "Dodaj rekord", editCaption: "Edytuj rekord", bSubmit: "Zapisz", bCancel: "Anuluj", bClose: "Zamknij", saveData: "Dane zosta\u0142y zmienione! Zapisać zmiany?", bYes : "Tak", bNo : "Nie", bExit : "Anuluj", msg: { required:"Pole jest wymagane", number:"Proszę wpisać poprawną liczbę", minValue:"wartość musi być większa lub równa", maxValue:"wartość musi być mniejsza od", email: "nie jest adresem e-mail", integer: "Proszę wpisać poprawną liczbę", date: "Proszę podaj poprawną datę", url: "jest niew\u0142aściwym adresem URL. Pamiętaj o prefiksie ('http://' lub 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Pokaż rekord", bClose: "Zamknij" }, del : { caption: "Usuwanie", msg: "Czy usunąć wybrany rekord(y)?", bSubmit: "Usuń", bCancel: "Anuluj" }, nav : { edittext: " ", edittitle: "Edytuj wybrany wiersz", addtext:" ", addtitle: "Dodaj nowy wiersz", deltext: " ", deltitle: "Usuń wybrany wiersz", searchtext: " ", searchtitle: "Wyszukaj rekord", refreshtext: "", refreshtitle: "Prze\u0142aduj", alertcap: "Uwaga", alerttext: "Proszę wybrać wiersz", viewtext: "", viewtitle: "View selected row" }, col : { caption: "Pokaż/Ukryj kolumny", bSubmit: "Zatwierdź", bCancel: "Anuluj" }, errors : { errcap : "B\u0142ąd", nourl : "Brak adresu url", norecords: "Brak danych", model : "D\u0142ugość colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Nie", "Pon", "Wt", "Śr", "Cz", "Pi", "So", "Niedziela", "Poniedzia\u0142ek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota" ], monthNames: [ "Sty", "Lu", "Mar", "Kwie", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru", "Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid German Translation * Version 1.0.0 (developed for jQuery Grid 3.3.1) * Olaf Klöppel opensource@blue-hit.de * http://blue-hit.de/ * * Updated for jqGrid 3.8 * Andreas Flack * http://www.contentcontrol-berlin.de * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Zeige {0} - {1} von {2}", emptyrecords: "Keine Datensätze vorhanden", loadtext: "Lädt...", pgtext : "Seite {0} von {1}" }, search : { caption: "Suche...", Find: "Suchen", Reset: "Zurücksetzen", odata : ['gleich', 'ungleich', 'kleiner', 'kleiner gleich','größer','größer gleich', 'beginnt mit','beginnt nicht mit','ist in','ist nicht in','endet mit','endet nicht mit','enthält','enthält nicht'], groupOps: [ { op: "AND", text: "alle" }, { op: "OR", text: "mindestens eine" } ], matchText: " erfülle", rulesText: " Bedingung(en)" }, edit : { addCaption: "Datensatz hinzufügen", editCaption: "Datensatz bearbeiten", bSubmit: "Speichern", bCancel: "Abbrechen", bClose: "Schließen", saveData: "Daten wurden geändert! Änderungen speichern?", bYes : "ja", bNo : "nein", bExit : "abbrechen", msg: { required:"Feld ist erforderlich", number: "Bitte geben Sie eine Zahl ein", minValue:"Wert muss größer oder gleich sein, als ", maxValue:"Wert muss kleiner oder gleich sein, als ", email: "ist keine gültige E-Mail-Adresse", integer: "Bitte geben Sie eine Ganzzahl ein", date: "Bitte geben Sie ein gültiges Datum ein", url: "ist keine gültige URL. Präfix muss eingegeben werden ('http://' oder 'https://')", nodefined : " ist nicht definiert!", novalue : " Rückgabewert ist erforderlich!", customarray : "Benutzerdefinierte Funktion sollte ein Array zurückgeben!", customfcheck : "Benutzerdefinierte Funktion sollte im Falle der benutzerdefinierten Überprüfung vorhanden sein!" } }, view : { caption: "Datensatz anzeigen", bClose: "Schließen" }, del : { caption: "Löschen", msg: "Ausgewählte Datensätze löschen?", bSubmit: "Löschen", bCancel: "Abbrechen" }, nav : { edittext: " ", edittitle: "Ausgewählte Zeile editieren", addtext:" ", addtitle: "Neue Zeile einfügen", deltext: " ", deltitle: "Ausgewählte Zeile löschen", searchtext: " ", searchtitle: "Datensatz suchen", refreshtext: "", refreshtitle: "Tabelle neu laden", alertcap: "Warnung", alerttext: "Bitte Zeile auswählen", viewtext: "", viewtitle: "Ausgewählte Zeile anzeigen" }, col : { caption: "Spalten auswählen", bSubmit: "Speichern", bCancel: "Abbrechen" }, errors : { errcap : "Fehler", nourl : "Keine URL angegeben", norecords: "Keine Datensätze zu bearbeiten", model : "colNames und colModel sind unterschiedlich lang!" }, formatter : { integer : {thousandsSeparator: ".", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:" €", defaultValue: '0,00'}, date : { dayNames: [ "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return 'ter'}, srcformat: 'Y-m-d', newformat: 'd.m.Y', masks : { ISO8601Long: "Y-m-d H:i:s", ISO8601Short: "Y-m-d", ShortDate: "j.n.Y", LongDate: "l, j. F Y", FullDateTime: "l, d. F Y G:i:s", MonthDay: "d. F", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Russian Translation v1.0 02.07.2009 (based on translation by Alexey Kanaev v1.1 21.01.2009, http://softcore.com.ru) * Sergey Dyagovchenko * http://d.sumy.ua * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Просмотр {0} - {1} из {2}", emptyrecords: "Нет записей для просмотра", loadtext: "Загрузка...", pgtext : "Стр. {0} из {1}" }, search : { caption: "Поиск...", Find: "Найти", Reset: "Сброс", odata : ['равно', 'не равно', 'меньше', 'меньше или равно','больше','больше или равно', 'начинается с','не начинается с','находится в','не находится в','заканчивается на','не заканчивается на','содержит','не содержит'], groupOps: [ { op: "AND", text: "все" }, { op: "OR", text: "любой" } ], matchText: " совпадает", rulesText: " правила" }, edit : { addCaption: "Добавить запись", editCaption: "Редактировать запись", bSubmit: "Сохранить", bCancel: "Отмена", bClose: "Закрыть", saveData: "Данные были измененны! Сохранить изменения?", bYes : "Да", bNo : "Нет", bExit : "Отмена", msg: { required:"Поле является обязательным", number:"Пожалуйста, введите правильное число", minValue:"значение должно быть больше либо равно", maxValue:"значение должно быть меньше либо равно", email: "некорректное значение e-mail", integer: "Пожалуйста, введите целое число", date: "Пожалуйста, введите правильную дату", url: "неверная ссылка. Необходимо ввести префикс ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Просмотр записи", bClose: "Закрыть" }, del : { caption: "Удалить", msg: "Удалить выбранную запись(и)?", bSubmit: "Удалить", bCancel: "Отмена" }, nav : { edittext: " ", edittitle: "Редактировать выбранную запись", addtext:" ", addtitle: "Добавить новую запись", deltext: " ", deltitle: "Удалить выбранную запись", searchtext: " ", searchtitle: "Найти записи", refreshtext: "", refreshtitle: "Обновить таблицу", alertcap: "Внимание", alerttext: "Пожалуйста, выберите запись", viewtext: "", viewtitle: "Просмотреть выбранную запись" }, col : { caption: "Показать/скрыть столбцы", bSubmit: "Сохранить", bCancel: "Отмена" }, errors : { errcap : "Ошибка", nourl : "URL не установлен", norecords: "Нет записей для обработки", model : "Число полей не соответствует числу столбцов таблицы!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Воскресение", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота" ], monthNames: [ "Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек", "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd.m.Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n.j.Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y G:i:s", MonthDay: "F d", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Swedish Translation * Harald Normann harald.normann@wts.se, harald.normann@gmail.com * http://www.worldteamsoftware.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Visar {0} - {1} av {2}", emptyrecords: "Det finns inga poster att visa", loadtext: "Laddar...", pgtext : "Sida {0} av {1}" }, search : { caption: "Sök Poster - Ange sökvillkor", Find: "Sök", Reset: "Nollställ Villkor", odata : ['lika', 'ej lika', 'mindre', 'mindre eller lika','större','större eller lika', 'börjar med','börjar inte med','tillhör','tillhör inte','slutar med','slutar inte med','innehåller','innehåller inte'], groupOps: [ { op: "AND", text: "alla" }, { op: "OR", text: "eller" } ], matchText: " träff", rulesText: " regler" }, edit : { addCaption: "Ny Post", editCaption: "Redigera Post", bSubmit: "Spara", bCancel: "Avbryt", bClose: "Stäng", saveData: "Data har ändrats! Spara förändringar?", bYes : "Ja", bNo : "Nej", bExit : "Avbryt", msg: { required:"Fältet är obligatoriskt", number:"Välj korrekt nummer", minValue:"värdet måste vara större än eller lika med", maxValue:"värdet måste vara mindre än eller lika med", email: "är inte korrekt e-post adress", integer: "Var god ange korrekt heltal", date: "Var god ange korrekt datum", url: "är inte en korrekt URL. Prefix måste anges ('http://' or 'https://')", nodefined : " är inte definierad!", novalue : " returvärde måste anges!", customarray : "Custom funktion måste returnera en vektor!", customfcheck : "Custom funktion måste finnas om Custom kontroll sker!" } }, view : { caption: "Visa Post", bClose: "Stäng" }, del : { caption: "Radera", msg: "Radera markerad(e) post(er)?", bSubmit: "Radera", bCancel: "Avbryt" }, nav : { edittext: "", edittitle: "Redigera markerad rad", addtext:"", addtitle: "Skapa ny post", deltext: "", deltitle: "Radera markerad rad", searchtext: "", searchtitle: "Sök poster", refreshtext: "", refreshtitle: "Uppdatera data", alertcap: "Varning", alerttext: "Ingen rad är markerad", viewtext: "", viewtitle: "Visa markerad rad" }, col : { caption: "Välj Kolumner", bSubmit: "OK", bCancel: "Avbryt" }, errors : { errcap : "Fel", nourl : "URL saknas", norecords: "Det finns inga poster att bearbeta", model : "Antal colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"Kr", defaultValue: '0,00'}, date : { dayNames: [ "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör", "Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec", "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" ], AmPm : ["fm","em","FM","EM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'Y-m-d', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
(function(a) { a.jgrid = { defaults: { recordtext: "regels {0} - {1} van {2}", emptyrecords: "Geen data gevonden.", loadtext: "laden...", pgtext: "pagina {0} van {1}" }, search: { caption: "Zoeken...", Find: "Zoek", Reset: "Herstellen", odata: ["gelijk aan", "niet gelijk aan", "kleiner dan", "kleiner dan of gelijk aan", "groter dan", "groter dan of gelijk aan", "begint met", "begint niet met", "is in", "is niet in", "eindigd met", "eindigd niet met", "bevat", "bevat niet"], groupOps: [{ op: "AND", text: "alle" }, { op: "OR", text: "een van de"}], matchText: " match", rulesText: " regels" }, edit: { addCaption: "Nieuw", editCaption: "Bewerken", bSubmit: "Opslaan", bCancel: "Annuleren", bClose: "Sluiten", saveData: "Er is data aangepast! Wijzigingen opslaan?", bYes: "Ja", bNo: "Nee", bExit: "Sluiten", msg: { required: "Veld is verplicht", number: "Voer a.u.b. geldig nummer in", minValue: "Waarde moet groter of gelijk zijn aan ", maxValue: "Waarde moet kleiner of gelijks zijn aan", email: "is geen geldig e-mailadres", integer: "Voer a.u.b. een geldig getal in", date: "Voer a.u.b. een geldige waarde in", url: "is geen geldige URL. Prefix is verplicht ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view: { caption: "Tonen", bClose: "Sluiten" }, del: { caption: "Verwijderen", msg: "Verwijder geselecteerde regel(s)?", bSubmit: "Verwijderen", bCancel: "Annuleren" }, nav: { edittext: "", edittitle: "Bewerken", addtext: "", addtitle: "Nieuw", deltext: "", deltitle: "Verwijderen", searchtext: "", searchtitle: "Zoeken", refreshtext: "", refreshtitle: "Vernieuwen", alertcap: "Waarschuwing", alerttext: "Selecteer a.u.b. een regel", viewtext: "", viewtitle: "Openen" }, col: { caption: "Tonen/verbergen kolommen", bSubmit: "OK", bCancel: "Annuleren" }, errors: { errcap: "Fout", nourl: "Er is geen URL gedefinieerd", norecords: "Geen data om te verwerken", model: "Lengte van 'colNames' is niet gelijk aan 'colModel'!" }, formatter: { integer: { thousandsSeparator: ".", defaultValue: "0" }, number: { decimalSeparator: ",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: "0.00" }, currency: { decimalSeparator: ",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "EUR ", suffix: "", defaultValue: "0.00" }, date: { dayNames: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"], monthNames: ["Jan", "Feb", "Maa", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "October", "November", "December"], AmPm: ["am", "pm", "AM", "PM"], S: function(b) { return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th" }, srcformat: "Y-m-d", newformat: "d/m/Y", masks: { ISO8601Long: "Y-m-d H:i:s", ISO8601Short: "Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l d F Y G:i:s", MonthDay: "d F", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit: false }, baseLinkUrl: "", showAction: "", target: "", checkbox: { disabled: true }, idName: "id" } } })(jQuery);
JavaScript
;(function ($) { /** * jqGrid Persian Translation * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults: { recordtext: "نمابش {0} - {1} از {2}", emptyrecords: "رکوردی یافت نشد", loadtext: "بارگزاري...", pgtext: "صفحه {0} از {1}" }, search: { caption: "جستجو...", Find: "يافته ها", Reset: "از نو", odata: ['برابر', 'نا برابر', 'به', 'کوچکتر', 'از', 'بزرگتر', 'شروع با', 'شروع نشود با', 'نباشد', 'عضو این نباشد', 'اتمام با', 'تمام نشود با', 'حاوی', 'نباشد حاوی'], groupOps: [{ op: "AND", text: "کل" }, { op: "OR", text: "مجموع" }], matchText: " حاوی", rulesText: " اطلاعات" }, edit: { addCaption: "اضافه کردن رکورد", editCaption: "ويرايش رکورد", bSubmit: "ثبت", bCancel: "انصراف", bClose: "بستن", saveData: "دیتا تعییر کرد! ذخیره شود؟", bYes: "بله", bNo: "خیر", bExit: "انصراف", msg: { required: "فيلدها بايد ختما پر شوند", number: "لطفا عدد وعتبر وارد کنيد", minValue: "مقدار وارد شده بايد بزرگتر يا مساوي با", maxValue: "مقدار وارد شده بايد کوچکتر يا مساوي", email: "پست الکترونيک وارد شده معتبر نيست", integer: "لطفا يک عدد صحيح وارد کنيد", date: "لطفا يک تاريخ معتبر وارد کنيد", url: "این آدرس صحیح نمی باشد. پیشوند نیاز است ('http://' یا 'https://')", nodefined: " تعریف نشده!", novalue: " مقدار برگشتی اجباری است!", customarray: "تابع شما باید مقدار آرایه داشته باشد!", customfcheck: "برای داشتن متد دلخواه شما باید سطون با چکینگ دلخواه داشته باشید!" } }, view: { caption: "نمایش رکورد", bClose: "بستن" }, del: { caption: "حذف", msg: "از حذف گزينه هاي انتخاب شده مطمئن هستيد؟", bSubmit: "حذف", bCancel: "ابطال" }, nav: { edittext: " ", edittitle: "ويرايش رديف هاي انتخاب شده", addtext: " ", addtitle: "افزودن رديف جديد", deltext: " ", deltitle: "حذف ردبف هاي انتخاب شده", searchtext: " ", searchtitle: "جستجوي رديف", refreshtext: "", refreshtitle: "بازيابي مجدد صفحه", alertcap: "اخطار", alerttext: "لطفا يک رديف انتخاب کنيد", viewtext: "", viewtitle: "نمایش رکورد های انتخاب شده" }, col: { caption: "نمايش/عدم نمايش ستون", bSubmit: "ثبت", bCancel: "انصراف" }, errors: { errcap: "خطا", nourl: "هيچ آدرسي تنظيم نشده است", norecords: "هيچ رکوردي براي پردازش موجود نيست", model: "طول نام ستون ها محالف ستون هاي مدل مي باشد!" }, formatter: { integer: { thousandsSeparator: " ", defaultValue: "0" }, number: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: "0.00" }, currency: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix: "", defaultValue: "0" }, date: { dayNames: ["يک", "دو", "سه", "چهار", "پنج", "جمع", "شنب", "يکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"], monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "ژانويه", "فوريه", "مارس", "آوريل", "مه", "ژوئن", "ژوئيه", "اوت", "سپتامبر", "اکتبر", "نوامبر", "December"], AmPm: ["ب.ظ", "ب.ظ", "ق.ظ", "ق.ظ"], S: function (b) { return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th" }, srcformat: "Y-m-d", newformat: "d/m/Y", masks: { ISO8601Long: "Y-m-d H:i:s", ISO8601Short: "Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit: false }, baseLinkUrl: "", showAction: "نمايش", target: "", checkbox: { disabled: true }, idName: "id" } } })(jQuery);
JavaScript
;(function($){ /** * jqGrid Brazilian-Portuguese Translation * Sergio Righi sergio.righi@gmail.com * http://curve.com.br * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Ver {0} - {1} of {2}", emptyrecords: "Nenhum registro para visualizar", loadtext: "Carregando...", pgtext : "Página {0} de {1}" }, search : { caption: "Procurar...", Find: "Procurar", Reset: "Resetar", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " iguala", rulesText: " regras" }, edit : { addCaption: "Incluir", editCaption: "Alterar", bSubmit: "Enviar", bCancel: "Cancelar", bClose: "Fechar", saveData: "Os dados foram alterados! Salvar alterações?", bYes : "Sim", bNo : "Não", bExit : "Cancelar", msg: { required:"Campo obrigatório", number:"Por favor, informe um número válido", minValue:"valor deve ser igual ou maior que ", maxValue:"valor deve ser menor ou igual a", email: "este e-mail não é válido", integer: "Por favor, informe um valor inteiro", date: "Por favor, informe uma data válida", url: "não é uma URL válida. Prefixo obrigatório ('http://' or 'https://')", nodefined : " não está definido!", novalue : " um valor de retorno é obrigatório!", customarray : "Função customizada deve retornar um array!", customfcheck : "Função customizada deve estar presente em caso de validação customizada!" } }, view : { caption: "Ver Registro", bClose: "Fechar" }, del : { caption: "Apagar", msg: "Apagar registros selecionado(s)?", bSubmit: "Apagar", bCancel: "Cancelar" }, nav : { edittext: " ", edittitle: "Alterar registro selecionado", addtext:" ", addtitle: "Incluir novo registro", deltext: " ", deltitle: "Apagar registro selecionado", searchtext: " ", searchtitle: "Procurar registros", refreshtext: "", refreshtitle: "Recarrgando Tabela", alertcap: "Aviso", alerttext: "Por favor, selecione um registro", viewtext: "", viewtitle: "Ver linha selecionada" }, col : { caption: "Mostrar/Esconder Colunas", bSubmit: "Enviar", bCancel: "Cancelar" }, errors : { errcap : "Erro", nourl : "Nenhuma URL defenida", norecords: "Sem registros para exibir", model : "Comprimento de colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "R$ ", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado" ], monthNames: [ "Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez", "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['º', 'º', 'º', 'º'][Math.min((j - 1) % 10, 3)] : 'º'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Turkish Translation * Erhan Gündoğan (erhan@trposta.net) * http://blog.zakkum.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "{0}-{1} listeleniyor. Toplam:{2}", emptyrecords: "Kayıt bulunamadı", loadtext: "Yükleniyor...", pgtext : "{0}/{1}. Sayfa" }, search : { caption: "Arama...", Find: "Bul", Reset: "Temizle", odata : ['eşit', 'eşit değil', 'daha az', 'daha az veya eşit', 'daha fazla', 'daha fazla veya eşit', 'ile başlayan', 'ile başlamayan', 'içinde', 'içinde değil', 'ile biten', 'ile bitmeyen', 'içeren', 'içermeyen'], groupOps: [ { op: "VE", text: "tüm" }, { op: "VEYA", text: "herhangi" } ], matchText: " uyan", rulesText: " kurallar" }, edit : { addCaption: "Kayıt Ekle", editCaption: "Kayıt Düzenle", bSubmit: "Gönder", bCancel: "İptal", bClose: "Kapat", saveData: "Veriler değişti! Kayıt edilsin mi?", bYes : "Evet", bNo : "Hayıt", bExit : "İptal", msg: { required:"Alan gerekli", number:"Lütfen bir numara giriniz", minValue:"girilen değer daha büyük ya da buna eşit olmalıdır", maxValue:"girilen değer daha küçük ya da buna eşit olmalıdır", email: "geçerli bir e-posta adresi değildir", integer: "Lütfen bir tamsayı giriniz", url: "Geçerli bir URL değil. ('http://' or 'https://') ön eki gerekli.", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Kayıt Görüntüle", bClose: "Kapat" }, del : { caption: "Sil", msg: "Seçilen kayıtlar silinsin mi?", bSubmit: "Sil", bCancel: "İptal" }, nav : { edittext: " ", edittitle: "Seçili satırı düzenle", addtext:" ", addtitle: "Yeni satır ekle", deltext: " ", deltitle: "Seçili satırı sil", searchtext: " ", searchtitle: "Kayıtları bul", refreshtext: "", refreshtitle: "Tabloyu yenile", alertcap: "Uyarı", alerttext: "Lütfen bir satır seçiniz", viewtext: "", viewtitle: "Seçilen satırı görüntüle" }, col : { caption: "Sütunları göster/gizle", bSubmit: "Gönder", bCancel: "İptal" }, errors : { errcap : "Hata", nourl : "Bir url yapılandırılmamış", norecords: "İşlem yapılacak bir kayıt yok", model : "colNames uzunluğu <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts", "Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi" ], monthNames: [ "Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara", "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Danish Translation * Aesiras A/S * http://www.aesiras.dk * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Vis {0} - {1} of {2}", emptyrecords: "Ingen linjer fundet", loadtext: "Henter...", pgtext : "Side {0} af {1}" }, search : { caption: "Søg...", Find: "Find", Reset: "Nulstil", odata : ['lig', 'forskellige fra', 'mindre', 'mindre eller lig','større','større eller lig', 'begynder med','begynder ikke med','findes i','findes ikke i','ender med','ender ikke med','indeholder','indeholder ikke'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " lig", rulesText: " regler" }, edit : { addCaption: "Tilføj", editCaption: "Ret", bSubmit: "Send", bCancel: "Annuller", bClose: "Luk", saveData: "Data er ændret. Gem data?", bYes : "Ja", bNo : "Nej", bExit : "Fortryd", msg: { required:"Felt er nødvendigt", number:"Indtast venligst et validt tal", minValue:"værdi skal være større end eller lig med", maxValue:"værdi skal være mindre end eller lig med", email: "er ikke en gyldig email", integer: "Indtast venligst et gyldigt heltal", date: "Indtast venligst en gyldig datoværdi", url: "er ugyldig URL. Prefix mangler ('http://' or 'https://')", nodefined : " er ikke defineret!", novalue : " returværdi kræves!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Vis linje", bClose: "Luk" }, del : { caption: "Slet", msg: "Slet valgte linje(r)?", bSubmit: "Slet", bCancel: "Fortryd" }, nav : { edittext: " ", edittitle: "Rediger valgte linje", addtext:" ", addtitle: "Tilføj ny linje", deltext: " ", deltitle: "Slet valgte linje", searchtext: " ", searchtitle: "Find linjer", refreshtext: "", refreshtitle: "Indlæs igen", alertcap: "Advarsel", alerttext: "Vælg venligst linje", viewtext: "", viewtitle: "Vis valgte linje" }, col : { caption: "Vis/skjul kolonner", bSubmit: "Opdatere", bCancel: "Fortryd" }, errors : { errcap : "Fejl", nourl : "Ingen url valgt", norecords: "Ingen linjer at behandle", model : "colNames og colModel har ikke samme længde!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec", "Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December" ], AmPm : ["","","",""], S: function (j) {return '.'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "j/n/Y", LongDate: "l d. F Y", FullDateTime: "l d F Y G:i:s", MonthDay: "d. F", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; // DA })(jQuery);
JavaScript
;(function($){ /** * jqGrid Romanian Translation * Alexandru Emil Lupu contact@alecslupu.ro * http://www.alecslupu.ro/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Vizualizare {0} - {1} din {2}", emptyrecords: "Nu există înregistrări de vizualizat", loadtext: "Încărcare...", pgtext : "Pagina {0} din {1}" }, search : { caption: "Caută...", Find: "Caută", Reset: "Resetare", odata : ['egal', 'diferit', 'mai mic', 'mai mic sau egal','mai mare','mai mare sau egal', 'începe cu','nu începe cu','se găsește în','nu se găsește în','se termină cu','nu se termină cu','conține',''], groupOps: [ { op: "AND", text: "toate" }, { op: "OR", text: "oricare" } ], matchText: " găsite", rulesText: " reguli" }, edit : { addCaption: "Adăugare înregistrare", editCaption: "Modificare înregistrare", bSubmit: "Salvează", bCancel: "Anulare", bClose: "Închide", saveData: "Informațiile au fost modificate! Salvați modificările?", bYes : "Da", bNo : "Nu", bExit : "Anulare", msg: { required:"Câmpul este obligatoriu", number:"Vă rugăm introduceți un număr valid", minValue:"valoarea trebuie sa fie mai mare sau egală cu", maxValue:"valoarea trebuie sa fie mai mică sau egală cu", email: "nu este o adresă de e-mail validă", integer: "Vă rugăm introduceți un număr valid", date: "Vă rugăm să introduceți o dată validă", url: "Nu este un URL valid. Prefixul este necesar('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Vizualizare înregistrare", bClose: "Închidere" }, del : { caption: "Ștegere", msg: "Ștergeți înregistrarea (înregistrările) selectate?", bSubmit: "Șterge", bCancel: "Anulare" }, nav : { edittext: "", edittitle: "Modifică rândul selectat", addtext:"", addtitle: "Adaugă rând nou", deltext: "", deltitle: "Șterge rândul selectat", searchtext: "", searchtitle: "Căutare înregistrări", refreshtext: "", refreshtitle: "Reîncarcare Grid", alertcap: "Avertisment", alerttext: "Vă rugăm să selectați un rând", viewtext: "", viewtitle: "Vizualizează rândul selectat" }, col : { caption: "Arată/Ascunde coloanele", bSubmit: "Salvează", bCancel: "Anulare" }, errors : { errcap : "Eroare", nourl : "Niciun url nu este setat", norecords: "Nu sunt înregistrări de procesat", model : "Lungimea colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm", "Duminică", "Luni", "Marți", "Miercuri", "Joi", "Vineri", "Sâmbătă" ], monthNames: [ "Ian", "Feb", "Mar", "Apr", "Mai", "Iun", "Iul", "Aug", "Sep", "Oct", "Noi", "Dec", "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie" ], AmPm : ["am","pm","AM","PM"], /* Here is a problem in romanian: M / F 1st = primul / prima 2nd = Al doilea / A doua 3rd = Al treilea / A treia 4th = Al patrulea/ A patra 5th = Al cincilea / A cincea 6th = Al șaselea / A șasea 7th = Al șaptelea / A șaptea .... */ S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Greek (el) Translation * Alex Cicovic * http://www.alexcicovic.com * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "View {0} - {1} of {2}", emptyrecords: "No records to view", loadtext: "Φόρτωση...", pgtext : "Page {0} of {1}" }, search : { caption: "Αναζήτηση...", Find: "Εύρεση", Reset: "Επαναφορά", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Εισαγωγή Εγγραφής", editCaption: "Επεξεργασία Εγγραφής", bSubmit: "Καταχώρηση", bCancel: "Άκυρο", bClose: "Κλείσιμο", saveData: "Data has been changed! Save changes?", bYes : "Yes", bNo : "No", bExit : "Cancel", msg: { required:"Το πεδίο είναι απαραίτητο", number:"Το πεδίο δέχεται μόνο αριθμούς", minValue:"Η τιμή πρέπει να είναι μεγαλύτερη ή ίση του ", maxValue:"Η τιμή πρέπει να είναι μικρότερη ή ίση του ", email: "Η διεύθυνση e-mail δεν είναι έγκυρη", integer: "Το πεδίο δέχεται μόνο ακέραιους αριθμούς", url: "is not a valid URL. Prefix required ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "View Record", bClose: "Close" }, del : { caption: "Διαγραφή", msg: "Διαγραφή των επιλεγμένων εγγραφών;", bSubmit: "Ναι", bCancel: "Άκυρο" }, nav : { edittext: " ", edittitle: "Επεξεργασία επιλεγμένης εγγραφής", addtext:" ", addtitle: "Εισαγωγή νέας εγγραφής", deltext: " ", deltitle: "Διαγραφή επιλεγμένης εγγραφής", searchtext: " ", searchtitle: "Εύρεση Εγγραφών", refreshtext: "", refreshtitle: "Ανανέωση Πίνακα", alertcap: "Προσοχή", alerttext: "Δεν έχετε επιλέξει εγγραφή", viewtext: "", viewtitle: "View selected row" }, col : { caption: "Εμφάνιση / Απόκρυψη Στηλών", bSubmit: "ΟΚ", bCancel: "Άκυρο" }, errors : { errcap : "Σφάλμα", nourl : "Δεν έχει δοθεί διεύθυνση χειρισμού για τη συγκεκριμένη ενέργεια", norecords: "Δεν υπάρχουν εγγραφές προς επεξεργασία", model : "Άνισος αριθμός πεδίων colNames/colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ", "Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο" ], monthNames: [ "Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαι", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ", "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος" ], AmPm : ["πμ","μμ","ΠΜ","ΜΜ"], S: function (j) {return j == 1 || j > 1 ? ['η'][Math.min((j - 1) % 10, 3)] : ''}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Icelandic Translation * jtm@hi.is Univercity of Iceland * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "View {0} - {1} of {2}", emptyrecords: "No records to view", loadtext: "Hleður...", pgtext : "Page {0} of {1}" }, search : { caption: "Leita...", Find: "Leita", Reset: "Endursetja", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Add Record", editCaption: "Edit Record", bSubmit: "Vista", bCancel: "Hætta við", bClose: "Loka", saveData: "Data has been changed! Save changes?", bYes : "Yes", bNo : "No", bExit : "Cancel", msg: { required:"Reitur er nauðsynlegur", number:"Vinsamlega settu inn tölu", minValue:"gildi verður að vera meira en eða jafnt og ", maxValue:"gildi verður að vera minna en eða jafnt og ", email: "er ekki löglegt email", integer: "Vinsamlega settu inn tölu", date: "Please, enter valid date value", url: "is not a valid URL. Prefix required ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "View Record", bClose: "Close" }, del : { caption: "Eyða", msg: "Eyða völdum færslum ?", bSubmit: "Eyða", bCancel: "Hætta við" }, nav : { edittext: " ", edittitle: "Breyta færslu", addtext:" ", addtitle: "Ný færsla", deltext: " ", deltitle: "Eyða færslu", searchtext: " ", searchtitle: "Leita", refreshtext: "", refreshtitle: "Endurhlaða", alertcap: "Viðvörun", alerttext: "Vinsamlega veldu færslu", viewtext: "", viewtitle: "View selected row" }, col : { caption: "Sýna / fela dálka", bSubmit: "Vista", bCancel: "Hætta við" }, errors : { errcap : "Villa", nourl : "Vantar slóð", norecords: "Engar færslur valdar", model : "Length of colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Chinese Translation for v3.6 * waiting 2010.01.18 * http://waiting.javaeye.com/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * update 2010.05.04 * add double u3000 SPACE for search:odata to fix SEARCH box display err when narrow width from only use of eq/ne/cn/in/lt/gt operator under IE6/7 **/ $.jgrid = { defaults : { recordtext: "{0} - {1}\u3000共 {2} 条", // 共字前是全角空格 emptyrecords: "无数据显示", loadtext: "读取中...", pgtext : " {0} 共 {1} 页" }, search : { caption: "搜索...", Find: "查找", Reset: "重置", odata : ['等于\u3000\u3000', '不等\u3000\u3000', '小于\u3000\u3000', '小于等于','大于\u3000\u3000','大于等于', '开始于','不开始于','属于\u3000\u3000','不属于','结束于','不结束于','包含\u3000\u3000','不包含'], groupOps: [ { op: "AND", text: "所有" }, { op: "OR", text: "任一" } ], matchText: " 匹配", rulesText: " 规则" }, edit : { addCaption: "添加记录", editCaption: "编辑记录", bSubmit: "提交", bCancel: "取消", bClose: "关闭", saveData: "数据已改变,是否保存?", bYes : "是", bNo : "否", bExit : "取消", msg: { required:"此字段必需", number:"请输入有效数字", minValue:"输值必须大于等于 ", maxValue:"输值必须小于等于 ", email: "这不是有效的e-mail地址", integer: "请输入有效整数", date: "请输入有效时间", url: "无效网址。前缀必须为 ('http://' 或 'https://')", nodefined : " 未定义!", novalue : " 需要返回值!", customarray : "自定义函数需要返回数组!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "查看记录", bClose: "关闭" }, del : { caption: "删除", msg: "删除所选记录?", bSubmit: "删除", bCancel: "取消" }, nav : { edittext: "", edittitle: "编辑所选记录", addtext:"", addtitle: "添加新记录", deltext: "", deltitle: "删除所选记录", searchtext: "", searchtitle: "查找", refreshtext: "", refreshtitle: "刷新表格", alertcap: "注意", alerttext: "请选择记录", viewtext: "", viewtitle: "查看所选记录" }, col : { caption: "选择列", bSubmit: "确定", bCancel: "取消" }, errors : { errcap : "错误", nourl : "没有设置url", norecords: "没有要处理的记录", model : "colNames 和 colModel 长度不等!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'm-d-Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "Y/j/n", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Bulgarian Translation * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "{0} - {1} от {2}", emptyrecords: "Няма запис(и)", loadtext: "Зареждам...", pgtext : "Стр. {0} от {1}" }, search : { caption: "Търсене...", Find: "Намери", Reset: "Изчисти", odata : ['равно', 'различно', 'по-малко', 'по-малко или=','по-голямо','по-голямо или =', 'започва с','не започва с','се намира в','не се намира в','завършва с','не завършава с','съдържа', 'не съдържа' ], groupOps: [ { op: "AND", text: "&nbsp;И " }, { op: "OR", text: "ИЛИ" } ], matchText: " включи", rulesText: " клауза" }, edit : { addCaption: "Нов Запис", editCaption: "Редакция Запис", bSubmit: "Запиши", bCancel: "Изход", bClose: "Затвори", saveData: "Данните са променени! Да съхраня ли промените?", bYes : "Да", bNo : "Не", bExit : "Отказ", msg: { required:"Полето е задължително", number:"Въведете валидно число!", minValue:"стойността трябва да е по-голяма или равна от", maxValue:"стойността трябва да е по-малка или равна от", email: "не е валиден ел. адрес", integer: "Въведете валидно цяло число", date: "Въведете валидна дата", url: "e невалиден URL. Изискава се префикс('http://' или 'https://')", nodefined : " е недефинирана!", novalue : " изисква връщане на стойност!", customarray : "Потреб. Функция трябва да върне масив!", customfcheck : "Потребителска функция е задължителна при този тип елемент!" } }, view : { caption: "Преглед запис", bClose: "Затвори" }, del : { caption: "Изтриване", msg: "Да изтрия ли избраният запис?", bSubmit: "Изтрий", bCancel: "Отказ" }, nav : { edittext: " ", edittitle: "Редакция избран запис", addtext:" ", addtitle: "Добавяне нов запис", deltext: " ", deltitle: "Изтриване избран запис", searchtext: " ", searchtitle: "Търсене запис(и)", refreshtext: "", refreshtitle: "Обнови таблица", alertcap: "Предупреждение", alerttext: "Моля, изберете запис", viewtext: "", viewtitle: "Преглед избран запис" }, col : { caption: "Избери колони", bSubmit: "Ок", bCancel: "Изход" }, errors : { errcap : "Грешка", nourl : "Няма посочен url адрес", norecords: "Няма запис за обработка", model : "Модела не съответства на имената!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:" лв.", defaultValue: '0.00'}, date : { dayNames: [ "Нед", "Пон", "Вт", "Ср", "Чет", "Пет", "Съб", "Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота" ], monthNames: [ "Яну", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Нов", "Дек", "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември" ], AmPm : ["","","",""], S: function (j) { if(j==7 || j==8 || j== 27 || j== 28) { return 'ми'; } return ['ви', 'ри', 'ти'][Math.min((j - 1) % 10, 2)]; }, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Japanese Translation * OKADA Yoshitada okada.dev@sth.jp * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "{2} \u4EF6\u4E2D {0} - {1} \u3092\u8868\u793A ", emptyrecords: "\u8868\u793A\u3059\u308B\u30EC\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093", loadtext: "\u8aad\u307f\u8fbc\u307f\u4e2d...", pgtext : "{1} \u30DA\u30FC\u30B8\u4E2D {0} \u30DA\u30FC\u30B8\u76EE " }, search : { caption: "\u691c\u7d22...", Find: "\u691c\u7d22", Reset: "\u30ea\u30bb\u30c3\u30c8", odata: ["\u6B21\u306B\u7B49\u3057\u3044", "\u6B21\u306B\u7B49\u3057\u304F\u306A\u3044", "\u6B21\u3088\u308A\u5C0F\u3055\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5C0F\u3055\u3044", "\u6B21\u3088\u308A\u5927\u304D\u3044", "\u6B21\u306B\u7B49\u3057\u3044\u304B\u5927\u304D\u3044", "\u6B21\u3067\u59CB\u307E\u308B", "\u6B21\u3067\u59CB\u307E\u3089\u306A\u3044", "\u6B21\u306B\u542B\u307E\u308C\u308B", "\u6B21\u306B\u542B\u307E\u308C\u306A\u3044", "\u6B21\u3067\u7D42\u308F\u308B", "\u6B21\u3067\u7D42\u308F\u3089\u306A\u3044", "\u6B21\u3092\u542B\u3080", "\u6B21\u3092\u542B\u307E\u306A\u3044"], groupOps: [{ op: "AND", text: "\u3059\u3079\u3066\u306E" }, { op: "OR", text: "\u3044\u305A\u308C\u304B\u306E" }], matchText: " \u6B21\u306E", rulesText: " \u6761\u4EF6\u3092\u6E80\u305F\u3059" }, edit : { addCaption: "\u30ec\u30b3\u30fc\u30c9\u8ffd\u52a0", editCaption: "\u30ec\u30b3\u30fc\u30c9\u7de8\u96c6", bSubmit: "\u9001\u4fe1", bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb", bClose: "\u9589\u3058\u308b", saveData: "\u30C7\u30FC\u30BF\u304C\u5909\u66F4\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u4FDD\u5B58\u3057\u307E\u3059\u304B\uFF1F", bYes: "\u306F\u3044", bNo: "\u3044\u3044\u3048", bExit: "\u30AD\u30E3\u30F3\u30BB\u30EB", msg: { required:"\u3053\u306e\u9805\u76ee\u306f\u5fc5\u9808\u3067\u3059\u3002", number:"\u6b63\u3057\u3044\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", minValue:"\u6b21\u306e\u5024\u4ee5\u4e0a\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", maxValue:"\u6b21\u306e\u5024\u4ee5\u4e0b\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", email: "e-mail\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002", integer: "\u6b63\u3057\u3044\u6574\u6570\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", date: "\u6b63\u3057\u3044\u5024\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002", url: "\u306F\u6709\u52B9\u306AURL\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\20\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u304C\u5FC5\u8981\u3067\u3059\u3002 ('http://' \u307E\u305F\u306F 'https://')", nodefined: " \u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093", novalue: " \u623B\u308A\u5024\u304C\u5FC5\u8981\u3067\u3059", customarray: "\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u306F\u914D\u5217\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059", customfcheck: "\u30AB\u30B9\u30BF\u30E0\u691C\u8A3C\u306B\u306F\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u304C\u5FC5\u8981\u3067\u3059" } }, view : { caption: "\u30EC\u30B3\u30FC\u30C9\u3092\u8868\u793A", bClose: "\u9589\u3058\u308B" }, del : { caption: "\u524a\u9664", msg: "\u9078\u629e\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u3092\u524a\u9664\u3057\u307e\u3059\u304b\uff1f", bSubmit: "\u524a\u9664", bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb" }, nav : { edittext: " ", edittitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u7de8\u96c6", addtext:" ", addtitle: "\u884c\u3092\u65b0\u898f\u8ffd\u52a0", deltext: " ", deltitle: "\u9078\u629e\u3057\u305f\u884c\u3092\u524a\u9664", searchtext: " ", searchtitle: "\u30ec\u30b3\u30fc\u30c9\u691c\u7d22", refreshtext: "", refreshtitle: "\u30b0\u30ea\u30c3\u30c9\u3092\u30ea\u30ed\u30fc\u30c9", alertcap: "\u8b66\u544a", alerttext: "\u884c\u3092\u9078\u629e\u3057\u3066\u4e0b\u3055\u3044\u3002", viewtext: "", viewtitle: "\u9078\u629E\u3057\u305F\u884C\u3092\u8868\u793A" }, col : { caption: "\u5217\u3092\u8868\u793a\uff0f\u96a0\u3059", bSubmit: "\u9001\u4fe1", bCancel: "\u30ad\u30e3\u30f3\u30bb\u30eb" }, errors : { errcap : "\u30a8\u30e9\u30fc", nourl : "URL\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002", norecords: "\u51e6\u7406\u5bfe\u8c61\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u305b\u3093\u3002", model : "colNames\u306e\u9577\u3055\u304ccolModel\u3068\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002" }, formatter : { integer: { thousandsSeparator: ",", defaultValue: '0' }, number: { decimalSeparator: ".", thousandsSeparator: ",", decimalPlaces: 2, defaultValue: '0.00' }, currency: { decimalSeparator: ".", thousandsSeparator: ",", decimalPlaces: 0, prefix: "", suffix: "", defaultValue: '0' }, date : { dayNames: [ "\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f", "\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f" ], monthNames: [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708" ], AmPm : ["am","pm","AM","PM"], S: "\u756a\u76ee", srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid (fi) Finnish Translation * Jukka Inkeri awot.fi 2010-05-19 Version * http://awot.fi * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { //recordtext: "N&auml;yt&auml; {0} - {1} / {2}", recordtext: " {0}-{1}/{2}", emptyrecords: "Ei n&auml;ytett&auml;vi&auml;", loadtext: "Haetaan...", //pgtext : "Sivu {0} / {1}" pgtext : "{0}/{1}" }, search : { caption: "Etsi...", Find: "Etsi", Reset: "Tyhj&auml;&auml;", odata : ['=', '<>', '<', '<=','>','>=', 'alkaa','ei ala','joukossa','ei joukossa ','loppuu','ei lopu','sis&auml;lt&auml;&auml;','ei sis&auml;ll&auml;'], groupOps: [ { op: "JA", text: "kaikki" }, { op: "TAI", text: "mik&auml; tahansa" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Uusi rivi", editCaption: "Muokkaa rivi", bSubmit: "OK", bCancel: "Peru", bClose: "Sulje", saveData: "Tietoja muutettu! Tallenetaanko?", bYes : "K", bNo : "E", bExit : "Peru", msg: { required:"pakollinen", number:"Anna kelvollinen nro", minValue:"arvo oltava >= ", maxValue:"arvo oltava <= ", email: "virheellinen sposti ", integer: "Anna kelvollinen kokonaisluku", date: "Anna kelvollinen pvm", url: "Ei ole sopiva linkki(URL). Alku oltava ('http://' tai 'https://')", nodefined : " ei ole m&auml;&auml;ritelty!", novalue : " paluuarvo vaaditaan!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "N&auml; rivi", bClose: "Sulje" }, del : { caption: "Poista", msg: "Poista valitut rivi(t)?", bSubmit: "Poista", bCancel: "Peru" }, nav : { edittext: " ", edittitle: "Muokkaa valittu rivi", addtext:" ", addtitle: "Uusi rivi", deltext: " ", deltitle: "Poista valittu rivi", searchtext: " ", searchtitle: "Etsi tietoja", refreshtext: "", refreshtitle: "Lataa uudelleen", alertcap: "Varoitus", alerttext: "Valitse rivi", viewtext: "", viewtitle: "Nayta valitut rivit" }, col : { caption: "Nayta/Piilota sarakkeet", bSubmit: "OK", bCancel: "Peru" }, errors : { errcap : "Virhe", nourl : "url asettamatta", norecords: "Ei muokattavia tietoja", model : "Pituus colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: "", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: "", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Su", "Ma", "Ti", "Ke", "To", "Pe", "La", "Sunnuntai", "Maanantai", "Tiista", "Keskiviikko", "Torstai", "Perjantai", "Lauantai" ], monthNames: [ "Tam", "Hel", "Maa", "Huh", "Tou", "Kes", "Hei", "Elo", "Syy", "Lok", "Mar", "Jou", "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kes&auml;kuu", "Hein&auml;kuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "d.m.Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; // FI })(jQuery);
JavaScript
;(function($){ /** * jqGrid Galician Translation * Translated by Jorge Barreiro <yortx.barry@gmail.com> * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Amosando {0} - {1} de {2}", emptyrecords: "Sen rexistros que amosar", loadtext: "Cargando...", pgtext : "Páxina {0} de {1}" }, search : { caption: "Búsqueda...", Find: "Buscar", Reset: "Limpar", odata : ['igual ', 'diferente a', 'menor que', 'menor ou igual que','maior que','maior ou igual a', 'empece por','non empece por','está en','non está en','termina por','non termina por','contén','non contén'], groupOps: [ { op: "AND", text: "todo" }, { op: "OR", text: "calquera" } ], matchText: " match", rulesText: " regras" }, edit : { addCaption: "Engadir rexistro", editCaption: "Modificar rexistro", bSubmit: "Gardar", bCancel: "Cancelar", bClose: "Pechar", saveData: "Modificáronse os datos, quere gardar os cambios?", bYes : "Si", bNo : "Non", bExit : "Cancelar", msg: { required:"Campo obrigatorio", number:"Introduza un número", minValue:"O valor debe ser maior ou igual a ", maxValue:"O valor debe ser menor ou igual a ", email: "non é un enderezo de correo válido", integer: "Introduza un valor enteiro", date: "Introduza unha data correcta ", url: "non é unha URL válida. Prefixo requerido ('http://' ou 'https://')", nodefined : " non está definido.", novalue : " o valor de retorno é obrigatorio.", customarray : "A función persoalizada debe devolver un array.", customfcheck : "A función persoalizada debe estar presente no caso de ter validación persoalizada." } }, view : { caption: "Consultar rexistro", bClose: "Pechar" }, del : { caption: "Eliminar", msg: "Desexa eliminar os rexistros seleccionados?", bSubmit: "Eliminar", bCancel: "Cancelar" }, nav : { edittext: " ", edittitle: "Modificar a fila seleccionada", addtext:" ", addtitle: "Engadir unha nova fila", deltext: " ", deltitle: "Eliminar a fila seleccionada", searchtext: " ", searchtitle: "Buscar información", refreshtext: "", refreshtitle: "Recargar datos", alertcap: "Aviso", alerttext: "Seleccione unha fila", viewtext: "", viewtitle: "Ver fila seleccionada" }, col : { caption: "Mostrar/ocultar columnas", bSubmit: "Enviar", bCancel: "Cancelar" }, errors : { errcap : "Erro", nourl : "Non especificou unha URL", norecords: "Non hai datos para procesar", model : "As columnas de nomes son diferentes das columnas de modelo" }, formatter : { integer : {thousandsSeparator: ".", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Do", "Lu", "Ma", "Me", "Xo", "Ve", "Sa", "Domingo", "Luns", "Martes", "Mércoles", "Xoves", "Vernes", "Sábado" ], monthNames: [ "Xan", "Feb", "Mar", "Abr", "Mai", "Xuñ", "Xul", "Ago", "Set", "Out", "Nov", "Dec", "Xaneiro", "Febreiro", "Marzo", "Abril", "Maio", "Xuño", "Xullo", "Agosto", "Setembro", "Outubro", "Novembro", "Decembro" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd-m-Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Serbian Translation * Александар Миловац(Aleksandar Milovac) aleksandar.milovac@gmail.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Преглед {0} - {1} од {2}", emptyrecords: "Не постоји ниједан запис", loadtext: "Учитавање...", pgtext : "Страна {0} од {1}" }, search : { caption: "Тражење...", Find: "Тражи", Reset: "Ресетуј", odata : ['једнако', 'није једнако', 'мање', 'мање или једнако','веће','веће или једнако', 'почиње са','не почиње са','је у','није у','завршава са','не завршава са','садржи','не садржи'], groupOps: [ { op: "И", text: "сви" }, { op: "ИЛИ", text: "сваки" } ], matchText: " match", rulesText: " правила" }, edit : { addCaption: "Додај запис", editCaption: "Измени запис", bSubmit: "Пошаљи", bCancel: "Одустани", bClose: "Затвори", saveData: "Податак је измењен! Сачувај измене?", bYes : "Да", bNo : "Не", bExit : "Одустани", msg: { required:"Поље је обавезно", number:"Молим, унесите исправан број", minValue:"вредност мора бити већа од или једнака са ", maxValue:"вредност мора бити мања од или једнака са", email: "није исправна имејл адреса", integer: "Молим, унесите исправну целобројну вредност ", date: "Молим, унесите исправан датум", url: "није исправан УРЛ. Потребан је префикс ('http://' or 'https://')", nodefined : " није дефинисан!", novalue : " захтевана је повратна вредност!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Погледај запис", bClose: "Затвори" }, del : { caption: "Избриши", msg: "Избриши изабран(е) запис(е)?", bSubmit: "Ибриши", bCancel: "Одбаци" }, nav : { edittext: "", edittitle: "Измени изабрани ред", addtext:"", addtitle: "Додај нови ред", deltext: "", deltitle: "Избриши изабран ред", searchtext: "", searchtitle: "Нађи записе", refreshtext: "", refreshtitle: "Поново учитај податке", alertcap: "Упозорење", alerttext: "Молим, изаберите ред", viewtext: "", viewtitle: "Погледај изабрани ред" }, col : { caption: "Изабери колоне", bSubmit: "ОК", bCancel: "Одбаци" }, errors : { errcap : "Грешка", nourl : "Није постављен URL", norecords: "Нема записа за обраду", model : "Дужина модела colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Нед", "Пон", "Уто", "Сре", "Чет", "Пет", "Суб", "Недеља", "Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота" ], monthNames: [ "Јан", "Феб", "Мар", "Апр", "Мај", "Јун", "Јул", "Авг", "Сеп", "Окт", "Нов", "Дец", "Јануар", "Фебруар", "Март", "Април", "Мај", "Јун", "Јул", "Август", "Септембар", "Октобар", "Новембар", "Децембар" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid French Translation * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Enregistrements {0} - {1} sur {2}", emptyrecords: "Aucun enregistrement à afficher", loadtext: "Chargement...", pgtext : "Page {0} sur {1}" }, search : { caption: "Recherche...", Find: "Chercher", Reset: "Annuler", odata : ['égal', 'différent', 'inférieur', 'inférieur ou égal','supérieur','supérieur ou égal', 'commence par','ne commence pas par','est dans',"n'est pas dans",'finit par','ne finit pas par','contient','ne contient pas'], groupOps: [ { op: "AND", text: "tous" }, { op: "OR", text: "aucun" } ], matchText: " correspondance", rulesText: " règles" }, edit : { addCaption: "Ajouter", editCaption: "Editer", bSubmit: "Valider", bCancel: "Annuler", bClose: "Fermer", saveData: "Les données ont changé ! Enregistrer les modifications ?", bYes: "Oui", bNo: "Non", bExit: "Annuler", msg: { required: "Champ obligatoire", number: "Saisissez un nombre correct", minValue: "La valeur doit être supérieure ou égale à", maxValue: "La valeur doit être inférieure ou égale à", email: "n'est pas un email correct", integer: "Saisissez un entier correct", url: "n'est pas une adresse correcte. Préfixe requis ('http://' or 'https://')", nodefined : " n'est pas défini!", novalue : " la valeur de retour est requise!", customarray : "Une fonction personnalisée devrait retourner un tableau (array)!", customfcheck : "Une fonction personnalisée devrait être présente dans le cas d'une vérification personnalisée!" } }, view : { caption: "Voir les enregistrement", bClose: "Fermer" }, del : { caption: "Supprimer", msg: "Supprimer les enregistrements sélectionnés ?", bSubmit: "Supprimer", bCancel: "Annuler" }, nav : { edittext: " ", edittitle: "Editer la ligne sélectionnée", addtext:" ", addtitle: "Ajouter une ligne", deltext: " ", deltitle: "Supprimer la ligne sélectionnée", searchtext: " ", searchtitle: "Chercher un enregistrement", refreshtext: "", refreshtitle: "Recharger le tableau", alertcap: "Avertissement", alerttext: "Veuillez sélectionner une ligne", viewtext: "", viewtitle: "Afficher la ligne sélectionnée" }, col : { caption: "Afficher/Masquer les colonnes", bSubmit: "Valider", bCancel: "Annuler" }, errors : { errcap : "Erreur", nourl : "Aucune adresse n'est paramétrée", norecords: "Aucun enregistrement à traiter", model : "Nombre de titres (colNames) <> Nombre de données (colModel)!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi" ], monthNames: [ "Jan", "Fév", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Déc", "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Décembre" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j == 1 ? 'er' : 'e';}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Czech Translation * Pavel Jirak pavel.jirak@jipas.cz * doplnil Thomas Wagner xwagne01@stud.fit.vutbr.cz * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Zobrazeno {0} - {1} z {2} záznamů", emptyrecords: "Nenalezeny žádné záznamy", loadtext: "Načítám...", pgtext : "Strana {0} z {1}" }, search : { caption: "Vyhledávám...", Find: "Hledat", Reset: "Reset", odata : ['rovno', 'nerovono', 'menší', 'menší nebo rovno','větší', 'větší nebo rovno', 'začíná s', 'nezačíná s', 'je v', 'není v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'], groupOps: [ { op: "AND", text: "všech" }, { op: "OR", text: "některého z" } ], matchText: " hledat podle", rulesText: " pravidel" }, edit : { addCaption: "Přidat záznam", editCaption: "Editace záznamu", bSubmit: "Uložit", bCancel: "Storno", bClose: "Zavřít", saveData: "Data byla změněna! Uložit změny?", bYes : "Ano", bNo : "Ne", bExit : "Zrušit", msg: { required:"Pole je vyžadováno", number:"Prosím, vložte validní číslo", minValue:"hodnota musí být větší než nebo rovná ", maxValue:"hodnota musí být menší než nebo rovná ", email: "není validní e-mail", integer: "Prosím, vložte celé číslo", date: "Prosím, vložte validní datum", url: "není platnou URL. Vyžadován prefix ('http://' or 'https://')", nodefined : " není definován!", novalue : " je vyžadována návratová hodnota!", customarray : "Custom function mělá vrátit pole!", customfcheck : "Custom function by měla být přítomna v případě custom checking!" } }, view : { caption: "Zobrazit záznam", bClose: "Zavřít" }, del : { caption: "Smazat", msg: "Smazat vybraný(é) záznam(y)?", bSubmit: "Smazat", bCancel: "Storno" }, nav : { edittext: " ", edittitle: "Editovat vybraný řádek", addtext:" ", addtitle: "Přidat nový řádek", deltext: " ", deltitle: "Smazat vybraný záznam ", searchtext: " ", searchtitle: "Najít záznamy", refreshtext: "", refreshtitle: "Obnovit tabulku", alertcap: "Varování", alerttext: "Prosím, vyberte řádek", viewtext: "", viewtitle: "Zobrazit vybraný řádek" }, col : { caption: "Zobrazit/Skrýt sloupce", bSubmit: "Uložit", bCancel: "Storno" }, errors : { errcap : "Chyba", nourl : "Není nastavena url", norecords: "Žádné záznamy ke zpracování", model : "Délka colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Ne", "Po", "Út", "St", "Čt", "Pá", "So", "Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota" ], monthNames: [ "Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čvc", "Srp", "Zář", "Říj", "Lis", "Pro", "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec" ], AmPm : ["do","od","DO","OD"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid English Translation * Tony Tomov tony@trirand.com * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "View {0} - {1} of {2}", emptyrecords: "No records to view", loadtext: "Loading...", pgtext : "Page {0} of {1}" }, search : { caption: "Search...", Find: "Find", Reset: "Reset", odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Add Record", editCaption: "Edit Record", bSubmit: "Submit", bCancel: "Cancel", bClose: "Close", saveData: "Data has been changed! Save changes?", bYes : "Yes", bNo : "No", bExit : "Cancel", msg: { required:"Field is required", number:"Please, enter valid number", minValue:"value must be greater than or equal to ", maxValue:"value must be less than or equal to", email: "is not a valid e-mail", integer: "Please, enter valid integer value", date: "Please, enter valid date value", url: "is not a valid URL. Prefix required ('http://' or 'https://')", nodefined : " is not defined!", novalue : " return value is required!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "View Record", bClose: "Close" }, del : { caption: "Delete", msg: "Delete selected record(s)?", bSubmit: "Delete", bCancel: "Cancel" }, nav : { edittext: "", edittitle: "Edit selected row", addtext:"", addtitle: "Add new row", deltext: "", deltitle: "Delete selected row", searchtext: "", searchtitle: "Find records", refreshtext: "", refreshtitle: "Reload Grid", alertcap: "Warning", alerttext: "Please, select row", viewtext: "", viewtitle: "View selected row" }, col : { caption: "Select columns", bSubmit: "Ok", bCancel: "Cancel" }, errors : { errcap : "Error", nourl : "No url is set", norecords: "No records to process", model : "Length of colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Hungarian Translation * Őrszigety Ádám udx6bs@freemail.hu * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Oldal {0} - {1} / {2}", emptyrecords: "Nincs találat", loadtext: "Betöltés...", pgtext : "Oldal {0} / {1}" }, search : { caption: "Keresés...", Find: "Keres", Reset: "Alapértelmezett", odata : ['egyenlő', 'nem egyenlő', 'kevesebb', 'kevesebb vagy egyenlő','nagyobb','nagyobb vagy egyenlő', 'ezzel kezdődik','nem ezzel kezdődik','tartalmaz','nem tartalmaz','végződik','nem végződik','tartalmaz','nem tartalmaz'], groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Új tétel", editCaption: "Tétel szerkesztése", bSubmit: "Mentés", bCancel: "Mégse", bClose: "Bezárás", saveData: "A tétel megváltozott! Tétel mentése?", bYes : "Igen", bNo : "Nem", bExit : "Mégse", msg: { required:"Kötelező mező", number:"Kérjük, adjon meg egy helyes számot", minValue:"Nagyobb vagy egyenlőnek kell lenni mint ", maxValue:"Kisebb vagy egyenlőnek kell lennie mint", email: "hibás emailcím", integer: "Kérjük adjon meg egy helyes egész számot", date: "Kérjük adjon meg egy helyes dátumot", url: "nem helyes cím. Előtag kötelező ('http://' vagy 'https://')", nodefined : " nem definiált!", novalue : " visszatérési érték kötelező!!", customarray : "Custom function should return array!", customfcheck : "Custom function should be present in case of custom checking!" } }, view : { caption: "Tétel megtekintése", bClose: "Bezárás" }, del : { caption: "Törlés", msg: "Kiválaztott tétel(ek) törlése?", bSubmit: "Törlés", bCancel: "Mégse" }, nav : { edittext: "", edittitle: "Tétel szerkesztése", addtext:"", addtitle: "Új tétel hozzáadása", deltext: "", deltitle: "Tétel törlése", searchtext: "", searchtitle: "Keresés", refreshtext: "", refreshtitle: "Frissítés", alertcap: "Figyelmeztetés", alerttext: "Kérem válasszon tételt.", viewtext: "", viewtitle: "Tétel megtekintése" }, col : { caption: "Oszlopok kiválasztása", bSubmit: "Ok", bCancel: "Mégse" }, errors : { errcap : "Hiba", nourl : "Nincs URL beállítva", norecords: "Nincs feldolgozásra váró tétel", model : "colNames és colModel hossza nem egyenlő!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'}, date : { dayNames: [ "Va", "Hé", "Ke", "Sze", "Csü", "Pé", "Szo", "Vasárnap", "Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat" ], monthNames: [ "Jan", "Feb", "Már", "Ápr", "Máj", "Jún", "Júl", "Aug", "Szep", "Okt", "Nov", "Dec", "Január", "Február", "Március", "Áprili", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" ], AmPm : ["de","du","DE","DU"], S: function (j) {return '.-ik';}, srcformat: 'Y-m-d', newformat: 'Y/m/d', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "Y/j/n", LongDate: "Y. F hó d., l", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "a g:i", LongTime: "a g:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "Y, F" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
;(function($){ /** * jqGrid Slovak Translation * Milan Cibulka * http://trirand.com/blog/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Zobrazených {0} - {1} z {2} záznamov", emptyrecords: "Neboli nájdené žiadne záznamy", loadtext: "Načítám...", pgtext : "Strana {0} z {1}" }, search : { caption: "Vyhľadávam...", Find: "Hľadať", Reset: "Reset", odata : ['rovná sa', 'nerovná sa', 'menšie', 'menšie alebo rovnajúce sa','väčšie', 'väčšie alebo rovnajúce sa', 'začína s', 'nezačína s', 'je v', 'nie je v', 'končí s', 'nekončí s', 'obahuje', 'neobsahuje'], groupOps: [ { op: "AND", text: "všetkých" }, { op: "OR", text: "niektorého z" } ], matchText: " hľadať podla", rulesText: " pravidiel" }, edit : { addCaption: "Pridať záznam", editCaption: "Editácia záznamov", bSubmit: "Uložiť", bCancel: "Storno", bClose: "Zavrieť", saveData: "Údaje boli zmenené! Uložiť zmeny?", bYes : "Ano", bNo : "Nie", bExit : "Zrušiť", msg: { required:"Pole je požadované", number:"Prosím, vložte valídne číslo", minValue:"hodnota musí býť väčšia ako alebo rovná ", maxValue:"hodnota musí býť menšia ako alebo rovná ", email: "nie je valídny e-mail", integer: "Prosím, vložte celé číslo", date: "Prosím, vložte valídny dátum", url: "nie je platnou URL. Požadovaný prefix ('http://' alebo 'https://')", nodefined : " nie je definovaný!", novalue : " je vyžadovaná návratová hodnota!", customarray : "Custom function mala vrátiť pole!", customfcheck : "Custom function by mala byť prítomná v prípade custom checking!" } }, view : { caption: "Zobraziť záznam", bClose: "Zavrieť" }, del : { caption: "Zmazať", msg: "Zmazať vybraný(é) záznam(y)?", bSubmit: "Zmazať", bCancel: "Storno" }, nav : { edittext: " ", edittitle: "Editovať vybraný riadok", addtext:" ", addtitle: "Pridať nový riadek", deltext: " ", deltitle: "Zmazať vybraný záznam ", searchtext: " ", searchtitle: "Nájsť záznamy", refreshtext: "", refreshtitle: "Obnoviť tabuľku", alertcap: "Varovanie", alerttext: "Prosím, vyberte riadok", viewtext: "", viewtitle: "Zobraziť vybraný riadok" }, col : { caption: "Zobrazit/Skrýť stĺpce", bSubmit: "Uložiť", bCancel: "Storno" }, errors : { errcap : "Chyba", nourl : "Nie je nastavená url", norecords: "Žiadne záznamy k spracovaniu", model : "Dĺžka colNames <> colModel!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}, currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'}, date : { dayNames: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So", "Nedela", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatek", "Sobota" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec", "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December" ], AmPm : ["do","od","DO","OD"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd/m/Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "n/j/Y", LongDate: "l, F d, Y", FullDateTime: "l, F d, Y g:i:s A", MonthDay: "F d", ShortTime: "g:i A", LongTime: "g:i:s A", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F, Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
/*! * jQuery JavaScript Library v1.5 * http://jquery.com/ * * Copyright 2011, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * * Date: Mon Jan 31 08:31:29 2011 -0500 */ (function( window, undefined ) { // Use the correct document accordingly with window argument (sandbox) var document = window.document; var jQuery = (function() { // Define a local copy of jQuery var jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, rootjQuery ); }, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, // A central reference to the root jQuery(document) rootjQuery, // A simple way to check for HTML strings or ID strings // (both of which we optimize for) quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, // Check if a string has a non-whitespace character in it rnotwhite = /\S/, // Used for trimming whitespace trimLeft = /^\s+/, trimRight = /\s+$/, // Check for digits rdigit = /\d/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, // Useragent RegExp rwebkit = /(webkit)[ \/]([\w.]+)/, ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, rmsie = /(msie) ([\w.]+)/, rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, // Keep a UserAgent string for use with jQuery.browser userAgent = navigator.userAgent, // For matching the engine and version of the browser browserMatch, // Has the ready events already been bound? readyBound = false, // The deferred used on DOM ready readyList, // Promise methods promiseMethods = "then done fail isResolved isRejected promise".split( " " ), // The ready event handler DOMContentLoaded, // Save a reference to some core methods toString = Object.prototype.toString, hasOwn = Object.prototype.hasOwnProperty, push = Array.prototype.push, slice = Array.prototype.slice, trim = String.prototype.trim, indexOf = Array.prototype.indexOf, // [[Class]] -> type pairs class2type = {}; jQuery.fn = jQuery.prototype = { constructor: jQuery, init: function( selector, context, rootjQuery ) { var match, elem, ret, doc; // Handle $(""), $(null), or $(undefined) if ( !selector ) { return this; } // Handle $(DOMElement) if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; } // The body element only exists once, optimize finding it if ( selector === "body" && !context && document.body ) { this.context = document; this[0] = document.body; this.selector = "body"; this.length = 1; return this; } // Handle HTML strings if ( typeof selector === "string" ) { // Are we dealing with HTML string or an ID? match = quickExpr.exec( selector ); // Verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; doc = (context ? context.ownerDocument || context : document); // If a single string is passed in and it's a single tag // just do a createElement and skip the rest ret = rsingleTag.exec( selector ); if ( ret ) { if ( jQuery.isPlainObject( context ) ) { selector = [ document.createElement( ret[1] ) ]; jQuery.fn.attr.call( selector, context, true ); } else { selector = [ doc.createElement( ret[1] ) ]; } } else { ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; } return jQuery.merge( this, selector ); // HANDLE: $("#id") } else { elem = document.getElementById( match[2] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return (context || rootjQuery).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } if (selector.selector !== undefined) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.5", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function() { return this.length; }, toArray: function() { return slice.call( this, 0 ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = this.constructor(); if ( jQuery.isArray( elems ) ) { push.apply( ret, elems ); } else { jQuery.merge( ret, elems ); } // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) { ret.selector = this.selector + (this.selector ? " " : "") + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, ready: function( fn ) { // Attach the listeners jQuery.bindReady(); // Add the callback readyList.done( fn ); return this; }, eq: function( i ) { return i === -1 ? this.slice( i ) : this.slice( i, +i + 1 ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, slice: function() { return this.pushStack( slice.apply( this, arguments ), "slice", slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function( deep ) { window.$ = _$; if ( deep ) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Handle when the DOM is ready ready: function( wait ) { // A third-party is pushing the ready event forwards if ( wait === true ) { jQuery.readyWait--; } // Make sure that the DOM is not already loaded if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { jQuery( document ).trigger( "ready" ).unbind( "ready" ); } } }, bindReady: function() { if ( readyBound ) { return; } readyBound = true; // Catch cases where $(document).ready() is called after the // browser event has already occurred. if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready return setTimeout( jQuery.ready, 1 ); } // Mozilla, Opera and webkit nightlies currently support this event if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", jQuery.ready, false ); // If IE event model is used } else if ( document.attachEvent ) { // ensure firing before onload, // maybe late but safe also for iframes document.attachEvent("onreadystatechange", DOMContentLoaded); // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); // If IE and not a frame // continually check to see if the document is ready var toplevel = false; try { toplevel = window.frameElement == null; } catch(e) {} if ( document.documentElement.doScroll && toplevel ) { doScrollCheck(); } } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, // A crude way of determining if an object is a window isWindow: function( obj ) { return obj && typeof obj === "object" && "setInterval" in obj; }, isNaN: function( obj ) { return obj == null || !rdigit.test( obj ) || isNaN( obj ); }, type: function( obj ) { return obj == null ? String( obj ) : class2type[ toString.call(obj) ] || "object"; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } // Not own constructor property must be Object if ( obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { for ( var name in obj ) { return false; } return true; }, error: function( msg ) { throw msg; }, parseJSON: function( data ) { if ( typeof data !== "string" || !data ) { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( rvalidchars.test(data.replace(rvalidescape, "@") .replace(rvalidtokens, "]") .replace(rvalidbraces, "")) ) { // Try to use the native JSON parser first return window.JSON && window.JSON.parse ? window.JSON.parse( data ) : (new Function("return " + data))(); } else { jQuery.error( "Invalid JSON: " + data ); } }, // Cross-browser xml parsing // (xml & tmp used internally) parseXML: function( data , xml , tmp ) { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data , "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } tmp = xml.documentElement; if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) { jQuery.error( "Invalid XML: " + data ); } return xml; }, noop: function() {}, // Evalulates a script in a global context globalEval: function( data ) { if ( data && rnotwhite.test(data) ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); script.type = "text/javascript"; if ( jQuery.support.scriptEval() ) { script.appendChild( document.createTextNode( data ) ); } else { script.text = data; } // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709). head.insertBefore( script, head.firstChild ); head.removeChild( script ); } }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); }, // args is for internal usage only each: function( object, callback, args ) { var name, i = 0, length = object.length, isObj = length === undefined || jQuery.isFunction(object); if ( args ) { if ( isObj ) { for ( name in object ) { if ( callback.apply( object[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( object[ i++ ], args ) === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isObj ) { for ( name in object ) { if ( callback.call( object[ name ], name, object[ name ] ) === false ) { break; } } } else { for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} } } return object; }, // Use native String.trim function wherever possible trim: trim ? function( text ) { return text == null ? "" : trim.call( text ); } : // Otherwise use our own trimming functionality function( text ) { return text == null ? "" : text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); }, // results is for internal usage only makeArray: function( array, results ) { var ret = results || []; if ( array != null ) { // The window, strings (and functions) also have 'length' // The extra typeof function check is to prevent crashes // in Safari 2 (See: #3039) // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 var type = jQuery.type(array); if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { push.call( ret, array ); } else { jQuery.merge( ret, array ); } } return ret; }, inArray: function( elem, array ) { if ( array.indexOf ) { return array.indexOf( elem ); } for ( var i = 0, length = array.length; i < length; i++ ) { if ( array[ i ] === elem ) { return i; } } return -1; }, merge: function( first, second ) { var i = first.length, j = 0; if ( typeof second.length === "number" ) { for ( var l = second.length; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var ret = [], retVal; inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( var i = 0, length = elems.length; i < length; i++ ) { retVal = !!callback( elems[ i ], i ); if ( inv !== retVal ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var ret = [], value; // Go through the array, translating each of the items to their // new value (or values). for ( var i = 0, length = elems.length; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // Flatten any nested arrays return ret.concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, proxy: function( fn, proxy, thisObject ) { if ( arguments.length === 2 ) { if ( typeof proxy === "string" ) { thisObject = fn; fn = thisObject[ proxy ]; proxy = undefined; } else if ( proxy && !jQuery.isFunction( proxy ) ) { thisObject = proxy; proxy = undefined; } } if ( !proxy && fn ) { proxy = function() { return fn.apply( thisObject || this, arguments ); }; } // Set the guid of unique handler to the same of original handler, so it can be removed if ( fn ) { proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; } // So proxy can be declared as an argument return proxy; }, // Mutifunctional method to get and set values to a collection // The value/s can be optionally by executed if its a function access: function( elems, key, value, exec, fn, pass ) { var length = elems.length; // Setting many attributes if ( typeof key === "object" ) { for ( var k in key ) { jQuery.access( elems, k, key[k], exec, fn, value ); } return elems; } // Setting one attribute if ( value !== undefined ) { // Optionally, function values get executed if exec is true exec = !pass && exec && jQuery.isFunction(value); for ( var i = 0; i < length; i++ ) { fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); } return elems; } // Getting an attribute return length ? fn( elems[0], key ) : undefined; }, now: function() { return (new Date()).getTime(); }, // Create a simple deferred (one callbacks list) _Deferred: function() { var // callbacks list callbacks = [], // stored [ context , args ] fired, // to avoid firing when already doing so firing, // flag to know if the deferred has been cancelled cancelled, // the deferred itself deferred = { // done( f1, f2, ...) done: function() { if ( !cancelled ) { var args = arguments, i, length, elem, type, _fired; if ( fired ) { _fired = fired; fired = 0; } for ( i = 0, length = args.length; i < length; i++ ) { elem = args[ i ]; type = jQuery.type( elem ); if ( type === "array" ) { deferred.done.apply( deferred, elem ); } else if ( type === "function" ) { callbacks.push( elem ); } } if ( _fired ) { deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); } } return this; }, // resolve with given context and args resolveWith: function( context, args ) { if ( !cancelled && !fired && !firing ) { firing = 1; try { while( callbacks[ 0 ] ) { callbacks.shift().apply( context, args ); } } finally { fired = [ context, args ]; firing = 0; } } return this; }, // resolve with this as context and given arguments resolve: function() { deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments ); return this; }, // Has this deferred been resolved? isResolved: function() { return !!( firing || fired ); }, // Cancel cancel: function() { cancelled = 1; callbacks = []; return this; } }; return deferred; }, // Full fledged deferred (two callbacks list) Deferred: function( func ) { var deferred = jQuery._Deferred(), failDeferred = jQuery._Deferred(), promise; // Add errorDeferred methods, then and promise jQuery.extend( deferred, { then: function( doneCallbacks, failCallbacks ) { deferred.done( doneCallbacks ).fail( failCallbacks ); return this; }, fail: failDeferred.done, rejectWith: failDeferred.resolveWith, reject: failDeferred.resolve, isRejected: failDeferred.isResolved, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj , i /* internal */ ) { if ( obj == null ) { if ( promise ) { return promise; } promise = obj = {}; } i = promiseMethods.length; while( i-- ) { obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ]; } return obj; } } ); // Make sure only one callback list will be used deferred.then( failDeferred.cancel, deferred.cancel ); // Unexpose cancel delete deferred.cancel; // Call given func if any if ( func ) { func.call( deferred, deferred ); } return deferred; }, // Deferred helper when: function( object ) { var args = arguments, length = args.length, deferred = length <= 1 && object && jQuery.isFunction( object.promise ) ? object : jQuery.Deferred(), promise = deferred.promise(), resolveArray; if ( length > 1 ) { resolveArray = new Array( length ); jQuery.each( args, function( index, element ) { jQuery.when( element ).then( function( value ) { resolveArray[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value; if( ! --length ) { deferred.resolveWith( promise, resolveArray ); } }, deferred.reject ); } ); } else if ( deferred !== object ) { deferred.resolve( object ); } return promise; }, // Use of jQuery.browser is frowned upon. // More details: http://docs.jquery.com/Utilities/jQuery.browser uaMatch: function( ua ) { ua = ua.toLowerCase(); var match = rwebkit.exec( ua ) || ropera.exec( ua ) || rmsie.exec( ua ) || ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || []; return { browser: match[1] || "", version: match[2] || "0" }; }, sub: function() { function jQuerySubclass( selector, context ) { return new jQuerySubclass.fn.init( selector, context ); } jQuery.extend( true, jQuerySubclass, this ); jQuerySubclass.superclass = this; jQuerySubclass.fn = jQuerySubclass.prototype = this(); jQuerySubclass.fn.constructor = jQuerySubclass; jQuerySubclass.subclass = this.subclass; jQuerySubclass.fn.init = function init( selector, context ) { if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) { context = jQuerySubclass(context); } return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass ); }; jQuerySubclass.fn.init.prototype = jQuerySubclass.fn; var rootjQuerySubclass = jQuerySubclass(document); return jQuerySubclass; }, browser: {} }); // Create readyList deferred readyList = jQuery._Deferred(); // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); browserMatch = jQuery.uaMatch( userAgent ); if ( browserMatch.browser ) { jQuery.browser[ browserMatch.browser ] = true; jQuery.browser.version = browserMatch.version; } // Deprecated, use jQuery.browser.webkit instead if ( jQuery.browser.webkit ) { jQuery.browser.safari = true; } if ( indexOf ) { jQuery.inArray = function( elem, array ) { return indexOf.call( array, elem ); }; } // IE doesn't match non-breaking spaces with \s if ( rnotwhite.test( "\xA0" ) ) { trimLeft = /^[\s\xA0]+/; trimRight = /[\s\xA0]+$/; } // All jQuery objects should point back to these rootjQuery = jQuery(document); // Cleanup functions for the document ready method if ( document.addEventListener ) { DOMContentLoaded = function() { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); jQuery.ready(); }; } else if ( document.attachEvent ) { DOMContentLoaded = function() { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( document.readyState === "complete" ) { document.detachEvent( "onreadystatechange", DOMContentLoaded ); jQuery.ready(); } }; } // The DOM ready check for Internet Explorer function doScrollCheck() { if ( jQuery.isReady ) { return; } try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch(e) { setTimeout( doScrollCheck, 1 ); return; } // and execute any waiting functions jQuery.ready(); } // Expose jQuery to the global object return (window.jQuery = window.$ = jQuery); })(); (function() { jQuery.support = {}; var div = document.createElement("div"); div.style.display = "none"; div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; var all = div.getElementsByTagName("*"), a = div.getElementsByTagName("a")[0], select = document.createElement("select"), opt = select.appendChild( document.createElement("option") ); // Can't get basic test support if ( !all || !all.length || !a ) { return; } jQuery.support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: div.firstChild.nodeType === 3, // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText insted) style: /red/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: a.getAttribute("href") === "/a", // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.55$/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) checkOn: div.getElementsByTagName("input")[0].value === "on", // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, // Will be defined later deleteExpando: true, optDisabled: false, checkClone: false, _scriptEval: null, noCloneEvent: true, boxModel: null, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableHiddenOffsets: true }; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as diabled) select.disabled = true; jQuery.support.optDisabled = !opt.disabled; jQuery.support.scriptEval = function() { if ( jQuery.support._scriptEval === null ) { var root = document.documentElement, script = document.createElement("script"), id = "script" + jQuery.now(); script.type = "text/javascript"; try { script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); } catch(e) {} root.insertBefore( script, root.firstChild ); // Make sure that the execution of code works by injecting a script // tag with appendChild/createTextNode // (IE doesn't support this, fails, and uses .text instead) if ( window[ id ] ) { jQuery.support._scriptEval = true; delete window[ id ]; } else { jQuery.support._scriptEval = false; } root.removeChild( script ); // release memory in IE root = script = id = null; } return jQuery.support._scriptEval; }; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { delete div.test; } catch(e) { jQuery.support.deleteExpando = false; } if ( div.attachEvent && div.fireEvent ) { div.attachEvent("onclick", function click() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) jQuery.support.noCloneEvent = false; div.detachEvent("onclick", click); }); div.cloneNode(true).fireEvent("onclick"); } div = document.createElement("div"); div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; var fragment = document.createDocumentFragment(); fragment.appendChild( div.firstChild ); // WebKit doesn't clone checked state correctly in fragments jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; // Figure out if the W3C box model works as expected // document.body must exist before we can do this jQuery(function() { var div = document.createElement("div"), body = document.getElementsByTagName("body")[0]; // Frameset documents with no body should not run this code if ( !body ) { return; } div.style.width = div.style.paddingLeft = "1px"; body.appendChild( div ); jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; if ( "zoom" in div.style ) { // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout // (IE < 8 does this) div.style.display = "inline"; div.style.zoom = 1; jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2; // Check if elements with layout shrink-wrap their children // (IE 6 does this) div.style.display = ""; div.innerHTML = "<div style='width:4px;'></div>"; jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2; } div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; var tds = div.getElementsByTagName("td"); // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only IE 8 fails this test) jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0; tds[0].style.display = ""; tds[1].style.display = "none"; // Check if empty table cells still have offsetWidth/Height // (IE < 8 fail this test) jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; div.innerHTML = ""; body.removeChild( div ).style.display = "none"; div = tds = null; }); // Technique from Juriy Zaytsev // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ var eventSupported = function( eventName ) { var el = document.createElement("div"); eventName = "on" + eventName; // We only care about the case where non-standard event systems // are used, namely in IE. Short-circuiting here helps us to // avoid an eval call (in setAttribute) which can cause CSP // to go haywire. See: https://developer.mozilla.org/en/Security/CSP if ( !el.attachEvent ) { return true; } var isSupported = (eventName in el); if ( !isSupported ) { el.setAttribute(eventName, "return;"); isSupported = typeof el[eventName] === "function"; } el = null; return isSupported; }; jQuery.support.submitBubbles = eventSupported("submit"); jQuery.support.changeBubbles = eventSupported("change"); // release memory in IE div = all = a = null; })(); var rbrace = /^(?:\{.*\}|\[.*\])$/; jQuery.extend({ cache: {}, // Please use with caution uuid: 0, // Unique for each copy of jQuery on the page // Non-digits removed to match rinlinejQuery expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, // Ban all objects except for Flash (which handle expandos) "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !jQuery.isEmptyObject(elem); }, data: function( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache, // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { elem[ jQuery.expando ] = id = ++jQuery.uuid; } else { id = jQuery.expando; } } if ( !cache[ id ] ) { cache[ id ] = {}; } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" ) { if ( pvt ) { cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); } else { cache[ id ] = jQuery.extend(cache[ id ], name); } } thisCache = cache[ id ]; // Internal jQuery data is stored in a separate object inside the object's data // cache in order to avoid key collisions between internal data and user-defined // data if ( pvt ) { if ( !thisCache[ internalKey ] ) { thisCache[ internalKey ] = {}; } thisCache = thisCache[ internalKey ]; } if ( data !== undefined ) { thisCache[ name ] = data; } // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should // not attempt to inspect the internal events object using jQuery.data, as this // internal data object is undocumented and subject to change. if ( name === "events" && !thisCache[name] ) { return thisCache[ internalKey ] && thisCache[ internalKey ].events; } return getByName ? thisCache[ name ] : thisCache; }, removeData: function( elem, name, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var internalKey = jQuery.expando, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, // See jQuery.data for more information id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; if ( thisCache ) { delete thisCache[ name ]; // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !jQuery.isEmptyObject(thisCache) ) { return; } } } // See jQuery.data for more information if ( pvt ) { delete cache[ id ][ internalKey ]; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !jQuery.isEmptyObject(cache[ id ]) ) { return; } } var internalCache = cache[ id ][ internalKey ]; // Browsers that fail expando deletion also refuse to delete expandos on // the window, but it will allow it on all other JS objects; other browsers // don't care if ( jQuery.support.deleteExpando || cache != window ) { delete cache[ id ]; } else { cache[ id ] = null; } // We destroyed the entire user cache at once because it's faster than // iterating through each key, but we need to continue to persist internal // data if it existed if ( internalCache ) { cache[ id ] = {}; cache[ id ][ internalKey ] = internalCache; // Otherwise, we need to eliminate the expando on the node to avoid // false lookups in the cache for entries that no longer exist } else if ( isNode ) { // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( jQuery.support.deleteExpando ) { delete elem[ jQuery.expando ]; } else if ( elem.removeAttribute ) { elem.removeAttribute( jQuery.expando ); } else { elem[ jQuery.expando ] = null; } } }, // For internal use only. _data: function( elem, name, data ) { return jQuery.data( elem, name, data, true ); }, // A method for determining if a DOM node can handle the data expando acceptData: function( elem ) { if ( elem.nodeName ) { var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; if ( match ) { return !(match === true || elem.getAttribute("classid") !== match); } } return true; } }); jQuery.fn.extend({ data: function( key, value ) { var data = null; if ( typeof key === "undefined" ) { if ( this.length ) { data = jQuery.data( this[0] ); if ( this[0].nodeType === 1 ) { var attr = this[0].attributes, name; for ( var i = 0, l = attr.length; i < l; i++ ) { name = attr[i].name; if ( name.indexOf( "data-" ) === 0 ) { name = name.substr( 5 ); dataAttr( this[0], name, data[ name ] ); } } } } return data; } else if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } var parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); // Try to fetch any internally stored data first if ( data === undefined && this.length ) { data = jQuery.data( this[0], key ); data = dataAttr( this[0], key, data ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } else { return this.each(function() { var $this = jQuery( this ), args = [ parts[0], value ]; $this.triggerHandler( "setData" + parts[1] + "!", args ); jQuery.data( this, key, value ); $this.triggerHandler( "changeData" + parts[1] + "!", args ); }); } }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { data = elem.getAttribute( "data-" + key ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : !jQuery.isNaN( data ) ? parseFloat( data ) : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } jQuery.extend({ queue: function( elem, type, data ) { if ( !elem ) { return; } type = (type || "fx") + "queue"; var q = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( !data ) { return q || []; } if ( !q || jQuery.isArray(data) ) { q = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { q.push( data ); } return q; }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), fn = queue.shift(); // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift("inprogress"); } fn.call(elem, function() { jQuery.dequeue(elem, type); }); } if ( !queue.length ) { jQuery.removeData( elem, type + "queue", true ); } } }); jQuery.fn.extend({ queue: function( type, data ) { if ( typeof type !== "string" ) { data = type; type = "fx"; } if ( data === undefined ) { return jQuery.queue( this[0], type ); } return this.each(function( i ) { var queue = jQuery.queue( this, type, data ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; type = type || "fx"; return this.queue( type, function() { var elem = this; setTimeout(function() { jQuery.dequeue( elem, type ); }, time ); }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); } }); var rclass = /[\n\t\r]/g, rspaces = /\s+/, rreturn = /\r/g, rspecialurl = /^(?:href|src|style)$/, rtype = /^(?:button|input)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea)?$/i, rradiocheck = /^(?:radio|checkbox)$/i; jQuery.props = { "for": "htmlFor", "class": "className", readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", colspan: "colSpan", tabindex: "tabIndex", usemap: "useMap", frameborder: "frameBorder" }; jQuery.fn.extend({ attr: function( name, value ) { return jQuery.access( this, name, value, true, jQuery.attr ); }, removeAttr: function( name, fn ) { return this.each(function(){ jQuery.attr( this, name, "" ); if ( this.nodeType === 1 ) { this.removeAttribute( name ); } }); }, addClass: function( value ) { if ( jQuery.isFunction(value) ) { return this.each(function(i) { var self = jQuery(this); self.addClass( value.call(this, i, self.attr("class")) ); }); } if ( value && typeof value === "string" ) { var classNames = (value || "").split( rspaces ); for ( var i = 0, l = this.length; i < l; i++ ) { var elem = this[i]; if ( elem.nodeType === 1 ) { if ( !elem.className ) { elem.className = value; } else { var className = " " + elem.className + " ", setClass = elem.className; for ( var c = 0, cl = classNames.length; c < cl; c++ ) { if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { setClass += " " + classNames[c]; } } elem.className = jQuery.trim( setClass ); } } } } return this; }, removeClass: function( value ) { if ( jQuery.isFunction(value) ) { return this.each(function(i) { var self = jQuery(this); self.removeClass( value.call(this, i, self.attr("class")) ); }); } if ( (value && typeof value === "string") || value === undefined ) { var classNames = (value || "").split( rspaces ); for ( var i = 0, l = this.length; i < l; i++ ) { var elem = this[i]; if ( elem.nodeType === 1 && elem.className ) { if ( value ) { var className = (" " + elem.className + " ").replace(rclass, " "); for ( var c = 0, cl = classNames.length; c < cl; c++ ) { className = className.replace(" " + classNames[c] + " ", " "); } elem.className = jQuery.trim( className ); } else { elem.className = ""; } } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value, isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function(i) { var self = jQuery(this); self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), state = stateVal, classNames = value.split( rspaces ); while ( (className = classNames[ i++ ]) ) { // check each className given, space seperated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } } else if ( type === "undefined" || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // toggle whole className this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " "; for ( var i = 0, l = this.length; i < l; i++ ) { if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { return true; } } return false; }, val: function( value ) { if ( !arguments.length ) { var elem = this[0]; if ( elem ) { if ( jQuery.nodeName( elem, "option" ) ) { // attributes.value is undefined in Blackberry 4.7 but // uses .value. See #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } // We need to handle select boxes special if ( jQuery.nodeName( elem, "select" ) ) { var index = elem.selectedIndex, values = [], options = elem.options, one = elem.type === "select-one"; // Nothing was selected if ( index < 0 ) { return null; } // Loop through all the selected options for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { var option = options[ i ]; // Don't return options that are disabled or in a disabled optgroup if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { // Get the specific value for the option value = jQuery(option).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; } // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { return elem.getAttribute("value") === null ? "on" : elem.value; } // Everything else, we just grab the value return (elem.value || "").replace(rreturn, ""); } return undefined; } var isFunction = jQuery.isFunction(value); return this.each(function(i) { var self = jQuery(this), val = value; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call(this, i, self.val()); } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray(val) ) { val = jQuery.map(val, function (value) { return value == null ? "" : value + ""; }); } if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { this.checked = jQuery.inArray( self.val(), val ) >= 0; } else if ( jQuery.nodeName( this, "select" ) ) { var values = jQuery.makeArray(val); jQuery( "option", this ).each(function() { this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; }); if ( !values.length ) { this.selectedIndex = -1; } } else { this.value = val; } }); } }); jQuery.extend({ attrFn: { val: true, css: true, html: true, text: true, data: true, width: true, height: true, offset: true }, attr: function( elem, name, value, pass ) { // don't get/set attributes on text, comment and attribute nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) { return undefined; } if ( pass && name in jQuery.attrFn ) { return jQuery(elem)[name](value); } var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), // Whether we are setting (or getting) set = value !== undefined; // Try to normalize/fix the name name = notxml && jQuery.props[ name ] || name; // Only do all the following if this is a node (faster for style) if ( elem.nodeType === 1 ) { // These attributes require special treatment var special = rspecialurl.test( name ); // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( name === "selected" && !jQuery.support.optSelected ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } } // If applicable, access the attribute via the DOM 0 way // 'in' checks fail in Blackberry 4.7 #6931 if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) { if ( set ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { jQuery.error( "type property can't be changed" ); } if ( value === null ) { if ( elem.nodeType === 1 ) { elem.removeAttribute( name ); } } else { elem[ name ] = value; } } // browsers index elements by id/name on forms, give priority to attributes. if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { return elem.getAttributeNode( name ).nodeValue; } // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ if ( name === "tabIndex" ) { var attributeNode = elem.getAttributeNode( "tabIndex" ); return attributeNode && attributeNode.specified ? attributeNode.value : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : undefined; } return elem[ name ]; } if ( !jQuery.support.style && notxml && name === "style" ) { if ( set ) { elem.style.cssText = "" + value; } return elem.style.cssText; } if ( set ) { // convert the value to a string (all browsers do this but IE) see #1070 elem.setAttribute( name, "" + value ); } // Ensure that missing attributes return undefined // Blackberry 4.7 returns "" from getAttribute #6938 if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) { return undefined; } var attr = !jQuery.support.hrefNormalized && notxml && special ? // Some attributes require a special call on IE elem.getAttribute( name, 2 ) : elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return attr === null ? undefined : attr; } // Handle everything which isn't a DOM element node if ( set ) { elem[ name ] = value; } return elem[ name ]; } }); var rnamespaces = /\.(.*)$/, rformElems = /^(?:textarea|input|select)$/i, rperiod = /\./g, rspace = / /g, rescape = /[^\w\s.|`]/g, fcleanup = function( nm ) { return nm.replace(rescape, "\\$&"); }, eventKey = "events"; /* * A number of helper functions used for managing events. * Many of the ideas behind this code originated from * Dean Edwards' addEvent library. */ jQuery.event = { // Bind an event to an element // Original by Dean Edwards add: function( elem, types, handler, data ) { if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // For whatever reason, IE has trouble passing the window object // around, causing it to be cloned in the process if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) { elem = window; } if ( handler === false ) { handler = returnFalse; } else if ( !handler ) { // Fixes bug #7229. Fix recommended by jdalton return; } var handleObjIn, handleObj; if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; } // Make sure that the function being executed has a unique ID if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure var elemData = jQuery._data( elem ); // If no elemData is found then we must be trying to bind to one of the // banned noData elements if ( !elemData ) { return; } var events = elemData[ eventKey ], eventHandle = elemData.handle; if ( typeof events === "function" ) { // On plain objects events is a fn that holds the the data // which prevents this data from being JSON serialized // the function does not need to be called, it just contains the data eventHandle = events.handle; events = events.events; } else if ( !events ) { if ( !elem.nodeType ) { // On plain objects, create a fn that acts as the holder // of the values to avoid JSON serialization of event data elemData[ eventKey ] = elemData = function(){}; } elemData.events = events = {}; } if ( !eventHandle ) { elemData.handle = eventHandle = function() { // Handle the second event of a trigger and when // an event is called after a page has unloaded return typeof jQuery !== "undefined" && !jQuery.event.triggered ? jQuery.event.handle.apply( eventHandle.elem, arguments ) : undefined; }; } // Add elem as a property of the handle function // This is to prevent a memory leak with non-native events in IE. eventHandle.elem = elem; // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = types.split(" "); var type, i = 0, namespaces; while ( (type = types[ i++ ]) ) { handleObj = handleObjIn ? jQuery.extend({}, handleObjIn) : { handler: handler, data: data }; // Namespaced event handlers if ( type.indexOf(".") > -1 ) { namespaces = type.split("."); type = namespaces.shift(); handleObj.namespace = namespaces.slice(0).sort().join("."); } else { namespaces = []; handleObj.namespace = ""; } handleObj.type = type; if ( !handleObj.guid ) { handleObj.guid = handler.guid; } // Get the current list of functions bound to this event var handlers = events[ type ], special = jQuery.event.special[ type ] || {}; // Init the event handler queue if ( !handlers ) { handlers = events[ type ] = []; // Check for a special event handler // Only use addEventListener/attachEvent if the special // events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add the function to the element's handler list handlers.push( handleObj ); // Keep track of which events have been used, for global triggering jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, global: {}, // Detach an event or set of events from an element remove: function( elem, types, handler, pos ) { // don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } if ( handler === false ) { handler = returnFalse; } var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, elemData = jQuery.hasData( elem ) && jQuery._data( elem ), events = elemData && elemData[ eventKey ]; if ( !elemData || !events ) { return; } if ( typeof events === "function" ) { elemData = events; events = events.events; } // types is actually an event object here if ( types && types.type ) { handler = types.handler; types = types.type; } // Unbind all events for the element if ( !types || typeof types === "string" && types.charAt(0) === "." ) { types = types || ""; for ( type in events ) { jQuery.event.remove( elem, type + types ); } return; } // Handle multiple events separated by a space // jQuery(...).unbind("mouseover mouseout", fn); types = types.split(" "); while ( (type = types[ i++ ]) ) { origType = type; handleObj = null; all = type.indexOf(".") < 0; namespaces = []; if ( !all ) { // Namespaced event handlers namespaces = type.split("."); type = namespaces.shift(); namespace = new RegExp("(^|\\.)" + jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); } eventType = events[ type ]; if ( !eventType ) { continue; } if ( !handler ) { for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( all || namespace.test( handleObj.namespace ) ) { jQuery.event.remove( elem, origType, handleObj.handler, j ); eventType.splice( j--, 1 ); } } continue; } special = jQuery.event.special[ type ] || {}; for ( j = pos || 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( handler.guid === handleObj.guid ) { // remove the given handler for the given type if ( all || namespace.test( handleObj.namespace ) ) { if ( pos == null ) { eventType.splice( j--, 1 ); } if ( special.remove ) { special.remove.call( elem, handleObj ); } } if ( pos != null ) { break; } } } // remove generic event handler if no more handlers exist if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } ret = null; delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { var handle = elemData.handle; if ( handle ) { handle.elem = null; } delete elemData.events; delete elemData.handle; if ( typeof elemData === "function" ) { jQuery.removeData( elem, eventKey, true ); } else if ( jQuery.isEmptyObject( elemData ) ) { jQuery.removeData( elem, undefined, true ); } } }, // bubbling is internal trigger: function( event, data, elem /*, bubbling */ ) { // Event object or event type var type = event.type || event, bubbling = arguments[3]; if ( !bubbling ) { event = typeof event === "object" ? // jQuery.Event object event[ jQuery.expando ] ? event : // Object literal jQuery.extend( jQuery.Event(type), event ) : // Just the event type (string) jQuery.Event(type); if ( type.indexOf("!") >= 0 ) { event.type = type = type.slice(0, -1); event.exclusive = true; } // Handle a global trigger if ( !elem ) { // Don't bubble custom events when global (to avoid too much overhead) event.stopPropagation(); // Only trigger if we've ever bound an event for it if ( jQuery.event.global[ type ] ) { // XXX This code smells terrible. event.js should not be directly // inspecting the data cache jQuery.each( jQuery.cache, function() { // internalKey variable is just used to make it easier to find // and potentially change this stuff later; currently it just // points to jQuery.expando var internalKey = jQuery.expando, internalCache = this[ internalKey ]; if ( internalCache && internalCache.events && internalCache.events[type] ) { jQuery.event.trigger( event, data, internalCache.handle.elem ); } }); } } // Handle triggering a single element // don't do events on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { return undefined; } // Clean up in case it is reused event.result = undefined; event.target = elem; // Clone the incoming data, if any data = jQuery.makeArray( data ); data.unshift( event ); } event.currentTarget = elem; // Trigger the event, it is assumed that "handle" is a function var handle = elem.nodeType ? jQuery._data( elem, "handle" ) : (jQuery._data( elem, eventKey ) || {}).handle; if ( handle ) { handle.apply( elem, data ); } var parent = elem.parentNode || elem.ownerDocument; // Trigger an inline bound script try { if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { event.result = false; event.preventDefault(); } } // prevent IE from throwing an error for some elements with some event types, see #3533 } catch (inlineError) {} if ( !event.isPropagationStopped() && parent ) { jQuery.event.trigger( event, data, parent, true ); } else if ( !event.isDefaultPrevented() ) { var old, target = event.target, targetType = type.replace( rnamespaces, "" ), isClick = jQuery.nodeName( target, "a" ) && targetType === "click", special = jQuery.event.special[ targetType ] || {}; if ( (!special._default || special._default.call( elem, event ) === false) && !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { try { if ( target[ targetType ] ) { // Make sure that we don't accidentally re-trigger the onFOO events old = target[ "on" + targetType ]; if ( old ) { target[ "on" + targetType ] = null; } jQuery.event.triggered = true; target[ targetType ](); } // prevent IE from throwing an error for some elements with some event types, see #3533 } catch (triggerError) {} if ( old ) { target[ "on" + targetType ] = old; } jQuery.event.triggered = false; } } }, handle: function( event ) { var all, handlers, namespaces, namespace_re, events, namespace_sort = [], args = jQuery.makeArray( arguments ); event = args[0] = jQuery.event.fix( event || window.event ); event.currentTarget = this; // Namespaced event handlers all = event.type.indexOf(".") < 0 && !event.exclusive; if ( !all ) { namespaces = event.type.split("."); event.type = namespaces.shift(); namespace_sort = namespaces.slice(0).sort(); namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)"); } event.namespace = event.namespace || namespace_sort.join("."); events = jQuery._data(this, eventKey); if ( typeof events === "function" ) { events = events.events; } handlers = (events || {})[ event.type ]; if ( events && handlers ) { // Clone the handlers to prevent manipulation handlers = handlers.slice(0); for ( var j = 0, l = handlers.length; j < l; j++ ) { var handleObj = handlers[ j ]; // Filter the functions by class if ( all || namespace_re.test( handleObj.namespace ) ) { // Pass in a reference to the handler function itself // So that we can later remove it event.handler = handleObj.handler; event.data = handleObj.data; event.handleObj = handleObj; var ret = handleObj.handler.apply( this, args ); if ( ret !== undefined ) { event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } if ( event.isImmediatePropagationStopped() ) { break; } } } } return event.result; }, props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // store a copy of the original event object // and "clone" to set read-only properties var originalEvent = event; event = jQuery.Event( originalEvent ); for ( var i = this.props.length, prop; i; ) { prop = this.props[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary if ( !event.target ) { // Fixes #1925 where srcElement might not be defined either event.target = event.srcElement || document; } // check if target is a textnode (safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // Add relatedTarget, if necessary if ( !event.relatedTarget && event.fromElement ) { event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; } // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && event.clientX != null ) { var doc = document.documentElement, body = document.body; event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); } // Add which for key events if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { event.which = event.charCode != null ? event.charCode : event.keyCode; } // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) if ( !event.metaKey && event.ctrlKey ) { event.metaKey = event.ctrlKey; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && event.button !== undefined ) { event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); } return event; }, // Deprecated, use jQuery.guid instead guid: 1E8, // Deprecated, use jQuery.proxy instead proxy: jQuery.proxy, special: { ready: { // Make sure the ready event is setup setup: jQuery.bindReady, teardown: jQuery.noop }, live: { add: function( handleObj ) { jQuery.event.add( this, liveConvert( handleObj.origType, handleObj.selector ), jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); }, remove: function( handleObj ) { jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); } }, beforeunload: { setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on windows if ( jQuery.isWindow( this ) ) { this.onbeforeunload = eventHandle; } }, teardown: function( namespaces, eventHandle ) { if ( this.onbeforeunload === eventHandle ) { this.onbeforeunload = null; } } } } }; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { if ( elem.detachEvent ) { elem.detachEvent( "on" + type, handle ); } }; jQuery.Event = function( src ) { // Allow instantiation without the 'new' keyword if ( !this.preventDefault ) { return new jQuery.Event( src ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // timeStamp is buggy for some events on Firefox(#3843) // So we won't rely on the native value this.timeStamp = jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; function returnFalse() { return false; } function returnTrue() { return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if preventDefault exists run it on the original event if ( e.preventDefault ) { e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) } else { e.returnValue = false; } }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if stopPropagation exists run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Checks if an event happened on an element within another element // Used in jQuery.event.special.mouseenter and mouseleave handlers var withinElement = function( event ) { // Check if mouse(over|out) are still within the same parent element var parent = event.relatedTarget; // Firefox sometimes assigns relatedTarget a XUL element // which we cannot access the parentNode property of try { // Traverse up the tree while ( parent && parent !== this ) { parent = parent.parentNode; } if ( parent !== this ) { // set the correct event type event.type = event.data; // handle event if we actually just moused on to a non sub-element jQuery.event.handle.apply( this, arguments ); } // assuming we've left the element since we most likely mousedover a xul element } catch(e) { } }, // In case of event delegation, we only need to rename the event.type, // liveHandler will take care of the rest. delegate = function( event ) { event.type = event.data; jQuery.event.handle.apply( this, arguments ); }; // Create mouseenter and mouseleave events jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { setup: function( data ) { jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); }, teardown: function( data ) { jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); } }; }); // submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { setup: function( data, namespaces ) { if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) { jQuery.event.add(this, "click.specialSubmit", function( e ) { var elem = e.target, type = elem.type; if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { e.liveFired = undefined; return trigger( "submit", this, arguments ); } }); jQuery.event.add(this, "keypress.specialSubmit", function( e ) { var elem = e.target, type = elem.type; if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { e.liveFired = undefined; return trigger( "submit", this, arguments ); } }); } else { return false; } }, teardown: function( namespaces ) { jQuery.event.remove( this, ".specialSubmit" ); } }; } // change delegation, happens here so we have bind. if ( !jQuery.support.changeBubbles ) { var changeFilters, getVal = function( elem ) { var type = elem.type, val = elem.value; if ( type === "radio" || type === "checkbox" ) { val = elem.checked; } else if ( type === "select-multiple" ) { val = elem.selectedIndex > -1 ? jQuery.map( elem.options, function( elem ) { return elem.selected; }).join("-") : ""; } else if ( elem.nodeName.toLowerCase() === "select" ) { val = elem.selectedIndex; } return val; }, testChange = function testChange( e ) { var elem = e.target, data, val; if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { return; } data = jQuery._data( elem, "_change_data" ); val = getVal(elem); // the current data will be also retrieved by beforeactivate if ( e.type !== "focusout" || elem.type !== "radio" ) { jQuery._data( elem, "_change_data", val ); } if ( data === undefined || val === data ) { return; } if ( data != null || val ) { e.type = "change"; e.liveFired = undefined; return jQuery.event.trigger( e, arguments[1], elem ); } }; jQuery.event.special.change = { filters: { focusout: testChange, beforedeactivate: testChange, click: function( e ) { var elem = e.target, type = elem.type; if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { return testChange.call( this, e ); } }, // Change has to be called before submit // Keydown will be called before keypress, which is used in submit-event delegation keydown: function( e ) { var elem = e.target, type = elem.type; if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || type === "select-multiple" ) { return testChange.call( this, e ); } }, // Beforeactivate happens also before the previous element is blurred // with this event you can't trigger a change event, but you can store // information beforeactivate: function( e ) { var elem = e.target; jQuery._data( elem, "_change_data", getVal(elem) ); } }, setup: function( data, namespaces ) { if ( this.type === "file" ) { return false; } for ( var type in changeFilters ) { jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); } return rformElems.test( this.nodeName ); }, teardown: function( namespaces ) { jQuery.event.remove( this, ".specialChange" ); return rformElems.test( this.nodeName ); } }; changeFilters = jQuery.event.special.change.filters; // Handle when the input is .focus()'d changeFilters.focus = changeFilters.beforeactivate; } function trigger( type, elem, args ) { args[0].type = type; return jQuery.event.handle.apply( elem, args ); } // Create "bubbling" focus and blur events if ( document.addEventListener ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { jQuery.event.special[ fix ] = { setup: function() { this.addEventListener( orig, handler, true ); }, teardown: function() { this.removeEventListener( orig, handler, true ); } }; function handler( e ) { e = jQuery.event.fix( e ); e.type = fix; return jQuery.event.handle.call( this, e ); } }); } jQuery.each(["bind", "one"], function( i, name ) { jQuery.fn[ name ] = function( type, data, fn ) { // Handle object literals if ( typeof type === "object" ) { for ( var key in type ) { this[ name ](key, data, type[key], fn); } return this; } if ( jQuery.isFunction( data ) || data === false ) { fn = data; data = undefined; } var handler = name === "one" ? jQuery.proxy( fn, function( event ) { jQuery( this ).unbind( event, handler ); return fn.apply( this, arguments ); }) : fn; if ( type === "unload" && name !== "one" ) { this.one( type, data, fn ); } else { for ( var i = 0, l = this.length; i < l; i++ ) { jQuery.event.add( this[i], type, handler, data ); } } return this; }; }); jQuery.fn.extend({ unbind: function( type, fn ) { // Handle object literals if ( typeof type === "object" && !type.preventDefault ) { for ( var key in type ) { this.unbind(key, type[key]); } } else { for ( var i = 0, l = this.length; i < l; i++ ) { jQuery.event.remove( this[i], type, fn ); } } return this; }, delegate: function( selector, types, data, fn ) { return this.live( types, data, fn, selector ); }, undelegate: function( selector, types, fn ) { if ( arguments.length === 0 ) { return this.unbind( "live" ); } else { return this.die( types, null, fn, selector ); } }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { if ( this[0] ) { var event = jQuery.Event( type ); event.preventDefault(); event.stopPropagation(); jQuery.event.trigger( event, data, this[0] ); return event.result; } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, i = 1; // link all the functions, so any of them can unbind this click handler while ( i < args.length ) { jQuery.proxy( fn, args[ i++ ] ); } return this.click( jQuery.proxy( fn, function( event ) { // Figure out which function to execute var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ lastToggle ].apply( this, arguments ) || false; })); }, hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } }); var liveMap = { focus: "focusin", blur: "focusout", mouseenter: "mouseover", mouseleave: "mouseout" }; jQuery.each(["live", "die"], function( i, name ) { jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { var type, i = 0, match, namespaces, preType, selector = origSelector || this.selector, context = origSelector ? this : jQuery( this.context ); if ( typeof types === "object" && !types.preventDefault ) { for ( var key in types ) { context[ name ]( key, data, types[key], selector ); } return this; } if ( jQuery.isFunction( data ) ) { fn = data; data = undefined; } types = (types || "").split(" "); while ( (type = types[ i++ ]) != null ) { match = rnamespaces.exec( type ); namespaces = ""; if ( match ) { namespaces = match[0]; type = type.replace( rnamespaces, "" ); } if ( type === "hover" ) { types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); continue; } preType = type; if ( type === "focus" || type === "blur" ) { types.push( liveMap[ type ] + namespaces ); type = type + namespaces; } else { type = (liveMap[ type ] || type) + namespaces; } if ( name === "live" ) { // bind live handler for ( var j = 0, l = context.length; j < l; j++ ) { jQuery.event.add( context[j], "live." + liveConvert( type, selector ), { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); } } else { // unbind live handler context.unbind( "live." + liveConvert( type, selector ), fn ); } } return this; }; }); function liveHandler( event ) { var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, elems = [], selectors = [], events = jQuery._data( this, eventKey ); if ( typeof events === "function" ) { events = events.events; } // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { return; } if ( event.namespace ) { namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); } event.liveFired = this; var live = events.live.slice(0); for ( j = 0; j < live.length; j++ ) { handleObj = live[j]; if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { selectors.push( handleObj.selector ); } else { live.splice( j--, 1 ); } } match = jQuery( event.target ).closest( selectors, event.currentTarget ); for ( i = 0, l = match.length; i < l; i++ ) { close = match[i]; for ( j = 0; j < live.length; j++ ) { handleObj = live[j]; if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) { elem = close.elem; related = null; // Those two events require additional checking if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { event.type = handleObj.preType; related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; } if ( !related || related !== elem ) { elems.push({ elem: elem, handleObj: handleObj, level: close.level }); } } } } for ( i = 0, l = elems.length; i < l; i++ ) { match = elems[i]; if ( maxLevel && match.level > maxLevel ) { break; } event.currentTarget = match.elem; event.data = match.handleObj.data; event.handleObj = match.handleObj; ret = match.handleObj.origHandler.apply( match.elem, arguments ); if ( ret === false || event.isPropagationStopped() ) { maxLevel = match.level; if ( ret === false ) { stop = false; } if ( event.isImmediatePropagationStopped() ) { break; } } } return stop; } function liveConvert( type, selector ) { return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&"); } jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { if ( fn == null ) { fn = data; data = null; } return arguments.length > 0 ? this.bind( name, data, fn ) : this.trigger( name ); }; if ( jQuery.attrFn ) { jQuery.attrFn[ name ] = true; } }); /*! * Sizzle CSS Selector Engine * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, done = 0, toString = Object.prototype.toString, hasDuplicate = false, baseHasDuplicate = true; // Here we check if the JavaScript engine is using some sort of // optimization where it does not always call our comparision // function. If that is the case, discard the hasDuplicate value. // Thus far that includes Google Chrome. [0, 0].sort(function() { baseHasDuplicate = false; return 0; }); var Sizzle = function( selector, context, results, seed ) { results = results || []; context = context || document; var origContext = context; if ( context.nodeType !== 1 && context.nodeType !== 9 ) { return []; } if ( !selector || typeof selector !== "string" ) { return results; } var m, set, checkSet, extra, ret, cur, pop, i, prune = true, contextXML = Sizzle.isXML( context ), parts = [], soFar = selector; // Reset the position of the chunker regexp (start from head) do { chunker.exec( "" ); m = chunker.exec( soFar ); if ( m ) { soFar = m[3]; parts.push( m[1] ); if ( m[2] ) { extra = m[3]; break; } } } while ( m ); if ( parts.length > 1 && origPOS.exec( selector ) ) { if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { set = posProcess( parts[0] + parts[1], context ); } else { set = Expr.relative[ parts[0] ] ? [ context ] : Sizzle( parts.shift(), context ); while ( parts.length ) { selector = parts.shift(); if ( Expr.relative[ selector ] ) { selector += parts.shift(); } set = posProcess( selector, set ); } } } else { // Take a shortcut and set the context if the root selector is an ID // (but not if it'll be faster if the inner selector is an ID) if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { ret = Sizzle.find( parts.shift(), context, contextXML ); context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; } if ( context ) { ret = seed ? { expr: parts.pop(), set: makeArray(seed) } : Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; if ( parts.length > 0 ) { checkSet = makeArray( set ); } else { prune = false; } while ( parts.length ) { cur = parts.pop(); pop = cur; if ( !Expr.relative[ cur ] ) { cur = ""; } else { pop = parts.pop(); } if ( pop == null ) { pop = context; } Expr.relative[ cur ]( checkSet, pop, contextXML ); } } else { checkSet = parts = []; } } if ( !checkSet ) { checkSet = set; } if ( !checkSet ) { Sizzle.error( cur || selector ); } if ( toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); } else if ( context && context.nodeType === 1 ) { for ( i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { results.push( set[i] ); } } } else { for ( i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && checkSet[i].nodeType === 1 ) { results.push( set[i] ); } } } } else { makeArray( checkSet, results ); } if ( extra ) { Sizzle( extra, origContext, results, seed ); Sizzle.uniqueSort( results ); } return results; }; Sizzle.uniqueSort = function( results ) { if ( sortOrder ) { hasDuplicate = baseHasDuplicate; results.sort( sortOrder ); if ( hasDuplicate ) { for ( var i = 1; i < results.length; i++ ) { if ( results[i] === results[ i - 1 ] ) { results.splice( i--, 1 ); } } } } return results; }; Sizzle.matches = function( expr, set ) { return Sizzle( expr, null, null, set ); }; Sizzle.matchesSelector = function( node, expr ) { return Sizzle( expr, null, null, [node] ).length > 0; }; Sizzle.find = function( expr, context, isXML ) { var set; if ( !expr ) { return []; } for ( var i = 0, l = Expr.order.length; i < l; i++ ) { var match, type = Expr.order[i]; if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { var left = match[1]; match.splice( 1, 1 ); if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace(/\\/g, ""); set = Expr.find[ type ]( match, context, isXML ); if ( set != null ) { expr = expr.replace( Expr.match[ type ], "" ); break; } } } } if ( !set ) { set = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( "*" ) : []; } return { set: set, expr: expr }; }; Sizzle.filter = function( expr, set, inplace, not ) { var match, anyFound, old = expr, result = [], curLoop = set, isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); while ( expr && set.length ) { for ( var type in Expr.filter ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { var found, item, filter = Expr.filter[ type ], left = match[1]; anyFound = false; match.splice(1,1); if ( left.substr( left.length - 1 ) === "\\" ) { continue; } if ( curLoop === result ) { result = []; } if ( Expr.preFilter[ type ] ) { match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); if ( !match ) { anyFound = found = true; } else if ( match === true ) { continue; } } if ( match ) { for ( var i = 0; (item = curLoop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curLoop ); var pass = not ^ !!found; if ( inplace && found != null ) { if ( pass ) { anyFound = true; } else { curLoop[i] = false; } } else if ( pass ) { result.push( item ); anyFound = true; } } } } if ( found !== undefined ) { if ( !inplace ) { curLoop = result; } expr = expr.replace( Expr.match[ type ], "" ); if ( !anyFound ) { return []; } break; } } } // Improper expression if ( expr === old ) { if ( anyFound == null ) { Sizzle.error( expr ); } else { break; } } old = expr; } return curLoop; }; Sizzle.error = function( msg ) { throw "Syntax error, unrecognized expression: " + msg; }; var Expr = Sizzle.selectors = { order: [ "ID", "NAME", "TAG" ], match: { ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ }, leftMatch: {}, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function( elem ) { return elem.getAttribute( "href" ); } }, relative: { "+": function(checkSet, part){ var isPartStr = typeof part === "string", isTag = isPartStr && !/\W/.test( part ), isPartStrNotTag = isPartStr && !isTag; if ( isTag ) { part = part.toLowerCase(); } for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { if ( (elem = checkSet[i]) ) { while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? elem || false : elem === part; } } if ( isPartStrNotTag ) { Sizzle.filter( part, checkSet, true ); } }, ">": function( checkSet, part ) { var elem, isPartStr = typeof part === "string", i = 0, l = checkSet.length; if ( isPartStr && !/\W/.test( part ) ) { part = part.toLowerCase(); for ( ; i < l; i++ ) { elem = checkSet[i]; if ( elem ) { var parent = elem.parentNode; checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; } } } else { for ( ; i < l; i++ ) { elem = checkSet[i]; if ( elem ) { checkSet[i] = isPartStr ? elem.parentNode : elem.parentNode === part; } } if ( isPartStr ) { Sizzle.filter( part, checkSet, true ); } } }, "": function(checkSet, part, isXML){ var nodeCheck, doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !/\W/.test(part) ) { part = part.toLowerCase(); nodeCheck = part; checkFn = dirNodeCheck; } checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); }, "~": function( checkSet, part, isXML ) { var nodeCheck, doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !/\W/.test( part ) ) { part = part.toLowerCase(); nodeCheck = part; checkFn = dirNodeCheck; } checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); } }, find: { ID: function( match, context, isXML ) { if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } }, NAME: function( match, context ) { if ( typeof context.getElementsByName !== "undefined" ) { var ret = [], results = context.getElementsByName( match[1] ); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getAttribute("name") === match[1] ) { ret.push( results[i] ); } } return ret.length === 0 ? null : ret; } }, TAG: function( match, context ) { if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( match[1] ); } } }, preFilter: { CLASS: function( match, curLoop, inplace, result, not, isXML ) { match = " " + match[1].replace(/\\/g, "") + " "; if ( isXML ) { return match; } for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { if ( elem ) { if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { if ( !inplace ) { result.push( elem ); } } else if ( inplace ) { curLoop[i] = false; } } } return false; }, ID: function( match ) { return match[1].replace(/\\/g, ""); }, TAG: function( match, curLoop ) { return match[1].toLowerCase(); }, CHILD: function( match ) { if ( match[1] === "nth" ) { if ( !match[2] ) { Sizzle.error( match[0] ); } match[2] = match[2].replace(/^\+|\s*/g, ''); // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } else if ( match[2] ) { Sizzle.error( match[0] ); } // TODO: Move to normal caching system match[0] = done++; return match; }, ATTR: function( match, curLoop, inplace, result, not, isXML ) { var name = match[1] = match[1].replace(/\\/g, ""); if ( !isXML && Expr.attrMap[name] ) { match[1] = Expr.attrMap[name]; } // Handle if an un-quoted value was used match[4] = ( match[4] || match[5] || "" ).replace(/\\/g, ""); if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, PSEUDO: function( match, curLoop, inplace, result, not ) { if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } return false; } } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { return true; } return match; }, POS: function( match ) { match.unshift( true ); return match; } }, filters: { enabled: function( elem ) { return elem.disabled === false && elem.type !== "hidden"; }, disabled: function( elem ) { return elem.disabled === true; }, checked: function( elem ) { return elem.checked === true; }, selected: function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly elem.parentNode.selectedIndex; return elem.selected === true; }, parent: function( elem ) { return !!elem.firstChild; }, empty: function( elem ) { return !elem.firstChild; }, has: function( elem, i, match ) { return !!Sizzle( match[3], elem ).length; }, header: function( elem ) { return (/h\d/i).test( elem.nodeName ); }, text: function( elem ) { return "text" === elem.type; }, radio: function( elem ) { return "radio" === elem.type; }, checkbox: function( elem ) { return "checkbox" === elem.type; }, file: function( elem ) { return "file" === elem.type; }, password: function( elem ) { return "password" === elem.type; }, submit: function( elem ) { return "submit" === elem.type; }, image: function( elem ) { return "image" === elem.type; }, reset: function( elem ) { return "reset" === elem.type; }, button: function( elem ) { return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; }, input: function( elem ) { return (/input|select|textarea|button/i).test( elem.nodeName ); } }, setFilters: { first: function( elem, i ) { return i === 0; }, last: function( elem, i, match, array ) { return i === array.length - 1; }, even: function( elem, i ) { return i % 2 === 0; }, odd: function( elem, i ) { return i % 2 === 1; }, lt: function( elem, i, match ) { return i < match[3] - 0; }, gt: function( elem, i, match ) { return i > match[3] - 0; }, nth: function( elem, i, match ) { return match[3] - 0 === i; }, eq: function( elem, i, match ) { return match[3] - 0 === i; } }, filter: { PSEUDO: function( elem, match, i, array ) { var name = match[1], filter = Expr.filters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } else if ( name === "contains" ) { return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; for ( var j = 0, l = not.length; j < l; j++ ) { if ( not[j] === elem ) { return false; } } return true; } else { Sizzle.error( name ); } }, CHILD: function( elem, match ) { var type = match[1], node = elem; switch ( type ) { case "only": case "first": while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) { return false; } } if ( type === "first" ) { return true; } node = elem; case "last": while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) { return false; } } return true; case "nth": var first = match[2], last = match[3]; if ( first === 1 && last === 0 ) { return true; } var doneName = match[0], parent = elem.parentNode; if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { var count = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { node.nodeIndex = ++count; } } parent.sizcache = doneName; } var diff = elem.nodeIndex - last; if ( first === 0 ) { return diff === 0; } else { return ( diff % first === 0 && diff / first >= 0 ); } } }, ID: function( elem, match ) { return elem.nodeType === 1 && elem.getAttribute("id") === match; }, TAG: function( elem, match ) { return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; }, CLASS: function( elem, match ) { return (" " + (elem.className || elem.getAttribute("class")) + " ") .indexOf( match ) > -1; }, ATTR: function( elem, match ) { var name = match[1], result = Expr.attrHandle[ name ] ? Expr.attrHandle[ name ]( elem ) : elem[ name ] != null ? elem[ name ] : elem.getAttribute( name ), value = result + "", type = match[2], check = match[4]; return result == null ? type === "!=" : type === "=" ? value === check : type === "*=" ? value.indexOf(check) >= 0 : type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? value && result !== false : type === "!=" ? value !== check : type === "^=" ? value.indexOf(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check : type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-" : false; }, POS: function( elem, match, i, array ) { var name = match[2], filter = Expr.setFilters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } } } }; var origPOS = Expr.match.POS, fescape = function(all, num){ return "\\" + (num - 0 + 1); }; for ( var type in Expr.match ) { Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); } var makeArray = function( array, results ) { array = Array.prototype.slice.call( array, 0 ); if ( results ) { results.push.apply( results, array ); return results; } return array; }; // Perform a simple check to determine if the browser is capable of // converting a NodeList to an array using builtin methods. // Also verifies that the returned array holds DOM nodes // (which is not the case in the Blackberry browser) try { Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; // Provide a fallback method if it does not work } catch( e ) { makeArray = function( array, results ) { var i = 0, ret = results || []; if ( toString.call(array) === "[object Array]" ) { Array.prototype.push.apply( ret, array ); } else { if ( typeof array.length === "number" ) { for ( var l = array.length; i < l; i++ ) { ret.push( array[i] ); } } else { for ( ; array[i]; i++ ) { ret.push( array[i] ); } } } return ret; }; } var sortOrder, siblingCheck; if ( document.documentElement.compareDocumentPosition ) { sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; return 0; } if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { return a.compareDocumentPosition ? -1 : 1; } return a.compareDocumentPosition(b) & 4 ? -1 : 1; }; } else { sortOrder = function( a, b ) { var al, bl, ap = [], bp = [], aup = a.parentNode, bup = b.parentNode, cur = aup; // The nodes are identical, we can exit early if ( a === b ) { hasDuplicate = true; return 0; // If the nodes are siblings (or identical) we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); // If no parents were found then the nodes are disconnected } else if ( !aup ) { return -1; } else if ( !bup ) { return 1; } // Otherwise they're somewhere else in the tree so we need // to build up a full list of the parentNodes for comparison while ( cur ) { ap.unshift( cur ); cur = cur.parentNode; } cur = bup; while ( cur ) { bp.unshift( cur ); cur = cur.parentNode; } al = ap.length; bl = bp.length; // Start walking down the tree looking for a discrepancy for ( var i = 0; i < al && i < bl; i++ ) { if ( ap[i] !== bp[i] ) { return siblingCheck( ap[i], bp[i] ); } } // We ended someplace up the tree so do a sibling check return i === al ? siblingCheck( a, bp[i], -1 ) : siblingCheck( ap[i], b, 1 ); }; siblingCheck = function( a, b, ret ) { if ( a === b ) { return ret; } var cur = a.nextSibling; while ( cur ) { if ( cur === b ) { return -1; } cur = cur.nextSibling; } return 1; }; } // Utility function for retreiving the text value of an array of DOM nodes Sizzle.getText = function( elems ) { var ret = "", elem; for ( var i = 0; elems[i]; i++ ) { elem = elems[i]; // Get the text from text nodes and CDATA nodes if ( elem.nodeType === 3 || elem.nodeType === 4 ) { ret += elem.nodeValue; // Traverse everything else, except comment nodes } else if ( elem.nodeType !== 8 ) { ret += Sizzle.getText( elem.childNodes ); } } return ret; }; // Check to see if the browser returns elements by name when // querying by getElementById (and provide a workaround) (function(){ // We're going to inject a fake input element with a specified name var form = document.createElement("div"), id = "script" + (new Date()).getTime(), root = document.documentElement; form.innerHTML = "<a name='" + id + "'/>"; // Inject it into the root element, check its status, and remove it quickly root.insertBefore( form, root.firstChild ); // The workaround has to do additional checks after a getElementById // Which slows things down for other browsers (hence the branching) if ( document.getElementById( id ) ) { Expr.find.ID = function( match, context, isXML ) { if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; } }; Expr.filter.ID = function( elem, match ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return elem.nodeType === 1 && node && node.nodeValue === match; }; } root.removeChild( form ); // release memory in IE root = form = null; })(); (function(){ // Check to see if the browser returns only elements // when doing getElementsByTagName("*") // Create a fake element var div = document.createElement("div"); div.appendChild( document.createComment("") ); // Make sure no comments are found if ( div.getElementsByTagName("*").length > 0 ) { Expr.find.TAG = function( match, context ) { var results = context.getElementsByTagName( match[1] ); // Filter out possible comments if ( match[1] === "*" ) { var tmp = []; for ( var i = 0; results[i]; i++ ) { if ( results[i].nodeType === 1 ) { tmp.push( results[i] ); } } results = tmp; } return results; }; } // Check to see if an attribute returns normalized href attributes div.innerHTML = "<a href='#'></a>"; if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && div.firstChild.getAttribute("href") !== "#" ) { Expr.attrHandle.href = function( elem ) { return elem.getAttribute( "href", 2 ); }; } // release memory in IE div = null; })(); if ( document.querySelectorAll ) { (function(){ var oldSizzle = Sizzle, div = document.createElement("div"), id = "__sizzle__"; div.innerHTML = "<p class='TEST'></p>"; // Safari can't handle uppercase or unicode characters when // in quirks mode. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { return; } Sizzle = function( query, context, extra, seed ) { context = context || document; // Only use querySelectorAll on non-XML documents // (ID selectors don't work in non-HTML documents) if ( !seed && !Sizzle.isXML(context) ) { // See if we find a selector to speed up var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { // Speed-up: Sizzle("TAG") if ( match[1] ) { return makeArray( context.getElementsByTagName( query ), extra ); // Speed-up: Sizzle(".CLASS") } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { return makeArray( context.getElementsByClassName( match[2] ), extra ); } } if ( context.nodeType === 9 ) { // Speed-up: Sizzle("body") // The body element only exists once, optimize finding it if ( query === "body" && context.body ) { return makeArray( [ context.body ], extra ); // Speed-up: Sizzle("#ID") } else if ( match && match[3] ) { var elem = context.getElementById( match[3] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id === match[3] ) { return makeArray( [ elem ], extra ); } } else { return makeArray( [], extra ); } } try { return makeArray( context.querySelectorAll(query), extra ); } catch(qsaError) {} // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { var old = context.getAttribute( "id" ), nid = old || id, hasParent = context.parentNode, relativeHierarchySelector = /^\s*[+~]/.test( query ); if ( !old ) { context.setAttribute( "id", nid ); } else { nid = nid.replace( /'/g, "\\$&" ); } if ( relativeHierarchySelector && hasParent ) { context = context.parentNode; } try { if ( !relativeHierarchySelector || hasParent ) { return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); } } catch(pseudoError) { } finally { if ( !old ) { context.removeAttribute( "id" ); } } } } return oldSizzle(query, context, extra, seed); }; for ( var prop in oldSizzle ) { Sizzle[ prop ] = oldSizzle[ prop ]; } // release memory in IE div = null; })(); } (function(){ var html = document.documentElement, matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector, pseudoWorks = false; try { // This should fail with an exception // Gecko does not error, returns false instead matches.call( document.documentElement, "[test!='']:sizzle" ); } catch( pseudoError ) { pseudoWorks = true; } if ( matches ) { Sizzle.matchesSelector = function( node, expr ) { // Make sure that attribute selectors are quoted expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); if ( !Sizzle.isXML( node ) ) { try { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { return matches.call( node, expr ); } } catch(e) {} } return Sizzle(expr, null, null, [node]).length > 0; }; } })(); (function(){ var div = document.createElement("div"); div.innerHTML = "<div class='test e'></div><div class='test'></div>"; // Opera can't find a second classname (in 9.6) // Also, make sure that getElementsByClassName actually exists if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { return; } // Safari caches class attributes, doesn't catch changes (in 3.2) div.lastChild.className = "e"; if ( div.getElementsByClassName("e").length === 1 ) { return; } Expr.order.splice(1, 0, "CLASS"); Expr.find.CLASS = function( match, context, isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { return context.getElementsByClassName(match[1]); } }; // release memory in IE div = null; })(); function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var match = false; elem = elem[dir]; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 && !isXML ){ elem.sizcache = doneName; elem.sizset = i; } if ( elem.nodeName.toLowerCase() === cur ) { match = elem; break; } elem = elem[dir]; } checkSet[i] = match; } } } function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var match = false; elem = elem[dir]; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 ) { if ( !isXML ) { elem.sizcache = doneName; elem.sizset = i; } if ( typeof cur !== "string" ) { if ( elem === cur ) { match = true; break; } } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { match = elem; break; } } elem = elem[dir]; } checkSet[i] = match; } } } if ( document.documentElement.contains ) { Sizzle.contains = function( a, b ) { return a !== b && (a.contains ? a.contains(b) : true); }; } else if ( document.documentElement.compareDocumentPosition ) { Sizzle.contains = function( a, b ) { return !!(a.compareDocumentPosition(b) & 16); }; } else { Sizzle.contains = function() { return false; }; } Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; var posProcess = function( selector, context ) { var match, tmpSet = [], later = "", root = context.nodeType ? [context] : context; // Position selectors must be done after the filter // And so must :not(positional) so we move all PSEUDOs to the end while ( (match = Expr.match.PSEUDO.exec( selector )) ) { later += match[0]; selector = selector.replace( Expr.match.PSEUDO, "" ); } selector = Expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { Sizzle( selector, root[i], tmpSet ); } return Sizzle.filter( later, tmpSet ); }; // EXPOSE jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; })(); var runtil = /Until$/, rparentsprev = /^(?:parents|prevUntil|prevAll)/, // Note: This RegExp should be improved, or likely pulled from Sizzle rmultiselector = /,/, isSimple = /^.[^:#\[\.,]*$/, slice = Array.prototype.slice, POS = jQuery.expr.match.POS, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function( selector ) { var ret = this.pushStack( "", "find", selector ), length = 0; for ( var i = 0, l = this.length; i < l; i++ ) { length = ret.length; jQuery.find( selector, this[i], ret ); if ( i > 0 ) { // Make sure that the results are unique for ( var n = length; n < ret.length; n++ ) { for ( var r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function( target ) { var targets = jQuery( target ); return this.filter(function() { for ( var i = 0, l = targets.length; i < l; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushStack( winnow(this, selector, false), "not", selector); }, filter: function( selector ) { return this.pushStack( winnow(this, selector, true), "filter", selector ); }, is: function( selector ) { return !!selector && jQuery.filter( selector, this ).length > 0; }, closest: function( selectors, context ) { var ret = [], i, l, cur = this[0]; if ( jQuery.isArray( selectors ) ) { var match, selector, matches = {}, level = 1; if ( cur && selectors.length ) { for ( i = 0, l = selectors.length; i < l; i++ ) { selector = selectors[i]; if ( !matches[selector] ) { matches[selector] = jQuery.expr.match.POS.test( selector ) ? jQuery( selector, context || this.context ) : selector; } } while ( cur && cur.ownerDocument && cur !== context ) { for ( selector in matches ) { match = matches[selector]; if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { ret.push({ selector: selector, elem: cur, level: level }); } } cur = cur.parentNode; level++; } } return ret; } var pos = POS.test( selectors ) ? jQuery( selectors, context || this.context ) : null; for ( i = 0, l = this.length; i < l; i++ ) { cur = this[i]; while ( cur ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } else { cur = cur.parentNode; if ( !cur || !cur.ownerDocument || cur === context ) { break; } } } } ret = ret.length > 1 ? jQuery.unique(ret) : ret; return this.pushStack( ret, "closest", selectors ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { if ( !elem || typeof elem === "string" ) { return jQuery.inArray( this[0], // If it receives a string, the selector is used // If it receives nothing, the siblings are used elem ? jQuery( elem ) : this.parent().children() ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context ) : jQuery.makeArray( selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? all : jQuery.unique( all ) ); }, andSelf: function() { return this.add( this.prevObject ); } }); // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected( node ) { return !node || !node.parentNode || node.parentNode.nodeType === 11; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return jQuery.nth( elem, 2, "nextSibling" ); }, prev: function( elem ) { return jQuery.nth( elem, 2, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( elem.parentNode.firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.makeArray( elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ), // The variable 'args' was introduced in // https://github.com/jquery/jquery/commit/52a0238 // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. // http://code.google.com/p/v8/issues/detail?id=1050 args = slice.call(arguments); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushStack( ret, name, args.join(",") ); }; }); jQuery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, nth: function( cur, result, dir, elem ) { result = result || 1; var num = 0; for ( ; cur; cur = cur[dir] ) { if ( cur.nodeType === 1 && ++num === result ) { break; } } return cur; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return (elem === qualifier) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem, i ) { return (jQuery.inArray( elem, qualifier ) >= 0) === keep; }); } var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, rtagName = /<([\w:]+)/, rtbody = /<tbody/i, rhtml = /<|&#?\w+;/, rnocache = /<(?:script|object|embed|option|style)/i, // checked="checked" or checked (html5) rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], thead: [ 1, "<table>", "</table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], area: [ 1, "<map>", "</map>" ], _default: [ 0, "", "" ] }; wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // IE can't serialize <link> and <script> tags normally if ( !jQuery.support.htmlSerialize ) { wrapMap._default = [ 1, "div<div>", "</div>" ]; } jQuery.fn.extend({ text: function( text ) { if ( jQuery.isFunction(text) ) { return this.each(function(i) { var self = jQuery( this ); self.text( text.call(this, i, self.text()) ); }); } if ( typeof text !== "object" && text !== undefined ) { return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); } return jQuery.text( this ); }, wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapAll( html.call(this, i) ); }); } if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { elem = elem.firstChild; } return elem; }).append(this); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapInner( html.call(this, i) ); }); } return this.each(function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } }); }, wrap: function( html ) { return this.each(function() { jQuery( this ).wrapAll( html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } }).end(); }, append: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 ) { this.appendChild( elem ); } }); }, prepend: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 ) { this.insertBefore( elem, this.firstChild ); } }); }, before: function() { if ( this[0] && this[0].parentNode ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this ); }); } else if ( arguments.length ) { var set = jQuery(arguments[0]); set.push.apply( set, this.toArray() ); return this.pushStack( set, "before", arguments ); } }, after: function() { if ( this[0] && this[0].parentNode ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this.nextSibling ); }); } else if ( arguments.length ) { var set = this.pushStack( this, "after", arguments ); set.push.apply( set, jQuery(arguments[0]).toArray() ); return set; } }, // keepData is for internal use only--do not document remove: function( selector, keepData ) { for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); jQuery.cleanData( [ elem ] ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } } } return this; }, empty: function() { for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? true : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function () { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { if ( value === undefined ) { return this[0] && this[0].nodeType === 1 ? this[0].innerHTML.replace(rinlinejQuery, "") : null; // See if we can take a shortcut and just use innerHTML } else if ( typeof value === "string" && !rnocache.test( value ) && (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { value = value.replace(rxhtmlTag, "<$1></$2>"); try { for ( var i = 0, l = this.length; i < l; i++ ) { // Remove element nodes and prevent memory leaks if ( this[i].nodeType === 1 ) { jQuery.cleanData( this[i].getElementsByTagName("*") ); this[i].innerHTML = value; } } // If using innerHTML throws an exception, use the fallback method } catch(e) { this.empty().append( value ); } } else if ( jQuery.isFunction( value ) ) { this.each(function(i){ var self = jQuery( this ); self.html( value.call(this, i, self.html()) ); }); } else { this.empty().append( value ); } return this; }, replaceWith: function( value ) { if ( this[0] && this[0].parentNode ) { // Make sure that the elements are removed from the DOM before they are inserted // this can help fix replacing a parent with child elements if ( jQuery.isFunction( value ) ) { return this.each(function(i) { var self = jQuery(this), old = self.html(); self.replaceWith( value.call( this, i, old ) ); }); } if ( typeof value !== "string" ) { value = jQuery( value ).detach(); } return this.each(function() { var next = this.nextSibling, parent = this.parentNode; jQuery( this ).remove(); if ( next ) { jQuery(next).before( value ); } else { jQuery(parent).append( value ); } }); } else { return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ); } }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, table, callback ) { var results, first, fragment, parent, value = args[0], scripts = []; // We can't cloneNode fragments that contain checked, in WebKit if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { return this.each(function() { jQuery(this).domManip( args, table, callback, true ); }); } if ( jQuery.isFunction(value) ) { return this.each(function(i) { var self = jQuery(this); args[0] = value.call(this, i, table ? self.html() : undefined); self.domManip( args, table, callback ); }); } if ( this[0] ) { parent = value && value.parentNode; // If we're in a fragment, just use that instead of building a new one if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { results = { fragment: parent }; } else { results = jQuery.buildFragment( args, this, scripts ); } fragment = results.fragment; if ( fragment.childNodes.length === 1 ) { first = fragment = fragment.firstChild; } else { first = fragment.firstChild; } if ( first ) { table = table && jQuery.nodeName( first, "tr" ); for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { callback.call( table ? root(this[i], first) : this[i], // Make sure that we do not leak memory by inadvertently discarding // the original fragment (which might have attached data) instead of // using it; in addition, use the original fragment object for the last // item instead of first because it can end up being emptied incorrectly // in certain situations (Bug #8070). // Fragments from the fragment cache must always be cloned and never used // in place. results.cacheable || (l > 1 && i < lastIndex) ? jQuery.clone( fragment, true, true ) : fragment ); } } if ( scripts.length ) { jQuery.each( scripts, evalScript ); } } return this; } }); function root( elem, cur ) { return jQuery.nodeName(elem, "table") ? (elem.getElementsByTagName("tbody")[0] || elem.appendChild(elem.ownerDocument.createElement("tbody"))) : elem; } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var internalKey = jQuery.expando, oldData = jQuery.data( src ), curData = jQuery.data( dest, oldData ); // Switch to use the internal data object, if it exists, for the next // stage of data copying if ( (oldData = oldData[ internalKey ]) ) { var events = oldData.events; curData = curData[ internalKey ] = jQuery.extend({}, oldData); if ( events ) { delete curData.handle; curData.events = {}; for ( var type in events ) { for ( var i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ], events[ type ][ i ].data ); } } } } } function cloneFixAttributes(src, dest) { // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } var nodeName = dest.nodeName.toLowerCase(); // clearAttributes removes the attributes, which we don't want, // but also removes the attachEvent events, which we *do* want dest.clearAttributes(); // mergeAttributes, in contrast, only merges back on the // original attributes, not the events dest.mergeAttributes(src); // IE6-8 fail to clone children inside object elements that use // the proprietary classid attribute value (rather than the type // attribute) to identify the type of content to display if ( nodeName === "object" ) { dest.outerHTML = src.outerHTML; } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set if ( src.checked ) { dest.defaultChecked = dest.checked = src.checked; } // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } // Event data gets referenced instead of copied if the expando // gets copied too dest.removeAttribute( jQuery.expando ); } jQuery.buildFragment = function( args, nodes, scripts ) { var fragment, cacheable, cacheresults, doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); // Only cache "small" (1/2 KB) HTML strings that are associated with the main document // Cloning options loses the selected state, so don't cache them // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { cacheable = true; cacheresults = jQuery.fragments[ args[0] ]; if ( cacheresults ) { if ( cacheresults !== 1 ) { fragment = cacheresults; } } } if ( !fragment ) { fragment = doc.createDocumentFragment(); jQuery.clean( args, doc, fragment, scripts ); } if ( cacheable ) { jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; } return { fragment: fragment, cacheable: cacheable }; }; jQuery.fragments = {}; jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var ret = [], insert = jQuery( selector ), parent = this.length === 1 && this[0].parentNode; if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { insert[ original ]( this[0] ); return this; } else { for ( var i = 0, l = insert.length; i < l; i++ ) { var elems = (i > 0 ? this.clone(true) : this).get(); jQuery( insert[i] )[ original ]( elems ); ret = ret.concat( elems ); } return this.pushStack( ret, name, insert.selector ); } }; }); jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var clone = elem.cloneNode(true), srcElements, destElements, i; if ( !jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { // IE copies events bound via attachEvent when using cloneNode. // Calling detachEvent on the clone will also remove the events // from the original. In order to get around this, we use some // proprietary methods to clear the events. Thanks to MooTools // guys for this hotness. // Using Sizzle here is crazy slow, so we use getElementsByTagName // instead srcElements = elem.getElementsByTagName("*"); destElements = clone.getElementsByTagName("*"); // Weird iteration because IE will replace the length property // with an element if you are cloning the body and one of the // elements on the page has a name or id of "length" for ( i = 0; srcElements[i]; ++i ) { cloneFixAttributes( srcElements[i], destElements[i] ); } cloneFixAttributes( elem, clone ); } // Copy the events from the original to the clone if ( dataAndEvents ) { cloneCopyEvent( elem, clone ); if ( deepDataAndEvents && "getElementsByTagName" in elem ) { srcElements = elem.getElementsByTagName("*"); destElements = clone.getElementsByTagName("*"); if ( srcElements.length ) { for ( i = 0; srcElements[i]; ++i ) { cloneCopyEvent( srcElements[i], destElements[i] ); } } } } // Return the cloned set return clone; }, clean: function( elems, context, fragment, scripts ) { context = context || document; // !context.createElement fails in IE with an error but returns typeof 'object' if ( typeof context.createElement === "undefined" ) { context = context.ownerDocument || context[0] && context[0].ownerDocument || document; } var ret = []; for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { if ( typeof elem === "number" ) { elem += ""; } if ( !elem ) { continue; } // Convert html string into DOM nodes if ( typeof elem === "string" && !rhtml.test( elem ) ) { elem = context.createTextNode( elem ); } else if ( typeof elem === "string" ) { // Fix "XHTML"-style tags in all browsers elem = elem.replace(rxhtmlTag, "<$1></$2>"); // Trim whitespace, otherwise indexOf won't work as expected var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), wrap = wrapMap[ tag ] || wrapMap._default, depth = wrap[0], div = context.createElement("div"); // Go to html and back, then peel off extra wrappers div.innerHTML = wrap[1] + elem + wrap[2]; // Move to the right depth while ( depth-- ) { div = div.lastChild; } // Remove IE's autoinserted <tbody> from table fragments if ( !jQuery.support.tbody ) { // String was a <table>, *may* have spurious <tbody> var hasBody = rtbody.test(elem), tbody = tag === "table" && !hasBody ? div.firstChild && div.firstChild.childNodes : // String was a bare <thead> or <tfoot> wrap[1] === "<table>" && !hasBody ? div.childNodes : []; for ( var j = tbody.length - 1; j >= 0 ; --j ) { if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { tbody[ j ].parentNode.removeChild( tbody[ j ] ); } } } // IE completely kills leading whitespace when innerHTML is used if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); } elem = div.childNodes; } if ( elem.nodeType ) { ret.push( elem ); } else { ret = jQuery.merge( ret, elem ); } } if ( fragment ) { for ( i = 0; ret[i]; i++ ) { if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); } else { if ( ret[i].nodeType === 1 ) { ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); } fragment.appendChild( ret[i] ); } } } return ret; }, cleanData: function( elems ) { var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special, deleteExpando = jQuery.support.deleteExpando; for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { continue; } id = elem[ jQuery.expando ]; if ( id ) { data = cache[ id ] && cache[ id ][ internalKey ]; if ( data && data.events ) { for ( var type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } // Null the DOM reference to avoid IE6/7/8 leak (#7054) if ( data.handle ) { data.handle.elem = null; } } if ( deleteExpando ) { delete elem[ jQuery.expando ]; } else if ( elem.removeAttribute ) { elem.removeAttribute( jQuery.expando ); } delete cache[ id ]; } } } }); function evalScript( i, elem ) { if ( elem.src ) { jQuery.ajax({ url: elem.src, async: false, dataType: "script" }); } else { jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } } var ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, rdashAlpha = /-([a-z])/ig, rupper = /([A-Z])/g, rnumpx = /^-?\d+(?:px)?$/i, rnum = /^-?\d/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssWidth = [ "Left", "Right" ], cssHeight = [ "Top", "Bottom" ], curCSS, getComputedStyle, currentStyle, fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn.css = function( name, value ) { // Setting 'undefined' is a no-op if ( arguments.length === 2 && value === undefined ) { return this; } return jQuery.access( this, name, value, true, function( elem, name, value ) { return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }); }; jQuery.extend({ // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // We should always get a number back from opacity var ret = curCSS( elem, "opacity", "opacity" ); return ret === "" ? "1" : ret; } else { return elem.style.opacity; } } } }, // Exclude the following css properties to add px cssNumber: { "zIndex": true, "fontWeight": true, "opacity": true, "zoom": true, "lineHeight": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { // normalize float css property "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" }, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } // Make sure that we're working with the right name var ret, origName = jQuery.camelCase( name ), style = elem.style, hooks = jQuery.cssHooks[ origName ]; name = jQuery.cssProps[ origName ] || origName; // Check if we're setting a value if ( value !== undefined ) { // Make sure that NaN and null values aren't set. See: #7116 if ( typeof value === "number" && isNaN( value ) || value == null ) { return; } // If a number was passed in, add 'px' to the (except for certain CSS properties) if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) { value += "px"; } // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) { // Wrapped to prevent IE from throwing errors when 'invalid' values are provided // Fixes bug #5509 try { style[ name ] = value; } catch(e) {} } } else { // If a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { return ret; } // Otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, extra ) { // Make sure that we're working with the right name var ret, origName = jQuery.camelCase( name ), hooks = jQuery.cssHooks[ origName ]; name = jQuery.cssProps[ origName ] || origName; // If a hook was provided get the computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { return ret; // Otherwise, if a way to get the computed value exists, use that } else if ( curCSS ) { return curCSS( elem, name, origName ); } }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { var old = {}; // Remember the old values, and insert the new ones for ( var name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } callback.call( elem ); // Revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } }, camelCase: function( string ) { return string.replace( rdashAlpha, fcamelCase ); } }); // DEPRECATED, Use jQuery.css() instead jQuery.curCSS = jQuery.css; jQuery.each(["height", "width"], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { var val; if ( computed ) { if ( elem.offsetWidth !== 0 ) { val = getWH( elem, name, extra ); } else { jQuery.swap( elem, cssShow, function() { val = getWH( elem, name, extra ); }); } if ( val <= 0 ) { val = curCSS( elem, name, name ); if ( val === "0px" && currentStyle ) { val = currentStyle( elem, name, name ); } if ( val != null ) { // Should return "auto" instead of 0, use 0 for // temporary backwards-compat return val === "" || val === "auto" ? "0px" : val; } } if ( val < 0 || val == null ) { val = elem.style[ name ]; // Should return "auto" instead of 0, use 0 for // temporary backwards-compat return val === "" || val === "auto" ? "0px" : val; } return typeof val === "string" ? val : val + "px"; } }, set: function( elem, value ) { if ( rnumpx.test( value ) ) { // ignore negative width and height values #1599 value = parseFloat(value); if ( value >= 0 ) { return value + "px"; } } else { return value; } } }; }); if ( !jQuery.support.opacity ) { jQuery.cssHooks.opacity = { get: function( elem, computed ) { // IE uses filters for opacity return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? (parseFloat(RegExp.$1) / 100) + "" : computed ? "1" : ""; }, set: function( elem, value ) { var style = elem.style; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level style.zoom = 1; // Set the alpha filter to set the opacity var opacity = jQuery.isNaN(value) ? "" : "alpha(opacity=" + value * 100 + ")", filter = style.filter || ""; style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : style.filter + ' ' + opacity; } }; } if ( document.defaultView && document.defaultView.getComputedStyle ) { getComputedStyle = function( elem, newName, name ) { var ret, defaultView, computedStyle; name = name.replace( rupper, "-$1" ).toLowerCase(); if ( !(defaultView = elem.ownerDocument.defaultView) ) { return undefined; } if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) { ret = computedStyle.getPropertyValue( name ); if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { ret = jQuery.style( elem, name ); } } return ret; }; } if ( document.documentElement.currentStyle ) { currentStyle = function( elem, name ) { var left, ret = elem.currentStyle && elem.currentStyle[ name ], rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ], style = elem.style; // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { // Remember the original values left = style.left; // Put in the new values to get a computed value out if ( rsLeft ) { elem.runtimeStyle.left = elem.currentStyle.left; } style.left = name === "fontSize" ? "1em" : (ret || 0); ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; if ( rsLeft ) { elem.runtimeStyle.left = rsLeft; } } return ret === "" ? "auto" : ret; }; } curCSS = getComputedStyle || currentStyle; function getWH( elem, name, extra ) { var which = name === "width" ? cssWidth : cssHeight, val = name === "width" ? elem.offsetWidth : elem.offsetHeight; if ( extra === "border" ) { return val; } jQuery.each( which, function() { if ( !extra ) { val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0; } if ( extra === "margin" ) { val += parseFloat(jQuery.css( elem, "margin" + this )) || 0; } else { val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0; } }); return val; } if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.hidden = function( elem ) { var width = elem.offsetWidth, height = elem.offsetHeight; return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { return !jQuery.expr.filters.hidden( elem ); }; } var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rhash = /#.*$/, rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rquery = /\?/, rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, rselectTextarea = /^(?:select|textarea)/i, rspacesAjax = /\s+/, rts = /([?&])_=[^&]*/, rurl = /^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/, // Keep a copy of the old load method _load = jQuery.fn.load, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } if ( jQuery.isFunction( func ) ) { var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ), i = 0, length = dataTypes.length, dataType, list, placeBefore; // For each dataType in the dataTypeExpression for(; i < length; i++ ) { dataType = dataTypes[ i ]; // We control if we're asked to add before // any existing element placeBefore = /^\+/.test( dataType ); if ( placeBefore ) { dataType = dataType.substr( 1 ) || "*"; } list = structure[ dataType ] = structure[ dataType ] || []; // then we add to the structure accordingly list[ placeBefore ? "unshift" : "push" ]( func ); } } }; } //Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jXHR, dataType /* internal */, inspected /* internal */ ) { dataType = dataType || options.dataTypes[ 0 ]; inspected = inspected || {}; inspected[ dataType ] = true; var list = structure[ dataType ], i = 0, length = list ? list.length : 0, executeOnly = ( structure === prefilters ), selection; for(; i < length && ( executeOnly || !selection ); i++ ) { selection = list[ i ]( options, originalOptions, jXHR ); // If we got redirected to another dataType // we try there if not done already if ( typeof selection === "string" ) { if ( inspected[ selection ] ) { selection = undefined; } else { options.dataTypes.unshift( selection ); selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jXHR, selection, inspected ); } } } // If we're only executing or nothing was selected // we try the catchall dataType if not done already if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jXHR, "*", inspected ); } // unnecessary when only executing (prefilters) // but it'll be ignored by the caller in that case return selection; } jQuery.fn.extend({ load: function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); // Don't do a request if no elements are being requested } else if ( !this.length ) { return this; } var off = url.indexOf( " " ); if ( off >= 0 ) { var selector = url.slice( off, url.length ); url = url.slice( 0, off ); } // Default to a GET request var type = "GET"; // If the second parameter was provided if ( params ) { // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = null; // Otherwise, build a param string } else if ( typeof params === "object" ) { params = jQuery.param( params, jQuery.ajaxSettings.traditional ); type = "POST"; } } var self = this; // Request the remote document jQuery.ajax({ url: url, type: type, dataType: "html", data: params, // Complete callback (responseText is used internally) complete: function( jXHR, status, responseText ) { // Store the response as specified by the jXHR object responseText = jXHR.responseText; // If successful, inject the HTML into all the matched elements if ( jXHR.isResolved() ) { // #4825: Get the actual response in case // a dataFilter is present in ajaxSettings jXHR.done(function( r ) { responseText = r; }); // See if a selector was specified self.html( selector ? // Create a dummy div to hold the results jQuery("<div>") // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE .append(responseText.replace(rscript, "")) // Locate the specified elements .find(selector) : // If not, just inject the full result responseText ); } if ( callback ) { self.each( callback, [ responseText, status, jXHR ] ); } } }); return this; }, serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map(function(){ return this.elements ? jQuery.makeArray( this.elements ) : this; }) .filter(function(){ return this.name && !this.disabled && ( this.checked || rselectTextarea.test( this.nodeName ) || rinput.test( this.type ) ); }) .map(function( i, elem ){ var val = jQuery( this ).val(); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val, i ){ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); } }); // Attach a bunch of functions for handling common AJAX events jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ jQuery.fn[ o ] = function( f ){ return this.bind( o, f ); }; } ); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = null; } return jQuery.ajax({ type: method, url: url, data: data, success: callback, dataType: type }); }; } ); jQuery.extend({ getScript: function( url, callback ) { return jQuery.get( url, null, callback, "script" ); }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, ajaxSetup: function( settings ) { jQuery.extend( true, jQuery.ajaxSettings, settings ); if ( settings.context ) { jQuery.ajaxSettings.context = settings.context; } }, ajaxSettings: { url: location.href, global: true, type: "GET", contentType: "application/x-www-form-urlencoded", processData: true, async: true, /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, traditional: false, headers: {}, crossDomain: null, */ accepts: { xml: "application/xml, text/xml", html: "text/html", text: "text/plain", json: "application/json, text/javascript", "*": "*/*" }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText" }, // List of data converters // 1) key format is "source_type destination_type" (a single space in-between) // 2) the catchall symbol "*" can be used for source_type converters: { // Convert anything to text "* text": window.String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": jQuery.parseJSON, // Parse text as xml "text xml": jQuery.parseXML } }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), // Main method ajax: function( url, options ) { // If options is not an object, // we simulate pre-1.5 signature if ( typeof options !== "object" ) { options = url; url = undefined; } // Force options to be an object options = options || {}; var // Create the final options object s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ), // Callbacks contexts // We force the original context if it exists // or take it from jQuery.ajaxSettings otherwise // (plain objects used as context get extended) callbackContext = ( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s, globalEventContext = callbackContext === s ? jQuery.event : jQuery( callbackContext ), // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery._Deferred(), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, // Response headers responseHeadersString, responseHeaders, // transport transport, // timeout handle timeoutTimer, // Cross-domain detection vars loc = document.location, protocol = loc.protocol || "http:", parts, // The jXHR state state = 0, // Loop variable i, // Fake xhr jXHR = { readyState: 0, // Caches the header setRequestHeader: function( name, value ) { if ( state === 0 ) { requestHeaders[ name.toLowerCase() ] = value; } return this; }, // Raw string getAllResponseHeaders: function() { return state === 2 ? responseHeadersString : null; }, // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; while( ( match = rheaders.exec( responseHeadersString ) ) ) { responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match || null; }, // Cancel the request abort: function( statusText ) { statusText = statusText || "abort"; if ( transport ) { transport.abort( statusText ); } done( 0, statusText ); return this; } }; // Callback for when everything is done // It is defined here because jslint complains if it is declared // at the end of the function (which would be more logical and readable) function done( status, statusText, responses, headers) { // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jXHR.readyState = status ? 4 : 0; var isSuccess, success, error, response = responses ? ajaxHandleResponses( s, jXHR, responses ) : undefined, lastModified, etag; // If successful, handle type chaining if ( status >= 200 && status < 300 || status === 304 ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { if ( ( lastModified = jXHR.getResponseHeader( "Last-Modified" ) ) ) { jQuery.lastModified[ s.url ] = lastModified; } if ( ( etag = jXHR.getResponseHeader( "Etag" ) ) ) { jQuery.etag[ s.url ] = etag; } } // If not modified if ( status === 304 ) { statusText = "notmodified"; isSuccess = true; // If we have data } else { try { success = ajaxConvert( s, response ); statusText = "success"; isSuccess = true; } catch(e) { // We have a parsererror statusText = "parsererror"; error = e; } } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if( status ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jXHR.status = status; jXHR.statusText = statusText; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jXHR ] ); } else { deferred.rejectWith( callbackContext, [ jXHR, statusText, error ] ); } // Status-dependent callbacks jXHR.statusCode( statusCode ); statusCode = undefined; if ( s.global ) { globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), [ jXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.resolveWith( callbackContext, [ jXHR, statusText ] ); if ( s.global ) { globalEventContext.trigger( "ajaxComplete", [ jXHR, s] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); } } } // Attach deferreds deferred.promise( jXHR ); jXHR.success = jXHR.done; jXHR.error = jXHR.fail; jXHR.complete = completeDeferred.done; // Status-dependent callbacks jXHR.statusCode = function( map ) { if ( map ) { var tmp; if ( state < 2 ) { for( tmp in map ) { statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; } } else { tmp = map[ jXHR.status ]; jXHR.then( tmp, tmp ); } } return this; }; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) // We also use the url parameter if available s.url = ( "" + ( url || s.url ) ).replace( rhash, "" ).replace( rprotocol, protocol + "//" ); // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); // Determine if a cross-domain request is in order if ( !s.crossDomain ) { parts = rurl.exec( s.url.toLowerCase() ); s.crossDomain = !!( parts && ( parts[ 1 ] != protocol || parts[ 2 ] != loc.hostname || ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != ( loc.port || ( protocol === "http:" ? 80 : 443 ) ) ) ); } // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } // Apply prefilters inspectPrefiltersOrTransports( prefilters, s, options, jXHR ); // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); // Watch for a new set of requests if ( s.global && jQuery.active++ === 0 ) { jQuery.event.trigger( "ajaxStart" ); } // More options handling for requests with no content if ( !s.hasContent ) { // If data is available, append data to url if ( s.data ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; } // Add anti-cache in url if needed if ( s.cache === false ) { var ts = jQuery.now(), // try replacing _= if it is there ret = s.url.replace( rts, "$1_=" + ts ); // if nothing was replaced, add timestamp to the end s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { requestHeaders[ "content-type" ] = s.contentType; } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { if ( jQuery.lastModified[ s.url ] ) { requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ s.url ]; } if ( jQuery.etag[ s.url ] ) { requestHeaders[ "if-none-match" ] = jQuery.etag[ s.url ]; } } // Set the Accepts header for the server, depending on the dataType requestHeaders.accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) : s.accepts[ "*" ]; // Check for headers option for ( i in s.headers ) { requestHeaders[ i.toLowerCase() ] = s.headers[ i ]; } // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jXHR, s ) === false || state === 2 ) ) { // Abort if not done already done( 0, "abort" ); // Return false jXHR = false; } else { // Install callbacks on deferreds for ( i in { success: 1, error: 1, complete: 1 } ) { jXHR[ i ]( s[ i ] ); } // Get transport transport = inspectPrefiltersOrTransports( transports, s, options, jXHR ); // If no transport, we auto-abort if ( !transport ) { done( -1, "No Transport" ); } else { // Set state as sending state = jXHR.readyState = 1; // Send global event if ( s.global ) { globalEventContext.trigger( "ajaxSend", [ jXHR, s ] ); } // Timeout if ( s.async && s.timeout > 0 ) { timeoutTimer = setTimeout( function(){ jXHR.abort( "timeout" ); }, s.timeout ); } try { transport.send( requestHeaders, done ); } catch (e) { // Propagate exception as error if not done if ( status < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { jQuery.error( e ); } } } } return jXHR; }, // Serialize an array of form elements or a set of // key/values into a query string param: function( a, traditional ) { var s = [], add = function( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction( value ) ? value() : value; s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray( a ) || a.jquery ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); } ); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( var prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization return s.join( "&" ).replace( r20, "+" ); } }); function buildParams( prefix, obj, traditional, add ) { if ( jQuery.isArray( obj ) && obj.length ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // If array item is non-scalar (array or object), encode its // numeric index to resolve deserialization ambiguity issues. // Note that rack (as of 1.0.0) can't currently deserialize // nested arrays properly, and attempting to do so may cause // a server error. Possible fixes are to modify rack's // deserialization algorithm or to provide an option or flag // to force array serialization to be shallow. buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add ); } }); } else if ( !traditional && obj != null && typeof obj === "object" ) { // If we see an array here, it is empty and should be treated as an empty // object if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) { add( prefix, "" ); // Serialize object item. } else { jQuery.each( obj, function( k, v ) { buildParams( prefix + "[" + k + "]", v, traditional, add ); }); } } else { // Serialize scalar item. add( prefix, obj ); } } // This is still on the jQuery object... for now // Want to move this to jQuery.ajax some day jQuery.extend({ // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {} }); /* Handles responses to an ajax request: * - sets all responseXXX fields accordingly * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jXHR, responses ) { var contents = s.contents, dataTypes = s.dataTypes, responseFields = s.responseFields, ct, type, finalDataType, firstDataType; // Fill responseXXX fields for( type in responseFields ) { if ( type in responses ) { jXHR[ responseFields[type] ] = responses[ type ]; } } // Remove auto dataType and get content-type in the process while( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = jXHR.getResponseHeader( "content-type" ); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } // Chain conversions given the request and the original response function ajaxConvert( s, response ) { // Apply the dataFilter if provided if ( s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } var dataTypes = s.dataTypes, converters = s.converters, i, length = dataTypes.length, tmp, // Current and previous dataTypes current = dataTypes[ 0 ], prev, // Conversion expression conversion, // Conversion function conv, // Conversion functions (transitive conversion) conv1, conv2; // For each dataType in the chain for( i = 1; i < length; i++ ) { // Get the dataTypes prev = current; current = dataTypes[ i ]; // If current is auto dataType, update it to prev if( current === "*" ) { current = prev; // If no auto and dataTypes are actually different } else if ( prev !== "*" && prev !== current ) { // Get the converter conversion = prev + " " + current; conv = converters[ conversion ] || converters[ "* " + current ]; // If there is no direct converter, search transitively if ( !conv ) { conv2 = undefined; for( conv1 in converters ) { tmp = conv1.split( " " ); if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) { conv2 = converters[ tmp[1] + " " + current ]; if ( conv2 ) { conv1 = converters[ conv1 ]; if ( conv1 === true ) { conv = conv2; } else if ( conv2 === true ) { conv = conv1; } break; } } } } // If we found no converter, dispatch an error if ( !( conv || conv2 ) ) { jQuery.error( "No conversion from " + conversion.replace(" "," to ") ); } // If found converter is not an equivalence if ( conv !== true ) { // Convert with 1 or 2 converters accordingly response = conv ? conv( response ) : conv2( conv1(response) ); } } } return response; } var jsc = jQuery.now(), jsre = /(\=)\?(&|$)|()\?\?()/i; // Default jsonp settings jQuery.ajaxSetup({ jsonp: "callback", jsonpCallback: function() { return jQuery.expando + "_" + ( jsc++ ); } }); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) { dataIsString = ( typeof s.data === "string" ); if ( s.dataTypes[ 0 ] === "jsonp" || originalSettings.jsonpCallback || originalSettings.jsonp != null || s.jsonp !== false && ( jsre.test( s.url ) || dataIsString && jsre.test( s.data ) ) ) { var responseContainer, jsonpCallback = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, previous = window[ jsonpCallback ], url = s.url, data = s.data, replace = "$1" + jsonpCallback + "$2"; if ( s.jsonp !== false ) { url = url.replace( jsre, replace ); if ( s.url === url ) { if ( dataIsString ) { data = data.replace( jsre, replace ); } if ( s.data === data ) { // Add callback manually url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; } } } s.url = url; s.data = data; window[ jsonpCallback ] = function( response ) { responseContainer = [ response ]; }; s.complete = [ function() { // Set callback back to previous value window[ jsonpCallback ] = previous; // Call if it was a function and we have a response if ( previous) { if ( responseContainer && jQuery.isFunction( previous ) ) { window[ jsonpCallback ] ( responseContainer[ 0 ] ); } } else { // else, more memory leak avoidance try{ delete window[ jsonpCallback ]; } catch( e ) {} } }, s.complete ]; // Use data converter to retrieve json after script execution s.converters["script json"] = function() { if ( ! responseContainer ) { jQuery.error( jsonpCallback + " was not called" ); } return responseContainer[ 0 ]; }; // force json dataType s.dataTypes[ 0 ] = "json"; // Delegate to script return "script"; } } ); // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript" }, contents: { script: /javascript/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } }); // Handle cache's special case and global jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; s.global = false; } } ); // Bind script tag hack transport jQuery.ajaxTransport( "script", function(s) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement; return { send: function( _, callback ) { script = document.createElement( "script" ); script.async = "async"; if ( s.scriptCharset ) { script.charset = s.scriptCharset; } script.src = s.url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function( _, isAbort ) { if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; // Remove the script if ( head && script.parentNode ) { head.removeChild( script ); } // Dereference the script script = undefined; // Callback if not abort if ( !isAbort ) { callback( 200, "success" ); } } }; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709 and #4378). head.insertBefore( script, head.firstChild ); }, abort: function() { if ( script ) { script.onload( 0, 1 ); } } }; } } ); var // Next active xhr id xhrId = jQuery.now(), // active xhrs xhrs = {}, // #5280: see below xhrUnloadAbortInstalled, // XHR used to determine supports properties testXHR; // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject ? /* Microsoft failed to properly * implement the XMLHttpRequest in IE7 (can't request local files), * so we use the ActiveXObject when it is available * Additionally XMLHttpRequest can be disabled in IE7/IE8 so * we need a fallback. */ function() { if ( window.location.protocol !== "file:" ) { try { return new window.XMLHttpRequest(); } catch( xhrError ) {} } try { return new window.ActiveXObject("Microsoft.XMLHTTP"); } catch( activeError ) {} } : // For all other browsers, use the standard XMLHttpRequest object function() { return new window.XMLHttpRequest(); }; // Test if we can create an xhr object try { testXHR = jQuery.ajaxSettings.xhr(); } catch( xhrCreationException ) {} //Does this browser support XHR requests? jQuery.support.ajax = !!testXHR; // Does this browser support crossDomain XHR requests jQuery.support.cors = testXHR && ( "withCredentials" in testXHR ); // No need for the temporary xhr anymore testXHR = undefined; // Create transport if the browser can provide an xhr if ( jQuery.support.ajax ) { jQuery.ajaxTransport(function( s ) { // Cross domain only allowed if supported through XMLHttpRequest if ( !s.crossDomain || jQuery.support.cors ) { var callback; return { send: function( headers, complete ) { // #5280: we need to abort on unload or IE will keep connections alive if ( !xhrUnloadAbortInstalled ) { xhrUnloadAbortInstalled = 1; jQuery(window).bind( "unload", function() { // Abort all pending requests jQuery.each( xhrs, function( _, xhr ) { if ( xhr.onreadystatechange ) { xhr.onreadystatechange( 1 ); } } ); } ); } // Get a new xhr var xhr = s.xhr(), handle; // Open the socket // Passing null username, generates a login popup on Opera (#2865) if ( s.username ) { xhr.open( s.type, s.url, s.async, s.username, s.password ); } else { xhr.open( s.type, s.url, s.async ); } // Requested-With header // Not set for crossDomain requests with no content // (see why at http://trac.dojotoolkit.org/ticket/9486) // Won't change header if already provided if ( !( s.crossDomain && !s.hasContent ) && !headers["x-requested-with"] ) { headers[ "x-requested-with" ] = "XMLHttpRequest"; } // Need an extra try/catch for cross domain requests in Firefox 3 try { jQuery.each( headers, function( key, value ) { xhr.setRequestHeader( key, value ); } ); } catch( _ ) {} // Do send the request // This may raise an exception which is actually // handled in jQuery.ajax (so no try/catch here) xhr.send( ( s.hasContent && s.data ) || null ); // Listener callback = function( _, isAbort ) { // Was never called and is aborted or complete if ( callback && ( isAbort || xhr.readyState === 4 ) ) { // Only called once callback = 0; // Do not keep as active anymore if ( handle ) { xhr.onreadystatechange = jQuery.noop; delete xhrs[ handle ]; } // If it's an abort if ( isAbort ) { // Abort it manually if needed if ( xhr.readyState !== 4 ) { xhr.abort(); } } else { // Get info var status = xhr.status, statusText, responseHeaders = xhr.getAllResponseHeaders(), responses = {}, xml = xhr.responseXML; // Construct response list if ( xml && xml.documentElement /* #4958 */ ) { responses.xml = xml; } responses.text = xhr.responseText; // Firefox throws an exception when accessing // statusText for faulty cross-domain requests try { statusText = xhr.statusText; } catch( e ) { // We normalize with Webkit giving an empty statusText statusText = ""; } // Filter status for non standard behaviours status = // Opera returns 0 when it should be 304 // Webkit returns 0 for failing cross-domain no matter the real status status === 0 ? ( // Webkit, Firefox: filter out faulty cross-domain requests !s.crossDomain || statusText ? ( // Opera: filter out real aborts #6060 responseHeaders ? 304 : 0 ) : // We assume 302 but could be anything cross-domain related 302 ) : ( // IE sometimes returns 1223 when it should be 204 (see #1450) status == 1223 ? 204 : status ); // Call complete complete( status, statusText, responses, responseHeaders ); } } }; // if we're in sync mode or it's in cache // and has been retrieved directly (IE6 & IE7) // we need to manually fire the callback if ( !s.async || xhr.readyState === 4 ) { callback(); } else { // Add to list of active xhrs handle = xhrId++; xhrs[ handle ] = xhr; xhr.onreadystatechange = callback; } }, abort: function() { if ( callback ) { callback(0,1); } } }; } }); } var elemdisplay = {}, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, timerId, fxAttrs = [ // height animations [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], // width animations [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], // opacity animations [ "opacity" ] ]; jQuery.fn.extend({ show: function( speed, easing, callback ) { var elem, display; if ( speed || speed === 0 ) { return this.animate( genFx("show", 3), speed, easing, callback); } else { for ( var i = 0, j = this.length; i < j; i++ ) { elem = this[i]; display = elem.style.display; // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { display = elem.style.display = ""; } // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if ( display === "" && jQuery.css( elem, "display" ) === "none" ) { jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName)); } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( i = 0; i < j; i++ ) { elem = this[i]; display = elem.style.display; if ( display === "" || display === "none" ) { elem.style.display = jQuery._data(elem, "olddisplay") || ""; } } return this; } }, hide: function( speed, easing, callback ) { if ( speed || speed === 0 ) { return this.animate( genFx("hide", 3), speed, easing, callback); } else { for ( var i = 0, j = this.length; i < j; i++ ) { var display = jQuery.css( this[i], "display" ); if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) { jQuery._data( this[i], "olddisplay", display ); } } // Set the display of the elements in a second loop // to avoid the constant reflow for ( i = 0; i < j; i++ ) { this[i].style.display = "none"; } return this; } }, // Save the old toggle function _toggle: jQuery.fn.toggle, toggle: function( fn, fn2, callback ) { var bool = typeof fn === "boolean"; if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { this._toggle.apply( this, arguments ); } else if ( fn == null || bool ) { this.each(function() { var state = bool ? fn : jQuery(this).is(":hidden"); jQuery(this)[ state ? "show" : "hide" ](); }); } else { this.animate(genFx("toggle", 3), fn, fn2, callback); } return this; }, fadeTo: function( speed, to, easing, callback ) { return this.filter(":hidden").css("opacity", 0).show().end() .animate({opacity: to}, speed, easing, callback); }, animate: function( prop, speed, easing, callback ) { var optall = jQuery.speed(speed, easing, callback); if ( jQuery.isEmptyObject( prop ) ) { return this.each( optall.complete ); } return this[ optall.queue === false ? "each" : "queue" ](function() { // XXX 'this' does not always have a nodeName when running the // test suite var opt = jQuery.extend({}, optall), p, isElement = this.nodeType === 1, hidden = isElement && jQuery(this).is(":hidden"), self = this; for ( p in prop ) { var name = jQuery.camelCase( p ); if ( p !== name ) { prop[ name ] = prop[ p ]; delete prop[ p ]; p = name; } if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) { return opt.complete.call(this); } if ( isElement && ( p === "height" || p === "width" ) ) { // Make sure that nothing sneaks out // Record all 3 overflow attributes because IE does not // change the overflow attribute when overflowX and // overflowY are set to the same value opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; // Set display property to inline-block for height/width // animations on inline elements that are having width/height // animated if ( jQuery.css( this, "display" ) === "inline" && jQuery.css( this, "float" ) === "none" ) { if ( !jQuery.support.inlineBlockNeedsLayout ) { this.style.display = "inline-block"; } else { var display = defaultDisplay(this.nodeName); // inline-level elements accept inline-block; // block-level elements need to be inline with layout if ( display === "inline" ) { this.style.display = "inline-block"; } else { this.style.display = "inline"; this.style.zoom = 1; } } } } if ( jQuery.isArray( prop[p] ) ) { // Create (if needed) and add to specialEasing (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1]; prop[p] = prop[p][0]; } } if ( opt.overflow != null ) { this.style.overflow = "hidden"; } opt.curAnim = jQuery.extend({}, prop); jQuery.each( prop, function( name, val ) { var e = new jQuery.fx( self, opt, name ); if ( rfxtypes.test(val) ) { e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop ); } else { var parts = rfxnum.exec(val), start = e.cur() || 0; if ( parts ) { var end = parseFloat( parts[2] ), unit = parts[3] || "px"; // We need to compute starting value if ( unit !== "px" ) { jQuery.style( self, name, (end || 1) + unit); start = ((end || 1) / e.cur()) * start; jQuery.style( self, name, start + unit); } // If a +=/-= token was provided, we're doing a relative animation if ( parts[1] ) { end = ((parts[1] === "-=" ? -1 : 1) * end) + start; } e.custom( start, end, unit ); } else { e.custom( start, val, "" ); } } }); // For JS strict compliance return true; }); }, stop: function( clearQueue, gotoEnd ) { var timers = jQuery.timers; if ( clearQueue ) { this.queue([]); } this.each(function() { // go in reverse order so anything added to the queue during the loop is ignored for ( var i = timers.length - 1; i >= 0; i-- ) { if ( timers[i].elem === this ) { if (gotoEnd) { // force the next step to be the last timers[i](true); } timers.splice(i, 1); } } }); // start the next in the queue if the last step wasn't forced if ( !gotoEnd ) { this.dequeue(); } return this; } }); function genFx( type, num ) { var obj = {}; jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { obj[ this ] = type; }); return obj; } // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show", 1), slideUp: genFx("hide", 1), slideToggle: genFx("toggle", 1), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; }); jQuery.extend({ speed: function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction(easing) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; // Queueing opt.old = opt.complete; opt.complete = function() { if ( opt.queue !== false ) { jQuery(this).dequeue(); } if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } }; return opt; }, easing: { linear: function( p, n, firstNum, diff ) { return firstNum + diff * p; }, swing: function( p, n, firstNum, diff ) { return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; } }, timers: [], fx: function( elem, options, prop ) { this.options = options; this.elem = elem; this.prop = prop; if ( !options.orig ) { options.orig = {}; } } }); jQuery.fx.prototype = { // Simple function for setting a style value update: function() { if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); } (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); }, // Get the current size cur: function() { if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { return this.elem[ this.prop ]; } var r = parseFloat( jQuery.css( this.elem, this.prop ) ); return r || 0; }, // Start an animation from one number to another custom: function( from, to, unit ) { var self = this, fx = jQuery.fx; this.startTime = jQuery.now(); this.start = from; this.end = to; this.unit = unit || this.unit || "px"; this.now = this.start; this.pos = this.state = 0; function t( gotoEnd ) { return self.step(gotoEnd); } t.elem = this.elem; if ( t() && jQuery.timers.push(t) && !timerId ) { timerId = setInterval(fx.tick, fx.interval); } }, // Simple 'show' function show: function() { // Remember where we started, so that we can go back to it later this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); this.options.show = true; // Begin the animation // Make sure that we start at a small width/height to avoid any // flash of content this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()); // Start by showing the element jQuery( this.elem ).show(); }, // Simple 'hide' function hide: function() { // Remember where we started, so that we can go back to it later this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); this.options.hide = true; // Begin the animation this.custom(this.cur(), 0); }, // Each step of an animation step: function( gotoEnd ) { var t = jQuery.now(), done = true; if ( gotoEnd || t >= this.options.duration + this.startTime ) { this.now = this.end; this.pos = this.state = 1; this.update(); this.options.curAnim[ this.prop ] = true; for ( var i in this.options.curAnim ) { if ( this.options.curAnim[i] !== true ) { done = false; } } if ( done ) { // Reset the overflow if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { var elem = this.elem, options = this.options; jQuery.each( [ "", "X", "Y" ], function (index, value) { elem.style[ "overflow" + value ] = options.overflow[index]; } ); } // Hide the element if the "hide" operation was done if ( this.options.hide ) { jQuery(this.elem).hide(); } // Reset the properties, if the item has been hidden or shown if ( this.options.hide || this.options.show ) { for ( var p in this.options.curAnim ) { jQuery.style( this.elem, p, this.options.orig[p] ); } } // Execute the complete function this.options.complete.call( this.elem ); } return false; } else { var n = t - this.startTime; this.state = n / this.options.duration; // Perform the easing function, defaults to swing var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop]; var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear"); this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); this.now = this.start + ((this.end - this.start) * this.pos); // Perform the next step of the animation this.update(); } return true; } }; jQuery.extend( jQuery.fx, { tick: function() { var timers = jQuery.timers; for ( var i = 0; i < timers.length; i++ ) { if ( !timers[i]() ) { timers.splice(i--, 1); } } if ( !timers.length ) { jQuery.fx.stop(); } }, interval: 13, stop: function() { clearInterval( timerId ); timerId = null; }, speeds: { slow: 600, fast: 200, // Default speed _default: 400 }, step: { opacity: function( fx ) { jQuery.style( fx.elem, "opacity", fx.now ); }, _default: function( fx ) { if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit; } else { fx.elem[ fx.prop ] = fx.now; } } } }); if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.animated = function( elem ) { return jQuery.grep(jQuery.timers, function( fn ) { return elem === fn.elem; }).length; }; } function defaultDisplay( nodeName ) { if ( !elemdisplay[ nodeName ] ) { var elem = jQuery("<" + nodeName + ">").appendTo("body"), display = elem.css("display"); elem.remove(); if ( display === "none" || display === "" ) { display = "block"; } elemdisplay[ nodeName ] = display; } return elemdisplay[ nodeName ]; } var rtable = /^t(?:able|d|h)$/i, rroot = /^(?:body|html)$/i; if ( "getBoundingClientRect" in document.documentElement ) { jQuery.fn.offset = function( options ) { var elem = this[0], box; if ( options ) { return this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } if ( !elem || !elem.ownerDocument ) { return null; } if ( elem === elem.ownerDocument.body ) { return jQuery.offset.bodyOffset( elem ); } try { box = elem.getBoundingClientRect(); } catch(e) {} var doc = elem.ownerDocument, docElem = doc.documentElement; // Make sure we're not dealing with a disconnected DOM node if ( !box || !jQuery.contains( docElem, elem ) ) { return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; } var body = doc.body, win = getWindow(doc), clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ), scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft), top = box.top + scrollTop - clientTop, left = box.left + scrollLeft - clientLeft; return { top: top, left: left }; }; } else { jQuery.fn.offset = function( options ) { var elem = this[0]; if ( options ) { return this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } if ( !elem || !elem.ownerDocument ) { return null; } if ( elem === elem.ownerDocument.body ) { return jQuery.offset.bodyOffset( elem ); } jQuery.offset.initialize(); var computedStyle, offsetParent = elem.offsetParent, prevOffsetParent = elem, doc = elem.ownerDocument, docElem = doc.documentElement, body = doc.body, defaultView = doc.defaultView, prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, top = elem.offsetTop, left = elem.offsetLeft; while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { break; } computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; top -= elem.scrollTop; left -= elem.scrollLeft; if ( elem === offsetParent ) { top += elem.offsetTop; left += elem.offsetLeft; if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { top += parseFloat( computedStyle.borderTopWidth ) || 0; left += parseFloat( computedStyle.borderLeftWidth ) || 0; } prevOffsetParent = offsetParent; offsetParent = elem.offsetParent; } if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { top += parseFloat( computedStyle.borderTopWidth ) || 0; left += parseFloat( computedStyle.borderLeftWidth ) || 0; } prevComputedStyle = computedStyle; } if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { top += body.offsetTop; left += body.offsetLeft; } if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { top += Math.max( docElem.scrollTop, body.scrollTop ); left += Math.max( docElem.scrollLeft, body.scrollLeft ); } return { top: top, left: left }; }; } jQuery.offset = { initialize: function() { var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0, html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } ); container.innerHTML = html; body.insertBefore( container, body.firstChild ); innerDiv = container.firstChild; checkDiv = innerDiv.firstChild; td = innerDiv.nextSibling.firstChild.firstChild; this.doesNotAddBorder = (checkDiv.offsetTop !== 5); this.doesAddBorderForTableAndCells = (td.offsetTop === 5); checkDiv.style.position = "fixed"; checkDiv.style.top = "20px"; // safari subtracts parent border width here which is 5px this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15); checkDiv.style.position = checkDiv.style.top = ""; innerDiv.style.overflow = "hidden"; innerDiv.style.position = "relative"; this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); body.removeChild( container ); body = container = innerDiv = checkDiv = table = td = null; jQuery.offset.initialize = jQuery.noop; }, bodyOffset: function( body ) { var top = body.offsetTop, left = body.offsetLeft; jQuery.offset.initialize(); if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) { top += parseFloat( jQuery.css(body, "marginTop") ) || 0; left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; } return { top: top, left: left }; }, setOffset: function( elem, options, i ) { var position = jQuery.css( elem, "position" ); // set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } var curElem = jQuery( elem ), curOffset = curElem.offset(), curCSSTop = jQuery.css( elem, "top" ), curCSSLeft = jQuery.css( elem, "left" ), calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1), props = {}, curPosition = {}, curTop, curLeft; // need to be able to calculate position if either top or left is auto and position is absolute if ( calculatePosition ) { curPosition = curElem.position(); } curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0; curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0; if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } if (options.top != null) { props.top = (options.top - curOffset.top) + curTop; } if (options.left != null) { props.left = (options.left - curOffset.left) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend({ position: function() { if ( !this[0] ) { return null; } var elem = this[0], // Get *real* offsetParent offsetParent = this.offsetParent(), // Get correct offsets offset = this.offset(), parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; // Add offsetParent borders parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; // Subtract the two offsets return { top: offset.top - parentOffset.top, left: offset.left - parentOffset.left }; }, offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent || document.body; while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { offsetParent = offsetParent.offsetParent; } return offsetParent; }); } }); // Create scrollLeft and scrollTop methods jQuery.each( ["Left", "Top"], function( i, name ) { var method = "scroll" + name; jQuery.fn[ method ] = function(val) { var elem = this[0], win; if ( !elem ) { return null; } if ( val !== undefined ) { // Set the scroll offset return this.each(function() { win = getWindow( this ); if ( win ) { win.scrollTo( !i ? val : jQuery(win).scrollLeft(), i ? val : jQuery(win).scrollTop() ); } else { this[ method ] = val; } }); } else { win = getWindow( elem ); // Return the scroll offset return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : jQuery.support.boxModel && win.document.documentElement[ method ] || win.document.body[ method ] : elem[ method ]; } }; }); function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; } // Create innerHeight, innerWidth, outerHeight and outerWidth methods jQuery.each([ "Height", "Width" ], function( i, name ) { var type = name.toLowerCase(); // innerHeight and innerWidth jQuery.fn["inner" + name] = function() { return this[0] ? parseFloat( jQuery.css( this[0], type, "padding" ) ) : null; }; // outerHeight and outerWidth jQuery.fn["outer" + name] = function( margin ) { return this[0] ? parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) : null; }; jQuery.fn[ type ] = function( size ) { // Get window width or height var elem = this[0]; if ( !elem ) { return size == null ? null : this; } if ( jQuery.isFunction( size ) ) { return this.each(function( i ) { var self = jQuery( this ); self[ type ]( size.call( this, i, self[ type ]() ) ); }); } if ( jQuery.isWindow( elem ) ) { // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat var docElemProp = elem.document.documentElement[ "client" + name ]; return elem.document.compatMode === "CSS1Compat" && docElemProp || elem.document.body[ "client" + name ] || docElemProp; // Get document width or height } else if ( elem.nodeType === 9 ) { // Either scroll[Width/Height] or offset[Width/Height], whichever is greater return Math.max( elem.documentElement["client" + name], elem.body["scroll" + name], elem.documentElement["scroll" + name], elem.body["offset" + name], elem.documentElement["offset" + name] ); // Get or set width or height on the element } else if ( size === undefined ) { var orig = jQuery.css( elem, type ), ret = parseFloat( orig ); return jQuery.isNaN( ret ) ? orig : ret; // Set the width or height on the element (default to pixels if value is unitless) } else { return this.css( type, typeof size === "string" ? size : size + "px" ); } }; }); })(window);
JavaScript
/** * This jQuery plugin displays pagination links inside the selected elements. * * This plugin needs at least jQuery 1.4.2 * * @author Gabriel Birke (birke *at* d-scribe *dot* de) * @version 2.2 * @param {int} maxentries Number of entries to paginate * @param {Object} opts Several options (see README for documentation) * @return {Object} jQuery Object */ (function($){ /** * @class Class for calculating pagination values */ $.PaginationCalculator = function(maxentries, opts) { this.maxentries = maxentries; this.opts = opts; } $.extend($.PaginationCalculator.prototype, { /** * Calculate the maximum number of pages * @method * @returns {Number} */ numPages:function() { return Math.ceil(this.maxentries/this.opts.items_per_page); }, /** * Calculate start and end point of pagination links depending on * current_page and num_display_entries. * @returns {Array} */ getInterval:function(current_page) { var ne_half = Math.floor(this.opts.num_display_entries/2); var np = this.numPages(); var upper_limit = np - this.opts.num_display_entries; var start = current_page > ne_half ? Math.max( Math.min(current_page - ne_half, upper_limit), 0 ) : 0; var end = current_page > ne_half?Math.min(current_page+ne_half + (this.opts.num_display_entries % 2), np):Math.min(this.opts.num_display_entries, np); return {start:start, end:end}; } }); // Initialize jQuery object container for pagination renderers $.PaginationRenderers = {} /** * @class Default renderer for rendering pagination links */ $.PaginationRenderers.defaultRenderer = function(maxentries, opts) { this.maxentries = maxentries; this.opts = opts; this.pc = new $.PaginationCalculator(maxentries, opts); } $.extend($.PaginationRenderers.defaultRenderer.prototype, { /** * Helper function for generating a single link (or a span tag if it's the current page) * @param {Number} page_id The page id for the new item * @param {Number} current_page * @param {Object} appendopts Options for the new item: text and classes * @returns {jQuery} jQuery object containing the link */ createLink:function(page_id, current_page, appendopts){ var lnk, np = this.pc.numPages(); page_id = page_id<0?0:(page_id<np?page_id:np-1); // Normalize page id to sane value appendopts = $.extend({text:page_id+1, classes:""}, appendopts||{}); if(page_id == current_page){ lnk = $("<span class='current'>" + appendopts.text + "</span>"); } else { lnk = $("<a>" + appendopts.text + "</a>") .attr('href', this.opts.link_to.replace(/__id__/,page_id)); } if(appendopts.classes){ lnk.addClass(appendopts.classes); } lnk.data('page_id', page_id); return lnk; }, // Generate a range of numeric links appendRange:function(container, current_page, start, end, opts) { var i; for(i=start; i<end; i++) { this.createLink(i, current_page, opts).appendTo(container); } }, getLinks:function(current_page, eventHandler) { var begin, end, interval = this.pc.getInterval(current_page), np = this.pc.numPages(), fragment = $("<div class='pagination'></div>"); // Generate "Previous"-Link if(this.opts.prev_text && (current_page > 0 || this.opts.prev_show_always)){ fragment.append(this.createLink(current_page-1, current_page, {text:this.opts.prev_text, classes:"prev"})); } // Generate starting points if (interval.start > 0 && this.opts.num_edge_entries > 0) { end = Math.min(this.opts.num_edge_entries, interval.start); this.appendRange(fragment, current_page, 0, end, {classes:'sp'}); if(this.opts.num_edge_entries < interval.start && this.opts.ellipse_text) { jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(fragment); } } // Generate interval links this.appendRange(fragment, current_page, interval.start, interval.end); // Generate ending points if (interval.end < np && this.opts.num_edge_entries > 0) { if(np-this.opts.num_edge_entries > interval.end && this.opts.ellipse_text) { jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(fragment); } begin = Math.max(np-this.opts.num_edge_entries, interval.end); this.appendRange(fragment, current_page, begin, np, {classes:'ep'}); } // Generate "Next"-Link if(this.opts.next_text && (current_page < np-1 || this.opts.next_show_always)){ fragment.append(this.createLink(current_page+1, current_page, {text:this.opts.next_text, classes:"next"})); } $('a', fragment).click(eventHandler); return fragment; } }); // Extend jQuery $.fn.pagination = function(maxentries, opts){ // Initialize options with default values opts = jQuery.extend({ items_per_page:10, num_display_entries:11, current_page:0, num_edge_entries:0, link_to:"#", prev_text:"Prev", next_text:"Next", ellipse_text:"...", prev_show_always:true, next_show_always:true, renderer:"defaultRenderer", load_first_page:false, callback:function(){return false;} },opts||{}); var containers = this, renderer, links, current_page; /** * This is the event handling function for the pagination links. * @param {int} page_id The new page number */ function paginationClickHandler(evt){ var links, new_current_page = $(evt.target).data('page_id'), continuePropagation = selectPage(new_current_page); if (!continuePropagation) { evt.stopPropagation(); } return continuePropagation; } /** * This is a utility function for the internal event handlers. * It sets the new current page on the pagination container objects, * generates a new HTMl fragment for the pagination links and calls * the callback function. */ function selectPage(new_current_page) { // update the link display of a all containers containers.data('current_page', new_current_page); links = renderer.getLinks(new_current_page, paginationClickHandler); containers.empty(); links.appendTo(containers); // call the callback and propagate the event if it does not return false var continuePropagation = opts.callback(new_current_page, containers); return continuePropagation; } // ----------------------------------- // Initialize containers // ----------------------------------- current_page = opts.current_page; containers.data('current_page', current_page); // Create a sane value for maxentries and items_per_page maxentries = (!maxentries || maxentries < 0)?1:maxentries; opts.items_per_page = (!opts.items_per_page || opts.items_per_page < 0)?1:opts.items_per_page; if(!$.PaginationRenderers[opts.renderer]) { throw new ReferenceError("Pagination renderer '" + opts.renderer + "' was not found in jQuery.PaginationRenderers object."); } renderer = new $.PaginationRenderers[opts.renderer](maxentries, opts); // Attach control events to the DOM elements var pc = new $.PaginationCalculator(maxentries, opts); var np = pc.numPages(); containers.bind('setPage', {numPages:np}, function(evt, page_id) { if(page_id >= 0 && page_id < evt.data.numPages) { selectPage(page_id); return false; } }); containers.bind('prevPage', function(evt){ var current_page = $(this).data('current_page'); if (current_page > 0) { selectPage(current_page - 1); } return false; }); containers.bind('nextPage', {numPages:np}, function(evt){ var current_page = $(this).data('current_page'); if(current_page < evt.data.numPages - 1) { selectPage(current_page + 1); } return false; }); // When all initialisation is done, draw the links links = renderer.getLinks(current_page, paginationClickHandler); containers.empty(); links.appendTo(containers); // call callback function if(opts.load_first_page) { opts.callback(current_page, containers); } } // End of $.fn.pagination block })(jQuery);
JavaScript
/*********************************************************************************************************/ /* 文件目的 :定义一些jquery.pagination分页插件的扩展 /* 创建人 :王安生 /* 创建时间 :2013-04-10 /*********************************************************************************************************/ $.createPager = function(id, recordcount, pageIndex, pagesize, nearnum, edgenum, prevpagetext, nextpagetext, ellipsetext, fncallback) { /// <summary>创建分页并初始化</summary> /// <param name="id" type="string">分页插件载体ID,用来显示分页控件</param> /// <param name="recordcount" type="int">总记录数</param> /// <param name="pageIndex" type="int">当前页索引</param> /// <param name="pagesize" type="int">每页显示条数</param> /// <param name="nearnum" type="int">连续分页主体部分显示的分页条目数</param> /// <param name="edgenum" type="int">两侧显示的首尾分页的条目数</param> /// <param name="prevpagetext" type="string">“前一页”分页按钮上显示的文字</param> /// <param name="nextpagetext" type="string">“下一页”分页按钮上显示的文字</param> /// <param name="ellipsetext" type="string">省略的页数用什么文字表示</param> /// <param name="fncallback" type="function">回调函数</param> /// <returns></returns> $("#" + id + "").pagination(recordcount, { current_page: pageIndex, items_per_page: pagesize, num_display_entries: nearnum, num_edge_entries: edgenum, prev_text: prevpagetext, next_text: nextpagetext, ellipse_text: ellipsetext, callback: fncallback }); }
JavaScript
var iHeight = 0; var iTop = 0; var clientHeight = 0; var iIntervalId = null; var itemsSize = 0; var isHave = 0; var s_pageNo = 0; // 当前页数,默认设为第 1 页 // 添加定时检测事件,每1秒检测一次 iIntervalId = setInterval("_onScroll();", 1000); // 取得当前页面显示所占用的高度 function getPageHeight() { if (document.body.clientHeight && document.documentElement.clientHeight) { clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight; } else { clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight; } iHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); } // 判断滚动条是否到达底部 function reachBottom() { var scrollTop = 0; // if (document.documentElement && document.documentElement.scrollTop) { // scrollTop = document.documentElement.scrollTop; // } else if (document.body) { // scrollTop = document.body.scrollTop; // } scrollTop = $("#dvScroll").scrollTop(); if ((scrollTop > 0) && (scrollTop + $("#dvScroll").height() >= $("#dvShow") * 0.99)) { return true; } else { return false; } } // 检测事件,检测滚动条是否接近或到达页面的底部区域,0.99是为了更接近底部时 function _onScroll() { iTop = document.documentElement.scrollTop + document.body.scrollTop; getPageHeight(); if (reachBottom()) { var $strParams = strList("beginTime", $("#IptBeginDt").val()) + "|" + strList("endTime", $("#IptEndDt").val()); if (s_pageNo == 0) { DataBind("SaleProductReport.aspx", 1, $strParams, "dvWait", "为您加载数据中,请稍候......", "dvHeader", "dvShow", "dvWaitMore", "50", s_pageNo); s_pageNo = s_pageNo + 1; } else { DataBind("SaleProductReport.aspx", 0, $strParams, "dvWait", "为您加载数据中,请稍候......", "dvHeader", "dvShow", "dvWaitMore", "50", s_pageNo); s_pageNo = s_pageNo + 1; } } } $(document).ready(function () { $("#btnLoad").click(function () { s_pageNo = 0; var $strParams = strList("beginTime", $("#dtpBeginTime").val()) + "|" + strList("endTime", $("#dtpEndTime").val()); DataBind("SaleProductReport.aspx", 1, $strParams, "dvWait", "为您加载数据中,请稍候......", "dvHeader", "dvShow", "dvWaitMore", "50", s_pageNo); s_pageNo = s_pageNo + 1; $("#dvScroll").height(document.body.clientHeight - 400); $("#dvShow").width(document.body.clientWidth + 500); }); });
JavaScript
var $lang={ errAlertMsg: "Invalid date or the date out of range,redo or not?", aWeekStr: ["wk", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], aLongWeekStr:["wk","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"], aMonStr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], aLongMonStr: ["January","February","March","April","May","June","July","August","September","October","November","December"], clearStr: "Clear", todayStr: "Today", okStr: "OK", updateStr: "OK", timeStr: "Time", quickStr: "Quick Selection", err_1: 'MinDate Cannot be bigger than MaxDate!' }
JavaScript
var $lang={ errAlertMsg: "\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u8303\u56F4,\u9700\u8981\u64A4\u9500\u5417?", aWeekStr: ["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"], aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"], aMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"], aLongMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"], clearStr: "\u6E05\u7A7A", todayStr: "\u4ECA\u5929", okStr: "\u786E\u5B9A", updateStr: "\u786E\u5B9A", timeStr: "\u65F6\u95F4", quickStr: "\u5FEB\u901F\u9009\u62E9", err_1: '\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u4E8E\u6700\u5927\u65E5\u671F!' }
JavaScript
var $lang={ errAlertMsg: "Invalid date or the date out of range,redo or not?", aWeekStr: ["wk", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], aLongWeekStr:["wk","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"], aMonStr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], aLongMonStr: ["January","February","March","April","May","June","July","August","September","October","November","December"], clearStr: "Clear", todayStr: "Today", okStr: "OK", updateStr: "OK", timeStr: "Time", quickStr: "Quick Selection", err_1: 'MinDate Cannot be bigger than MaxDate!' }
JavaScript
var $lang={ errAlertMsg: "\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u7BC4\u570D,\u9700\u8981\u64A4\u92B7\u55CE?", aWeekStr: ["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"], aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"], aMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"], aLongMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"], clearStr: "\u6E05\u7A7A", todayStr: "\u4ECA\u5929", okStr: "\u78BA\u5B9A", updateStr: "\u78BA\u5B9A", timeStr: "\u6642\u9593", quickStr: "\u5FEB\u901F\u9078\u64C7", err_1: '\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u65BC\u6700\u5927\u65E5\u671F!' }
JavaScript
/*********************************************************************************************************/ /* 文件目的 :定义一些jQuery扩展 /* 创建人 :王安生 /* 创建时间 :2013-04-01 /*********************************************************************************************************/ /// <summary> /// Jquery ajax(Post方式处理数据,主要用于Insert,Delete,Update) /// </summary> /// <param name="url">处理请求的地址(支持本页或调整页)</param> /// <param name="param">传递参数</param> /// <param name="fnbefore">请求开始时的处理函数</param> /// <param name="fnSuccess">请求成功后的回调函数</param> /// <returns></returns> $.ajaxForPost = function(url, param, fnbefore, fnsuccess) { $.ajax({ async: false, type: "post", contentType: "application/json", url: url, data: param, dataType: "json", beforeSend: fnbefore, success: fnsuccess }); } /// <summary> /// Jquery ajax(get方式获取数据,主要用于查询) /// </summary> /// <param name="url">处理请求的地址(支持本页或调整页)</param> /// <param name="param">传递参数</param> /// <param name="fnbefore">请求开始时的处理函数</param> /// <param name="fnSuccess">请求成功后的回调函数</param> /// <returns></returns> $.ajaxForGet = function(url, param, fnbefore, fnsuccess) { $.ajax({ type: "get", url: url, data: param, beforeSend: fnbefore, success: fnsuccess }) } /// <summary> /// Jquery ajax(全动态参数) /// </summary> /// <param name="method">请求方式包括Get和Post两种</param> /// <param name="ctype">内容类型,例如ajaxForGet中其实contentType可以设置为text/html</param> /// <param name="url">处理请求的地址(支持本页或调整页)</param> /// <param name="param">传递参数</param> /// <param name="dtype">服务器返回的数据类型,例如ajaxForGet中其实datatype可以设置为html</param> /// <param name="fnbefore">请求开始时的处理函数</param> /// <param name="fnSuccess">请求成功后的回调函数</param> /// <returns></returns> $.ajaxForAll = function(method, ctype, url, param, dtype, fnbefore, fnSuccess) { $.ajax({ type: method, contentType: ctype, url: url, data: param, dataType: dtype, beforesend: fnbefore, success: fnSuccess }); }
JavaScript
/*! * jQuery JavaScript Library v1.3.2 * http://jquery.com/ * * Copyright (c) 2009 John Resig * Dual licensed under the MIT and GPL licenses. * http://docs.jquery.com/License * * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) * Revision: 6246 */ (function(){ var // Will speed up references to window, and allows munging its name. window = this, // Will speed up references to undefined, and allows munging its name. undefined, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, jQuery = window.jQuery = window.$ = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context ); }, // A simple way to check for HTML strings or ID strings // (both of which we optimize for) quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, // Is it a simple selector isSimple = /^.[^:#\[\.,]*$/; jQuery.fn = jQuery.prototype = { init: function( selector, context ) { // Make sure that a selection was provided selector = selector || document; // Handle $(DOMElement) if ( selector.nodeType ) { this[0] = selector; this.length = 1; this.context = selector; return this; } // Handle HTML strings if ( typeof selector === "string" ) { // Are we dealing with HTML string or an ID? var match = quickExpr.exec( selector ); // Verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) selector = jQuery.clean( [ match[1] ], context ); // HANDLE: $("#id") else { var elem = document.getElementById( match[3] ); // Handle the case where IE and Opera return items // by name instead of ID if ( elem && elem.id != match[3] ) return jQuery().find( selector ); // Otherwise, we inject the element directly into the jQuery object var ret = jQuery( elem || [] ); ret.context = document; ret.selector = selector; return ret; } // HANDLE: $(expr, [context]) // (which is just equivalent to: $(content).find(expr) } else return jQuery( context ).find( selector ); // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) return jQuery( document ).ready( selector ); // Make sure that old selector state is passed along if ( selector.selector && selector.context ) { this.selector = selector.selector; this.context = selector.context; } return this.setArray(jQuery.isArray( selector ) ? selector : jQuery.makeArray(selector)); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.3.2", // The number of elements contained in the matched element set size: function() { return this.length; }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num === undefined ? // Return a 'clean' array Array.prototype.slice.call( this ) : // Return just the object this[ num ]; }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = jQuery( elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) ret.selector = this.selector + (this.selector ? " " : "") + selector; else if ( name ) ret.selector = this.selector + "." + name + "(" + selector + ")"; // Return the newly-formed element set return ret; }, // Force the current matched set of elements to become // the specified array of elements (destroying the stack in the process) // You should use pushStack() in order to do this, but maintain the stack setArray: function( elems ) { // Resetting the length to 0, then using the native Array push // is a super-fast way to populate an object with array-like properties this.length = 0; Array.prototype.push.apply( this, elems ); return this; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem && elem.jquery ? elem[0] : elem , this ); }, attr: function( name, value, type ) { var options = name; // Look for the case where we're accessing a style value if ( typeof name === "string" ) if ( value === undefined ) return this[0] && jQuery[ type || "attr" ]( this[0], name ); else { options = {}; options[ name ] = value; } // Check to see if we're setting style values return this.each(function(i){ // Set all the styles for ( name in options ) jQuery.attr( type ? this.style : this, name, jQuery.prop( this, options[ name ], type, i, name ) ); }); }, css: function( key, value ) { // ignore negative width and height values if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) value = undefined; return this.attr( key, value, "curCSS" ); }, text: function( text ) { if ( typeof text !== "object" && text != null ) return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); var ret = ""; jQuery.each( text || this, function(){ jQuery.each( this.childNodes, function(){ if ( this.nodeType != 8 ) ret += this.nodeType != 1 ? this.nodeValue : jQuery.fn.text( [ this ] ); }); }); return ret; }, wrapAll: function( html ) { if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).clone(); if ( this[0].parentNode ) wrap.insertBefore( this[0] ); wrap.map(function(){ var elem = this; while ( elem.firstChild ) elem = elem.firstChild; return elem; }).append(this); } return this; }, wrapInner: function( html ) { return this.each(function(){ jQuery( this ).contents().wrapAll( html ); }); }, wrap: function( html ) { return this.each(function(){ jQuery( this ).wrapAll( html ); }); }, append: function() { return this.domManip(arguments, true, function(elem){ if (this.nodeType == 1) this.appendChild( elem ); }); }, prepend: function() { return this.domManip(arguments, true, function(elem){ if (this.nodeType == 1) this.insertBefore( elem, this.firstChild ); }); }, before: function() { return this.domManip(arguments, false, function(elem){ this.parentNode.insertBefore( elem, this ); }); }, after: function() { return this.domManip(arguments, false, function(elem){ this.parentNode.insertBefore( elem, this.nextSibling ); }); }, end: function() { return this.prevObject || jQuery( [] ); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: [].push, sort: [].sort, splice: [].splice, find: function( selector ) { if ( this.length === 1 ) { var ret = this.pushStack( [], "find", selector ); ret.length = 0; jQuery.find( selector, this[0], ret ); return ret; } else { return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ return jQuery.find( selector, elem ); })), "find", selector ); } }, clone: function( events ) { // Do the clone var ret = this.map(function(){ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { // IE copies events bound via attachEvent when // using cloneNode. Calling detachEvent on the // clone will also remove the events from the orignal // In order to get around this, we use innerHTML. // Unfortunately, this means some modifications to // attributes in IE that are actually only stored // as properties will not be copied (such as the // the name attribute on an input). var html = this.outerHTML; if ( !html ) { var div = this.ownerDocument.createElement("div"); div.appendChild( this.cloneNode(true) ); html = div.innerHTML; } return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; } else return this.cloneNode(true); }); // Copy the events from the original to the clone if ( events === true ) { var orig = this.find("*").andSelf(), i = 0; ret.find("*").andSelf().each(function(){ if ( this.nodeName !== orig[i].nodeName ) return; var events = jQuery.data( orig[i], "events" ); for ( var type in events ) { for ( var handler in events[ type ] ) { jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); } } i++; }); } // Return the cloned set return ret; }, filter: function( selector ) { return this.pushStack( jQuery.isFunction( selector ) && jQuery.grep(this, function(elem, i){ return selector.call( elem, i ); }) || jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ return elem.nodeType === 1; }) ), "filter", selector ); }, closest: function( selector ) { var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, closer = 0; return this.map(function(){ var cur = this; while ( cur && cur.ownerDocument ) { if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { jQuery.data(cur, "closest", closer); return cur; } cur = cur.parentNode; closer++; } }); }, not: function( selector ) { if ( typeof selector === "string" ) // test special case where just one selector is passed in if ( isSimple.test( selector ) ) return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); else selector = jQuery.multiFilter( selector, this ); var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; return this.filter(function() { return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; }); }, add: function( selector ) { return this.pushStack( jQuery.unique( jQuery.merge( this.get(), typeof selector === "string" ? jQuery( selector ) : jQuery.makeArray( selector ) ))); }, is: function( selector ) { return !!selector && jQuery.multiFilter( selector, this ).length > 0; }, hasClass: function( selector ) { return !!selector && this.is( "." + selector ); }, val: function( value ) { if ( value === undefined ) { var elem = this[0]; if ( elem ) { if( jQuery.nodeName( elem, 'option' ) ) return (elem.attributes.value || {}).specified ? elem.value : elem.text; // We need to handle select boxes special if ( jQuery.nodeName( elem, "select" ) ) { var index = elem.selectedIndex, values = [], options = elem.options, one = elem.type == "select-one"; // Nothing was selected if ( index < 0 ) return null; // Loop through all the selected options for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { var option = options[ i ]; if ( option.selected ) { // Get the specifc value for the option value = jQuery(option).val(); // We don't need an array for one selects if ( one ) return value; // Multi-Selects return an array values.push( value ); } } return values; } // Everything else, we just grab the value return (elem.value || "").replace(/\r/g, ""); } return undefined; } if ( typeof value === "number" ) value += ''; return this.each(function(){ if ( this.nodeType != 1 ) return; if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) this.checked = (jQuery.inArray(this.value, value) >= 0 || jQuery.inArray(this.name, value) >= 0); else if ( jQuery.nodeName( this, "select" ) ) { var values = jQuery.makeArray(value); jQuery( "option", this ).each(function(){ this.selected = (jQuery.inArray( this.value, values ) >= 0 || jQuery.inArray( this.text, values ) >= 0); }); if ( !values.length ) this.selectedIndex = -1; } else this.value = value; }); }, html: function( value ) { return value === undefined ? (this[0] ? this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : null) : this.empty().append( value ); }, replaceWith: function( value ) { return this.after( value ).remove(); }, eq: function( i ) { return this.slice( i, +i + 1 ); }, slice: function() { return this.pushStack( Array.prototype.slice.apply( this, arguments ), "slice", Array.prototype.slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function(elem, i){ return callback.call( elem, i, elem ); })); }, andSelf: function() { return this.add( this.prevObject ); }, domManip: function( args, table, callback ) { if ( this[0] ) { var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), first = fragment.firstChild; if ( first ) for ( var i = 0, l = this.length; i < l; i++ ) callback.call( root(this[i], first), this.length > 1 || i > 0 ? fragment.cloneNode(true) : fragment ); if ( scripts ) jQuery.each( scripts, evalScript ); } return this; function root( elem, cur ) { return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? (elem.getElementsByTagName("tbody")[0] || elem.appendChild(elem.ownerDocument.createElement("tbody"))) : elem; } } }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; function evalScript( i, elem ) { if ( elem.src ) jQuery.ajax({ url: elem.src, async: false, dataType: "script" }); else jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); if ( elem.parentNode ) elem.parentNode.removeChild( elem ); } function now(){ return +new Date; } jQuery.extend = jQuery.fn.extend = function() { // copy reference to target object var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) target = {}; // extend jQuery itself if only one argument is passed if ( length == i ) { target = this; --i; } for ( ; i < length; i++ ) // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) // Extend the base object for ( var name in options ) { var src = target[ name ], copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) continue; // Recurse if we're merging object values if ( deep && copy && typeof copy === "object" && !copy.nodeType ) target[ name ] = jQuery.extend( deep, // Never move original objects, clone them src || ( copy.length != null ? [ ] : { } ) , copy ); // Don't bring in undefined values else if ( copy !== undefined ) target[ name ] = copy; } // Return the modified object return target; }; // exclude the following css properties to add px var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, // cache defaultView defaultView = document.defaultView || {}, toString = Object.prototype.toString; jQuery.extend({ noConflict: function( deep ) { window.$ = _$; if ( deep ) window.jQuery = _jQuery; return jQuery; }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return toString.call(obj) === "[object Function]"; }, isArray: function( obj ) { return toString.call(obj) === "[object Array]"; }, // check if an element is in a (or is an) XML document isXMLDoc: function( elem ) { return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument ); }, // Evalulates a script in a global context globalEval: function( data ) { if ( data && /\S/.test(data) ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); script.type = "text/javascript"; if ( jQuery.support.scriptEval ) script.appendChild( document.createTextNode( data ) ); else script.text = data; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709). head.insertBefore( script, head.firstChild ); head.removeChild( script ); } }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); }, // args is for internal usage only each: function( object, callback, args ) { var name, i = 0, length = object.length; if ( args ) { if ( length === undefined ) { for ( name in object ) if ( callback.apply( object[ name ], args ) === false ) break; } else for ( ; i < length; ) if ( callback.apply( object[ i++ ], args ) === false ) break; // A special, fast, case for the most common use of each } else { if ( length === undefined ) { for ( name in object ) if ( callback.call( object[ name ], name, object[ name ] ) === false ) break; } else for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} } return object; }, prop: function( elem, value, type, i, name ) { // Handle executable functions if ( jQuery.isFunction( value ) ) value = value.call( elem, i ); // Handle passing in a number to a CSS property return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? value + "px" : value; }, className: { // internal only, use addClass("class") add: function( elem, classNames ) { jQuery.each((classNames || "").split(/\s+/), function(i, className){ if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) elem.className += (elem.className ? " " : "") + className; }); }, // internal only, use removeClass("class") remove: function( elem, classNames ) { if (elem.nodeType == 1) elem.className = classNames !== undefined ? jQuery.grep(elem.className.split(/\s+/), function(className){ return !jQuery.className.has( classNames, className ); }).join(" ") : ""; }, // internal only, use hasClass("class") has: function( elem, className ) { return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; } }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { var old = {}; // Remember the old values, and insert the new ones for ( var name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } callback.call( elem ); // Revert the old values for ( var name in options ) elem.style[ name ] = old[ name ]; }, css: function( elem, name, force, extra ) { if ( name == "width" || name == "height" ) { var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; function getWH() { val = name == "width" ? elem.offsetWidth : elem.offsetHeight; if ( extra === "border" ) return; jQuery.each( which, function() { if ( !extra ) val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; if ( extra === "margin" ) val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; else val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; }); } if ( elem.offsetWidth !== 0 ) getWH(); else jQuery.swap( elem, props, getWH ); return Math.max(0, Math.round(val)); } return jQuery.curCSS( elem, name, force ); }, curCSS: function( elem, name, force ) { var ret, style = elem.style; // We need to handle opacity special in IE if ( name == "opacity" && !jQuery.support.opacity ) { ret = jQuery.attr( style, "opacity" ); return ret == "" ? "1" : ret; } // Make sure we're using the right name for getting the float value if ( name.match( /float/i ) ) name = styleFloat; if ( !force && style && style[ name ] ) ret = style[ name ]; else if ( defaultView.getComputedStyle ) { // Only "float" is needed here if ( name.match( /float/i ) ) name = "float"; name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); var computedStyle = defaultView.getComputedStyle( elem, null ); if ( computedStyle ) ret = computedStyle.getPropertyValue( name ); // We should always get a number back from opacity if ( name == "opacity" && ret == "" ) ret = "1"; } else if ( elem.currentStyle ) { var camelCase = name.replace(/\-(\w)/g, function(all, letter){ return letter.toUpperCase(); }); ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { // Remember the original values var left = style.left, rsLeft = elem.runtimeStyle.left; // Put in the new values to get a computed value out elem.runtimeStyle.left = elem.currentStyle.left; style.left = ret || 0; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; elem.runtimeStyle.left = rsLeft; } } return ret; }, clean: function( elems, context, fragment ) { context = context || document; // !context.createElement fails in IE with an error but returns typeof 'object' if ( typeof context.createElement === "undefined" ) context = context.ownerDocument || context[0] && context[0].ownerDocument || document; // If a single string is passed in and it's a single tag // just do a createElement and skip the rest if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); if ( match ) return [ context.createElement( match[1] ) ]; } var ret = [], scripts = [], div = context.createElement("div"); jQuery.each(elems, function(i, elem){ if ( typeof elem === "number" ) elem += ''; if ( !elem ) return; // Convert html string into DOM nodes if ( typeof elem === "string" ) { // Fix "XHTML"-style tags in all browsers elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? all : front + "></" + tag + ">"; }); // Trim whitespace, otherwise indexOf won't work as expected var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); var wrap = // option or optgroup !tags.indexOf("<opt") && [ 1, "<select multiple='multiple'>", "</select>" ] || !tags.indexOf("<leg") && [ 1, "<fieldset>", "</fieldset>" ] || tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && [ 1, "<table>", "</table>" ] || !tags.indexOf("<tr") && [ 2, "<table><tbody>", "</tbody></table>" ] || // <thead> matched above (!tags.indexOf("<td") || !tags.indexOf("<th")) && [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || !tags.indexOf("<col") && [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || // IE can't serialize <link> and <script> tags normally !jQuery.support.htmlSerialize && [ 1, "div<div>", "</div>" ] || [ 0, "", "" ]; // Go to html and back, then peel off extra wrappers div.innerHTML = wrap[1] + elem + wrap[2]; // Move to the right depth while ( wrap[0]-- ) div = div.lastChild; // Remove IE's autoinserted <tbody> from table fragments if ( !jQuery.support.tbody ) { // String was a <table>, *may* have spurious <tbody> var hasBody = /<tbody/i.test(elem), tbody = !tags.indexOf("<table") && !hasBody ? div.firstChild && div.firstChild.childNodes : // String was a bare <thead> or <tfoot> wrap[1] == "<table>" && !hasBody ? div.childNodes : []; for ( var j = tbody.length - 1; j >= 0 ; --j ) if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) tbody[ j ].parentNode.removeChild( tbody[ j ] ); } // IE completely kills leading whitespace when innerHTML is used if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) ) div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); elem = jQuery.makeArray( div.childNodes ); } if ( elem.nodeType ) ret.push( elem ); else ret = jQuery.merge( ret, elem ); }); if ( fragment ) { for ( var i = 0; ret[i]; i++ ) { if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); } else { if ( ret[i].nodeType === 1 ) ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); fragment.appendChild( ret[i] ); } } return scripts; } return ret; }, attr: function( elem, name, value ) { // don't set attributes on text and comment nodes if (!elem || elem.nodeType == 3 || elem.nodeType == 8) return undefined; var notxml = !jQuery.isXMLDoc( elem ), // Whether we are setting (or getting) set = value !== undefined; // Try to normalize/fix the name name = notxml && jQuery.props[ name ] || name; // Only do all the following if this is a node (faster for style) // IE elem.getAttribute passes even for style if ( elem.tagName ) { // These attributes require special treatment var special = /href|src|style/.test( name ); // Safari mis-reports the default selected property of a hidden option // Accessing the parent's selectedIndex property fixes it if ( name == "selected" && elem.parentNode ) elem.parentNode.selectedIndex; // If applicable, access the attribute via the DOM 0 way if ( name in elem && notxml && !special ) { if ( set ){ // We can't allow the type property to be changed (since it causes problems in IE) if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) throw "type property can't be changed"; elem[ name ] = value; } // browsers index elements by id/name on forms, give priority to attributes. if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) return elem.getAttributeNode( name ).nodeValue; // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ if ( name == "tabIndex" ) { var attributeNode = elem.getAttributeNode( "tabIndex" ); return attributeNode && attributeNode.specified ? attributeNode.value : elem.nodeName.match(/(button|input|object|select|textarea)/i) ? 0 : elem.nodeName.match(/^(a|area)$/i) && elem.href ? 0 : undefined; } return elem[ name ]; } if ( !jQuery.support.style && notxml && name == "style" ) return jQuery.attr( elem.style, "cssText", value ); if ( set ) // convert the value to a string (all browsers do this but IE) see #1070 elem.setAttribute( name, "" + value ); var attr = !jQuery.support.hrefNormalized && notxml && special // Some attributes require a special call on IE ? elem.getAttribute( name, 2 ) : elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return attr === null ? undefined : attr; } // elem is actually elem.style ... set the style // IE uses filters for opacity if ( !jQuery.support.opacity && name == "opacity" ) { if ( set ) { // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level elem.zoom = 1; // Set the alpha filter to set the opacity elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); } return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': ""; } name = name.replace(/-([a-z])/ig, function(all, letter){ return letter.toUpperCase(); }); if ( set ) elem[ name ] = value; return elem[ name ]; }, trim: function( text ) { return (text || "").replace( /^\s+|\s+$/g, "" ); }, makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; // The window, strings (and functions) also have 'length' if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, inArray: function( elem, array ) { for ( var i = 0, length = array.length; i < length; i++ ) // Use === because on IE, window == document if ( array[ i ] === elem ) return i; return -1; }, merge: function( first, second ) { // We have to loop this way because IE & Opera overwrite the length // expando of getElementsByTagName var i = 0, elem, pos = first.length; // Also, we need to make sure that the correct elements are being returned // (IE returns comment nodes in a '*' query) if ( !jQuery.support.getAll ) { while ( (elem = second[ i++ ]) != null ) if ( elem.nodeType != 8 ) first[ pos++ ] = elem; } else while ( (elem = second[ i++ ]) != null ) first[ pos++ ] = elem; return first; }, unique: function( array ) { var ret = [], done = {}; try { for ( var i = 0, length = array.length; i < length; i++ ) { var id = jQuery.data( array[ i ] ); if ( !done[ id ] ) { done[ id ] = true; ret.push( array[ i ] ); } } } catch( e ) { ret = array; } return ret; }, grep: function( elems, callback, inv ) { var ret = []; // Go through the array, only saving the items // that pass the validator function for ( var i = 0, length = elems.length; i < length; i++ ) if ( !inv != !callback( elems[ i ], i ) ) ret.push( elems[ i ] ); return ret; }, map: function( elems, callback ) { var ret = []; // Go through the array, translating each of the items to their // new value (or values). for ( var i = 0, length = elems.length; i < length; i++ ) { var value = callback( elems[ i ], i ); if ( value != null ) ret[ ret.length ] = value; } return ret.concat.apply( [], ret ); } }); // Use of jQuery.browser is deprecated. // It's included for backwards compatibility and plugins, // although they should work to migrate away. var userAgent = navigator.userAgent.toLowerCase(); // Figure out what browser is being used jQuery.browser = { version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], safari: /webkit/.test( userAgent ), opera: /opera/.test( userAgent ), msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) }; jQuery.each({ parent: function(elem){return elem.parentNode;}, parents: function(elem){return jQuery.dir(elem,"parentNode");}, next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, children: function(elem){return jQuery.sibling(elem.firstChild);}, contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} }, function(name, fn){ jQuery.fn[ name ] = function( selector ) { var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function(name, original){ jQuery.fn[ name ] = function( selector ) { var ret = [], insert = jQuery( selector ); for ( var i = 0, l = insert.length; i < l; i++ ) { var elems = (i > 0 ? this.clone(true) : this).get(); jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); ret = ret.concat( elems ); } return this.pushStack( ret, name, selector ); }; }); jQuery.each({ removeAttr: function( name ) { jQuery.attr( this, name, "" ); if (this.nodeType == 1) this.removeAttribute( name ); }, addClass: function( classNames ) { jQuery.className.add( this, classNames ); }, removeClass: function( classNames ) { jQuery.className.remove( this, classNames ); }, toggleClass: function( classNames, state ) { if( typeof state !== "boolean" ) state = !jQuery.className.has( this, classNames ); jQuery.className[ state ? "add" : "remove" ]( this, classNames ); }, remove: function( selector ) { if ( !selector || jQuery.filter( selector, [ this ] ).length ) { // Prevent memory leaks jQuery( "*", this ).add([this]).each(function(){ jQuery.event.remove(this); jQuery.removeData(this); }); if (this.parentNode) this.parentNode.removeChild( this ); } }, empty: function() { // Remove element nodes and prevent memory leaks jQuery(this).children().remove(); // Remove any remaining nodes while ( this.firstChild ) this.removeChild( this.firstChild ); } }, function(name, fn){ jQuery.fn[ name ] = function(){ return this.each( fn, arguments ); }; }); // Helper function used by the dimensions and offset modules function num(elem, prop) { return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; } var expando = "jQuery" + now(), uuid = 0, windowData = {}; jQuery.extend({ cache: {}, data: function( elem, name, data ) { elem = elem == window ? windowData : elem; var id = elem[ expando ]; // Compute a unique ID for the element if ( !id ) id = elem[ expando ] = ++uuid; // Only generate the data cache if we're // trying to access or manipulate it if ( name && !jQuery.cache[ id ] ) jQuery.cache[ id ] = {}; // Prevent overriding the named cache with undefined values if ( data !== undefined ) jQuery.cache[ id ][ name ] = data; // Return the named cache data, or the ID for the element return name ? jQuery.cache[ id ][ name ] : id; }, removeData: function( elem, name ) { elem = elem == window ? windowData : elem; var id = elem[ expando ]; // If we want to remove a specific section of the element's data if ( name ) { if ( jQuery.cache[ id ] ) { // Remove the section of cache data delete jQuery.cache[ id ][ name ]; // If we've removed all the data, remove the element's cache name = ""; for ( name in jQuery.cache[ id ] ) break; if ( !name ) jQuery.removeData( elem ); } // Otherwise, we want to remove all of the element's data } else { // Clean up the element expando try { delete elem[ expando ]; } catch(e){ // IE has trouble directly removing the expando // but it's ok with using removeAttribute if ( elem.removeAttribute ) elem.removeAttribute( expando ); } // Completely remove the data cache delete jQuery.cache[ id ]; } }, queue: function( elem, type, data ) { if ( elem ){ type = (type || "fx") + "queue"; var q = jQuery.data( elem, type ); if ( !q || jQuery.isArray(data) ) q = jQuery.data( elem, type, jQuery.makeArray(data) ); else if( data ) q.push( data ); } return q; }, dequeue: function( elem, type ){ var queue = jQuery.queue( elem, type ), fn = queue.shift(); if( !type || type === "fx" ) fn = queue[0]; if( fn !== undefined ) fn.call(elem); } }); jQuery.fn.extend({ data: function( key, value ){ var parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); if ( data === undefined && this.length ) data = jQuery.data( this[0], key ); return data === undefined && parts[1] ? this.data( parts[0] ) : data; } else return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ jQuery.data( this, key, value ); }); }, removeData: function( key ){ return this.each(function(){ jQuery.removeData( this, key ); }); }, queue: function(type, data){ if ( typeof type !== "string" ) { data = type; type = "fx"; } if ( data === undefined ) return jQuery.queue( this[0], type ); return this.each(function(){ var queue = jQuery.queue( this, type, data ); if( type == "fx" && queue.length == 1 ) queue[0].call(this); }); }, dequeue: function(type){ return this.each(function(){ jQuery.dequeue( this, type ); }); } });/*! * Sizzle CSS Selector Engine - v0.9.3 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, done = 0, toString = Object.prototype.toString; var Sizzle = function(selector, context, results, seed) { results = results || []; context = context || document; if ( context.nodeType !== 1 && context.nodeType !== 9 ) return []; if ( !selector || typeof selector !== "string" ) { return results; } var parts = [], m, set, checkSet, check, mode, extra, prune = true; // Reset the position of the chunker regexp (start from head) chunker.lastIndex = 0; while ( (m = chunker.exec(selector)) !== null ) { parts.push( m[1] ); if ( m[2] ) { extra = RegExp.rightContext; break; } } if ( parts.length > 1 && origPOS.exec( selector ) ) { if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { set = posProcess( parts[0] + parts[1], context ); } else { set = Expr.relative[ parts[0] ] ? [ context ] : Sizzle( parts.shift(), context ); while ( parts.length ) { selector = parts.shift(); if ( Expr.relative[ selector ] ) selector += parts.shift(); set = posProcess( selector, set ); } } } else { var ret = seed ? { expr: parts.pop(), set: makeArray(seed) } : Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) ); set = Sizzle.filter( ret.expr, ret.set ); if ( parts.length > 0 ) { checkSet = makeArray(set); } else { prune = false; } while ( parts.length ) { var cur = parts.pop(), pop = cur; if ( !Expr.relative[ cur ] ) { cur = ""; } else { pop = parts.pop(); } if ( pop == null ) { pop = context; } Expr.relative[ cur ]( checkSet, pop, isXML(context) ); } } if ( !checkSet ) { checkSet = set; } if ( !checkSet ) { throw "Syntax error, unrecognized expression: " + (cur || selector); } if ( toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); } else if ( context.nodeType === 1 ) { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { results.push( set[i] ); } } } else { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && checkSet[i].nodeType === 1 ) { results.push( set[i] ); } } } } else { makeArray( checkSet, results ); } if ( extra ) { Sizzle( extra, context, results, seed ); if ( sortOrder ) { hasDuplicate = false; results.sort(sortOrder); if ( hasDuplicate ) { for ( var i = 1; i < results.length; i++ ) { if ( results[i] === results[i-1] ) { results.splice(i--, 1); } } } } } return results; }; Sizzle.matches = function(expr, set){ return Sizzle(expr, null, null, set); }; Sizzle.find = function(expr, context, isXML){ var set, match; if ( !expr ) { return []; } for ( var i = 0, l = Expr.order.length; i < l; i++ ) { var type = Expr.order[i], match; if ( (match = Expr.match[ type ].exec( expr )) ) { var left = RegExp.leftContext; if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace(/\\/g, ""); set = Expr.find[ type ]( match, context, isXML ); if ( set != null ) { expr = expr.replace( Expr.match[ type ], "" ); break; } } } } if ( !set ) { set = context.getElementsByTagName("*"); } return {set: set, expr: expr}; }; Sizzle.filter = function(expr, set, inplace, not){ var old = expr, result = [], curLoop = set, match, anyFound, isXMLFilter = set && set[0] && isXML(set[0]); while ( expr && set.length ) { for ( var type in Expr.filter ) { if ( (match = Expr.match[ type ].exec( expr )) != null ) { var filter = Expr.filter[ type ], found, item; anyFound = false; if ( curLoop == result ) { result = []; } if ( Expr.preFilter[ type ] ) { match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); if ( !match ) { anyFound = found = true; } else if ( match === true ) { continue; } } if ( match ) { for ( var i = 0; (item = curLoop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curLoop ); var pass = not ^ !!found; if ( inplace && found != null ) { if ( pass ) { anyFound = true; } else { curLoop[i] = false; } } else if ( pass ) { result.push( item ); anyFound = true; } } } } if ( found !== undefined ) { if ( !inplace ) { curLoop = result; } expr = expr.replace( Expr.match[ type ], "" ); if ( !anyFound ) { return []; } break; } } } // Improper expression if ( expr == old ) { if ( anyFound == null ) { throw "Syntax error, unrecognized expression: " + expr; } else { break; } } old = expr; } return curLoop; }; var Expr = Sizzle.selectors = { order: [ "ID", "NAME", "TAG" ], match: { ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ }, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function(elem){ return elem.getAttribute("href"); } }, relative: { "+": function(checkSet, part, isXML){ var isPartStr = typeof part === "string", isTag = isPartStr && !/\W/.test(part), isPartStrNotTag = isPartStr && !isTag; if ( isTag && !isXML ) { part = part.toUpperCase(); } for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { if ( (elem = checkSet[i]) ) { while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? elem || false : elem === part; } } if ( isPartStrNotTag ) { Sizzle.filter( part, checkSet, true ); } }, ">": function(checkSet, part, isXML){ var isPartStr = typeof part === "string"; if ( isPartStr && !/\W/.test(part) ) { part = isXML ? part : part.toUpperCase(); for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var parent = elem.parentNode; checkSet[i] = parent.nodeName === part ? parent : false; } } } else { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { checkSet[i] = isPartStr ? elem.parentNode : elem.parentNode === part; } } if ( isPartStr ) { Sizzle.filter( part, checkSet, true ); } } }, "": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( !part.match(/\W/) ) { var nodeCheck = part = isXML ? part : part.toUpperCase(); checkFn = dirNodeCheck; } checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); }, "~": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !part.match(/\W/) ) { var nodeCheck = part = isXML ? part : part.toUpperCase(); checkFn = dirNodeCheck; } checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); } }, find: { ID: function(match, context, isXML){ if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? [m] : []; } }, NAME: function(match, context, isXML){ if ( typeof context.getElementsByName !== "undefined" ) { var ret = [], results = context.getElementsByName(match[1]); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getAttribute("name") === match[1] ) { ret.push( results[i] ); } } return ret.length === 0 ? null : ret; } }, TAG: function(match, context){ return context.getElementsByTagName(match[1]); } }, preFilter: { CLASS: function(match, curLoop, inplace, result, not, isXML){ match = " " + match[1].replace(/\\/g, "") + " "; if ( isXML ) { return match; } for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { if ( elem ) { if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { if ( !inplace ) result.push( elem ); } else if ( inplace ) { curLoop[i] = false; } } } return false; }, ID: function(match){ return match[1].replace(/\\/g, ""); }, TAG: function(match, curLoop){ for ( var i = 0; curLoop[i] === false; i++ ){} return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); }, CHILD: function(match){ if ( match[1] == "nth" ) { // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } // TODO: Move to normal caching system match[0] = done++; return match; }, ATTR: function(match, curLoop, inplace, result, not, isXML){ var name = match[1].replace(/\\/g, ""); if ( !isXML && Expr.attrMap[name] ) { match[1] = Expr.attrMap[name]; } if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, PSEUDO: function(match, curLoop, inplace, result, not){ if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } return false; } } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { return true; } return match; }, POS: function(match){ match.unshift( true ); return match; } }, filters: { enabled: function(elem){ return elem.disabled === false && elem.type !== "hidden"; }, disabled: function(elem){ return elem.disabled === true; }, checked: function(elem){ return elem.checked === true; }, selected: function(elem){ // Accessing this property makes selected-by-default // options in Safari work properly elem.parentNode.selectedIndex; return elem.selected === true; }, parent: function(elem){ return !!elem.firstChild; }, empty: function(elem){ return !elem.firstChild; }, has: function(elem, i, match){ return !!Sizzle( match[3], elem ).length; }, header: function(elem){ return /h\d/i.test( elem.nodeName ); }, text: function(elem){ return "text" === elem.type; }, radio: function(elem){ return "radio" === elem.type; }, checkbox: function(elem){ return "checkbox" === elem.type; }, file: function(elem){ return "file" === elem.type; }, password: function(elem){ return "password" === elem.type; }, submit: function(elem){ return "submit" === elem.type; }, image: function(elem){ return "image" === elem.type; }, reset: function(elem){ return "reset" === elem.type; }, button: function(elem){ return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; }, input: function(elem){ return /input|select|textarea|button/i.test(elem.nodeName); } }, setFilters: { first: function(elem, i){ return i === 0; }, last: function(elem, i, match, array){ return i === array.length - 1; }, even: function(elem, i){ return i % 2 === 0; }, odd: function(elem, i){ return i % 2 === 1; }, lt: function(elem, i, match){ return i < match[3] - 0; }, gt: function(elem, i, match){ return i > match[3] - 0; }, nth: function(elem, i, match){ return match[3] - 0 == i; }, eq: function(elem, i, match){ return match[3] - 0 == i; } }, filter: { PSEUDO: function(elem, match, i, array){ var name = match[1], filter = Expr.filters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } else if ( name === "contains" ) { return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; for ( var i = 0, l = not.length; i < l; i++ ) { if ( not[i] === elem ) { return false; } } return true; } }, CHILD: function(elem, match){ var type = match[1], node = elem; switch (type) { case 'only': case 'first': while (node = node.previousSibling) { if ( node.nodeType === 1 ) return false; } if ( type == 'first') return true; node = elem; case 'last': while (node = node.nextSibling) { if ( node.nodeType === 1 ) return false; } return true; case 'nth': var first = match[2], last = match[3]; if ( first == 1 && last == 0 ) { return true; } var doneName = match[0], parent = elem.parentNode; if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { var count = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { node.nodeIndex = ++count; } } parent.sizcache = doneName; } var diff = elem.nodeIndex - last; if ( first == 0 ) { return diff == 0; } else { return ( diff % first == 0 && diff / first >= 0 ); } } }, ID: function(elem, match){ return elem.nodeType === 1 && elem.getAttribute("id") === match; }, TAG: function(elem, match){ return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; }, CLASS: function(elem, match){ return (" " + (elem.className || elem.getAttribute("class")) + " ") .indexOf( match ) > -1; }, ATTR: function(elem, match){ var name = match[1], result = Expr.attrHandle[ name ] ? Expr.attrHandle[ name ]( elem ) : elem[ name ] != null ? elem[ name ] : elem.getAttribute( name ), value = result + "", type = match[2], check = match[4]; return result == null ? type === "!=" : type === "=" ? value === check : type === "*=" ? value.indexOf(check) >= 0 : type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? value && result !== false : type === "!=" ? value != check : type === "^=" ? value.indexOf(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check : type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-" : false; }, POS: function(elem, match, i, array){ var name = match[2], filter = Expr.setFilters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } } } }; var origPOS = Expr.match.POS; for ( var type in Expr.match ) { Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); } var makeArray = function(array, results) { array = Array.prototype.slice.call( array ); if ( results ) { results.push.apply( results, array ); return results; } return array; }; // Perform a simple check to determine if the browser is capable of // converting a NodeList to an array using builtin methods. try { Array.prototype.slice.call( document.documentElement.childNodes ); // Provide a fallback method if it does not work } catch(e){ makeArray = function(array, results) { var ret = results || []; if ( toString.call(array) === "[object Array]" ) { Array.prototype.push.apply( ret, array ); } else { if ( typeof array.length === "number" ) { for ( var i = 0, l = array.length; i < l; i++ ) { ret.push( array[i] ); } } else { for ( var i = 0; array[i]; i++ ) { ret.push( array[i] ); } } } return ret; }; } var sortOrder; if ( document.documentElement.compareDocumentPosition ) { sortOrder = function( a, b ) { var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } else if ( "sourceIndex" in document.documentElement ) { sortOrder = function( a, b ) { var ret = a.sourceIndex - b.sourceIndex; if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } else if ( document.createRange ) { sortOrder = function( a, b ) { var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); aRange.selectNode(a); aRange.collapse(true); bRange.selectNode(b); bRange.collapse(true); var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } // Check to see if the browser returns elements by name when // querying by getElementById (and provide a workaround) (function(){ // We're going to inject a fake input element with a specified name var form = document.createElement("form"), id = "script" + (new Date).getTime(); form.innerHTML = "<input name='" + id + "'/>"; // Inject it into the root element, check its status, and remove it quickly var root = document.documentElement; root.insertBefore( form, root.firstChild ); // The workaround has to do additional checks after a getElementById // Which slows things down for other browsers (hence the branching) if ( !!document.getElementById( id ) ) { Expr.find.ID = function(match, context, isXML){ if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; } }; Expr.filter.ID = function(elem, match){ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return elem.nodeType === 1 && node && node.nodeValue === match; }; } root.removeChild( form ); })(); (function(){ // Check to see if the browser returns only elements // when doing getElementsByTagName("*") // Create a fake element var div = document.createElement("div"); div.appendChild( document.createComment("") ); // Make sure no comments are found if ( div.getElementsByTagName("*").length > 0 ) { Expr.find.TAG = function(match, context){ var results = context.getElementsByTagName(match[1]); // Filter out possible comments if ( match[1] === "*" ) { var tmp = []; for ( var i = 0; results[i]; i++ ) { if ( results[i].nodeType === 1 ) { tmp.push( results[i] ); } } results = tmp; } return results; }; } // Check to see if an attribute returns normalized href attributes div.innerHTML = "<a href='#'></a>"; if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && div.firstChild.getAttribute("href") !== "#" ) { Expr.attrHandle.href = function(elem){ return elem.getAttribute("href", 2); }; } })(); if ( document.querySelectorAll ) (function(){ var oldSizzle = Sizzle, div = document.createElement("div"); div.innerHTML = "<p class='TEST'></p>"; // Safari can't handle uppercase or unicode characters when // in quirks mode. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { return; } Sizzle = function(query, context, extra, seed){ context = context || document; // Only use querySelectorAll on non-XML documents // (ID selectors don't work in non-HTML documents) if ( !seed && context.nodeType === 9 && !isXML(context) ) { try { return makeArray( context.querySelectorAll(query), extra ); } catch(e){} } return oldSizzle(query, context, extra, seed); }; Sizzle.find = oldSizzle.find; Sizzle.filter = oldSizzle.filter; Sizzle.selectors = oldSizzle.selectors; Sizzle.matches = oldSizzle.matches; })(); if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ var div = document.createElement("div"); div.innerHTML = "<div class='test e'></div><div class='test'></div>"; // Opera can't find a second classname (in 9.6) if ( div.getElementsByClassName("e").length === 0 ) return; // Safari caches class attributes, doesn't catch changes (in 3.2) div.lastChild.className = "e"; if ( div.getElementsByClassName("e").length === 1 ) return; Expr.order.splice(1, 0, "CLASS"); Expr.find.CLASS = function(match, context, isXML) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { return context.getElementsByClassName(match[1]); } }; })(); function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { var sibDir = dir == "previousSibling" && !isXML; for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { if ( sibDir && elem.nodeType === 1 ){ elem.sizcache = doneName; elem.sizset = i; } elem = elem[dir]; var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 && !isXML ){ elem.sizcache = doneName; elem.sizset = i; } if ( elem.nodeName === cur ) { match = elem; break; } elem = elem[dir]; } checkSet[i] = match; } } } function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { var sibDir = dir == "previousSibling" && !isXML; for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { if ( sibDir && elem.nodeType === 1 ) { elem.sizcache = doneName; elem.sizset = i; } elem = elem[dir]; var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 ) { if ( !isXML ) { elem.sizcache = doneName; elem.sizset = i; } if ( typeof cur !== "string" ) { if ( elem === cur ) { match = true; break; } } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { match = elem; break; } } elem = elem[dir]; } checkSet[i] = match; } } } var contains = document.compareDocumentPosition ? function(a, b){ return a.compareDocumentPosition(b) & 16; } : function(a, b){ return a !== b && (a.contains ? a.contains(b) : true); }; var isXML = function(elem){ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || !!elem.ownerDocument && isXML( elem.ownerDocument ); }; var posProcess = function(selector, context){ var tmpSet = [], later = "", match, root = context.nodeType ? [context] : context; // Position selectors must be done after the filter // And so must :not(positional) so we move all PSEUDOs to the end while ( (match = Expr.match.PSEUDO.exec( selector )) ) { later += match[0]; selector = selector.replace( Expr.match.PSEUDO, "" ); } selector = Expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { Sizzle( selector, root[i], tmpSet ); } return Sizzle.filter( later, tmpSet ); }; // EXPOSE jQuery.find = Sizzle; jQuery.filter = Sizzle.filter; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; Sizzle.selectors.filters.hidden = function(elem){ return elem.offsetWidth === 0 || elem.offsetHeight === 0; }; Sizzle.selectors.filters.visible = function(elem){ return elem.offsetWidth > 0 || elem.offsetHeight > 0; }; Sizzle.selectors.filters.animated = function(elem){ return jQuery.grep(jQuery.timers, function(fn){ return elem === fn.elem; }).length; }; jQuery.multiFilter = function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return Sizzle.matches(expr, elems); }; jQuery.dir = function( elem, dir ){ var matched = [], cur = elem[dir]; while ( cur && cur != document ) { if ( cur.nodeType == 1 ) matched.push( cur ); cur = cur[dir]; } return matched; }; jQuery.nth = function(cur, result, dir, elem){ result = result || 1; var num = 0; for ( ; cur; cur = cur[dir] ) if ( cur.nodeType == 1 && ++num == result ) break; return cur; }; jQuery.sibling = function(n, elem){ var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType == 1 && n != elem ) r.push( n ); } return r; }; return; window.Sizzle = Sizzle; })(); /* * A number of helper functions used for managing events. * Many of the ideas behind this code originated from * Dean Edwards' addEvent library. */ jQuery.event = { // Bind an event to an element // Original by Dean Edwards add: function(elem, types, handler, data) { if ( elem.nodeType == 3 || elem.nodeType == 8 ) return; // For whatever reason, IE has trouble passing the window object // around, causing it to be cloned in the process if ( elem.setInterval && elem != window ) elem = window; // Make sure that the function being executed has a unique ID if ( !handler.guid ) handler.guid = this.guid++; // if data is passed, bind to handler if ( data !== undefined ) { // Create temporary function pointer to original handler var fn = handler; // Create unique handler function, wrapped around original handler handler = this.proxy( fn ); // Store data in unique handler handler.data = data; } // Init the element's event structure var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ // Handle the second event of a trigger and when // an event is called after a page has unloaded return typeof jQuery !== "undefined" && !jQuery.event.triggered ? jQuery.event.handle.apply(arguments.callee.elem, arguments) : undefined; }); // Add elem as a property of the handle function // This is to prevent a memory leak with non-native // event in IE. handle.elem = elem; // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); jQuery.each(types.split(/\s+/), function(index, type) { // Namespaced event handlers var namespaces = type.split("."); type = namespaces.shift(); handler.type = namespaces.slice().sort().join("."); // Get the current list of functions bound to this event var handlers = events[type]; if ( jQuery.event.specialAll[type] ) jQuery.event.specialAll[type].setup.call(elem, data, namespaces); // Init the event handler queue if (!handlers) { handlers = events[type] = {}; // Check for a special event handler // Only use addEventListener/attachEvent if the special // events handler returns false if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) { // Bind the global event handler to the element if (elem.addEventListener) elem.addEventListener(type, handle, false); else if (elem.attachEvent) elem.attachEvent("on" + type, handle); } } // Add the function to the element's handler list handlers[handler.guid] = handler; // Keep track of which events have been used, for global triggering jQuery.event.global[type] = true; }); // Nullify elem to prevent memory leaks in IE elem = null; }, guid: 1, global: {}, // Detach an event or set of events from an element remove: function(elem, types, handler) { // don't do events on text and comment nodes if ( elem.nodeType == 3 || elem.nodeType == 8 ) return; var events = jQuery.data(elem, "events"), ret, index; if ( events ) { // Unbind all events for the element if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") ) for ( var type in events ) this.remove( elem, type + (types || "") ); else { // types is actually an event object here if ( types.type ) { handler = types.handler; types = types.type; } // Handle multiple events seperated by a space // jQuery(...).unbind("mouseover mouseout", fn); jQuery.each(types.split(/\s+/), function(index, type){ // Namespaced event handlers var namespaces = type.split("."); type = namespaces.shift(); var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); if ( events[type] ) { // remove the given handler for the given type if ( handler ) delete events[type][handler.guid]; // remove all handlers for the given type else for ( var handle in events[type] ) // Handle the removal of namespaced events if ( namespace.test(events[type][handle].type) ) delete events[type][handle]; if ( jQuery.event.specialAll[type] ) jQuery.event.specialAll[type].teardown.call(elem, namespaces); // remove generic event handler if no more handlers exist for ( ret in events[type] ) break; if ( !ret ) { if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) { if (elem.removeEventListener) elem.removeEventListener(type, jQuery.data(elem, "handle"), false); else if (elem.detachEvent) elem.detachEvent("on" + type, jQuery.data(elem, "handle")); } ret = null; delete events[type]; } } }); } // Remove the expando if it's no longer used for ( ret in events ) break; if ( !ret ) { var handle = jQuery.data( elem, "handle" ); if ( handle ) handle.elem = null; jQuery.removeData( elem, "events" ); jQuery.removeData( elem, "handle" ); } } }, // bubbling is internal trigger: function( event, data, elem, bubbling ) { // Event object or event type var type = event.type || event; if( !bubbling ){ event = typeof event === "object" ? // jQuery.Event object event[expando] ? event : // Object literal jQuery.extend( jQuery.Event(type), event ) : // Just the event type (string) jQuery.Event(type); if ( type.indexOf("!") >= 0 ) { event.type = type = type.slice(0, -1); event.exclusive = true; } // Handle a global trigger if ( !elem ) { // Don't bubble custom events when global (to avoid too much overhead) event.stopPropagation(); // Only trigger if we've ever bound an event for it if ( this.global[type] ) jQuery.each( jQuery.cache, function(){ if ( this.events && this.events[type] ) jQuery.event.trigger( event, data, this.handle.elem ); }); } // Handle triggering a single element // don't do events on text and comment nodes if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) return undefined; // Clean up in case it is reused event.result = undefined; event.target = elem; // Clone the incoming data, if any data = jQuery.makeArray(data); data.unshift( event ); } event.currentTarget = elem; // Trigger the event, it is assumed that "handle" is a function var handle = jQuery.data(elem, "handle"); if ( handle ) handle.apply( elem, data ); // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) event.result = false; // Trigger the native events (except for clicks on links) if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) { this.triggered = true; try { elem[ type ](); // prevent IE from throwing an error for some hidden elements } catch (e) {} } this.triggered = false; if ( !event.isPropagationStopped() ) { var parent = elem.parentNode || elem.ownerDocument; if ( parent ) jQuery.event.trigger(event, data, parent, true); } }, handle: function(event) { // returned undefined or false var all, handlers; event = arguments[0] = jQuery.event.fix( event || window.event ); event.currentTarget = this; // Namespaced event handlers var namespaces = event.type.split("."); event.type = namespaces.shift(); // Cache this now, all = true means, any handler all = !namespaces.length && !event.exclusive; var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); handlers = ( jQuery.data(this, "events") || {} )[event.type]; for ( var j in handlers ) { var handler = handlers[j]; // Filter the functions by class if ( all || namespace.test(handler.type) ) { // Pass in a reference to the handler function itself // So that we can later remove it event.handler = handler; event.data = handler.data; var ret = handler.apply(this, arguments); if( ret !== undefined ){ event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } if( event.isImmediatePropagationStopped() ) break; } } }, props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix: function(event) { if ( event[expando] ) return event; // store a copy of the original event object // and "clone" to set read-only properties var originalEvent = event; event = jQuery.Event( originalEvent ); for ( var i = this.props.length, prop; i; ){ prop = this.props[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary if ( !event.target ) event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either // check if target is a textnode (safari) if ( event.target.nodeType == 3 ) event.target = event.target.parentNode; // Add relatedTarget, if necessary if ( !event.relatedTarget && event.fromElement ) event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && event.clientX != null ) { var doc = document.documentElement, body = document.body; event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); } // Add which for key events if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) event.which = event.charCode || event.keyCode; // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) if ( !event.metaKey && event.ctrlKey ) event.metaKey = event.ctrlKey; // Add which for click: 1 == left; 2 == middle; 3 == right // Note: button is not normalized, so don't use it if ( !event.which && event.button ) event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); return event; }, proxy: function( fn, proxy ){ proxy = proxy || function(){ return fn.apply(this, arguments); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; // So proxy can be declared as an argument return proxy; }, special: { ready: { // Make sure the ready event is setup setup: bindReady, teardown: function() {} } }, specialAll: { live: { setup: function( selector, namespaces ){ jQuery.event.add( this, namespaces[0], liveHandler ); }, teardown: function( namespaces ){ if ( namespaces.length ) { var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); jQuery.each( (jQuery.data(this, "events").live || {}), function(){ if ( name.test(this.type) ) remove++; }); if ( remove < 1 ) jQuery.event.remove( this, namespaces[0], liveHandler ); } } } } }; jQuery.Event = function( src ){ // Allow instantiation without the 'new' keyword if( !this.preventDefault ) return new jQuery.Event(src); // Event object if( src && src.type ){ this.originalEvent = src; this.type = src.type; // Event type }else this.type = src; // timeStamp is buggy for some events on Firefox(#3843) // So we won't rely on the native value this.timeStamp = now(); // Mark it as fixed this[expando] = true; }; function returnFalse(){ return false; } function returnTrue(){ return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if( !e ) return; // if preventDefault exists run it on the original event if (e.preventDefault) e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) e.returnValue = false; }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if( !e ) return; // if stopPropagation exists run it on the original event if (e.stopPropagation) e.stopPropagation(); // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation:function(){ this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Checks if an event happened on an element within another element // Used in jQuery.event.special.mouseenter and mouseleave handlers var withinElement = function(event) { // Check if mouse(over|out) are still within the same parent element var parent = event.relatedTarget; // Traverse up the tree while ( parent && parent != this ) try { parent = parent.parentNode; } catch(e) { parent = this; } if( parent != this ){ // set the correct event type event.type = event.data; // handle event if we actually just moused on to a non sub-element jQuery.event.handle.apply( this, arguments ); } }; jQuery.each({ mouseover: 'mouseenter', mouseout: 'mouseleave' }, function( orig, fix ){ jQuery.event.special[ fix ] = { setup: function(){ jQuery.event.add( this, orig, withinElement, fix ); }, teardown: function(){ jQuery.event.remove( this, orig, withinElement ); } }; }); jQuery.fn.extend({ bind: function( type, data, fn ) { return type == "unload" ? this.one(type, data, fn) : this.each(function(){ jQuery.event.add( this, type, fn || data, fn && data ); }); }, one: function( type, data, fn ) { var one = jQuery.event.proxy( fn || data, function(event) { jQuery(this).unbind(event, one); return (fn || data).apply( this, arguments ); }); return this.each(function(){ jQuery.event.add( this, type, one, fn && data); }); }, unbind: function( type, fn ) { return this.each(function(){ jQuery.event.remove( this, type, fn ); }); }, trigger: function( type, data ) { return this.each(function(){ jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { if( this[0] ){ var event = jQuery.Event(type); event.preventDefault(); event.stopPropagation(); jQuery.event.trigger( event, data, this[0] ); return event.result; } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, i = 1; // link all the functions, so any of them can unbind this click handler while( i < args.length ) jQuery.event.proxy( fn, args[i++] ); return this.click( jQuery.event.proxy( fn, function(event) { // Figure out which function to execute this.lastToggle = ( this.lastToggle || 0 ) % i; // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ this.lastToggle++ ].apply( this, arguments ) || false; })); }, hover: function(fnOver, fnOut) { return this.mouseenter(fnOver).mouseleave(fnOut); }, ready: function(fn) { // Attach the listeners bindReady(); // If the DOM is already ready if ( jQuery.isReady ) // Execute the function immediately fn.call( document, jQuery ); // Otherwise, remember the function for later else // Add the function to the wait list jQuery.readyList.push( fn ); return this; }, live: function( type, fn ){ var proxy = jQuery.event.proxy( fn ); proxy.guid += this.selector + type; jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy ); return this; }, die: function( type, fn ){ jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null ); return this; } }); function liveHandler( event ){ var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"), stop = true, elems = []; jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){ if ( check.test(fn.type) ) { var elem = jQuery(event.target).closest(fn.data)[0]; if ( elem ) elems.push({ elem: elem, fn: fn }); } }); elems.sort(function(a,b) { return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest"); }); jQuery.each(elems, function(){ if ( this.fn.call(this.elem, event, this.fn.data) === false ) return (stop = false); }); return stop; } function liveConvert(type, selector){ return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join("."); } jQuery.extend({ isReady: false, readyList: [], // Handle when the DOM is ready ready: function() { // Make sure that the DOM is not already loaded if ( !jQuery.isReady ) { // Remember that the DOM is ready jQuery.isReady = true; // If there are functions bound, to execute if ( jQuery.readyList ) { // Execute all of them jQuery.each( jQuery.readyList, function(){ this.call( document, jQuery ); }); // Reset the list of functions jQuery.readyList = null; } // Trigger any bound ready events jQuery(document).triggerHandler("ready"); } } }); var readyBound = false; function bindReady(){ if ( readyBound ) return; readyBound = true; // Mozilla, Opera and webkit nightlies currently support this event if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", function(){ document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); jQuery.ready(); }, false ); // If IE event model is used } else if ( document.attachEvent ) { // ensure firing before onload, // maybe late but safe also for iframes document.attachEvent("onreadystatechange", function(){ if ( document.readyState === "complete" ) { document.detachEvent( "onreadystatechange", arguments.callee ); jQuery.ready(); } }); // If IE and not an iframe // continually check to see if the document is ready if ( document.documentElement.doScroll && window == window.top ) (function(){ if ( jQuery.isReady ) return; try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch( error ) { setTimeout( arguments.callee, 0 ); return; } // and execute any waiting functions jQuery.ready(); })(); } // A fallback to window.onload, that will always work jQuery.event.add( window, "load", jQuery.ready ); } jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," + "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){ // Handle event binding jQuery.fn[name] = function(fn){ return fn ? this.bind(name, fn) : this.trigger(name); }; }); // Prevent memory leaks in IE // And prevent errors on refresh with events like mouseover in other browsers // Window isn't included so as not to unbind existing unload events jQuery( window ).bind( 'unload', function(){ for ( var id in jQuery.cache ) // Skip the window if ( id != 1 && jQuery.cache[ id ].handle ) jQuery.event.remove( jQuery.cache[ id ].handle.elem ); }); (function(){ jQuery.support = {}; var root = document.documentElement, script = document.createElement("script"), div = document.createElement("div"), id = "script" + (new Date).getTime(); div.style.display = "none"; div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>'; var all = div.getElementsByTagName("*"), a = div.getElementsByTagName("a")[0]; // Can't get basic test support if ( !all || !all.length || !a ) { return; } jQuery.support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: div.firstChild.nodeType == 3, // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that you can get all elements in an <object> element // IE 7 always returns no results objectAll: !!div.getElementsByTagName("object")[0] .getElementsByTagName("*").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText insted) style: /red/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: a.getAttribute("href") === "/a", // Make sure that element opacity exists // (IE uses filter instead) opacity: a.style.opacity === "0.5", // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Will be defined later scriptEval: false, noCloneEvent: true, boxModel: null }; script.type = "text/javascript"; try { script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); } catch(e){} root.insertBefore( script, root.firstChild ); // Make sure that the execution of code works by injecting a script // tag with appendChild/createTextNode // (IE doesn't support this, fails, and uses .text instead) if ( window[ id ] ) { jQuery.support.scriptEval = true; delete window[ id ]; } root.removeChild( script ); if ( div.attachEvent && div.fireEvent ) { div.attachEvent("onclick", function(){ // Cloning a node shouldn't copy over any // bound event handlers (IE does this) jQuery.support.noCloneEvent = false; div.detachEvent("onclick", arguments.callee); }); div.cloneNode(true).fireEvent("onclick"); } // Figure out if the W3C box model works as expected // document.body must exist before we can do this jQuery(function(){ var div = document.createElement("div"); div.style.width = div.style.paddingLeft = "1px"; document.body.appendChild( div ); jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; document.body.removeChild( div ).style.display = 'none'; }); })(); var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat"; jQuery.props = { "for": "htmlFor", "class": "className", "float": styleFloat, cssFloat: styleFloat, styleFloat: styleFloat, readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", tabindex: "tabIndex" }; jQuery.fn.extend({ // Keep a copy of the old load _load: jQuery.fn.load, load: function( url, params, callback ) { if ( typeof url !== "string" ) return this._load( url ); var off = url.indexOf(" "); if ( off >= 0 ) { var selector = url.slice(off, url.length); url = url.slice(0, off); } // Default to a GET request var type = "GET"; // If the second parameter was provided if ( params ) // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = null; // Otherwise, build a param string } else if( typeof params === "object" ) { params = jQuery.param( params ); type = "POST"; } var self = this; // Request the remote document jQuery.ajax({ url: url, type: type, dataType: "html", data: params, complete: function(res, status){ // If successful, inject the HTML into all the matched elements if ( status == "success" || status == "notmodified" ) // See if a selector was specified self.html( selector ? // Create a dummy div to hold the results jQuery("<div/>") // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")) // Locate the specified elements .find(selector) : // If not, just inject the full result res.responseText ); if( callback ) self.each( callback, [res.responseText, status, res] ); } }); return this; }, serialize: function() { return jQuery.param(this.serializeArray()); }, serializeArray: function() { return this.map(function(){ return this.elements ? jQuery.makeArray(this.elements) : this; }) .filter(function(){ return this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /text|hidden|password|search/i.test(this.type)); }) .map(function(i, elem){ var val = jQuery(this).val(); return val == null ? null : jQuery.isArray(val) ? jQuery.map( val, function(val, i){ return {name: elem.name, value: val}; }) : {name: elem.name, value: val}; }).get(); } }); // Attach a bunch of functions for handling common AJAX events jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){ jQuery.fn[o] = function(f){ return this.bind(o, f); }; }); var jsc = now(); jQuery.extend({ get: function( url, data, callback, type ) { // shift arguments if data argument was ommited if ( jQuery.isFunction( data ) ) { callback = data; data = null; } return jQuery.ajax({ type: "GET", url: url, data: data, success: callback, dataType: type }); }, getScript: function( url, callback ) { return jQuery.get(url, null, callback, "script"); }, getJSON: function( url, data, callback ) { return jQuery.get(url, data, callback, "json"); }, post: function( url, data, callback, type ) { if ( jQuery.isFunction( data ) ) { callback = data; data = {}; } return jQuery.ajax({ type: "POST", url: url, data: data, success: callback, dataType: type }); }, ajaxSetup: function( settings ) { jQuery.extend( jQuery.ajaxSettings, settings ); }, ajaxSettings: { url: location.href, global: true, type: "GET", //contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded; charset=UTF-8", processData: true, async: true, /* timeout: 0, data: null, username: null, password: null, */ // Create the request object; Microsoft failed to properly // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available // This function can be overriden by calling jQuery.ajaxSetup xhr:function(){ return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); }, accepts: { xml: "application/xml, text/xml", html: "text/html", script: "text/javascript, application/javascript", json: "application/json, text/javascript", text: "text/plain", _default: "*/*" } }, // Last-Modified header cache for next request lastModified: {}, ajax: function( s ) { // Extend the settings, but re-extend 's' so that it can be // checked again later (in the test suite, specifically) s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); var jsonp, jsre = /=\?(&|$)/g, status, data, type = s.type.toUpperCase(); // convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) s.data = jQuery.param(s.data); // Handle JSONP Parameter Callbacks if ( s.dataType == "jsonp" ) { if ( type == "GET" ) { if ( !s.url.match(jsre) ) s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; } else if ( !s.data || !s.data.match(jsre) ) s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; s.dataType = "json"; } // Build temporary JSONP function if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { jsonp = "jsonp" + jsc++; // Replace the =? sequence both in the query string and the data if ( s.data ) s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); s.url = s.url.replace(jsre, "=" + jsonp + "$1"); // We need to make sure // that a JSONP style response is executed properly s.dataType = "script"; // Handle JSONP-style loading window[ jsonp ] = function(tmp){ data = tmp; success(); complete(); // Garbage collect window[ jsonp ] = undefined; try{ delete window[ jsonp ]; } catch(e){} if ( head ) head.removeChild( script ); }; } if ( s.dataType == "script" && s.cache == null ) s.cache = false; if ( s.cache === false && type == "GET" ) { var ts = now(); // try replacing _= if it is there var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); // if nothing was replaced, add timestamp to the end s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); } // If data is available, append data to url for get requests if ( s.data && type == "GET" ) { s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; // IE likes to send both get and post data, prevent this s.data = null; } // Watch for a new set of requests if ( s.global && ! jQuery.active++ ) jQuery.event.trigger( "ajaxStart" ); // Matches an absolute URL, and saves the domain var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url ); // If we're requesting a remote document // and trying to load JSON or Script with a GET if ( s.dataType == "script" && type == "GET" && parts && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){ var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.src = s.url; if (s.scriptCharset) script.charset = s.scriptCharset; // Handle Script loading if ( !jsonp ) { var done = false; // Attach handlers for all browsers script.onload = script.onreadystatechange = function(){ if ( !done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) { done = true; success(); complete(); // Handle memory leak in IE script.onload = script.onreadystatechange = null; head.removeChild( script ); } }; } head.appendChild(script); // We handle everything using the script element injection return undefined; } var requestDone = false; // Create the request object var xhr = s.xhr(); // Open the socket // Passing null username, generates a login popup on Opera (#2865) if( s.username ) xhr.open(type, s.url, s.async, s.username, s.password); else xhr.open(type, s.url, s.async); // Need an extra try/catch for cross domain requests in Firefox 3 try { // Set the correct header, if data is being sent if ( s.data ) xhr.setRequestHeader("Content-Type", s.contentType); // Set the If-Modified-Since header, if ifModified mode. if ( s.ifModified ) xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); // Set header so the called script knows that it's an XMLHttpRequest xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); // Set the Accepts header for the server, depending on the dataType xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? s.accepts[ s.dataType ] + ", */*" : s.accepts._default ); } catch(e){} // Allow custom headers/mimetypes and early abort if ( s.beforeSend && s.beforeSend(xhr, s) === false ) { // Handle the global AJAX counter if ( s.global && ! --jQuery.active ) jQuery.event.trigger( "ajaxStop" ); // close opended socket xhr.abort(); return false; } if ( s.global ) jQuery.event.trigger("ajaxSend", [xhr, s]); // Wait for a response to come back var onreadystatechange = function(isTimeout){ // The request was aborted, clear the interval and decrement jQuery.active if (xhr.readyState == 0) { if (ival) { // clear poll interval clearInterval(ival); ival = null; // Handle the global AJAX counter if ( s.global && ! --jQuery.active ) jQuery.event.trigger( "ajaxStop" ); } // The transfer is complete and the data is available, or the request timed out } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { requestDone = true; // clear poll interval if (ival) { clearInterval(ival); ival = null; } status = isTimeout == "timeout" ? "timeout" : !jQuery.httpSuccess( xhr ) ? "error" : s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" : "success"; if ( status == "success" ) { // Watch for, and catch, XML document parse errors try { // process the data (runs the xml through httpData regardless of callback) data = jQuery.httpData( xhr, s.dataType, s ); } catch(e) { status = "parsererror"; } } // Make sure that the request was successful or notmodified if ( status == "success" ) { // Cache Last-Modified header, if ifModified mode. var modRes; try { modRes = xhr.getResponseHeader("Last-Modified"); } catch(e) {} // swallow exception thrown by FF if header is not available if ( s.ifModified && modRes ) jQuery.lastModified[s.url] = modRes; // JSONP handles its own success callback if ( !jsonp ) success(); } else jQuery.handleError(s, xhr, status); // Fire the complete handlers complete(); if ( isTimeout ) xhr.abort(); // Stop memory leaks if ( s.async ) xhr = null; } }; if ( s.async ) { // don't attach the handler to the request, just poll it instead var ival = setInterval(onreadystatechange, 13); // Timeout checker if ( s.timeout > 0 ) setTimeout(function(){ // Check to see if the request is still happening if ( xhr && !requestDone ) onreadystatechange( "timeout" ); }, s.timeout); } // Send the data try { xhr.send(s.data); } catch(e) { jQuery.handleError(s, xhr, null, e); } // firefox 1.5 doesn't fire statechange for sync requests if ( !s.async ) onreadystatechange(); function success(){ // If a local callback was specified, fire it and pass it the data if ( s.success ) s.success( data, status ); // Fire the global callback if ( s.global ) jQuery.event.trigger( "ajaxSuccess", [xhr, s] ); } function complete(){ // Process result if ( s.complete ) s.complete(xhr, status); // The request was completed if ( s.global ) jQuery.event.trigger( "ajaxComplete", [xhr, s] ); // Handle the global AJAX counter if ( s.global && ! --jQuery.active ) jQuery.event.trigger( "ajaxStop" ); } // return XMLHttpRequest to allow aborting the request etc. return xhr; }, handleError: function( s, xhr, status, e ) { // If a local callback was specified, fire it if ( s.error ) s.error( xhr, status, e ); // Fire the global callback if ( s.global ) jQuery.event.trigger( "ajaxError", [xhr, s, e] ); }, // Counter for holding the number of active queries active: 0, // Determines if an XMLHttpRequest was successful or not httpSuccess: function( xhr ) { try { // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !xhr.status && location.protocol == "file:" || ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223; } catch(e){} return false; }, // Determines if an XMLHttpRequest returns NotModified httpNotModified: function( xhr, url ) { try { var xhrRes = xhr.getResponseHeader("Last-Modified"); // Firefox always returns 200. check Last-Modified date return xhr.status == 304 || xhrRes == jQuery.lastModified[url]; } catch(e){} return false; }, httpData: function( xhr, type, s ) { var ct = xhr.getResponseHeader("content-type"), xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, data = xml ? xhr.responseXML : xhr.responseText; if ( xml && data.documentElement.tagName == "parsererror" ) throw "parsererror"; // Allow a pre-filtering function to sanitize the response // s != null is checked to keep backwards compatibility if( s && s.dataFilter ) data = s.dataFilter( data, type ); // The filter can actually parse the response if( typeof data === "string" ){ // If the type is "script", eval it in global context if ( type == "script" ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == "json" ) data = window["eval"]("(" + data + ")"); } return data; }, // Serialize an array of form elements or a set of // key/values into a query string param: function( a ) { var s = [ ]; function add( key, value ){ s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value); }; // If an array was passed in, assume that it is an array // of form elements if ( jQuery.isArray(a) || a.jquery ) // Serialize the form elements jQuery.each( a, function(){ add( this.name, this.value ); }); // Otherwise, assume that it's an object of key/value pairs else // Serialize the key/values for ( var j in a ) // If the value is an array then the key names need to be repeated if ( jQuery.isArray(a[j]) ) jQuery.each( a[j], function(){ add( j, this ); }); else add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] ); // Return the resulting serialization return s.join("&").replace(/%20/g, "+"); } }); var elemdisplay = {}, timerId, fxAttrs = [ // height animations [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], // width animations [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], // opacity animations [ "opacity" ] ]; function genFx( type, num ){ var obj = {}; jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){ obj[ this ] = type; }); return obj; } jQuery.fn.extend({ show: function(speed,callback){ if ( speed ) { return this.animate( genFx("show", 3), speed, callback); } else { for ( var i = 0, l = this.length; i < l; i++ ){ var old = jQuery.data(this[i], "olddisplay"); this[i].style.display = old || ""; if ( jQuery.css(this[i], "display") === "none" ) { var tagName = this[i].tagName, display; if ( elemdisplay[ tagName ] ) { display = elemdisplay[ tagName ]; } else { var elem = jQuery("<" + tagName + " />").appendTo("body"); display = elem.css("display"); if ( display === "none" ) display = "block"; elem.remove(); elemdisplay[ tagName ] = display; } jQuery.data(this[i], "olddisplay", display); } } // Set the display of the elements in a second loop // to avoid the constant reflow for ( var i = 0, l = this.length; i < l; i++ ){ this[i].style.display = jQuery.data(this[i], "olddisplay") || ""; } return this; } }, hide: function(speed,callback){ if ( speed ) { return this.animate( genFx("hide", 3), speed, callback); } else { for ( var i = 0, l = this.length; i < l; i++ ){ var old = jQuery.data(this[i], "olddisplay"); if ( !old && old !== "none" ) jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); } // Set the display of the elements in a second loop // to avoid the constant reflow for ( var i = 0, l = this.length; i < l; i++ ){ this[i].style.display = "none"; } return this; } }, // Save the old toggle function _toggle: jQuery.fn.toggle, toggle: function( fn, fn2 ){ var bool = typeof fn === "boolean"; return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? this._toggle.apply( this, arguments ) : fn == null || bool ? this.each(function(){ var state = bool ? fn : jQuery(this).is(":hidden"); jQuery(this)[ state ? "show" : "hide" ](); }) : this.animate(genFx("toggle", 3), fn, fn2); }, fadeTo: function(speed,to,callback){ return this.animate({opacity: to}, speed, callback); }, animate: function( prop, speed, easing, callback ) { var optall = jQuery.speed(speed, easing, callback); return this[ optall.queue === false ? "each" : "queue" ](function(){ var opt = jQuery.extend({}, optall), p, hidden = this.nodeType == 1 && jQuery(this).is(":hidden"), self = this; for ( p in prop ) { if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) return opt.complete.call(this); if ( ( p == "height" || p == "width" ) && this.style ) { // Store display property opt.display = jQuery.css(this, "display"); // Make sure that nothing sneaks out opt.overflow = this.style.overflow; } } if ( opt.overflow != null ) this.style.overflow = "hidden"; opt.curAnim = jQuery.extend({}, prop); jQuery.each( prop, function(name, val){ var e = new jQuery.fx( self, opt, name ); if ( /toggle|show|hide/.test(val) ) e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); else { var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), start = e.cur(true) || 0; if ( parts ) { var end = parseFloat(parts[2]), unit = parts[3] || "px"; // We need to compute starting value if ( unit != "px" ) { self.style[ name ] = (end || 1) + unit; start = ((end || 1) / e.cur(true)) * start; self.style[ name ] = start + unit; } // If a +=/-= token was provided, we're doing a relative animation if ( parts[1] ) end = ((parts[1] == "-=" ? -1 : 1) * end) + start; e.custom( start, end, unit ); } else e.custom( start, val, "" ); } }); // For JS strict compliance return true; }); }, stop: function(clearQueue, gotoEnd){ var timers = jQuery.timers; if (clearQueue) this.queue([]); this.each(function(){ // go in reverse order so anything added to the queue during the loop is ignored for ( var i = timers.length - 1; i >= 0; i-- ) if ( timers[i].elem == this ) { if (gotoEnd) // force the next step to be the last timers[i](true); timers.splice(i, 1); } }); // start the next in the queue if the last step wasn't forced if (!gotoEnd) this.dequeue(); return this; } }); // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show", 1), slideUp: genFx("hide", 1), slideToggle: genFx("toggle", 1), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" } }, function( name, props ){ jQuery.fn[ name ] = function( speed, callback ){ return this.animate( props, speed, callback ); }; }); jQuery.extend({ speed: function(speed, easing, fn) { var opt = typeof speed === "object" ? speed : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction(easing) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default; // Queueing opt.old = opt.complete; opt.complete = function(){ if ( opt.queue !== false ) jQuery(this).dequeue(); if ( jQuery.isFunction( opt.old ) ) opt.old.call( this ); }; return opt; }, easing: { linear: function( p, n, firstNum, diff ) { return firstNum + diff * p; }, swing: function( p, n, firstNum, diff ) { return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; } }, timers: [], fx: function( elem, options, prop ){ this.options = options; this.elem = elem; this.prop = prop; if ( !options.orig ) options.orig = {}; } }); jQuery.fx.prototype = { // Simple function for setting a style value update: function(){ if ( this.options.step ) this.options.step.call( this.elem, this.now, this ); (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); // Set display property to block for height/width animations if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style ) this.elem.style.display = "block"; }, // Get the current size cur: function(force){ if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) return this.elem[ this.prop ]; var r = parseFloat(jQuery.css(this.elem, this.prop, force)); return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; }, // Start an animation from one number to another custom: function(from, to, unit){ this.startTime = now(); this.start = from; this.end = to; this.unit = unit || this.unit || "px"; this.now = this.start; this.pos = this.state = 0; var self = this; function t(gotoEnd){ return self.step(gotoEnd); } t.elem = this.elem; if ( t() && jQuery.timers.push(t) && !timerId ) { timerId = setInterval(function(){ var timers = jQuery.timers; for ( var i = 0; i < timers.length; i++ ) if ( !timers[i]() ) timers.splice(i--, 1); if ( !timers.length ) { clearInterval( timerId ); timerId = undefined; } }, 13); } }, // Simple 'show' function show: function(){ // Remember where we started, so that we can go back to it later this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); this.options.show = true; // Begin the animation // Make sure that we start at a small width/height to avoid any // flash of content this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur()); // Start by showing the element jQuery(this.elem).show(); }, // Simple 'hide' function hide: function(){ // Remember where we started, so that we can go back to it later this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); this.options.hide = true; // Begin the animation this.custom(this.cur(), 0); }, // Each step of an animation step: function(gotoEnd){ var t = now(); if ( gotoEnd || t >= this.options.duration + this.startTime ) { this.now = this.end; this.pos = this.state = 1; this.update(); this.options.curAnim[ this.prop ] = true; var done = true; for ( var i in this.options.curAnim ) if ( this.options.curAnim[i] !== true ) done = false; if ( done ) { if ( this.options.display != null ) { // Reset the overflow this.elem.style.overflow = this.options.overflow; // Reset the display this.elem.style.display = this.options.display; if ( jQuery.css(this.elem, "display") == "none" ) this.elem.style.display = "block"; } // Hide the element if the "hide" operation was done if ( this.options.hide ) jQuery(this.elem).hide(); // Reset the properties, if the item has been hidden or shown if ( this.options.hide || this.options.show ) for ( var p in this.options.curAnim ) jQuery.attr(this.elem.style, p, this.options.orig[p]); // Execute the complete function this.options.complete.call( this.elem ); } return false; } else { var n = t - this.startTime; this.state = n / this.options.duration; // Perform the easing function, defaults to swing this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration); this.now = this.start + ((this.end - this.start) * this.pos); // Perform the next step of the animation this.update(); } return true; } }; jQuery.extend( jQuery.fx, { speeds:{ slow: 600, fast: 200, // Default speed _default: 400 }, step: { opacity: function(fx){ jQuery.attr(fx.elem.style, "opacity", fx.now); }, _default: function(fx){ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) fx.elem.style[ fx.prop ] = fx.now + fx.unit; else fx.elem[ fx.prop ] = fx.now; } } }); if ( document.documentElement["getBoundingClientRect"] ) jQuery.fn.offset = function() { if ( !this[0] ) return { top: 0, left: 0 }; if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement, clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; return { top: top, left: left }; }; else jQuery.fn.offset = function() { if ( !this[0] ) return { top: 0, left: 0 }; if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); jQuery.offset.initialized || jQuery.offset.initialize(); var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem, doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement, body = doc.body, defaultView = doc.defaultView, prevComputedStyle = defaultView.getComputedStyle(elem, null), top = elem.offsetTop, left = elem.offsetLeft; while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { computedStyle = defaultView.getComputedStyle(elem, null); top -= elem.scrollTop, left -= elem.scrollLeft; if ( elem === offsetParent ) { top += elem.offsetTop, left += elem.offsetLeft; if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) ) top += parseInt( computedStyle.borderTopWidth, 10) || 0, left += parseInt( computedStyle.borderLeftWidth, 10) || 0; prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; } if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) top += parseInt( computedStyle.borderTopWidth, 10) || 0, left += parseInt( computedStyle.borderLeftWidth, 10) || 0; prevComputedStyle = computedStyle; } if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) top += body.offsetTop, left += body.offsetLeft; if ( prevComputedStyle.position === "fixed" ) top += Math.max(docElem.scrollTop, body.scrollTop), left += Math.max(docElem.scrollLeft, body.scrollLeft); return { top: top, left: left }; }; jQuery.offset = { initialize: function() { if ( this.initialized ) return; var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop, html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>'; rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' }; for ( prop in rules ) container.style[prop] = rules[prop]; container.innerHTML = html; body.insertBefore(container, body.firstChild); innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild; this.doesNotAddBorder = (checkDiv.offsetTop !== 5); this.doesAddBorderForTableAndCells = (td.offsetTop === 5); innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative'; this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); body.style.marginTop = '1px'; this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0); body.style.marginTop = bodyMarginTop; body.removeChild(container); this.initialized = true; }, bodyOffset: function(body) { jQuery.offset.initialized || jQuery.offset.initialize(); var top = body.offsetTop, left = body.offsetLeft; if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0, left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0; return { top: top, left: left }; } }; jQuery.fn.extend({ position: function() { var left = 0, top = 0, results; if ( this[0] ) { // Get *real* offsetParent var offsetParent = this.offsetParent(), // Get correct offsets offset = this.offset(), parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 offset.top -= num( this, 'marginTop' ); offset.left -= num( this, 'marginLeft' ); // Add offsetParent borders parentOffset.top += num( offsetParent, 'borderTopWidth' ); parentOffset.left += num( offsetParent, 'borderLeftWidth' ); // Subtract the two offsets results = { top: offset.top - parentOffset.top, left: offset.left - parentOffset.left }; } return results; }, offsetParent: function() { var offsetParent = this[0].offsetParent || document.body; while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') ) offsetParent = offsetParent.offsetParent; return jQuery(offsetParent); } }); // Create scrollLeft and scrollTop methods jQuery.each( ['Left', 'Top'], function(i, name) { var method = 'scroll' + name; jQuery.fn[ method ] = function(val) { if (!this[0]) return null; return val !== undefined ? // Set the scroll offset this.each(function() { this == window || this == document ? window.scrollTo( !i ? val : jQuery(window).scrollLeft(), i ? val : jQuery(window).scrollTop() ) : this[ method ] = val; }) : // Return the scroll offset this[0] == window || this[0] == document ? self[ i ? 'pageYOffset' : 'pageXOffset' ] || jQuery.boxModel && document.documentElement[ method ] || document.body[ method ] : this[0][ method ]; }; }); // Create innerHeight, innerWidth, outerHeight and outerWidth methods jQuery.each([ "Height", "Width" ], function(i, name){ var tl = i ? "Left" : "Top", // top or left br = i ? "Right" : "Bottom", // bottom or right lower = name.toLowerCase(); // innerHeight and innerWidth jQuery.fn["inner" + name] = function(){ return this[0] ? jQuery.css( this[0], lower, false, "padding" ) : null; }; // outerHeight and outerWidth jQuery.fn["outer" + name] = function(margin) { return this[0] ? jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) : null; }; var type = name.toLowerCase(); jQuery.fn[ type ] = function( size ) { // Get window width or height return this[0] == window ? // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] : // Get document width or height this[0] == document ? // Either scroll[Width/Height] or offset[Width/Height], whichever is greater Math.max( document.documentElement["client" + name], document.body["scroll" + name], document.documentElement["scroll" + name], document.body["offset" + name], document.documentElement["offset" + name] ) : // Get or set width or height on the element size === undefined ? // Get width or height on the element (this.length ? jQuery.css( this[0], type ) : null) : // Set the width or height on the element (default to pixels if value is unitless) this.css( type, typeof size === "string" ? size : size + "px" ); }; }); })();
JavaScript
var $radomvalue = ""; //页面加载时初始化下拉列表 $(document).ready(function () { pageInit(0); ControlAddShow(0) var tnow = new Date(); $radomvalue = checkTime(tnow.getHours()).toString() + checkTime(tnow.getMinutes()).toString() + checkTime(tnow.getSeconds()).toString() + tnow.getMilliseconds().toString(); }); $(document).ready(function () { $("#selBig").change(function () { ChangeBigSel(0); }); }) $(document).ready(function () { $("#selSmall").change(function () { ChangeSmallSel(0); }); }) $(document).ready(function () { $("#selMtrlNo").change(function () { ChangeMtrlSel(0); }); }) $(document).ready(function () { $("#selSize").change(function () { ChangeSizeSel(0); }); }) $(document).ready(function () { $("#selFive").change(function () { ChangeFiveSel(0); }); }) $(document).ready(function () { $("#selSix").change(function () { ChangeSixSel(0); }); }) $(document).ready(function () { $("#selSeven").change(function () { ChangeSevenSel(0); }); }) $(document).ready(function () { $("#selEight").change(function () { ChangeEightSel(0); }); }) $(document).ready(function () { $("#imgBigAdd").click(function () { ControlAddShow(1); }); }) $(document).ready(function () { $("#imgSmallAdd").click(function () { ControlAddShow(2); }); }) $(document).ready(function () { $("#imgMtrlAdd").click(function () { ControlAddShow(3); }); }) $(document).ready(function () { $("#imgSizeAdd").click(function () { ControlAddShow(4); }); }) $(document).ready(function () { $("#imgFiveAdd").click(function () { ControlAddShow(5); }); }) $(document).ready(function () { $("#btnBigOK").click(function () { if ($.trim($("#txtBig").val()) == "") { alert("大类名称不能为空!"); return; } var $addValue = $("#txtBig").val(); $.ajaxForPost("AddMtrlInfo.aspx/AddData", "{ addType:1,addValueStr:'" + $addValue + "',radomvalue:'" + $radomvalue + "',mtrlCode:0}", function () { }, function (data) { pageInit(1); ChangeBigSel(0); alert(data.d); $("#txtBig").val(""); }); }); }) $(document).ready(function () { $("#btnSmallOK").click(function () { if ($.trim($("#txtSmall").val()) == "") { alert("小类名称不能为空!"); return; } var $addValue = $("#selBig").val() + "|" + $("#txtSmall").val(); $.ajaxForPost("AddMtrlInfo.aspx/AddData", "{ addType:1,addValueStr:'" + $addValue + "',radomvalue:'" + $radomvalue + "',mtrlCode:0}", function () { }, function (data) { ChangeBigSel(1); ChangeSmallSel(0); alert(data.d); $("#txtSmall").val(""); }); }); }) $(document).ready(function () { $("#btnMtrlOK").click(function () { if ($.trim($("#txtMtrl").val()) == "") { alert("物料名称不能为空!"); return; } var $addValue = $("#selBig").val() + "|" + $("#selSmall").val() + "|" + $("#txtMtrl").val(); $.ajaxForPost("AddMtrlInfo.aspx/AddData", "{ addType:1,addValueStr:'" + $addValue + "',radomvalue:'" + $radomvalue + "',mtrlCode:0}", function () { }, function (data) { ChangeSmallSel(1); ChangeMtrlSel(0) alert(data.d); $("#txtMtrl").val(""); }); }); }) $(document).ready(function () { $("#btnSizeOK").click(function () { if ($.trim($("#txtSize").val()) == "") { alert("规格名称不能为空!"); return; } var $addValue = $("#selBig").val() + "|" + $("#selSmall").val() + "|" + $("#selMtrlNo").val() + "|" + $("#txtSize").val(); $.ajaxForPost("AddMtrlInfo.aspx/AddData", "{ addType:1,addValueStr:'" + $addValue + "',radomvalue:'" + $radomvalue + "',mtrlCode:0}", function () { }, function (data) { ChangeMtrlSel(1); ChangeSizeSel(0) alert(data.d); $("#txtSize").val(""); }); }); }) $(document).ready(function () { $("#btnFiveOK").click(function () { if ($.trim($("#txtFive").val()) == "") { alert("备注名称不能为空!"); return; } var $addValue = $("#selBig").val() + "|" + $("#selSmall").val() + "|" + $("#selMtrlNo").val() + "|" + $("#selSize").val() + "|" + $("#txtFive").val(); $.ajaxForPost("AddMtrlInfo.aspx/AddData", "{ addType:1,addValueStr:'" + $addValue + "',radomvalue:'" + $radomvalue + "',mtrlCode:0}", function () { }, function (data) { ChangeSizeSel(1); ChangeFiveSel(0) alert(data.d); $("#txtFive").val(""); }); }); }) $(document).ready(function () { $("#btnAdd").click(function () { ControlAddShow(0); var $mCode = $("#selBig").val(); if ($("#selBig").val() == "-1" || $("#selBig").val() == "-2") { alert("大类不能为空!"); return; } if ($("#selSmall").val() == "-1" || $("#selSmall").val() == "-2") { alert("小类不能为空!"); return; } else $mCode = $mCode + $("#selSmall").val(); if ($("#selMtrlNo").val() == "-1" || $("#selMtrlNo").val() == "-2") { alert("物料不能为空!"); return; } else $mCode = $mCode + $("#selMtrlNo").val(); if ($("#selSize").val() == "-1" || $("#selSize").val() == "-2") $mCode = $mCode + "00"; else $mCode = $mCode + $("#selSize").val(); if ($("#selFive").val() == "-1" || $("#selFive").val() == "-2") $mCode = $mCode + "00"; else $mCode = $mCode + $("#selFive").val(); $.ajaxForPost("AddMtrlInfo.aspx/AddData", "{ addType:0,addValueStr:0,radomvalue:0,mtrlCode:'" + $mCode + "'}", function () { }, function (data) { alert(data.d); }); }); }); $(document).ready(function () { $("#btnBack").click(function () { location.href = "MtrlInfoManage.aspx"; }); }); function checkTime(i) { if (i < 10) { i = "0" + i; } return i; } //列表加载 function pageInit(path) { var $fatherStr = "all"; var $type = "init"; $("#amtrlcv").html("0 00 000 00 00"); //隐藏新增 // $("#aBig").hide(); // $("#txtBig").hide(); // $("#btnBigOK").hide(); $.ajaxForPost("AddMtrlInfo.aspx/GetSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $type + "'}", function () { }, function (data) { $("#selBig").empty(); $("#selSmall").empty(); $("#selMtrlNo").empty(); $("#selSize").empty(); $("#selFive").empty(); $("#selSix").empty(); $("#selSeven").empty(); $("#selEight").empty(); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (path == 0) { if (i == 0) $("#selBig").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selBig").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } if (path == 1) { if (i == $jsondata.length - 1) { $("#selBig").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); $("#amtrlcv").html($jsondata[i].value + " 00 000 00 00"); } else $("#selBig").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } } else { $("#selBig").append($("<option selected='true'></option>").val("-1").html("--请选择--")); } $("#selSmall").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSize").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selFive").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSix").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSeven").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selEight").append($("<option selected='true'></option>").val("-2").html("--无--")); }); } function ChangeBigSel(path) { var $fatherStr = $("#selBig").val(); if (path == 0) { $("#amtrlcv").html($("#selBig").val() + " 00 000 00 00"); } $("#selSmall").empty(); $("#selMtrlNo").empty(); $("#selSize").empty(); $("#selFive").empty(); $("#selSix").empty(); $("#selSeven").empty(); $("#selEight").empty(); $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSize").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selFive").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSix").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSeven").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selEight").append($("<option selected='true'></option>").val("-2").html("--无--")); if ($("#selBig").val() == "-1") { $("#selSmall").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#amtrlcv").html("0 00 000 00 00"); } else { var $selType = "big"; //获取相应小类信息 $.ajaxForPost("AddMtrlInfo.aspx/GetSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $selType + "'}", function () { }, function (data) { // $("#selSmall").empty(); // $("#selMtrlNo").empty(); // $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (path == 0) { if (i == 0) $("#selSmall").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selSmall").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } if (path == 1) { if (i == $jsondata.length - 1) { $("#selSmall").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); $("#amtrlcv").html($("#selBig").val() + " " + $jsondata[i].value + " 000 00 00"); } else $("#selSmall").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } } else { $("#selSmall").append($("<option selected='true'></option>").val("-2").html("--无--")); } }); } } function ChangeSmallSel(path) { $("#selMtrlNo").empty(); $("#selSize").empty(); $("#selFive").empty(); $("#selSix").empty(); $("#selSeven").empty(); $("#selEight").empty(); $("#selSize").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selFive").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSix").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSeven").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selEight").append($("<option selected='true'></option>").val("-2").html("--无--")); var $fatherStr = $("#selBig").val() + "." + $("#selSmall").val(); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " 000 00 00"); if ($("#selSmall").val() == "-1") { $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#amtrlcv").html($("#selBig").val() + " 00 000 00 00"); } else { var $selType = "small"; //获取相应物料信息 $.ajaxForPost("AddMtrlInfo.aspx/GetSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $selType + "'}", function () { }, function (data) { // $("#selMtrlNo").empty(); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (path == 0) { if (i == 0) $("#selMtrlNo").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selMtrlNo").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } if (path == 1) { if (i == $jsondata.length - 1) { $("#selMtrlNo").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " " + $jsondata[i].value + " 00 00"); } else $("#selMtrlNo").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } } else { $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); } }); } } function ChangeMtrlSel(path) { var $fatherStr = ""; $("#selSize").empty(); $("#selFive").empty(); $("#selSix").empty(); $("#selSeven").empty(); $("#selEight").empty(); $("#selFive").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSix").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSeven").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selEight").append($("<option selected='true'></option>").val("-2").html("--无--")); $fatherStr = $("#selBig").val() + "." + $("#selSmall").val() + "." + $("#selMtrlNo").val(); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " " + $("#selMtrlNo").val() + " 00 00"); if ($("#selMtrlNo").val() == "-1") { $("#selSize").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " 000 00 00"); } else { var $selType = "mtrl"; //获取相应物料信息 $.ajaxForPost("AddMtrlInfo.aspx/GetSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $selType + "'}", function () { }, function (data) { // $("#selMtrlNo").empty(); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (path == 0) { if (i == 0) $("#selSize").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selSize").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } if (path == 1) { if (i == $jsondata.length - 1) { $("#selSize").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " " + $("#selMtrlNo").val() + " " + $jsondata[i].value + " 00"); } else $("#selSize").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } } else { $("#selSize").append($("<option selected='true'></option>").val("-2").html("--无--")); } }); } } function ChangeSizeSel(path) { var $fatherStr = ""; $("#selFive").empty(); $("#selSix").empty(); $("#selSeven").empty(); $("#selEight").empty(); $("#selSix").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selSeven").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selEight").append($("<option selected='true'></option>").val("-2").html("--无--")); $fatherStr = $("#selBig").val() + "." + $("#selSmall").val() + "." + $("#selMtrlNo").val() + "." + $("#selSize").val(); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " " + $("#selMtrlNo").val() + " " + $("#selSize").val() + " 00"); if ($("#selSize").val() == "-1") { $("#selFive").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " " + $("#selMtrlNo").val() + " 00 00"); } else { var $selType = "size"; //获取相应物料信息 $.ajaxForPost("AddMtrlInfo.aspx/GetSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $selType + "'}", function () { }, function (data) { // $("#selMtrlNo").empty(); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (path == 0) { if (i == 0) $("#selFive").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selFive").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } if (path == 1) { if (i == $jsondata.length - 1) { $("#selFive").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " " + $("#selMtrlNo").val() + " " + $("#selSize").val() + " " + $jsondata[i].value); } else $("#selFive").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } } else { $("#selFive").append($("<option selected='true'></option>").val("-2").html("--无--")); } }); } } function ChangeFiveSel(path) { var $fatherStr = ""; $("#selSix").empty(); $("#selSeven").empty(); $("#selEight").empty(); $("#selSeven").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selEight").append($("<option selected='true'></option>").val("-2").html("--无--")); $fatherStr = $("#selBig").val() + "." + $("#selSmall").val() + "." + $("#selMtrlNo").val() + "." + $("#selSize").val() + "." + $("#selFive").val(); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " " + $("#selMtrlNo").val() + " " + $("#selSize").val() + " " + $("#selFive").val()); if ($("#selFive").val() == "-1") { $("#selSix").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#amtrlcv").html($("#selBig").val() + " " + $("#selSmall").val() + " " + $("#selMtrlNo").val() + " " + $("#selSize").val() + " 00"); } else { var $selType = "five"; //获取相应物料信息 $.ajaxForPost("AddMtrlInfo.aspx/GetSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $selType + "'}", function () { }, function (data) { // $("#selMtrlNo").empty(); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (i == 0) $("#selSix").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selSix").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } else { $("#selSix").append($("<option selected='true'></option>").val("-2").html("--无--")); } }); } } function ChangeSixSel(path) { var $fatherStr = ""; $("#selSeven").empty(); $("#selEight").empty(); $("#selEight").append($("<option selected='true'></option>").val("-2").html("--无--")); $fatherStr = $("#selBig").val() + "." + $("#selSmall").val() + "." + $("#selMtrlNo").val() + "." + $("#selSize").val() + "." + $("#selFive").val() + "." + $("#selSix").val(); if ($("#selSix").val() == "-1") { $("#selSeven").append($("<option selected='true'></option>").val("-2").html("--无--")); } else { var $selType = "six"; //获取相应物料信息 $.ajaxForPost("AddMtrlInfo.aspx/GetSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $selType + "'}", function () { }, function (data) { // $("#selMtrlNo").empty(); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (i == 0) $("#selSeven").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selSeven").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } else { $("#selSeven").append($("<option selected='true'></option>").val("-2").html("--无--")); } }); } } function ChangeSevenSel(path) { $("#selEight").empty(); var $fatherStr = $("#selBig").val() + "." + $("#selSmall").val() + "." + $("#selMtrlNo").val() + "." + $("#selSize").val() + "." + $("#selFive").val() + "." + $("#selSix").val() + "." + $("#selSeven").val(); if ($("#selSeven").val() == "-1") { $("#selEight").append($("<option selected='true'></option>").val("-2").html("--无--")); } else { var $selType = "seven"; //获取相应物料信息 $.ajaxForPost("AddMtrlInfo.aspx/GetSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $selType + "'}", function () { }, function (data) { // $("#selMtrlNo").empty(); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (i == 0) $("#selEight").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selEight").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } else { $("#selEight").append($("<option selected='true'></option>").val("-2").html("--无--")); } }); } } function ChangeEightSel(path) { var $fatherStr = $("#selBig").val() + "." + $("#selSmall").val() + "." + $("#selMtrlNo").val() + "." + $("#selSize").val() + "." + $("#selFive").val() + "." + $("#selSix").val() + "." + $("#selSeven").val() + "." + $("#selEight").val(); if ($("#selMtrlNo").val() == "-1") { $fatherStr = $("#selBig").val() + "." + $("#selSmall").val(); } } function ControlAddShow(type) { //页面初始化 if (type == 0) { $("#abig").hide(); $("#txtBig").hide(); $("#btnBigOK").hide(); $("#asmall").hide(); $("#txtSmall").hide(); $("#btnSmallOK").hide(); $("#amtrl").hide(); $("#txtMtrl").hide(); $("#btnMtrlOK").hide(); $("#asize").hide(); $("#txtSize").hide(); $("#btnSizeOK").hide(); $("#afive").hide(); $("#txtFive").hide(); $("#btnFiveOK").hide(); } if (type == 1) { $("#abig").show(); $("#txtBig").show(); $("#btnBigOK").show(); $("#asmall").hide(); $("#txtSmall").hide(); $("#btnSmallOK").hide(); $("#amtrl").hide(); $("#txtMtrl").hide(); $("#btnMtrlOK").hide(); $("#asize").hide(); $("#txtSize").hide(); $("#btnSizeOK").hide(); $("#afive").hide(); $("#txtFive").hide(); $("#btnFiveOK").hide(); } if (type == 2) { $("#abig").hide(); $("#txtBig").hide(); $("#btnBigOK").hide(); $("#asmall").show(); $("#txtSmall").show(); $("#btnSmallOK").show(); $("#amtrl").hide(); $("#txtMtrl").hide(); $("#btnMtrlOK").hide(); $("#asize").hide(); $("#txtSize").hide(); $("#btnSizeOK").hide(); $("#afive").hide(); $("#txtFive").hide(); $("#btnFiveOK").hide(); } if (type == 3) { $("#abig").hide(); $("#txtBig").hide(); $("#btnBigOK").hide(); $("#asmall").hide(); $("#txtSmall").hide(); $("#btnSmallOK").hide(); $("#amtrl").show(); $("#txtMtrl").show(); $("#btnMtrlOK").show(); $("#asize").hide(); $("#txtSize").hide(); $("#btnSizeOK").hide(); $("#afive").hide(); $("#txtFive").hide(); $("#btnFiveOK").hide(); } if (type == 4) { $("#abig").hide(); $("#txtBig").hide(); $("#btnBigOK").hide(); $("#asmall").hide(); $("#txtSmall").hide(); $("#btnSmallOK").hide(); $("#amtrl").hide(); $("#txtMtrl").hide(); $("#btnMtrlOK").hide(); $("#asize").show(); $("#txtSize").show(); $("#btnSizeOK").show(); $("#afive").hide(); $("#txtFive").hide(); $("#btnFiveOK").hide(); } if (type == 5) { $("#abig").hide(); $("#txtBig").hide(); $("#btnBigOK").hide(); $("#asmall").hide(); $("#txtSmall").hide(); $("#btnSmallOK").hide(); $("#amtrl").hide(); $("#txtMtrl").hide(); $("#btnMtrlOK").hide(); $("#asize").hide(); $("#txtSize").hide(); $("#btnSizeOK").hide(); $("#afive").show(); $("#txtFive").show(); $("#btnFiveOK").show(); } }
JavaScript
var $pageSize = "12"; var $pageIndex = 0; var $queryCondition = ""; $(document).ready(function () { $("#btnQuery").click(function () { var $fatherStr = "wlbm." + $("#txtMtrlCode").val(); if ($("#selMtrlNo").val() == "-1") { $fatherStr = $("#selBig").val() + "." + $("#selSmall").val(); } $queryCondition = $fatherStr; var $strParams = strList("selqCondition", $fatherStr); DataBind("MtrlInfoManage.aspx", $strParams, "dvWait", "正在为您查询数据,请稍候......", "dvShow", "dvPager", $pageSize, $pageIndex); }); }); $(document).ready(function () { $("#btnAdd").click(function () { location.href = "AddMtrlInfo.aspx"; }); }); //页面加载时初始化下拉列表 $(document).ready(function () { var $fatherStr = ""; var $type = "init"; $.ajaxForPost("MtrlInfoManage.aspx/getSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $type + "'}", function () { }, function (data) { $("#selBig").empty(); $("#selSmall").empty(); $("#selMtrlNo").empty(); var $jsondata = eval('(' + data.d + ')'); for (var i = 0; i < $jsondata.length; i++) { if (i == 0) $("#selBig").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selBig").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } $("#selSmall").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); }); var $initqCondition = "all"; $queryCondition = $initqCondition; var $strParams = strList("initqCondition", $initqCondition); DataBind("MtrlInfoManage.aspx", $strParams, "dvWait", "正在为您查询数据,请稍候......", "dvShow", "dvPager", $pageSize, $pageIndex); }); $(document).ready(function () { $("#selBig").change(function () { var $fatherStr = $("#selBig").val(); if ($("#selBig").val() == "-1") { $fatherStr = "all"; $("#selSmall").empty(); $("#selMtrlNo").empty(); $("#selSmall").append($("<option selected='true'></option>").val("-2").html("--无--")); $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); } else { var $selType = "big"; //获取相应小类信息 $.ajaxForPost("MtrlInfoManage.aspx/getSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $selType + "'}", function () { }, function (data) { $("#selSmall").empty(); $("#selMtrlNo").empty(); $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (i == 0) $("#selSmall").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selSmall").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } else { $("#selSmall").append($("<option selected='true'></option>").val("-2").html("--无--")); } }); } $queryCondition = $fatherStr; var $strParams = strList("selqCondition", $fatherStr); DataBind("MtrlInfoManage.aspx", $strParams, "dvWait", "正在为您查询数据,请稍候......", "dvShow", "dvPager", $pageSize, $pageIndex); }); }) $(document).ready(function () { $("#selSmall").change(function () { var $fatherStr = ""; $fatherStr = $("#selBig").val() + "." + $("#selSmall").val(); if ($("#selSmall").val() == "-1") { $fatherStr = $("#selBig").val(); $("#selMtrlNo").empty(); $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); } else { var $selType = "small"; //获取相应物料信息 $.ajaxForPost("MtrlInfoManage.aspx/getSelInit", "{ fatherStr:'" + $fatherStr + "',selType:'" + $selType + "'}", function () { }, function (data) { $("#selMtrlNo").empty(); var $jsondata = eval('(' + data.d + ')'); if ($jsondata.length > 1) { for (var i = 0; i < $jsondata.length; i++) { if (i == 0) $("#selMtrlNo").append($("<option selected='true'></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); else $("#selMtrlNo").append($("<option></option>").val($jsondata[i].value).html($jsondata[i].tvalue)); } } else { $("#selMtrlNo").append($("<option selected='true'></option>").val("-2").html("--无--")); } }); } $queryCondition = $fatherStr; var $strParams = strList("selqCondition", $fatherStr); DataBind("MtrlInfoManage.aspx", $strParams, "dvWait", "正在为您查询数据,请稍候......", "dvShow", "dvPager", $pageSize, $pageIndex); }); }) $(document).ready(function () { $("#selMtrlNo").change(function () { var $fatherStr = $("#selBig").val() + "." + $("#selSmall").val() + "." + $("#selMtrlNo").val(); if ($("#selMtrlNo").val() == "-1") { $fatherStr = $("#selBig").val() + "." + $("#selSmall").val(); } $queryCondition = $fatherStr; var $strParams = strList("selqCondition", $fatherStr); DataBind("MtrlInfoManage.aspx", $strParams, "dvWait", "正在为您查询数据,请稍候......", "dvShow", "dvPager", $pageSize, $pageIndex); }); }) function updateinfo(obj) { var $upValueStr = ""; //获取组合值 var $l1 = $(obj).parent().parent().find(".hid0").attr("value") + "/" + $(obj).parent().parent().find(".txtnoclickr0").val(); var $l2 = $(obj).parent().parent().find(".hid1").attr("value") + "/" + $(obj).parent().parent().find(".txtnoclickr1").val(); var $l3 = $(obj).parent().parent().find(".hid2").attr("value") + "/" + $(obj).parent().parent().find(".txtnoclickr2").val(); var $l4 = $(obj).parent().parent().find(".hid3").attr("value") + "/" + $(obj).parent().parent().find(".txtnoclickr3").val(); var $l5 = $(obj).parent().parent().find(".hid4").attr("value") + "/" + $(obj).parent().parent().find(".txtnoclickr4").val(); if ($(obj).parent().parent().find(".hid3").attr("value") == "00") $(obj).parent().parent().find(".txtnoclickr3").val(""); if ($(obj).parent().parent().find(".hid4").attr("value") == "00") $(obj).parent().parent().find(".txtnoclickr4").val(""); $upValueStr = $l1 + "|" + $l2 + "|" + $l3 + "|" + $l4 + "|" + $l5; $.ajaxForPost("MtrlInfoManage.aspx/UpdateData", "{ upValueStr:'" + $upValueStr + "'}", function () { }, function (data) { alert(data.d); }); } function deleteinfo(obj) { var $id = $(obj).attr("value"); //获取组合值 $.ajaxForPost("MtrlInfoManage.aspx/DeleteData", "{ id:'" + $id + "'}", function () { }, function (data) { if (data.d == "0") { $(obj).parent().parent().hide(); alert("删除成功!"); } if (data.d == "1") { $(obj).parent().parent().find(".txtnoclickr2").val(""); $(obj).parent().parent().find(".txtnoclickr3").val(""); $(obj).parent().parent().find(".txtnoclickr4").val(""); alert("删除成功!"); } }); }
JavaScript
/*******************************************************************数据加载**************************************************************************************************************************/ function DataBindNoPager(pagename, isFirst, param, wait, statustext, head, show, more, pagesize, pageindex) { if (isFirst == 1) { $("#" + wait).show(); $("#" + more).hide(); } else if (isFirst == 0) { $("#" + more).show(); $("#" + wait).hide(); } var $strpara = strChange(param, pagesize, pageindex); var $params = eval('(' + $strpara + ')'); $.ajaxForGet(pagename, $params, function () { if (isFirst == 1) { $("#" + wait).html('<div id="dvMsg" style="font-size:12;text-align:center;"><img src="../../img/wait1.gif" alt="" />&nbsp;&nbsp;' + statustext + '</div>'); } else if (isFirst == 0) { $("#" + more).html('<div id="dvMsg" style="font-size:12;text-align:center;"><img src="../../img/wait1.gif" alt="" />&nbsp;&nbsp;' + statustext + '</div>'); } }, function (responseText) { //$("#" + head).show(); if (isFirst == 1) { //$("#" + show).html(responseText).find(".trcreate").remove(); $("#" + show).html(responseText); } else if (isFirst == 0) { //$("#" + show).append(responseText).find(".trcreate").remove(); $("#" + show).html(responseText); } $("#" + wait).hide(); $("#" + more).hide(); }); } function DataBind(pagename, param, wait, statustext, show, dvpager, pagesize, pageindex) { var $strpara = strChange(param, pagesize, pageindex); var $params = eval('(' + $strpara + ')'); $.ajaxForGet(pagename, $params, function () { $("#" + wait).show(); $("#" + wait).html('<div id="dvMsg" style="font-size:12;text-align:center;"><img src="../../img/wait1.gif" alt="" />&nbsp;&nbsp;' + statustext + '</div>'); }, function (responseText) { $("#" + show).html(responseText); $("#" + wait).hide(); //获取数据总数 var $rowcount = parseInt($("#aTotal").html()); $.createPager(dvpager, $rowcount, pageindex, pagesize, "5", "1", "上一页", "下一页", "......", function (page_id, jq) { DataBind(pagename, param, wait, statustext, show, dvpager, pagesize, page_id); }); }); } function strChange(strparam, pagesize, pageindex) { var $strDouble = '"'; var $sArray = strparam.split("|"); strReturn = "{" + $strDouble + "pageSize" + $strDouble + ":" + $strDouble + pagesize + $strDouble + "," + $strDouble + "pageIndex" + $strDouble + ":" + $strDouble + pageindex + $strDouble; for (var i = 0; i < $sArray.length; i++) { if (i < $sArray.length - 1) strReturn = strReturn + "," + $strDouble + $sArray[i].split("/")[0] + $strDouble + ":" + $strDouble + $sArray[i].split("/")[1] + $strDouble + "," else strReturn = strReturn + "," + $strDouble + $sArray[i].split("/")[0] + $strDouble + ":" + $strDouble + $sArray[i].split("/")[1] + $strDouble } strReturn = strReturn + "}"; return strReturn; } function strList(strKey, strValue) { var strReturn = strKey + "/" + strValue; return strReturn; } /********************************************************************************************************************************************************************************************************/
JavaScript
/* * This file has been commented to support Visual Studio Intellisense. * You should not use this file at runtime inside the browser--it is only * intended to be used only for design-time IntelliSense. Please use the * standard jQuery library for all production use. * * Comment version: 1.3.2b */ /* * jQuery JavaScript Library v1.3.2 * http://jquery.com/ * * Copyright (c) 2009 John Resig * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) * Revision: 6246 */ (function(){ var // Will speed up references to window, and allows munging its name. window = this, // Will speed up references to undefined, and allows munging its name. undefined, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, jQuery = window.jQuery = window.$ = function(selector, context) { /// <summary> /// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements. /// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML. /// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s). /// 4: $(callback) - A shorthand for $(document).ready(). /// </summary> /// <param name="selector" type="String"> /// 1: expression - An expression to search with. /// 2: html - A string of HTML to create on the fly. /// 3: elements - DOM element(s) to be encapsulated by a jQuery object. /// 4: callback - The function to execute when the DOM is ready. /// </param> /// <param name="context" type="jQuery"> /// 1: context - A DOM Element, Document or jQuery to use as context. /// </param> /// <field name="selector" Type="Object"> /// The DOM node context originally passed to jQuery() (if none was passed then context will be equal to the document). /// </field> /// <field name="context" Type="String"> /// A selector representing selector originally passed to jQuery(). /// </field> /// <returns type="jQuery" /> // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context ); }, // A simple way to check for HTML strings or ID strings // (both of which we optimize for) quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, // Is it a simple selector isSimple = /^.[^:#\[\.,]*$/; jQuery.fn = jQuery.prototype = { init: function( selector, context ) { /// <summary> /// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements. /// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML. /// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s). /// 4: $(callback) - A shorthand for $(document).ready(). /// </summary> /// <param name="selector" type="String"> /// 1: expression - An expression to search with. /// 2: html - A string of HTML to create on the fly. /// 3: elements - DOM element(s) to be encapsulated by a jQuery object. /// 4: callback - The function to execute when the DOM is ready. /// </param> /// <param name="context" type="jQuery"> /// 1: context - A DOM Element, Document or jQuery to use as context. /// </param> /// <returns type="jQuery" /> // Make sure that a selection was provided selector = selector || document; // Handle $(DOMElement) if ( selector.nodeType ) { this[0] = selector; this.length = 1; this.context = selector; return this; } // Handle HTML strings if (typeof selector === "string") { // Are we dealing with HTML string or an ID? var match = quickExpr.exec(selector); // Verify a match, and that no context was specified for #id if (match && (match[1] || !context)) { // HANDLE: $(html) -> $(array) if (match[1]) selector = jQuery.clean([match[1]], context); // HANDLE: $("#id") else { var elem = document.getElementById(match[3]); // Handle the case where IE and Opera return items // by name instead of ID if (elem && elem.id != match[3]) return jQuery().find(selector); // Otherwise, we inject the element directly into the jQuery object var ret = jQuery(elem || []); ret.context = document; ret.selector = selector; return ret; } // HANDLE: $(expr, [context]) // (which is just equivalent to: $(content).find(expr) } else return jQuery(context).find(selector); // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) return jQuery( document ).ready( selector ); // Make sure that old selector state is passed along if ( selector.selector && selector.context ) { this.selector = selector.selector; this.context = selector.context; } return this.setArray(jQuery.isArray( selector ) ? selector : jQuery.makeArray(selector)); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.3.2", // The number of elements contained in the matched element set size: function() { /// <summary> /// The number of elements currently matched. /// Part of Core /// </summary> /// <returns type="Number" /> return this.length; }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { /// <summary> /// Access a single matched element. num is used to access the /// Nth element matched. /// Part of Core /// </summary> /// <returns type="Element" /> /// <param name="num" type="Number"> /// Access the element in the Nth position. /// </param> return num == undefined ? // Return a 'clean' array Array.prototype.slice.call( this ) : // Return just the object this[ num ]; }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { /// <summary> /// Set the jQuery object to an array of elements, while maintaining /// the stack. /// Part of Core /// </summary> /// <returns type="jQuery" /> /// <param name="elems" type="Elements"> /// An array of elements /// </param> // Build a new jQuery matched element set var ret = jQuery( elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) ret.selector = this.selector + (this.selector ? " " : "") + selector; else if ( name ) ret.selector = this.selector + "." + name + "(" + selector + ")"; // Return the newly-formed element set return ret; }, // Force the current matched set of elements to become // the specified array of elements (destroying the stack in the process) // You should use pushStack() in order to do this, but maintain the stack setArray: function( elems ) { /// <summary> /// Set the jQuery object to an array of elements. This operation is /// completely destructive - be sure to use .pushStack() if you wish to maintain /// the jQuery stack. /// Part of Core /// </summary> /// <returns type="jQuery" /> /// <param name="elems" type="Elements"> /// An array of elements /// </param> // Resetting the length to 0, then using the native Array push // is a super-fast way to populate an object with array-like properties this.length = 0; Array.prototype.push.apply( this, elems ); return this; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { /// <summary> /// Execute a function within the context of every matched element. /// This means that every time the passed-in function is executed /// (which is once for every element matched) the 'this' keyword /// points to the specific element. /// Additionally, the function, when executed, is passed a single /// argument representing the position of the element in the matched /// set. /// Part of Core /// </summary> /// <returns type="jQuery" /> /// <param name="callback" type="Function"> /// A function to execute /// </param> return jQuery.each( this, callback, args ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { /// <summary> /// Searches every matched element for the object and returns /// the index of the element, if found, starting with zero. /// Returns -1 if the object wasn't found. /// Part of Core /// </summary> /// <returns type="Number" /> /// <param name="elem" type="Element"> /// Object to search for /// </param> // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem && elem.jquery ? elem[0] : elem , this ); }, attr: function( name, value, type ) { /// <summary> /// Set a single property to a computed value, on all matched elements. /// Instead of a value, a function is provided, that computes the value. /// Part of DOM/Attributes /// </summary> /// <returns type="jQuery" /> /// <param name="name" type="String"> /// The name of the property to set. /// </param> /// <param name="value" type="Function"> /// A function returning the value to set. /// </param> var options = name; // Look for the case where we're accessing a style value if ( typeof name === "string" ) if ( value === undefined ) return this[0] && jQuery[ type || "attr" ]( this[0], name ); else { options = {}; options[ name ] = value; } // Check to see if we're setting style values return this.each(function(i){ // Set all the styles for ( name in options ) jQuery.attr( type ? this.style : this, name, jQuery.prop( this, options[ name ], type, i, name ) ); }); }, css: function( key, value ) { /// <summary> /// Set a single style property to a value, on all matched elements. /// If a number is provided, it is automatically converted into a pixel value. /// Part of CSS /// </summary> /// <returns type="jQuery" /> /// <param name="key" type="String"> /// The name of the property to set. /// </param> /// <param name="value" type="String"> /// The value to set the property to. /// </param> // ignore negative width and height values if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) value = undefined; return this.attr( key, value, "curCSS" ); }, text: function( text ) { /// <summary> /// Set the text contents of all matched elements. /// Similar to html(), but escapes HTML (replace &quot;&lt;&quot; and &quot;&gt;&quot; with their /// HTML entities). /// Part of DOM/Attributes /// </summary> /// <returns type="String" /> /// <param name="text" type="String"> /// The text value to set the contents of the element to. /// </param> if ( typeof text !== "object" && text != null ) return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); var ret = ""; jQuery.each( text || this, function(){ jQuery.each( this.childNodes, function(){ if ( this.nodeType != 8 ) ret += this.nodeType != 1 ? this.nodeValue : jQuery.fn.text( [ this ] ); }); }); return ret; }, wrapAll: function( html ) { /// <summary> /// Wrap all matched elements with a structure of other elements. /// This wrapping process is most useful for injecting additional /// stucture into a document, without ruining the original semantic /// qualities of a document. /// This works by going through the first element /// provided and finding the deepest ancestor element within its /// structure - it is that element that will en-wrap everything else. /// This does not work with elements that contain text. Any necessary text /// must be added after the wrapping is done. /// Part of DOM/Manipulation /// </summary> /// <returns type="jQuery" /> /// <param name="html" type="Element"> /// A DOM element that will be wrapped around the target. /// </param> if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).clone(); if ( this[0].parentNode ) wrap.insertBefore( this[0] ); wrap.map(function(){ var elem = this; while ( elem.firstChild ) elem = elem.firstChild; return elem; }).append(this); } return this; }, wrapInner: function( html ) { /// <summary> /// Wraps the inner child contents of each matched elemenht (including text nodes) with an HTML structure. /// </summary> /// <param name="html" type="String"> /// A string of HTML or a DOM element that will be wrapped around the target contents. /// </param> /// <returns type="jQuery" /> return this.each(function(){ jQuery( this ).contents().wrapAll( html ); }); }, wrap: function( html ) { /// <summary> /// Wrap all matched elements with a structure of other elements. /// This wrapping process is most useful for injecting additional /// stucture into a document, without ruining the original semantic /// qualities of a document. /// This works by going through the first element /// provided and finding the deepest ancestor element within its /// structure - it is that element that will en-wrap everything else. /// This does not work with elements that contain text. Any necessary text /// must be added after the wrapping is done. /// Part of DOM/Manipulation /// </summary> /// <returns type="jQuery" /> /// <param name="html" type="Element"> /// A DOM element that will be wrapped around the target. /// </param> return this.each(function(){ jQuery( this ).wrapAll( html ); }); }, append: function() { /// <summary> /// Append content to the inside of every matched element. /// This operation is similar to doing an appendChild to all the /// specified elements, adding them into the document. /// Part of DOM/Manipulation /// </summary> /// <returns type="jQuery" /> /// <param name="content" type="Content"> /// Content to append to the target /// </param> return this.domManip(arguments, true, function(elem){ if (this.nodeType == 1) this.appendChild( elem ); }); }, prepend: function() { /// <summary> /// Prepend content to the inside of every matched element. /// This operation is the best way to insert elements /// inside, at the beginning, of all matched elements. /// Part of DOM/Manipulation /// </summary> /// <returns type="jQuery" /> /// <param name="" type="Content"> /// Content to prepend to the target. /// </param> return this.domManip(arguments, true, function(elem){ if (this.nodeType == 1) this.insertBefore( elem, this.firstChild ); }); }, before: function() { /// <summary> /// Insert content before each of the matched elements. /// Part of DOM/Manipulation /// </summary> /// <returns type="jQuery" /> /// <param name="" type="Content"> /// Content to insert before each target. /// </param> return this.domManip(arguments, false, function(elem){ this.parentNode.insertBefore( elem, this ); }); }, after: function() { /// <summary> /// Insert content after each of the matched elements. /// Part of DOM/Manipulation /// </summary> /// <returns type="jQuery" /> /// <param name="" type="Content"> /// Content to insert after each target. /// </param> return this.domManip(arguments, false, function(elem){ this.parentNode.insertBefore( elem, this.nextSibling ); }); }, end: function() { /// <summary> /// End the most recent 'destructive' operation, reverting the list of matched elements /// back to its previous state. After an end operation, the list of matched elements will /// revert to the last state of matched elements. /// If there was no destructive operation before, an empty set is returned. /// Part of DOM/Traversing /// </summary> /// <returns type="jQuery" /> return this.prevObject || jQuery( [] ); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: [].push, sort: [].sort, splice: [].splice, find: function( selector ) { /// <summary> /// Searches for all elements that match the specified expression. /// This method is a good way to find additional descendant /// elements with which to process. /// All searching is done using a jQuery expression. The expression can be /// written using CSS 1-3 Selector syntax, or basic XPath. /// Part of DOM/Traversing /// </summary> /// <returns type="jQuery" /> /// <param name="selector" type="String"> /// An expression to search with. /// </param> /// <returns type="jQuery" /> if ( this.length === 1 ) { var ret = this.pushStack( [], "find", selector ); ret.length = 0; jQuery.find( selector, this[0], ret ); return ret; } else { return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ return jQuery.find( selector, elem ); })), "find", selector ); } }, clone: function( events ) { /// <summary> /// Clone matched DOM Elements and select the clones. /// This is useful for moving copies of the elements to another /// location in the DOM. /// Part of DOM/Manipulation /// </summary> /// <returns type="jQuery" /> /// <param name="deep" type="Boolean" optional="true"> /// (Optional) Set to false if you don't want to clone all descendant nodes, in addition to the element itself. /// </param> // Do the clone var ret = this.map(function(){ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { // IE copies events bound via attachEvent when // using cloneNode. Calling detachEvent on the // clone will also remove the events from the orignal // In order to get around this, we use innerHTML. // Unfortunately, this means some modifications to // attributes in IE that are actually only stored // as properties will not be copied (such as the // the name attribute on an input). var html = this.outerHTML; if ( !html ) { var div = this.ownerDocument.createElement("div"); div.appendChild( this.cloneNode(true) ); html = div.innerHTML; } return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; } else return this.cloneNode(true); }); // Copy the events from the original to the clone if ( events === true ) { var orig = this.find("*").andSelf(), i = 0; ret.find("*").andSelf().each(function(){ if ( this.nodeName !== orig[i].nodeName ) return; var events = jQuery.data( orig[i], "events" ); for ( var type in events ) { for ( var handler in events[ type ] ) { jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); } } i++; }); } // Return the cloned set return ret; }, filter: function( selector ) { /// <summary> /// Removes all elements from the set of matched elements that do not /// pass the specified filter. This method is used to narrow down /// the results of a search. /// }) /// Part of DOM/Traversing /// </summary> /// <returns type="jQuery" /> /// <param name="selector" type="Function"> /// A function to use for filtering /// </param> /// <returns type="jQuery" /> return this.pushStack( jQuery.isFunction( selector ) && jQuery.grep(this, function(elem, i){ return selector.call( elem, i ); }) || jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ return elem.nodeType === 1; }) ), "filter", selector ); }, closest: function( selector ) { /// <summary> /// Get a set of elements containing the closest parent element that matches the specified selector, the starting element included. /// </summary> /// <returns type="jQuery" /> /// <param name="selector" type="Function"> /// An expression to filter the elements with. /// </param> /// <returns type="jQuery" /> var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, closer = 0; return this.map(function(){ var cur = this; while ( cur && cur.ownerDocument ) { if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { jQuery.data(cur, "closest", closer); return cur; } cur = cur.parentNode; closer++; } }); }, not: function( selector ) { /// <summary> /// Removes any elements inside the array of elements from the set /// of matched elements. This method is used to remove one or more /// elements from a jQuery object. /// Part of DOM/Traversing /// </summary> /// <param name="selector" type="jQuery"> /// A set of elements to remove from the jQuery set of matched elements. /// </param> /// <returns type="jQuery" /> if ( typeof selector === "string" ) // test special case where just one selector is passed in if ( isSimple.test( selector ) ) return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); else selector = jQuery.multiFilter( selector, this ); var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; return this.filter(function() { return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; }); }, add: function( selector ) { /// <summary> /// Adds one or more Elements to the set of matched elements. /// Part of DOM/Traversing /// </summary> /// <param name="elements" type="Element"> /// One or more Elements to add /// </param> /// <returns type="jQuery" /> return this.pushStack( jQuery.unique( jQuery.merge( this.get(), typeof selector === "string" ? jQuery( selector ) : jQuery.makeArray( selector ) ))); }, is: function( selector ) { /// <summary> /// Checks the current selection against an expression and returns true, /// if at least one element of the selection fits the given expression. /// Does return false, if no element fits or the expression is not valid. /// filter(String) is used internally, therefore all rules that apply there /// apply here, too. /// Part of DOM/Traversing /// </summary> /// <returns type="Boolean" /> /// <param name="expr" type="String"> /// The expression with which to filter /// </param> return !!selector && jQuery.multiFilter( selector, this ).length > 0; }, hasClass: function( selector ) { /// <summary> /// Checks the current selection against a class and returns whether at least one selection has a given class. /// </summary> /// <param name="selector" type="String">The class to check against</param> /// <returns type="Boolean">True if at least one element in the selection has the class, otherwise false.</returns> return !!selector && this.is( "." + selector ); }, val: function( value ) { /// <summary> /// Set the value of every matched element. /// Part of DOM/Attributes /// </summary> /// <returns type="jQuery" /> /// <param name="val" type="String"> /// Set the property to the specified value. /// </param> if ( value === undefined ) { var elem = this[0]; if ( elem ) { if( jQuery.nodeName( elem, 'option' ) ) return (elem.attributes.value || {}).specified ? elem.value : elem.text; // We need to handle select boxes special if ( jQuery.nodeName( elem, "select" ) ) { var index = elem.selectedIndex, values = [], options = elem.options, one = elem.type == "select-one"; // Nothing was selected if ( index < 0 ) return null; // Loop through all the selected options for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { var option = options[ i ]; if ( option.selected ) { // Get the specifc value for the option value = jQuery(option).val(); // We don't need an array for one selects if ( one ) return value; // Multi-Selects return an array values.push( value ); } } return values; } // Everything else, we just grab the value return (elem.value || "").replace(/\r/g, ""); } return undefined; } if ( typeof value === "number" ) value += ''; return this.each(function(){ if ( this.nodeType != 1 ) return; if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) this.checked = (jQuery.inArray(this.value, value) >= 0 || jQuery.inArray(this.name, value) >= 0); else if ( jQuery.nodeName( this, "select" ) ) { var values = jQuery.makeArray(value); jQuery( "option", this ).each(function(){ this.selected = (jQuery.inArray( this.value, values ) >= 0 || jQuery.inArray( this.text, values ) >= 0); }); if ( !values.length ) this.selectedIndex = -1; } else this.value = value; }); }, html: function( value ) { /// <summary> /// Set the html contents of every matched element. /// This property is not available on XML documents. /// Part of DOM/Attributes /// </summary> /// <returns type="jQuery" /> /// <param name="val" type="String"> /// Set the html contents to the specified value. /// </param> return value === undefined ? (this[0] ? this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : null) : this.empty().append( value ); }, replaceWith: function( value ) { /// <summary> /// Replaces all matched element with the specified HTML or DOM elements. /// </summary> /// <param name="value" type="String"> /// The content with which to replace the matched elements. /// </param> /// <returns type="jQuery">The element that was just replaced.</returns> return this.after( value ).remove(); }, eq: function( i ) { /// <summary> /// Reduce the set of matched elements to a single element. /// The position of the element in the set of matched elements /// starts at 0 and goes to length - 1. /// Part of Core /// </summary> /// <returns type="jQuery" /> /// <param name="num" type="Number"> /// pos The index of the element that you wish to limit to. /// </param> return this.slice( i, +i + 1 ); }, slice: function() { /// <summary> /// Selects a subset of the matched elements. Behaves exactly like the built-in Array slice method. /// </summary> /// <param name="start" type="Number" integer="true">Where to start the subset (0-based).</param> /// <param name="end" optional="true" type="Number" integer="true">Where to end the subset (not including the end element itself). /// If omitted, ends at the end of the selection</param> /// <returns type="jQuery">The sliced elements</returns> return this.pushStack( Array.prototype.slice.apply( this, arguments ), "slice", Array.prototype.slice.call(arguments).join(",") ); }, map: function( callback ) { /// <summary> /// This member is internal. /// </summary> /// <private /> /// <returns type="jQuery" /> return this.pushStack( jQuery.map(this, function(elem, i){ return callback.call( elem, i, elem ); })); }, andSelf: function() { /// <summary> /// Adds the previous selection to the current selection. /// </summary> /// <returns type="jQuery" /> return this.add( this.prevObject ); }, domManip: function( args, table, callback ) { /// <param name="args" type="Array"> /// Args /// </param> /// <param name="table" type="Boolean"> /// Insert TBODY in TABLEs if one is not found. /// </param> /// <param name="dir" type="Number"> /// If dir&lt;0, process args in reverse order. /// </param> /// <param name="fn" type="Function"> /// The function doing the DOM manipulation. /// </param> /// <returns type="jQuery" /> /// <summary> /// Part of Core /// </summary> if ( this[0] ) { var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), first = fragment.firstChild; if ( first ) for ( var i = 0, l = this.length; i < l; i++ ) callback.call( root(this[i], first), this.length > 1 || i > 0 ? fragment.cloneNode(true) : fragment ); if ( scripts ) jQuery.each( scripts, evalScript ); } return this; function root( elem, cur ) { return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? (elem.getElementsByTagName("tbody")[0] || elem.appendChild(elem.ownerDocument.createElement("tbody"))) : elem; } } }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; function evalScript( i, elem ) { /// <summary> /// This method is internal. /// </summary> /// <private /> if ( elem.src ) jQuery.ajax({ url: elem.src, async: false, dataType: "script" }); else jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); if ( elem.parentNode ) elem.parentNode.removeChild( elem ); } function now(){ /// <summary> /// Gets the current date. /// </summary> /// <returns type="Date">The current date.</returns> return +new Date; } jQuery.extend = jQuery.fn.extend = function() { /// <summary> /// Extend one object with one or more others, returning the original, /// modified, object. This is a great utility for simple inheritance. /// jQuery.extend(settings, options); /// var settings = jQuery.extend({}, defaults, options); /// Part of JavaScript /// </summary> /// <param name="target" type="Object"> /// The object to extend /// </param> /// <param name="prop1" type="Object"> /// The object that will be merged into the first. /// </param> /// <param name="propN" type="Object" optional="true" parameterArray="true"> /// (optional) More objects to merge into the first /// </param> /// <returns type="Object" /> // copy reference to target object var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) target = {}; // extend jQuery itself if only one argument is passed if ( length == i ) { target = this; --i; } for ( ; i < length; i++ ) // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) // Extend the base object for ( var name in options ) { var src = target[ name ], copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) continue; // Recurse if we're merging object values if ( deep && copy && typeof copy === "object" && !copy.nodeType ) target[ name ] = jQuery.extend( deep, // Never move original objects, clone them src || ( copy.length != null ? [ ] : { } ) , copy ); // Don't bring in undefined values else if ( copy !== undefined ) target[ name ] = copy; } // Return the modified object return target; }; // exclude the following css properties to add px var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, // cache defaultView defaultView = document.defaultView || {}, toString = Object.prototype.toString; jQuery.extend({ noConflict: function( deep ) { /// <summary> /// Run this function to give control of the $ variable back /// to whichever library first implemented it. This helps to make /// sure that jQuery doesn't conflict with the $ object /// of other libraries. /// By using this function, you will only be able to access jQuery /// using the 'jQuery' variable. For example, where you used to do /// $(&quot;div p&quot;), you now must do jQuery(&quot;div p&quot;). /// Part of Core /// </summary> /// <returns type="undefined" /> window.$ = _$; if ( deep ) window.jQuery = _jQuery; return jQuery; }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { /// <summary> /// Determines if the parameter passed is a function. /// </summary> /// <param name="obj" type="Object">The object to check</param> /// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns> return toString.call(obj) === "[object Function]"; }, isArray: function(obj) { /// <summary> /// Determine if the parameter passed is an array. /// </summary> /// <param name="obj" type="Object">Object to test whether or not it is an array.</param> /// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns> return toString.call(obj) === "[object Array]"; }, // check if an element is in a (or is an) XML document isXMLDoc: function( elem ) { /// <summary> /// Determines if the parameter passed is an XML document. /// </summary> /// <param name="elem" type="Object">The object to test</param> /// <returns type="Boolean">True if the parameter is an XML document; otherwise false.</returns> return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || !!elem.ownerDocument && jQuery.isXMLDoc(elem.ownerDocument); }, // Evalulates a script in a global context globalEval: function( data ) { /// <summary> /// Internally evaluates a script in a global context. /// </summary> /// <private /> if ( data && /\S/.test(data) ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); script.type = "text/javascript"; if ( jQuery.support.scriptEval ) script.appendChild( document.createTextNode( data ) ); else script.text = data; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709). head.insertBefore( script, head.firstChild ); head.removeChild( script ); } }, nodeName: function( elem, name ) { /// <summary> /// Checks whether the specified element has the specified DOM node name. /// </summary> /// <param name="elem" type="Element">The element to examine</param> /// <param name="name" type="String">The node name to check</param> /// <returns type="Boolean">True if the specified node name matches the node's DOM node name; otherwise false</returns> return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); }, // args is for internal usage only each: function( object, callback, args ) { /// <summary> /// A generic iterator function, which can be used to seemlessly /// iterate over both objects and arrays. This function is not the same /// as $().each() - which is used to iterate, exclusively, over a jQuery /// object. This function can be used to iterate over anything. /// The callback has two arguments:the key (objects) or index (arrays) as first /// the first, and the value as the second. /// Part of JavaScript /// </summary> /// <param name="obj" type="Object"> /// The object, or array, to iterate over. /// </param> /// <param name="fn" type="Function"> /// The function that will be executed on every object. /// </param> /// <returns type="Object" /> var name, i = 0, length = object.length; if ( args ) { if ( length === undefined ) { for ( name in object ) if ( callback.apply( object[ name ], args ) === false ) break; } else for ( ; i < length; ) if ( callback.apply( object[ i++ ], args ) === false ) break; // A special, fast, case for the most common use of each } else { if ( length === undefined ) { for ( name in object ) if ( callback.call( object[ name ], name, object[ name ] ) === false ) break; } else for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} } return object; }, prop: function( elem, value, type, i, name ) { /// <summary> /// This method is internal. /// </summary> /// <private /> // This member is not documented within the jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.prop // Handle executable functions if ( jQuery.isFunction( value ) ) value = value.call( elem, i ); // Handle passing in a number to a CSS property return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? value + "px" : value; }, className: { // internal only, use addClass("class") add: function( elem, classNames ) { /// <summary> /// Internal use only; use addClass('class') /// </summary> /// <private /> jQuery.each((classNames || "").split(/\s+/), function(i, className){ if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) elem.className += (elem.className ? " " : "") + className; }); }, // internal only, use removeClass("class") remove: function( elem, classNames ) { /// <summary> /// Internal use only; use removeClass('class') /// </summary> /// <private /> if (elem.nodeType == 1) elem.className = classNames !== undefined ? jQuery.grep(elem.className.split(/\s+/), function(className){ return !jQuery.className.has( classNames, className ); }).join(" ") : ""; }, // internal only, use hasClass("class") has: function( elem, className ) { /// <summary> /// Internal use only; use hasClass('class') /// </summary> /// <private /> return elem && jQuery.inArray(className, (elem.className || elem).toString().split(/\s+/)) > -1; } }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { /// <summary> /// Swap in/out style options. /// </summary> var old = {}; // Remember the old values, and insert the new ones for ( var name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } callback.call( elem ); // Revert the old values for ( var name in options ) elem.style[ name ] = old[ name ]; }, css: function( elem, name, force, extra ) { /// <summary> /// This method is internal only. /// </summary> /// <private /> // This method is undocumented in jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.css if ( name == "width" || name == "height" ) { var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; function getWH() { val = name == "width" ? elem.offsetWidth : elem.offsetHeight; if ( extra === "border" ) return; jQuery.each( which, function() { if ( !extra ) val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; if ( extra === "margin" ) val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; else val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; }); } if ( elem.offsetWidth !== 0 ) getWH(); else jQuery.swap( elem, props, getWH ); return Math.max(0, Math.round(val)); } return jQuery.curCSS( elem, name, force ); }, curCSS: function( elem, name, force ) { /// <summary> /// This method is internal only. /// </summary> /// <private /> // This method is undocumented in jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.curCSS var ret, style = elem.style; // We need to handle opacity special in IE if ( name == "opacity" && !jQuery.support.opacity ) { ret = jQuery.attr( style, "opacity" ); return ret == "" ? "1" : ret; } // Make sure we're using the right name for getting the float value if ( name.match( /float/i ) ) name = styleFloat; if ( !force && style && style[ name ] ) ret = style[ name ]; else if ( defaultView.getComputedStyle ) { // Only "float" is needed here if ( name.match( /float/i ) ) name = "float"; name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); var computedStyle = defaultView.getComputedStyle( elem, null ); if ( computedStyle ) ret = computedStyle.getPropertyValue( name ); // We should always get a number back from opacity if ( name == "opacity" && ret == "" ) ret = "1"; } else if ( elem.currentStyle ) { var camelCase = name.replace(/\-(\w)/g, function(all, letter){ return letter.toUpperCase(); }); ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { // Remember the original values var left = style.left, rsLeft = elem.runtimeStyle.left; // Put in the new values to get a computed value out elem.runtimeStyle.left = elem.currentStyle.left; style.left = ret || 0; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; elem.runtimeStyle.left = rsLeft; } } return ret; }, clean: function( elems, context, fragment ) { /// <summary> /// This method is internal only. /// </summary> /// <private /> // This method is undocumented in the jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.clean context = context || document; // !context.createElement fails in IE with an error but returns typeof 'object' if ( typeof context.createElement === "undefined" ) context = context.ownerDocument || context[0] && context[0].ownerDocument || document; // If a single string is passed in and it's a single tag // just do a createElement and skip the rest if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); if ( match ) return [ context.createElement( match[1] ) ]; } var ret = [], scripts = [], div = context.createElement("div"); jQuery.each(elems, function(i, elem){ if ( typeof elem === "number" ) elem += ''; if ( !elem ) return; // Convert html string into DOM nodes if ( typeof elem === "string" ) { // Fix "XHTML"-style tags in all browsers elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? all : front + "></" + tag + ">"; }); // Trim whitespace, otherwise indexOf won't work as expected var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); var wrap = // option or optgroup !tags.indexOf("<opt") && [ 1, "<select multiple='multiple'>", "</select>" ] || !tags.indexOf("<leg") && [ 1, "<fieldset>", "</fieldset>" ] || tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && [ 1, "<table>", "</table>" ] || !tags.indexOf("<tr") && [ 2, "<table><tbody>", "</tbody></table>" ] || // <thead> matched above (!tags.indexOf("<td") || !tags.indexOf("<th")) && [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || !tags.indexOf("<col") && [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || // IE can't serialize <link> and <script> tags normally !jQuery.support.htmlSerialize && [ 1, "div<div>", "</div>" ] || [ 0, "", "" ]; // Go to html and back, then peel off extra wrappers div.innerHTML = wrap[1] + elem + wrap[2]; // Move to the right depth while ( wrap[0]-- ) div = div.lastChild; // Remove IE's autoinserted <tbody> from table fragments if ( !jQuery.support.tbody ) { // String was a <table>, *may* have spurious <tbody> var hasBody = /<tbody/i.test(elem), tbody = !tags.indexOf("<table") && !hasBody ? div.firstChild && div.firstChild.childNodes : // String was a bare <thead> or <tfoot> wrap[1] == "<table>" && !hasBody ? div.childNodes : []; for ( var j = tbody.length - 1; j >= 0 ; --j ) if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) tbody[ j ].parentNode.removeChild( tbody[ j ] ); } // IE completely kills leading whitespace when innerHTML is used if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) ) div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); elem = jQuery.makeArray( div.childNodes ); } if ( elem.nodeType ) ret.push( elem ); else ret = jQuery.merge( ret, elem ); }); if ( fragment ) { for ( var i = 0; ret[i]; i++ ) { if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); } else { if ( ret[i].nodeType === 1 ) ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); fragment.appendChild( ret[i] ); } } return scripts; } return ret; }, attr: function( elem, name, value ) { /// <summary> /// This method is internal. /// </summary> /// <private /> // don't set attributes on text and comment nodes if (!elem || elem.nodeType == 3 || elem.nodeType == 8) return undefined; var notxml = !jQuery.isXMLDoc( elem ), // Whether we are setting (or getting) set = value !== undefined; // Try to normalize/fix the name name = notxml && jQuery.props[ name ] || name; // Only do all the following if this is a node (faster for style) // IE elem.getAttribute passes even for style if ( elem.tagName ) { // These attributes require special treatment var special = /href|src|style/.test( name ); // Safari mis-reports the default selected property of a hidden option // Accessing the parent's selectedIndex property fixes it if ( name == "selected" && elem.parentNode ) elem.parentNode.selectedIndex; // If applicable, access the attribute via the DOM 0 way if ( name in elem && notxml && !special ) { if ( set ){ // We can't allow the type property to be changed (since it causes problems in IE) if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) throw "type property can't be changed"; elem[ name ] = value; } // browsers index elements by id/name on forms, give priority to attributes. if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) return elem.getAttributeNode( name ).nodeValue; // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ if ( name == "tabIndex" ) { var attributeNode = elem.getAttributeNode( "tabIndex" ); return attributeNode && attributeNode.specified ? attributeNode.value : elem.nodeName.match(/(button|input|object|select|textarea)/i) ? 0 : elem.nodeName.match(/^(a|area)$/i) && elem.href ? 0 : undefined; } return elem[ name ]; } if ( !jQuery.support.style && notxml && name == "style" ) return jQuery.attr( elem.style, "cssText", value ); if ( set ) // convert the value to a string (all browsers do this but IE) see #1070 elem.setAttribute( name, "" + value ); var attr = !jQuery.support.hrefNormalized && notxml && special // Some attributes require a special call on IE ? elem.getAttribute( name, 2 ) : elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return attr === null ? undefined : attr; } // elem is actually elem.style ... set the style // IE uses filters for opacity if ( !jQuery.support.opacity && name == "opacity" ) { if ( set ) { // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level elem.zoom = 1; // Set the alpha filter to set the opacity elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); } return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': ""; } name = name.replace(/-([a-z])/ig, function(all, letter){ return letter.toUpperCase(); }); if ( set ) elem[ name ] = value; return elem[ name ]; }, trim: function( text ) { /// <summary> /// Remove the whitespace from the beginning and end of a string. /// Part of JavaScript /// </summary> /// <returns type="String" /> /// <param name="text" type="String"> /// The string to trim. /// </param> return (text || "").replace( /^\s+|\s+$/g, "" ); }, makeArray: function( array ) { /// <summary> /// Turns anything into a true array. This is an internal method. /// </summary> /// <param name="array" type="Object">Anything to turn into an actual Array</param> /// <returns type="Array" /> /// <private /> var ret = []; if( array != null ){ var i = array.length; // The window, strings (and functions) also have 'length' if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, inArray: function( elem, array ) { /// <summary> /// Determines the index of the first parameter in the array. /// </summary> /// <param name="elem">The value to see if it exists in the array.</param> /// <param name="array" type="Array">The array to look through for the value</param> /// <returns type="Number" integer="true">The 0-based index of the item if it was found, otherwise -1.</returns> for ( var i = 0, length = array.length; i < length; i++ ) // Use === because on IE, window == document if ( array[ i ] === elem ) return i; return -1; }, merge: function( first, second ) { /// <summary> /// Merge two arrays together, removing all duplicates. /// The new array is: All the results from the first array, followed /// by the unique results from the second array. /// Part of JavaScript /// </summary> /// <returns type="Array" /> /// <param name="first" type="Array"> /// The first array to merge. /// </param> /// <param name="second" type="Array"> /// The second array to merge. /// </param> // We have to loop this way because IE & Opera overwrite the length // expando of getElementsByTagName var i = 0, elem, pos = first.length; // Also, we need to make sure that the correct elements are being returned // (IE returns comment nodes in a '*' query) if ( !jQuery.support.getAll ) { while ( (elem = second[ i++ ]) != null ) if ( elem.nodeType != 8 ) first[ pos++ ] = elem; } else while ( (elem = second[ i++ ]) != null ) first[ pos++ ] = elem; return first; }, unique: function( array ) { /// <summary> /// Removes all duplicate elements from an array of elements. /// </summary> /// <param name="array" type="Array&lt;Element&gt;">The array to translate</param> /// <returns type="Array&lt;Element&gt;">The array after translation.</returns> var ret = [], done = {}; try { for ( var i = 0, length = array.length; i < length; i++ ) { var id = jQuery.data( array[ i ] ); if ( !done[ id ] ) { done[ id ] = true; ret.push( array[ i ] ); } } } catch( e ) { ret = array; } return ret; }, grep: function( elems, callback, inv ) { /// <summary> /// Filter items out of an array, by using a filter function. /// The specified function will be passed two arguments: The /// current array item and the index of the item in the array. The /// function must return 'true' to keep the item in the array, /// false to remove it. /// }); /// Part of JavaScript /// </summary> /// <returns type="Array" /> /// <param name="elems" type="Array"> /// array The Array to find items in. /// </param> /// <param name="fn" type="Function"> /// The function to process each item against. /// </param> /// <param name="inv" type="Boolean"> /// Invert the selection - select the opposite of the function. /// </param> var ret = []; // Go through the array, only saving the items // that pass the validator function for ( var i = 0, length = elems.length; i < length; i++ ) if ( !inv != !callback( elems[ i ], i ) ) ret.push( elems[ i ] ); return ret; }, map: function( elems, callback ) { /// <summary> /// Translate all items in an array to another array of items. /// The translation function that is provided to this method is /// called for each item in the array and is passed one argument: /// The item to be translated. /// The function can then return the translated value, 'null' /// (to remove the item), or an array of values - which will /// be flattened into the full array. /// Part of JavaScript /// </summary> /// <returns type="Array" /> /// <param name="elems" type="Array"> /// array The Array to translate. /// </param> /// <param name="fn" type="Function"> /// The function to process each item against. /// </param> var ret = []; // Go through the array, translating each of the items to their // new value (or values). for ( var i = 0, length = elems.length; i < length; i++ ) { var value = callback( elems[ i ], i ); if ( value != null ) ret[ ret.length ] = value; } return ret.concat.apply( [], ret ); } }); // Use of jQuery.browser is deprecated. // It's included for backwards compatibility and plugins, // although they should work to migrate away. var userAgent = navigator.userAgent.toLowerCase(); // Figure out what browser is being used jQuery.browser = { version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], safari: /webkit/.test( userAgent ), opera: /opera/.test( userAgent ), msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) }; // [vsdoc] The following section has been denormalized from original sources for IntelliSense. // jQuery.each({ // parent: function(elem){return elem.parentNode;}, // parents: function(elem){return jQuery.dir(elem,"parentNode");}, // next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, // prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, // nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, // prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, // siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, // children: function(elem){return jQuery.sibling(elem.firstChild);}, // contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} // }, function(name, fn){ // jQuery.fn[ name ] = function( selector ) { // /// <summary> // /// Get a set of elements containing the unique parents of the matched // /// set of elements. // /// Can be filtered with an optional expressions. // /// Part of DOM/Traversing // /// </summary> // /// <param name="expr" type="String" optional="true"> // /// (optional) An expression to filter the parents with // /// </param> // /// <returns type="jQuery" /> // // var ret = jQuery.map( this, fn ); // // if ( selector && typeof selector == "string" ) // ret = jQuery.multiFilter( selector, ret ); // // return this.pushStack( jQuery.unique( ret ), name, selector ); // }; // }); jQuery.each({ parent: function(elem){return elem.parentNode;} }, function(name, fn){ jQuery.fn[ name ] = function( selector ) { /// <summary> /// Get a set of elements containing the unique parents of the matched /// set of elements. /// Can be filtered with an optional expressions. /// Part of DOM/Traversing /// </summary> /// <param name="expr" type="String" optional="true"> /// (optional) An expression to filter the parents with /// </param> /// <returns type="jQuery" /> var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); jQuery.each({ parents: function(elem){return jQuery.dir(elem,"parentNode");} }, function(name, fn){ jQuery.fn[ name ] = function( selector ) { /// <summary> /// Get a set of elements containing the unique ancestors of the matched /// set of elements (except for the root element). /// Can be filtered with an optional expressions. /// Part of DOM/Traversing /// </summary> /// <param name="expr" type="String" optional="true"> /// (optional) An expression to filter the ancestors with /// </param> /// <returns type="jQuery" /> var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); jQuery.each({ next: function(elem){return jQuery.nth(elem,2,"nextSibling");} }, function(name, fn){ jQuery.fn[ name ] = function( selector ) { /// <summary> /// Get a set of elements containing the unique next siblings of each of the /// matched set of elements. /// It only returns the very next sibling, not all next siblings. /// Can be filtered with an optional expressions. /// Part of DOM/Traversing /// </summary> /// <param name="expr" type="String" optional="true"> /// (optional) An expression to filter the next Elements with /// </param> /// <returns type="jQuery" /> var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); jQuery.each({ prev: function(elem){return jQuery.nth(elem,2,"previousSibling");} }, function(name, fn){ jQuery.fn[ name ] = function( selector ) { /// <summary> /// Get a set of elements containing the unique previous siblings of each of the /// matched set of elements. /// Can be filtered with an optional expressions. /// It only returns the immediately previous sibling, not all previous siblings. /// Part of DOM/Traversing /// </summary> /// <param name="expr" type="String" optional="true"> /// (optional) An expression to filter the previous Elements with /// </param> /// <returns type="jQuery" /> var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); jQuery.each({ nextAll: function(elem){return jQuery.dir(elem,"nextSibling");} }, function(name, fn){ jQuery.fn[name] = function(selector) { /// <summary> /// Finds all sibling elements after the current element. /// Can be filtered with an optional expressions. /// Part of DOM/Traversing /// </summary> /// <param name="expr" type="String" optional="true"> /// (optional) An expression to filter the next Elements with /// </param> /// <returns type="jQuery" /> var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); jQuery.each({ prevAll: function(elem){return jQuery.dir(elem,"previousSibling");} }, function(name, fn){ jQuery.fn[ name ] = function( selector ) { /// <summary> /// Finds all sibling elements before the current element. /// Can be filtered with an optional expressions. /// Part of DOM/Traversing /// </summary> /// <param name="expr" type="String" optional="true"> /// (optional) An expression to filter the previous Elements with /// </param> /// <returns type="jQuery" /> var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); jQuery.each({ siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);} }, function(name, fn){ jQuery.fn[ name ] = function( selector ) { /// <summary> /// Get a set of elements containing all of the unique siblings of each of the /// matched set of elements. /// Can be filtered with an optional expressions. /// Part of DOM/Traversing /// </summary> /// <param name="expr" type="String" optional="true"> /// (optional) An expression to filter the sibling Elements with /// </param> /// <returns type="jQuery" /> var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); jQuery.each({ children: function(elem){return jQuery.sibling(elem.firstChild);} }, function(name, fn){ jQuery.fn[ name ] = function( selector ) { /// <summary> /// Get a set of elements containing all of the unique children of each of the /// matched set of elements. /// Can be filtered with an optional expressions. /// Part of DOM/Traversing /// </summary> /// <param name="expr" type="String" optional="true"> /// (optional) An expression to filter the child Elements with /// </param> /// <returns type="jQuery" /> var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); jQuery.each({ contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} }, function(name, fn){ jQuery.fn[ name ] = function( selector ) { /// <summary>Finds all the child nodes inside the matched elements including text nodes, or the content document if the element is an iframe.</summary> /// <returns type="jQuery" /> var ret = jQuery.map( this, fn ); if ( selector && typeof selector == "string" ) ret = jQuery.multiFilter( selector, ret ); return this.pushStack( jQuery.unique( ret ), name, selector ); }; }); // [vsdoc] The following section has been denormalized from original sources for IntelliSense. // jQuery.each({ // appendTo: "append", // prependTo: "prepend", // insertBefore: "before", // insertAfter: "after", // replaceAll: "replaceWith" // }, function(name, original){ // jQuery.fn[ name ] = function() { // var args = arguments; // // return this.each(function(){ // for ( var i = 0, length = args.length; i < length; i++ ) // jQuery( args[ i ] )[ original ]( this ); // }); // }; // }); jQuery.fn.appendTo = function( selector ) { /// <summary> /// Append all of the matched elements to another, specified, set of elements. /// As of jQuery 1.3.2, returns all of the inserted elements. /// This operation is, essentially, the reverse of doing a regular /// $(A).append(B), in that instead of appending B to A, you're appending /// A to B. /// </summary> /// <param name="selector" type="Selector"> /// target to which the content will be appended. /// </param> /// <returns type="jQuery" /> var ret = [], insert = jQuery( selector ); for ( var i = 0, l = insert.length; i < l; i++ ) { var elems = (i > 0 ? this.clone(true) : this).get(); jQuery.fn[ "append" ].apply( jQuery(insert[i]), elems ); ret = ret.concat( elems ); } return this.pushStack( ret, "appendTo", selector ); }; jQuery.fn.prependTo = function( selector ) { /// <summary> /// Prepend all of the matched elements to another, specified, set of elements. /// As of jQuery 1.3.2, returns all of the inserted elements. /// This operation is, essentially, the reverse of doing a regular /// $(A).prepend(B), in that instead of prepending B to A, you're prepending /// A to B. /// </summary> /// <param name="selector" type="Selector"> /// target to which the content will be appended. /// </param> /// <returns type="jQuery" /> var ret = [], insert = jQuery( selector ); for ( var i = 0, l = insert.length; i < l; i++ ) { var elems = (i > 0 ? this.clone(true) : this).get(); jQuery.fn[ "prepend" ].apply( jQuery(insert[i]), elems ); ret = ret.concat( elems ); } return this.pushStack( ret, "prependTo", selector ); }; jQuery.fn.insertBefore = function( selector ) { /// <summary> /// Insert all of the matched elements before another, specified, set of elements. /// As of jQuery 1.3.2, returns all of the inserted elements. /// This operation is, essentially, the reverse of doing a regular /// $(A).before(B), in that instead of inserting B before A, you're inserting /// A before B. /// </summary> /// <param name="content" type="String"> /// Content after which the selected element(s) is inserted. /// </param> /// <returns type="jQuery" /> var ret = [], insert = jQuery( selector ); for ( var i = 0, l = insert.length; i < l; i++ ) { var elems = (i > 0 ? this.clone(true) : this).get(); jQuery.fn[ "before" ].apply( jQuery(insert[i]), elems ); ret = ret.concat( elems ); } return this.pushStack( ret, "insertBefore", selector ); }; jQuery.fn.insertAfter = function( selector ) { /// <summary> /// Insert all of the matched elements after another, specified, set of elements. /// As of jQuery 1.3.2, returns all of the inserted elements. /// This operation is, essentially, the reverse of doing a regular /// $(A).after(B), in that instead of inserting B after A, you're inserting /// A after B. /// </summary> /// <param name="content" type="String"> /// Content after which the selected element(s) is inserted. /// </param> /// <returns type="jQuery" /> var ret = [], insert = jQuery( selector ); for ( var i = 0, l = insert.length; i < l; i++ ) { var elems = (i > 0 ? this.clone(true) : this).get(); jQuery.fn[ "after" ].apply( jQuery(insert[i]), elems ); ret = ret.concat( elems ); } return this.pushStack( ret, "insertAfter", selector ); }; jQuery.fn.replaceAll = function( selector ) { /// <summary> /// Replaces the elements matched by the specified selector with the matched elements. /// As of jQuery 1.3.2, returns all of the inserted elements. /// </summary> /// <param name="selector" type="Selector">The elements to find and replace the matched elements with.</param> /// <returns type="jQuery" /> var ret = [], insert = jQuery( selector ); for ( var i = 0, l = insert.length; i < l; i++ ) { var elems = (i > 0 ? this.clone(true) : this).get(); jQuery.fn[ "replaceWith" ].apply( jQuery(insert[i]), elems ); ret = ret.concat( elems ); } return this.pushStack( ret, "replaceAll", selector ); }; // [vsdoc] The following section has been denormalized from original sources for IntelliSense. // jQuery.each({ // removeAttr: function( name ) { // jQuery.attr( this, name, "" ); // if (this.nodeType == 1) // this.removeAttribute( name ); // }, // // addClass: function( classNames ) { // jQuery.className.add( this, classNames ); // }, // // removeClass: function( classNames ) { // jQuery.className.remove( this, classNames ); // }, // // toggleClass: function( classNames, state ) { // if( typeof state !== "boolean" ) // state = !jQuery.className.has( this, classNames ); // jQuery.className[ state ? "add" : "remove" ]( this, classNames ); // }, // // remove: function( selector ) { // if ( !selector || jQuery.filter( selector, [ this ] ).length ) { // // Prevent memory leaks // jQuery( "*", this ).add([this]).each(function(){ // jQuery.event.remove(this); // jQuery.removeData(this); // }); // if (this.parentNode) // this.parentNode.removeChild( this ); // } // }, // // empty: function() { // // Remove element nodes and prevent memory leaks // jQuery( ">*", this ).remove(); // // // Remove any remaining nodes // while ( this.firstChild ) // this.removeChild( this.firstChild ); // } // }, function(name, fn){ // jQuery.fn[ name ] = function(){ // return this.each( fn, arguments ); // }; // }); jQuery.fn.removeAttr = function(){ /// <summary> /// Remove an attribute from each of the matched elements. /// Part of DOM/Attributes /// </summary> /// <param name="key" type="String"> /// name The name of the attribute to remove. /// </param> /// <returns type="jQuery" /> return this.each( function( name ) { jQuery.attr( this, name, "" ); if (this.nodeType == 1) this.removeAttribute( name ); }, arguments ); }; jQuery.fn.addClass = function(){ /// <summary> /// Adds the specified class(es) to each of the set of matched elements. /// Part of DOM/Attributes /// </summary> /// <param name="classNames" type="String"> /// lass One or more CSS classes to add to the elements /// </param> /// <returns type="jQuery" /> return this.each( function( classNames ) { jQuery.className.add( this, classNames ); }, arguments ); }; jQuery.fn.removeClass = function(){ /// <summary> /// Removes all or the specified class(es) from the set of matched elements. /// Part of DOM/Attributes /// </summary> /// <param name="cssClasses" type="String" optional="true"> /// (Optional) One or more CSS classes to remove from the elements /// </param> /// <returns type="jQuery" /> return this.each( function( classNames ) { jQuery.className.remove( this, classNames ); }, arguments ); }; jQuery.fn.toggleClass = function(){ /// <summary> /// Adds the specified class if it is not present, removes it if it is /// present. /// Part of DOM/Attributes /// </summary> /// <param name="cssClass" type="String"> /// A CSS class with which to toggle the elements /// </param> /// <returns type="jQuery" /> return this.each( function( classNames, state ) { if( typeof state !== "boolean" ) state = !jQuery.className.has( this, classNames ); jQuery.className[ state ? "add" : "remove" ]( this, classNames ); }, arguments ); }; jQuery.fn.remove = function(){ /// <summary> /// Removes all matched elements from the DOM. This does NOT remove them from the /// jQuery object, allowing you to use the matched elements further. /// Can be filtered with an optional expressions. /// Part of DOM/Manipulation /// </summary> /// <param name="expr" type="String" optional="true"> /// (optional) A jQuery expression to filter elements by. /// </param> /// <returns type="jQuery" /> return this.each( function( selector ) { if ( !selector || jQuery.filter( selector, [ this ] ).length ) { // Prevent memory leaks jQuery( "*", this ).add([this]).each(function(){ jQuery.event.remove(this); jQuery.removeData(this); }); if (this.parentNode) this.parentNode.removeChild( this ); } }, arguments ); }; jQuery.fn.empty = function(){ /// <summary> /// Removes all child nodes from the set of matched elements. /// Part of DOM/Manipulation /// </summary> /// <returns type="jQuery" /> return this.each( function() { // Remove element nodes and prevent memory leaks jQuery(this).children().remove(); // Remove any remaining nodes while ( this.firstChild ) this.removeChild( this.firstChild ); }, arguments ); }; // Helper function used by the dimensions and offset modules function num(elem, prop) { return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; } var expando = "jQuery" + now(), uuid = 0, windowData = {}; jQuery.extend({ cache: {}, data: function( elem, name, data ) { elem = elem == window ? windowData : elem; var id = elem[ expando ]; // Compute a unique ID for the element if ( !id ) id = elem[ expando ] = ++uuid; // Only generate the data cache if we're // trying to access or manipulate it if ( name && !jQuery.cache[ id ] ) jQuery.cache[ id ] = {}; // Prevent overriding the named cache with undefined values if ( data !== undefined ) jQuery.cache[ id ][ name ] = data; // Return the named cache data, or the ID for the element return name ? jQuery.cache[ id ][ name ] : id; }, removeData: function( elem, name ) { elem = elem == window ? windowData : elem; var id = elem[ expando ]; // If we want to remove a specific section of the element's data if ( name ) { if ( jQuery.cache[ id ] ) { // Remove the section of cache data delete jQuery.cache[ id ][ name ]; // If we've removed all the data, remove the element's cache name = ""; for ( name in jQuery.cache[ id ] ) break; if ( !name ) jQuery.removeData( elem ); } // Otherwise, we want to remove all of the element's data } else { // Clean up the element expando try { delete elem[ expando ]; } catch(e){ // IE has trouble directly removing the expando // but it's ok with using removeAttribute if ( elem.removeAttribute ) elem.removeAttribute( expando ); } // Completely remove the data cache delete jQuery.cache[ id ]; } }, queue: function( elem, type, data ) { if ( elem ){ type = (type || "fx") + "queue"; var q = jQuery.data( elem, type ); if ( !q || jQuery.isArray(data) ) q = jQuery.data( elem, type, jQuery.makeArray(data) ); else if( data ) q.push( data ); } return q; }, dequeue: function( elem, type ){ var queue = jQuery.queue( elem, type ), fn = queue.shift(); if( !type || type === "fx" ) fn = queue[0]; if( fn !== undefined ) fn.call(elem); } }); jQuery.fn.extend({ data: function( key, value ){ var parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); if ( data === undefined && this.length ) data = jQuery.data( this[0], key ); return data === undefined && parts[1] ? this.data( parts[0] ) : data; } else return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ jQuery.data( this, key, value ); }); }, removeData: function( key ){ return this.each(function(){ jQuery.removeData( this, key ); }); }, queue: function(type, data){ /// <summary> /// 1: queue() - Returns a reference to the first element's queue (which is an array of functions). /// 2: queue(callback) - Adds a new function, to be executed, onto the end of the queue of all matched elements. /// 3: queue(queue) - Replaces the queue of all matched element with this new queue (the array of functions). /// </summary> /// <param name="type" type="Function">The function to add to the queue.</param> /// <returns type="jQuery" /> if ( typeof type !== "string" ) { data = type; type = "fx"; } if ( data === undefined ) return jQuery.queue( this[0], type ); return this.each(function(){ var queue = jQuery.queue( this, type, data ); if( type == "fx" && queue.length == 1 ) queue[0].call(this); }); }, dequeue: function(type){ /// <summary> /// Removes a queued function from the front of the queue and executes it. /// </summary> /// <param name="type" type="String" optional="true">The type of queue to access.</param> /// <returns type="jQuery" /> return this.each(function(){ jQuery.dequeue( this, type ); }); } });/*! * Sizzle CSS Selector Engine - v0.9.3 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, done = 0, toString = Object.prototype.toString; var Sizzle = function(selector, context, results, seed) { results = results || []; context = context || document; if ( context.nodeType !== 1 && context.nodeType !== 9 ) return []; if ( !selector || typeof selector !== "string" ) { return results; } var parts = [], m, set, checkSet, check, mode, extra, prune = true; // Reset the position of the chunker regexp (start from head) chunker.lastIndex = 0; while ( (m = chunker.exec(selector)) !== null ) { parts.push( m[1] ); if ( m[2] ) { extra = RegExp.rightContext; break; } } if ( parts.length > 1 && origPOS.exec( selector ) ) { if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { set = posProcess( parts[0] + parts[1], context ); } else { set = Expr.relative[ parts[0] ] ? [ context ] : Sizzle( parts.shift(), context ); while ( parts.length ) { selector = parts.shift(); if ( Expr.relative[ selector ] ) selector += parts.shift(); set = posProcess( selector, set ); } } } else { var ret = seed ? { expr: parts.pop(), set: makeArray(seed) } : Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) ); set = Sizzle.filter( ret.expr, ret.set ); if ( parts.length > 0 ) { checkSet = makeArray(set); } else { prune = false; } while ( parts.length ) { var cur = parts.pop(), pop = cur; if ( !Expr.relative[ cur ] ) { cur = ""; } else { pop = parts.pop(); } if ( pop == null ) { pop = context; } Expr.relative[ cur ]( checkSet, pop, isXML(context) ); } } if ( !checkSet ) { checkSet = set; } if ( !checkSet ) { throw "Syntax error, unrecognized expression: " + (cur || selector); } if ( toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); } else if ( context.nodeType === 1 ) { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { results.push( set[i] ); } } } else { for ( var i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && checkSet[i].nodeType === 1 ) { results.push( set[i] ); } } } } else { makeArray( checkSet, results ); } if ( extra ) { Sizzle( extra, context, results, seed ); if ( sortOrder ) { hasDuplicate = false; results.sort(sortOrder); if ( hasDuplicate ) { for ( var i = 1; i < results.length; i++ ) { if ( results[i] === results[i-1] ) { results.splice(i--, 1); } } } } } return results; }; Sizzle.matches = function(expr, set){ return Sizzle(expr, null, null, set); }; Sizzle.find = function(expr, context, isXML){ var set, match; if ( !expr ) { return []; } for ( var i = 0, l = Expr.order.length; i < l; i++ ) { var type = Expr.order[i], match; if ( (match = Expr.match[ type ].exec( expr )) ) { var left = RegExp.leftContext; if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace(/\\/g, ""); set = Expr.find[ type ]( match, context, isXML ); if ( set != null ) { expr = expr.replace( Expr.match[ type ], "" ); break; } } } } if ( !set ) { set = context.getElementsByTagName("*"); } return {set: set, expr: expr}; }; Sizzle.filter = function(expr, set, inplace, not){ var old = expr, result = [], curLoop = set, match, anyFound, isXMLFilter = set && set[0] && isXML(set[0]); while ( expr && set.length ) { for ( var type in Expr.filter ) { if ( (match = Expr.match[ type ].exec( expr )) != null ) { var filter = Expr.filter[ type ], found, item; anyFound = false; if ( curLoop == result ) { result = []; } if ( Expr.preFilter[ type ] ) { match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); if ( !match ) { anyFound = found = true; } else if ( match === true ) { continue; } } if ( match ) { for ( var i = 0; (item = curLoop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curLoop ); var pass = not ^ !!found; if ( inplace && found != null ) { if ( pass ) { anyFound = true; } else { curLoop[i] = false; } } else if ( pass ) { result.push( item ); anyFound = true; } } } } if ( found !== undefined ) { if ( !inplace ) { curLoop = result; } expr = expr.replace( Expr.match[ type ], "" ); if ( !anyFound ) { return []; } break; } } } // Improper expression if ( expr == old ) { if ( anyFound == null ) { throw "Syntax error, unrecognized expression: " + expr; } else { break; } } old = expr; } return curLoop; }; var Expr = Sizzle.selectors = { order: [ "ID", "NAME", "TAG" ], match: { ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ }, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function(elem){ return elem.getAttribute("href"); } }, relative: { "+": function(checkSet, part, isXML){ var isPartStr = typeof part === "string", isTag = isPartStr && !/\W/.test(part), isPartStrNotTag = isPartStr && !isTag; if ( isTag && !isXML ) { part = part.toUpperCase(); } for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { if ( (elem = checkSet[i]) ) { while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? elem || false : elem === part; } } if ( isPartStrNotTag ) { Sizzle.filter( part, checkSet, true ); } }, ">": function(checkSet, part, isXML){ var isPartStr = typeof part === "string"; if ( isPartStr && !/\W/.test(part) ) { part = isXML ? part : part.toUpperCase(); for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var parent = elem.parentNode; checkSet[i] = parent.nodeName === part ? parent : false; } } } else { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { checkSet[i] = isPartStr ? elem.parentNode : elem.parentNode === part; } } if ( isPartStr ) { Sizzle.filter( part, checkSet, true ); } } }, "": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( !part.match(/\W/) ) { var nodeCheck = part = isXML ? part : part.toUpperCase(); checkFn = dirNodeCheck; } checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); }, "~": function(checkSet, part, isXML){ var doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !part.match(/\W/) ) { var nodeCheck = part = isXML ? part : part.toUpperCase(); checkFn = dirNodeCheck; } checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); } }, find: { ID: function(match, context, isXML){ if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? [m] : []; } }, NAME: function(match, context, isXML){ if ( typeof context.getElementsByName !== "undefined" ) { var ret = [], results = context.getElementsByName(match[1]); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getAttribute("name") === match[1] ) { ret.push( results[i] ); } } return ret.length === 0 ? null : ret; } }, TAG: function(match, context){ return context.getElementsByTagName(match[1]); } }, preFilter: { CLASS: function(match, curLoop, inplace, result, not, isXML){ match = " " + match[1].replace(/\\/g, "") + " "; if ( isXML ) { return match; } for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { if ( elem ) { if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { if ( !inplace ) result.push( elem ); } else if ( inplace ) { curLoop[i] = false; } } } return false; }, ID: function(match){ return match[1].replace(/\\/g, ""); }, TAG: function(match, curLoop){ for ( var i = 0; curLoop[i] === false; i++ ){} return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); }, CHILD: function(match){ if ( match[1] == "nth" ) { // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } // TODO: Move to normal caching system match[0] = done++; return match; }, ATTR: function(match, curLoop, inplace, result, not, isXML){ var name = match[1].replace(/\\/g, ""); if ( !isXML && Expr.attrMap[name] ) { match[1] = Expr.attrMap[name]; } if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, PSEUDO: function(match, curLoop, inplace, result, not){ if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } return false; } } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { return true; } return match; }, POS: function(match){ match.unshift( true ); return match; } }, filters: { enabled: function(elem){ return elem.disabled === false && elem.type !== "hidden"; }, disabled: function(elem){ return elem.disabled === true; }, checked: function(elem){ return elem.checked === true; }, selected: function(elem){ // Accessing this property makes selected-by-default // options in Safari work properly elem.parentNode.selectedIndex; return elem.selected === true; }, parent: function(elem){ return !!elem.firstChild; }, empty: function(elem){ return !elem.firstChild; }, has: function(elem, i, match){ return !!Sizzle( match[3], elem ).length; }, header: function(elem){ return /h\d/i.test( elem.nodeName ); }, text: function(elem){ return "text" === elem.type; }, radio: function(elem){ return "radio" === elem.type; }, checkbox: function(elem){ return "checkbox" === elem.type; }, file: function(elem){ return "file" === elem.type; }, password: function(elem){ return "password" === elem.type; }, submit: function(elem){ return "submit" === elem.type; }, image: function(elem){ return "image" === elem.type; }, reset: function(elem){ return "reset" === elem.type; }, button: function(elem){ return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; }, input: function(elem){ return /input|select|textarea|button/i.test(elem.nodeName); } }, setFilters: { first: function(elem, i){ return i === 0; }, last: function(elem, i, match, array){ return i === array.length - 1; }, even: function(elem, i){ return i % 2 === 0; }, odd: function(elem, i){ return i % 2 === 1; }, lt: function(elem, i, match){ return i < match[3] - 0; }, gt: function(elem, i, match){ return i > match[3] - 0; }, nth: function(elem, i, match){ return match[3] - 0 == i; }, eq: function(elem, i, match){ return match[3] - 0 == i; } }, filter: { PSEUDO: function(elem, match, i, array){ var name = match[1], filter = Expr.filters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } else if ( name === "contains" ) { return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; for ( var i = 0, l = not.length; i < l; i++ ) { if ( not[i] === elem ) { return false; } } return true; } }, CHILD: function(elem, match){ var type = match[1], node = elem; switch (type) { case 'only': case 'first': while (node = node.previousSibling) { if ( node.nodeType === 1 ) return false; } if ( type == 'first') return true; node = elem; case 'last': while (node = node.nextSibling) { if ( node.nodeType === 1 ) return false; } return true; case 'nth': var first = match[2], last = match[3]; if ( first == 1 && last == 0 ) { return true; } var doneName = match[0], parent = elem.parentNode; if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { var count = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { node.nodeIndex = ++count; } } parent.sizcache = doneName; } var diff = elem.nodeIndex - last; if ( first == 0 ) { return diff == 0; } else { return ( diff % first == 0 && diff / first >= 0 ); } } }, ID: function(elem, match){ return elem.nodeType === 1 && elem.getAttribute("id") === match; }, TAG: function(elem, match){ return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; }, CLASS: function(elem, match){ return (" " + (elem.className || elem.getAttribute("class")) + " ") .indexOf( match ) > -1; }, ATTR: function(elem, match){ var name = match[1], result = Expr.attrHandle[ name ] ? Expr.attrHandle[ name ]( elem ) : elem[ name ] != null ? elem[ name ] : elem.getAttribute( name ), value = result + "", type = match[2], check = match[4]; return result == null ? type === "!=" : type === "=" ? value === check : type === "*=" ? value.indexOf(check) >= 0 : type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? value && result !== false : type === "!=" ? value != check : type === "^=" ? value.indexOf(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check : type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-" : false; }, POS: function(elem, match, i, array){ var name = match[2], filter = Expr.setFilters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } } } }; var origPOS = Expr.match.POS; for ( var type in Expr.match ) { Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); } var makeArray = function(array, results) { array = Array.prototype.slice.call( array ); if ( results ) { results.push.apply( results, array ); return results; } return array; }; // Perform a simple check to determine if the browser is capable of // converting a NodeList to an array using builtin methods. try { Array.prototype.slice.call( document.documentElement.childNodes ); // Provide a fallback method if it does not work } catch(e){ makeArray = function(array, results) { var ret = results || []; if ( toString.call(array) === "[object Array]" ) { Array.prototype.push.apply( ret, array ); } else { if ( typeof array.length === "number" ) { for ( var i = 0, l = array.length; i < l; i++ ) { ret.push( array[i] ); } } else { for ( var i = 0; array[i]; i++ ) { ret.push( array[i] ); } } } return ret; }; } var sortOrder; if ( document.documentElement.compareDocumentPosition ) { sortOrder = function( a, b ) { var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } else if ( "sourceIndex" in document.documentElement ) { sortOrder = function( a, b ) { var ret = a.sourceIndex - b.sourceIndex; if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } else if ( document.createRange ) { sortOrder = function( a, b ) { var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); aRange.selectNode(a); aRange.collapse(true); bRange.selectNode(b); bRange.collapse(true); var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); if ( ret === 0 ) { hasDuplicate = true; } return ret; }; } // [vsdoc] The following function has been modified for IntelliSense. // Check to see if the browser returns elements by name when // querying by getElementById (and provide a workaround) (function(){ // We're going to inject a fake input element with a specified name ////var form = document.createElement("form"), //// id = "script" + (new Date).getTime(); ////form.innerHTML = "<input name='" + id + "'/>"; // Inject it into the root element, check its status, and remove it quickly ////var root = document.documentElement; ////root.insertBefore( form, root.firstChild ); // The workaround has to do additional checks after a getElementById // Which slows things down for other browsers (hence the branching) ////if ( !!document.getElementById( id ) ) { Expr.find.ID = function(match, context, isXML){ if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; } }; Expr.filter.ID = function(elem, match){ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return elem.nodeType === 1 && node && node.nodeValue === match; }; ////} ////root.removeChild( form ); })(); // [vsdoc] The following function has been modified for IntelliSense. (function(){ // Check to see if the browser returns only elements // when doing getElementsByTagName("*") // Create a fake element ////var div = document.createElement("div"); ////div.appendChild( document.createComment("") ); // Make sure no comments are found ////if ( div.getElementsByTagName("*").length > 0 ) { Expr.find.TAG = function(match, context){ var results = context.getElementsByTagName(match[1]); // Filter out possible comments if ( match[1] === "*" ) { var tmp = []; for ( var i = 0; results[i]; i++ ) { if ( results[i].nodeType === 1 ) { tmp.push( results[i] ); } } results = tmp; } return results; }; ////} // Check to see if an attribute returns normalized href attributes ////div.innerHTML = "<a href='#'></a>"; ////if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && //// div.firstChild.getAttribute("href") !== "#" ) { Expr.attrHandle.href = function(elem){ return elem.getAttribute("href", 2); }; ////} })(); if ( document.querySelectorAll ) (function(){ var oldSizzle = Sizzle, div = document.createElement("div"); div.innerHTML = "<p class='TEST'></p>"; // Safari can't handle uppercase or unicode characters when // in quirks mode. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { return; } Sizzle = function(query, context, extra, seed){ context = context || document; // Only use querySelectorAll on non-XML documents // (ID selectors don't work in non-HTML documents) if ( !seed && context.nodeType === 9 && !isXML(context) ) { try { return makeArray( context.querySelectorAll(query), extra ); } catch(e){} } return oldSizzle(query, context, extra, seed); }; Sizzle.find = oldSizzle.find; Sizzle.filter = oldSizzle.filter; Sizzle.selectors = oldSizzle.selectors; Sizzle.matches = oldSizzle.matches; })(); if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ var div = document.createElement("div"); div.innerHTML = "<div class='test e'></div><div class='test'></div>"; // Opera can't find a second classname (in 9.6) if ( div.getElementsByClassName("e").length === 0 ) return; // Safari caches class attributes, doesn't catch changes (in 3.2) div.lastChild.className = "e"; if ( div.getElementsByClassName("e").length === 1 ) return; Expr.order.splice(1, 0, "CLASS"); Expr.find.CLASS = function(match, context, isXML) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { return context.getElementsByClassName(match[1]); } }; })(); function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { var sibDir = dir == "previousSibling" && !isXML; for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { if ( sibDir && elem.nodeType === 1 ){ elem.sizcache = doneName; elem.sizset = i; } elem = elem[dir]; var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 && !isXML ){ elem.sizcache = doneName; elem.sizset = i; } if ( elem.nodeName === cur ) { match = elem; break; } elem = elem[dir]; } checkSet[i] = match; } } } function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { var sibDir = dir == "previousSibling" && !isXML; for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { if ( sibDir && elem.nodeType === 1 ) { elem.sizcache = doneName; elem.sizset = i; } elem = elem[dir]; var match = false; while ( elem ) { if ( elem.sizcache === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 ) { if ( !isXML ) { elem.sizcache = doneName; elem.sizset = i; } if ( typeof cur !== "string" ) { if ( elem === cur ) { match = true; break; } } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { match = elem; break; } } elem = elem[dir]; } checkSet[i] = match; } } } var contains = document.compareDocumentPosition ? function(a, b){ return a.compareDocumentPosition(b) & 16; } : function(a, b){ return a !== b && (a.contains ? a.contains(b) : true); }; var isXML = function(elem){ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || !!elem.ownerDocument && isXML( elem.ownerDocument ); }; var posProcess = function(selector, context){ var tmpSet = [], later = "", match, root = context.nodeType ? [context] : context; // Position selectors must be done after the filter // And so must :not(positional) so we move all PSEUDOs to the end while ( (match = Expr.match.PSEUDO.exec( selector )) ) { later += match[0]; selector = selector.replace( Expr.match.PSEUDO, "" ); } selector = Expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { Sizzle( selector, root[i], tmpSet ); } return Sizzle.filter( later, tmpSet ); }; // EXPOSE jQuery.find = Sizzle; jQuery.filter = Sizzle.filter; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; Sizzle.selectors.filters.hidden = function(elem){ return elem.offsetWidth === 0 || elem.offsetHeight === 0; }; Sizzle.selectors.filters.visible = function(elem){ return elem.offsetWidth > 0 || elem.offsetHeight > 0; }; Sizzle.selectors.filters.animated = function(elem){ return jQuery.grep(jQuery.timers, function(fn){ return elem === fn.elem; }).length; }; jQuery.multiFilter = function( expr, elems, not ) { /// <summary> /// This member is internal only. /// </summary> /// <private /> if ( not ) { expr = ":not(" + expr + ")"; } return Sizzle.matches(expr, elems); }; jQuery.dir = function( elem, dir ){ /// <summary> /// This member is internal only. /// </summary> /// <private /> // This member is not documented in the jQuery API: http://docs.jquery.com/Special:Search?ns0=1&search=dir var matched = [], cur = elem[dir]; while ( cur && cur != document ) { if ( cur.nodeType == 1 ) matched.push( cur ); cur = cur[dir]; } return matched; }; jQuery.nth = function(cur, result, dir, elem){ /// <summary> /// This member is internal only. /// </summary> /// <private /> // This member is not documented in the jQuery API: http://docs.jquery.com/Special:Search?ns0=1&search=nth result = result || 1; var num = 0; for ( ; cur; cur = cur[dir] ) if ( cur.nodeType == 1 && ++num == result ) break; return cur; }; jQuery.sibling = function(n, elem){ /// <summary> /// This member is internal only. /// </summary> /// <private /> // This member is not documented in the jQuery API: http://docs.jquery.com/Special:Search?ns0=1&search=nth var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType == 1 && n != elem ) r.push( n ); } return r; }; return; window.Sizzle = Sizzle; })(); /* * A number of helper functions used for managing events. * Many of the ideas behind this code originated from * Dean Edwards' addEvent library. */ jQuery.event = { // Bind an event to an element // Original by Dean Edwards add: function(elem, types, handler, data) { /// <summary> /// This method is internal. /// </summary> /// <private /> if ( elem.nodeType == 3 || elem.nodeType == 8 ) return; // For whatever reason, IE has trouble passing the window object // around, causing it to be cloned in the process if ( elem.setInterval && elem != window ) elem = window; // Make sure that the function being executed has a unique ID if ( !handler.guid ) handler.guid = this.guid++; // if data is passed, bind to handler if ( data !== undefined ) { // Create temporary function pointer to original handler var fn = handler; // Create unique handler function, wrapped around original handler handler = this.proxy( fn ); // Store data in unique handler handler.data = data; } // Init the element's event structure var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ // Handle the second event of a trigger and when // an event is called after a page has unloaded return typeof jQuery !== "undefined" && !jQuery.event.triggered ? jQuery.event.handle.apply(arguments.callee.elem, arguments) : undefined; }); // Add elem as a property of the handle function // This is to prevent a memory leak with non-native // event in IE. handle.elem = elem; // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); jQuery.each(types.split(/\s+/), function(index, type) { // Namespaced event handlers var namespaces = type.split("."); type = namespaces.shift(); handler.type = namespaces.slice().sort().join("."); // Get the current list of functions bound to this event var handlers = events[type]; if ( jQuery.event.specialAll[type] ) jQuery.event.specialAll[type].setup.call(elem, data, namespaces); // Init the event handler queue if (!handlers) { handlers = events[type] = {}; // Check for a special event handler // Only use addEventListener/attachEvent if the special // events handler returns false if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) { // Bind the global event handler to the element if (elem.addEventListener) elem.addEventListener(type, handle, false); else if (elem.attachEvent) elem.attachEvent("on" + type, handle); } } // Add the function to the element's handler list handlers[handler.guid] = handler; // Keep track of which events have been used, for global triggering jQuery.event.global[type] = true; }); // Nullify elem to prevent memory leaks in IE elem = null; }, guid: 1, global: {}, // Detach an event or set of events from an element remove: function(elem, types, handler) { /// <summary> /// This method is internal. /// </summary> /// <private /> // don't do events on text and comment nodes if ( elem.nodeType == 3 || elem.nodeType == 8 ) return; var events = jQuery.data(elem, "events"), ret, index; if ( events ) { // Unbind all events for the element if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") ) for ( var type in events ) this.remove( elem, type + (types || "") ); else { // types is actually an event object here if ( types.type ) { handler = types.handler; types = types.type; } // Handle multiple events seperated by a space // jQuery(...).unbind("mouseover mouseout", fn); jQuery.each(types.split(/\s+/), function(index, type){ // Namespaced event handlers var namespaces = type.split("."); type = namespaces.shift(); var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); if ( events[type] ) { // remove the given handler for the given type if ( handler ) delete events[type][handler.guid]; // remove all handlers for the given type else for ( var handle in events[type] ) // Handle the removal of namespaced events if ( namespace.test(events[type][handle].type) ) delete events[type][handle]; if ( jQuery.event.specialAll[type] ) jQuery.event.specialAll[type].teardown.call(elem, namespaces); // remove generic event handler if no more handlers exist for ( ret in events[type] ) break; if ( !ret ) { if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) { if (elem.removeEventListener) elem.removeEventListener(type, jQuery.data(elem, "handle"), false); else if (elem.detachEvent) elem.detachEvent("on" + type, jQuery.data(elem, "handle")); } ret = null; delete events[type]; } } }); } // Remove the expando if it's no longer used for ( ret in events ) break; if ( !ret ) { var handle = jQuery.data( elem, "handle" ); if ( handle ) handle.elem = null; jQuery.removeData( elem, "events" ); jQuery.removeData( elem, "handle" ); } } }, // bubbling is internal trigger: function( event, data, elem, bubbling ) { /// <summary> /// This method is internal. /// </summary> /// <private /> // Event object or event type var type = event.type || event; if( !bubbling ){ event = typeof event === "object" ? // jQuery.Event object event[expando] ? event : // Object literal jQuery.extend( jQuery.Event(type), event ) : // Just the event type (string) jQuery.Event(type); if ( type.indexOf("!") >= 0 ) { event.type = type = type.slice(0, -1); event.exclusive = true; } // Handle a global trigger if ( !elem ) { // Don't bubble custom events when global (to avoid too much overhead) event.stopPropagation(); // Only trigger if we've ever bound an event for it if ( this.global[type] ) jQuery.each( jQuery.cache, function(){ if ( this.events && this.events[type] ) jQuery.event.trigger( event, data, this.handle.elem ); }); } // Handle triggering a single element // don't do events on text and comment nodes if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) return undefined; // Clean up in case it is reused event.result = undefined; event.target = elem; // Clone the incoming data, if any data = jQuery.makeArray(data); data.unshift( event ); } event.currentTarget = elem; // Trigger the event, it is assumed that "handle" is a function var handle = jQuery.data(elem, "handle"); if ( handle ) handle.apply( elem, data ); // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) event.result = false; // Trigger the native events (except for clicks on links) if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) { this.triggered = true; try { elem[ type ](); // prevent IE from throwing an error for some hidden elements } catch (e) {} } this.triggered = false; if ( !event.isPropagationStopped() ) { var parent = elem.parentNode || elem.ownerDocument; if ( parent ) jQuery.event.trigger(event, data, parent, true); } }, handle: function(event) { /// <summary> /// This method is internal. /// </summary> /// <private /> // returned undefined or false var all, handlers; event = arguments[0] = jQuery.event.fix( event || window.event ); event.currentTarget = this; // Namespaced event handlers var namespaces = event.type.split("."); event.type = namespaces.shift(); // Cache this now, all = true means, any handler all = !namespaces.length && !event.exclusive; var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); handlers = ( jQuery.data(this, "events") || {} )[event.type]; for ( var j in handlers ) { var handler = handlers[j]; // Filter the functions by class if ( all || namespace.test(handler.type) ) { // Pass in a reference to the handler function itself // So that we can later remove it event.handler = handler; event.data = handler.data; var ret = handler.apply(this, arguments); if( ret !== undefined ){ event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } if( event.isImmediatePropagationStopped() ) break; } } }, props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix: function(event) { /// <summary> /// This method is internal. /// </summary> /// <private /> if ( event[expando] ) return event; // store a copy of the original event object // and "clone" to set read-only properties var originalEvent = event; event = jQuery.Event( originalEvent ); for ( var i = this.props.length, prop; i; ){ prop = this.props[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary if ( !event.target ) event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either // check if target is a textnode (safari) if ( event.target.nodeType == 3 ) event.target = event.target.parentNode; // Add relatedTarget, if necessary if ( !event.relatedTarget && event.fromElement ) event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && event.clientX != null ) { var doc = document.documentElement, body = document.body; event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); } // Add which for key events if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) event.which = event.charCode || event.keyCode; // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) if ( !event.metaKey && event.ctrlKey ) event.metaKey = event.ctrlKey; // Add which for click: 1 == left; 2 == middle; 3 == right // Note: button is not normalized, so don't use it if ( !event.which && event.button ) event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); return event; }, proxy: function( fn, proxy ){ /// <summary> /// This method is internal. /// </summary> /// <private /> proxy = proxy || function(){ return fn.apply(this, arguments); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; // So proxy can be declared as an argument return proxy; }, special: { ready: { /// <summary> /// This method is internal. /// </summary> /// <private /> // Make sure the ready event is setup setup: bindReady, teardown: function() {} } }, specialAll: { live: { setup: function( selector, namespaces ){ jQuery.event.add( this, namespaces[0], liveHandler ); }, teardown: function( namespaces ){ if ( namespaces.length ) { var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); jQuery.each( (jQuery.data(this, "events").live || {}), function(){ if ( name.test(this.type) ) remove++; }); if ( remove < 1 ) jQuery.event.remove( this, namespaces[0], liveHandler ); } } } } }; jQuery.Event = function( src ){ // Allow instantiation without the 'new' keyword if( !this.preventDefault ) return new jQuery.Event(src); // Event object if( src && src.type ){ this.originalEvent = src; this.type = src.type; // Event type }else this.type = src; // timeStamp is buggy for some events on Firefox(#3843) // So we won't rely on the native value this.timeStamp = now(); // Mark it as fixed this[expando] = true; }; function returnFalse(){ return false; } function returnTrue(){ return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if( !e ) return; // if preventDefault exists run it on the original event if (e.preventDefault) e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) e.returnValue = false; }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if( !e ) return; // if stopPropagation exists run it on the original event if (e.stopPropagation) e.stopPropagation(); // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation:function(){ this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Checks if an event happened on an element within another element // Used in jQuery.event.special.mouseenter and mouseleave handlers var withinElement = function(event) { // Check if mouse(over|out) are still within the same parent element var parent = event.relatedTarget; // Traverse up the tree while ( parent && parent != this ) try { parent = parent.parentNode; } catch(e) { parent = this; } if( parent != this ){ // set the correct event type event.type = event.data; // handle event if we actually just moused on to a non sub-element jQuery.event.handle.apply( this, arguments ); } }; jQuery.each({ mouseover: 'mouseenter', mouseout: 'mouseleave' }, function( orig, fix ){ jQuery.event.special[ fix ] = { setup: function(){ /// <summary> /// This method is internal. /// </summary> /// <private /> jQuery.event.add( this, orig, withinElement, fix ); }, teardown: function(){ /// <summary> /// This method is internal. /// </summary> /// <private /> jQuery.event.remove( this, orig, withinElement ); } }; }); jQuery.fn.extend({ bind: function( type, data, fn ) { /// <summary> /// Binds a handler to one or more events for each matched element. Can also bind custom events. /// </summary> /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param> /// <param name="data" optional="true" type="Object">Additional data passed to the event handler as event.data</param> /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param> return type == "unload" ? this.one(type, data, fn) : this.each(function(){ jQuery.event.add( this, type, fn || data, fn && data ); }); }, one: function( type, data, fn ) { /// <summary> /// Binds a handler to one or more events to be executed exactly once for each matched element. /// </summary> /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param> /// <param name="data" optional="true" type="Object">Additional data passed to the event handler as event.data</param> /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param> var one = jQuery.event.proxy( fn || data, function(event) { jQuery(this).unbind(event, one); return (fn || data).apply( this, arguments ); }); return this.each(function(){ jQuery.event.add( this, type, one, fn && data); }); }, unbind: function( type, fn ) { /// <summary> /// Unbinds a handler from one or more events for each matched element. /// </summary> /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param> /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param> return this.each(function(){ jQuery.event.remove( this, type, fn ); }); }, trigger: function( type, data ) { /// <summary> /// Triggers a type of event on every matched element. /// </summary> /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param> /// <param name="data" optional="true" type="Array">Additional data passed to the event handler as additional arguments.</param> /// <param name="fn" type="Function">This parameter is undocumented.</param> return this.each(function(){ jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { /// <summary> /// Triggers all bound event handlers on an element for a specific event type without executing the browser's default actions. /// </summary> /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param> /// <param name="data" optional="true" type="Array">Additional data passed to the event handler as additional arguments.</param> /// <param name="fn" type="Function">This parameter is undocumented.</param> if( this[0] ){ var event = jQuery.Event(type); event.preventDefault(); event.stopPropagation(); jQuery.event.trigger( event, data, this[0] ); return event.result; } }, toggle: function( fn ) { /// <summary> /// Toggles among two or more function calls every other click. /// </summary> /// <param name="fn" type="Function">The functions among which to toggle execution</param> // Save reference to arguments for access in closure var args = arguments, i = 1; // link all the functions, so any of them can unbind this click handler while( i < args.length ) jQuery.event.proxy( fn, args[i++] ); return this.click( jQuery.event.proxy( fn, function(event) { // Figure out which function to execute this.lastToggle = ( this.lastToggle || 0 ) % i; // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ this.lastToggle++ ].apply( this, arguments ) || false; })); }, hover: function(fnOver, fnOut) { /// <summary> /// Simulates hovering (moving the mouse on or off of an object). /// </summary> /// <param name="fnOver" type="Function">The function to fire when the mouse is moved over a matched element.</param> /// <param name="fnOut" type="Function">The function to fire when the mouse is moved off of a matched element.</param> return this.mouseenter(fnOver).mouseleave(fnOut); }, ready: function(fn) { /// <summary> /// Binds a function to be executed whenever the DOM is ready to be traversed and manipulated. /// </summary> /// <param name="fn" type="Function">The function to be executed when the DOM is ready.</param> // Attach the listeners bindReady(); // If the DOM is already ready if ( jQuery.isReady ) // Execute the function immediately fn.call( document, jQuery ); // Otherwise, remember the function for later else // Add the function to the wait list jQuery.readyList.push( fn ); return this; }, live: function( type, fn ){ /// <summary> /// Binds a handler to an event (like click) for all current - and future - matched element. Can also bind custom events. /// </summary> /// <param name="type" type="String">An event type</param> /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements</param> var proxy = jQuery.event.proxy( fn ); proxy.guid += this.selector + type; jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy ); return this; }, die: function( type, fn ){ /// <summary> /// This does the opposite of live, it removes a bound live event. /// You can also unbind custom events registered with live. /// If the type is provided, all bound live events of that type are removed. /// If the function that was passed to live is provided as the second argument, only that specific event handler is removed. /// </summary> /// <param name="type" type="String">A live event type to unbind.</param> /// <param name="fn" type="Function">A function to unbind from the event on each of the set of matched elements.</param> jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null ); return this; } }); function liveHandler( event ){ var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"), stop = true, elems = []; jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){ if ( check.test(fn.type) ) { var elem = jQuery(event.target).closest(fn.data)[0]; if ( elem ) elems.push({ elem: elem, fn: fn }); } }); elems.sort(function(a,b) { return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest"); }); jQuery.each(elems, function(){ if ( this.fn.call(this.elem, event, this.fn.data) === false ) return (stop = false); }); return stop; } function liveConvert(type, selector){ return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join("."); } jQuery.extend({ isReady: false, readyList: [], // Handle when the DOM is ready ready: function() { /// <summary> /// This method is internal. /// </summary> /// <private /> // Make sure that the DOM is not already loaded if ( !jQuery.isReady ) { // Remember that the DOM is ready jQuery.isReady = true; // If there are functions bound, to execute if ( jQuery.readyList ) { // Execute all of them jQuery.each( jQuery.readyList, function(){ this.call( document, jQuery ); }); // Reset the list of functions jQuery.readyList = null; } // Trigger any bound ready events jQuery(document).triggerHandler("ready"); } } }); var readyBound = false; function bindReady(){ if ( readyBound ) return; readyBound = true; // Mozilla, Opera and webkit nightlies currently support this event if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", function(){ document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); jQuery.ready(); }, false ); // If IE event model is used } else if ( document.attachEvent ) { // ensure firing before onload, // maybe late but safe also for iframes document.attachEvent("onreadystatechange", function(){ if ( document.readyState === "complete" ) { document.detachEvent( "onreadystatechange", arguments.callee ); jQuery.ready(); } }); // If IE and not an iframe // continually check to see if the document is ready if ( document.documentElement.doScroll && window == window.top ) (function(){ if ( jQuery.isReady ) return; try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch( error ) { setTimeout( arguments.callee, 0 ); return; } // and execute any waiting functions jQuery.ready(); })(); } // A fallback to window.onload, that will always work jQuery.event.add( window, "load", jQuery.ready ); } // [vsdoc] The following section has been denormalized from original sources for IntelliSense. jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," + "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){ // Handle event binding jQuery.fn[name] = function(fn){ return fn ? this.bind(name, fn) : this.trigger(name); }; }); jQuery.fn["blur"] = function(fn) { /// <summary> /// 1: blur() - Triggers the blur event of each matched element. /// 2: blur(fn) - Binds a function to the blur event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("blur", fn) : this.trigger(name); }; jQuery.fn["focus"] = function(fn) { /// <summary> /// 1: focus() - Triggers the focus event of each matched element. /// 2: focus(fn) - Binds a function to the focus event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("focus", fn) : this.trigger(name); }; jQuery.fn["load"] = function(fn) { /// <summary> /// 1: load() - Triggers the load event of each matched element. /// 2: load(fn) - Binds a function to the load event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("load", fn) : this.trigger(name); }; jQuery.fn["resize"] = function(fn) { /// <summary> /// 1: resize() - Triggers the resize event of each matched element. /// 2: resize(fn) - Binds a function to the resize event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("resize", fn) : this.trigger(name); }; jQuery.fn["scroll"] = function(fn) { /// <summary> /// 1: scroll() - Triggers the scroll event of each matched element. /// 2: scroll(fn) - Binds a function to the scroll event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("scroll", fn) : this.trigger(name); }; jQuery.fn["unload"] = function(fn) { /// <summary> /// 1: unload() - Triggers the unload event of each matched element. /// 2: unload(fn) - Binds a function to the unload event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("unload", fn) : this.trigger(name); }; jQuery.fn["click"] = function(fn) { /// <summary> /// 1: click() - Triggers the click event of each matched element. /// 2: click(fn) - Binds a function to the click event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("click", fn) : this.trigger(name); }; jQuery.fn["dblclick"] = function(fn) { /// <summary> /// 1: dblclick() - Triggers the dblclick event of each matched element. /// 2: dblclick(fn) - Binds a function to the dblclick event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("dblclick", fn) : this.trigger(name); }; jQuery.fn["mousedown"] = function(fn) { /// <summary> /// Binds a function to the mousedown event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("mousedown", fn) : this.trigger(name); }; jQuery.fn["mouseup"] = function(fn) { /// <summary> /// Bind a function to the mouseup event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("mouseup", fn) : this.trigger(name); }; jQuery.fn["mousemove"] = function(fn) { /// <summary> /// Bind a function to the mousemove event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("mousemove", fn) : this.trigger(name); }; jQuery.fn["mouseover"] = function(fn) { /// <summary> /// Bind a function to the mouseover event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("mouseover", fn) : this.trigger(name); }; jQuery.fn["mouseout"] = function(fn) { /// <summary> /// Bind a function to the mouseout event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("mouseout", fn) : this.trigger(name); }; jQuery.fn["mouseenter"] = function(fn) { /// <summary> /// Bind a function to the mouseenter event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("mouseenter", fn) : this.trigger(name); }; jQuery.fn["mouseleave"] = function(fn) { /// <summary> /// Bind a function to the mouseleave event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("mouseleave", fn) : this.trigger(name); }; jQuery.fn["change"] = function(fn) { /// <summary> /// 1: change() - Triggers the change event of each matched element. /// 2: change(fn) - Binds a function to the change event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("change", fn) : this.trigger(name); }; jQuery.fn["select"] = function(fn) { /// <summary> /// 1: select() - Triggers the select event of each matched element. /// 2: select(fn) - Binds a function to the select event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("select", fn) : this.trigger(name); }; jQuery.fn["submit"] = function(fn) { /// <summary> /// 1: submit() - Triggers the submit event of each matched element. /// 2: submit(fn) - Binds a function to the submit event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("submit", fn) : this.trigger(name); }; jQuery.fn["keydown"] = function(fn) { /// <summary> /// 1: keydown() - Triggers the keydown event of each matched element. /// 2: keydown(fn) - Binds a function to the keydown event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("keydown", fn) : this.trigger(name); }; jQuery.fn["keypress"] = function(fn) { /// <summary> /// 1: keypress() - Triggers the keypress event of each matched element. /// 2: keypress(fn) - Binds a function to the keypress event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("keypress", fn) : this.trigger(name); }; jQuery.fn["keyup"] = function(fn) { /// <summary> /// 1: keyup() - Triggers the keyup event of each matched element. /// 2: keyup(fn) - Binds a function to the keyup event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("keyup", fn) : this.trigger(name); }; jQuery.fn["error"] = function(fn) { /// <summary> /// 1: error() - Triggers the error event of each matched element. /// 2: error(fn) - Binds a function to the error event of each matched element. /// </summary> /// <param name="fn" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return fn ? this.bind("error", fn) : this.trigger(name); }; // Prevent memory leaks in IE // And prevent errors on refresh with events like mouseover in other browsers // Window isn't included so as not to unbind existing unload events jQuery( window ).bind( 'unload', function(){ for ( var id in jQuery.cache ) // Skip the window if ( id != 1 && jQuery.cache[ id ].handle ) jQuery.event.remove( jQuery.cache[ id ].handle.elem ); }); // [vsdoc] The following function has been modified for IntelliSense. // [vsdoc] Stubbing support properties to "false" since we simulate IE. (function(){ jQuery.support = {}; jQuery.support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: false, // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: false, // Make sure that you can get all elements in an <object> element // IE 7 always returns no results objectAll: false, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: false, // Get the style information from getAttribute // (IE uses .cssText insted) style: false, // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: false, // Make sure that element opacity exists // (IE uses filter instead) opacity: false, // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: false, // Will be defined later scriptEval: false, noCloneEvent: false, boxModel: false }; })(); // [vsdoc] The following member has been modified for IntelliSense. var styleFloat = "styleFloat"; jQuery.props = { "for": "htmlFor", "class": "className", "float": styleFloat, cssFloat: styleFloat, styleFloat: styleFloat, readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", tabindex: "tabIndex" }; jQuery.fn.extend({ // Keep a copy of the old load _load: jQuery.fn.load, load: function( url, params, callback ) { /// <summary> /// Loads HTML from a remote file and injects it into the DOM. By default performs a GET request, but if parameters are included /// then a POST will be performed. /// </summary> /// <param name="url" type="String">The URL of the HTML page to load.</param> /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param> /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus, XMLHttpRequest) such that this maps the injected DOM element.</param> /// <returns type="jQuery" /> if ( typeof url !== "string" ) return this._load( url ); var off = url.indexOf(" "); if ( off >= 0 ) { var selector = url.slice(off, url.length); url = url.slice(0, off); } // Default to a GET request var type = "GET"; // If the second parameter was provided if ( params ) // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = null; // Otherwise, build a param string } else if( typeof params === "object" ) { params = jQuery.param( params ); type = "POST"; } var self = this; // Request the remote document jQuery.ajax({ url: url, type: type, dataType: "html", data: params, complete: function(res, status){ // If successful, inject the HTML into all the matched elements if ( status == "success" || status == "notmodified" ) // See if a selector was specified self.html( selector ? // Create a dummy div to hold the results jQuery("<div/>") // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")) // Locate the specified elements .find(selector) : // If not, just inject the full result res.responseText ); if( callback ) self.each( callback, [res.responseText, status, res] ); } }); return this; }, serialize: function() { /// <summary> /// Serializes a set of input elements into a string of data. /// </summary> /// <returns type="String">The serialized result</returns> return jQuery.param(this.serializeArray()); }, serializeArray: function() { /// <summary> /// Serializes all forms and form elements but returns a JSON data structure. /// </summary> /// <returns type="String">A JSON data structure representing the serialized items.</returns> return this.map(function(){ return this.elements ? jQuery.makeArray(this.elements) : this; }) .filter(function(){ return this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /text|hidden|password|search/i.test(this.type)); }) .map(function(i, elem){ var val = jQuery(this).val(); return val == null ? null : jQuery.isArray(val) ? jQuery.map( val, function(val, i){ return {name: elem.name, value: val}; }) : {name: elem.name, value: val}; }).get(); } }); // [vsdoc] The following section has been denormalized from original sources for IntelliSense. // Attach a bunch of functions for handling common AJAX events // jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){ // jQuery.fn[o] = function(f){ // return this.bind(o, f); // }; // }); jQuery.fn["ajaxStart"] = function(callback) { /// <summary> /// Attach a function to be executed whenever an AJAX request begins and there is none already active. This is an Ajax Event. /// </summary> /// <param name="callback" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return this.bind("ajaxStart", f); }; jQuery.fn["ajaxStop"] = function(callback) { /// <summary> /// Attach a function to be executed whenever all AJAX requests have ended. This is an Ajax Event. /// </summary> /// <param name="callback" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return this.bind("ajaxStop", f); }; jQuery.fn["ajaxComplete"] = function(callback) { /// <summary> /// Attach a function to be executed whenever an AJAX request completes. This is an Ajax Event. /// </summary> /// <param name="callback" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return this.bind("ajaxComplete", f); }; jQuery.fn["ajaxError"] = function(callback) { /// <summary> /// Attach a function to be executed whenever an AJAX request fails. This is an Ajax Event. /// </summary> /// <param name="callback" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return this.bind("ajaxError", f); }; jQuery.fn["ajaxSuccess"] = function(callback) { /// <summary> /// Attach a function to be executed whenever an AJAX request completes successfully. This is an Ajax Event. /// </summary> /// <param name="callback" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return this.bind("ajaxSuccess", f); }; jQuery.fn["ajaxSend"] = function(callback) { /// <summary> /// Attach a function to be executed before an AJAX request is sent. This is an Ajax Event. /// </summary> /// <param name="callback" type="Function">The function to execute.</param> /// <returns type="jQuery" /> return this.bind("ajaxSend", f); }; var jsc = now(); jQuery.extend({ get: function( url, data, callback, type ) { /// <summary> /// Loads a remote page using an HTTP GET request. /// </summary> /// <param name="url" type="String">The URL of the HTML page to load.</param> /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param> /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus) such that this maps the options for this AJAX request.</param> /// <param name="type" optional="true" type="String">Type of data to be returned to callback function. Valid valiues are xml, html, script, json, text, _default.</param> /// <returns type="XMLHttpRequest" /> // shift arguments if data argument was ommited if ( jQuery.isFunction( data ) ) { callback = data; data = null; } return jQuery.ajax({ type: "GET", url: url, data: data, success: callback, dataType: type }); }, getScript: function( url, callback ) { /// <summary> /// Loads and executes a local JavaScript file using an HTTP GET request. /// </summary> /// <param name="url" type="String">The URL of the script to load.</param> /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(data, textStatus) such that this maps the options for the AJAX request.</param> /// <returns type="XMLHttpRequest" /> return jQuery.get(url, null, callback, "script"); }, getJSON: function( url, data, callback ) { /// <summary> /// Loads JSON data using an HTTP GET request. /// </summary> /// <param name="url" type="String">The URL of the JSON data to load.</param> /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param> /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete if the data is loaded successfully. It should map function(data, textStatus) such that this maps the options for this AJAX request.</param> /// <returns type="XMLHttpRequest" /> return jQuery.get(url, data, callback, "json"); }, post: function( url, data, callback, type ) { /// <summary> /// Loads a remote page using an HTTP POST request. /// </summary> /// <param name="url" type="String">The URL of the HTML page to load.</param> /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param> /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus) such that this maps the options for this AJAX request.</param> /// <param name="type" optional="true" type="String">Type of data to be returned to callback function. Valid valiues are xml, html, script, json, text, _default.</param> /// <returns type="XMLHttpRequest" /> if ( jQuery.isFunction( data ) ) { callback = data; data = {}; } return jQuery.ajax({ type: "POST", url: url, data: data, success: callback, dataType: type }); }, ajaxSetup: function( settings ) { /// <summary> /// Sets up global settings for AJAX requests. /// </summary> /// <param name="settings" type="Options">A set of key/value pairs that configure the default Ajax request.</param> jQuery.extend( jQuery.ajaxSettings, settings ); }, ajaxSettings: { url: location.href, global: true, type: "GET", contentType: "application/x-www-form-urlencoded", processData: true, async: true, /* timeout: 0, data: null, username: null, password: null, */ // Create the request object; Microsoft failed to properly // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available // This function can be overriden by calling jQuery.ajaxSetup xhr:function(){ return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); }, accepts: { xml: "application/xml, text/xml", html: "text/html", script: "text/javascript, application/javascript", json: "application/json, text/javascript", text: "text/plain", _default: "*/*" } }, // Last-Modified header cache for next request lastModified: {}, ajax: function( s ) { /// <summary> /// Load a remote page using an HTTP request. /// </summary> /// <private /> // Extend the settings, but re-extend 's' so that it can be // checked again later (in the test suite, specifically) s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); var jsonp, jsre = /=\?(&|$)/g, status, data, type = s.type.toUpperCase(); // convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) s.data = jQuery.param(s.data); // Handle JSONP Parameter Callbacks if ( s.dataType == "jsonp" ) { if ( type == "GET" ) { if ( !s.url.match(jsre) ) s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; } else if ( !s.data || !s.data.match(jsre) ) s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; s.dataType = "json"; } // Build temporary JSONP function if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { jsonp = "jsonp" + jsc++; // Replace the =? sequence both in the query string and the data if ( s.data ) s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); s.url = s.url.replace(jsre, "=" + jsonp + "$1"); // We need to make sure // that a JSONP style response is executed properly s.dataType = "script"; // Handle JSONP-style loading window[ jsonp ] = function(tmp){ data = tmp; success(); complete(); // Garbage collect window[ jsonp ] = undefined; try{ delete window[ jsonp ]; } catch(e){} if ( head ) head.removeChild( script ); }; } if ( s.dataType == "script" && s.cache == null ) s.cache = false; if ( s.cache === false && type == "GET" ) { var ts = now(); // try replacing _= if it is there var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); // if nothing was replaced, add timestamp to the end s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); } // If data is available, append data to url for get requests if ( s.data && type == "GET" ) { s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; // IE likes to send both get and post data, prevent this s.data = null; } // Watch for a new set of requests if ( s.global && ! jQuery.active++ ) jQuery.event.trigger( "ajaxStart" ); // Matches an absolute URL, and saves the domain var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url ); // If we're requesting a remote document // and trying to load JSON or Script with a GET if ( s.dataType == "script" && type == "GET" && parts && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){ var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.src = s.url; if (s.scriptCharset) script.charset = s.scriptCharset; // Handle Script loading if ( !jsonp ) { var done = false; // Attach handlers for all browsers script.onload = script.onreadystatechange = function(){ if ( !done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) { done = true; success(); complete(); // Handle memory leak in IE script.onload = script.onreadystatechange = null; head.removeChild( script ); } }; } head.appendChild(script); // We handle everything using the script element injection return undefined; } var requestDone = false; // Create the request object var xhr = s.xhr(); // Open the socket // Passing null username, generates a login popup on Opera (#2865) if( s.username ) xhr.open(type, s.url, s.async, s.username, s.password); else xhr.open(type, s.url, s.async); // Need an extra try/catch for cross domain requests in Firefox 3 try { // Set the correct header, if data is being sent if ( s.data ) xhr.setRequestHeader("Content-Type", s.contentType); // Set the If-Modified-Since header, if ifModified mode. if ( s.ifModified ) xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); // Set header so the called script knows that it's an XMLHttpRequest xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); // Set the Accepts header for the server, depending on the dataType xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? s.accepts[ s.dataType ] + ", */*" : s.accepts._default ); } catch(e){} // Allow custom headers/mimetypes and early abort if ( s.beforeSend && s.beforeSend(xhr, s) === false ) { // Handle the global AJAX counter if ( s.global && ! --jQuery.active ) jQuery.event.trigger( "ajaxStop" ); // close opended socket xhr.abort(); return false; } if ( s.global ) jQuery.event.trigger("ajaxSend", [xhr, s]); // Wait for a response to come back var onreadystatechange = function(isTimeout){ // The request was aborted, clear the interval and decrement jQuery.active if (xhr.readyState == 0) { if (ival) { // clear poll interval clearInterval(ival); ival = null; // Handle the global AJAX counter if ( s.global && ! --jQuery.active ) jQuery.event.trigger( "ajaxStop" ); } // The transfer is complete and the data is available, or the request timed out } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { requestDone = true; // clear poll interval if (ival) { clearInterval(ival); ival = null; } status = isTimeout == "timeout" ? "timeout" : !jQuery.httpSuccess( xhr ) ? "error" : s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" : "success"; if ( status == "success" ) { // Watch for, and catch, XML document parse errors try { // process the data (runs the xml through httpData regardless of callback) data = jQuery.httpData( xhr, s.dataType, s ); } catch(e) { status = "parsererror"; } } // Make sure that the request was successful or notmodified if ( status == "success" ) { // Cache Last-Modified header, if ifModified mode. var modRes; try { modRes = xhr.getResponseHeader("Last-Modified"); } catch(e) {} // swallow exception thrown by FF if header is not available if ( s.ifModified && modRes ) jQuery.lastModified[s.url] = modRes; // JSONP handles its own success callback if ( !jsonp ) success(); } else jQuery.handleError(s, xhr, status); // Fire the complete handlers complete(); if ( isTimeout ) xhr.abort(); // Stop memory leaks if ( s.async ) xhr = null; } }; if ( s.async ) { // don't attach the handler to the request, just poll it instead var ival = setInterval(onreadystatechange, 13); // Timeout checker if ( s.timeout > 0 ) setTimeout(function(){ // Check to see if the request is still happening if ( xhr && !requestDone ) onreadystatechange( "timeout" ); }, s.timeout); } // Send the data try { xhr.send(s.data); } catch(e) { jQuery.handleError(s, xhr, null, e); } // firefox 1.5 doesn't fire statechange for sync requests if ( !s.async ) onreadystatechange(); function success(){ // If a local callback was specified, fire it and pass it the data if ( s.success ) s.success( data, status ); // Fire the global callback if ( s.global ) jQuery.event.trigger( "ajaxSuccess", [xhr, s] ); } function complete(){ // Process result if ( s.complete ) s.complete(xhr, status); // The request was completed if ( s.global ) jQuery.event.trigger( "ajaxComplete", [xhr, s] ); // Handle the global AJAX counter if ( s.global && ! --jQuery.active ) jQuery.event.trigger( "ajaxStop" ); } // return XMLHttpRequest to allow aborting the request etc. return xhr; }, handleError: function( s, xhr, status, e ) { /// <summary> /// This method is internal. /// </summary> /// <private /> // If a local callback was specified, fire it if ( s.error ) s.error( xhr, status, e ); // Fire the global callback if ( s.global ) jQuery.event.trigger( "ajaxError", [xhr, s, e] ); }, // Counter for holding the number of active queries active: 0, // Determines if an XMLHttpRequest was successful or not httpSuccess: function( xhr ) { /// <summary> /// This method is internal. /// </summary> /// <private /> try { // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !xhr.status && location.protocol == "file:" || ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223; } catch(e){} return false; }, // Determines if an XMLHttpRequest returns NotModified httpNotModified: function( xhr, url ) { /// <summary> /// This method is internal. /// </summary> /// <private /> try { var xhrRes = xhr.getResponseHeader("Last-Modified"); // Firefox always returns 200. check Last-Modified date return xhr.status == 304 || xhrRes == jQuery.lastModified[url]; } catch(e){} return false; }, httpData: function( xhr, type, s ) { /// <summary> /// This method is internal. /// </summary> /// <private /> var ct = xhr.getResponseHeader("content-type"), xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, data = xml ? xhr.responseXML : xhr.responseText; if ( xml && data.documentElement.tagName == "parsererror" ) throw "parsererror"; // Allow a pre-filtering function to sanitize the response // s != null is checked to keep backwards compatibility if( s && s.dataFilter ) data = s.dataFilter( data, type ); // The filter can actually parse the response if( typeof data === "string" ){ // If the type is "script", eval it in global context if ( type == "script" ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == "json" ) data = window["eval"]("(" + data + ")"); } return data; }, // Serialize an array of form elements or a set of // key/values into a query string param: function( a ) { /// <summary> /// This method is internal. Use serialize() instead. /// </summary> /// <param name="a" type="Map">A map of key/value pairs to serialize into a string.</param>' /// <returns type="String" /> /// <private /> var s = [ ]; function add( key, value ){ s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value); }; // If an array was passed in, assume that it is an array // of form elements if ( jQuery.isArray(a) || a.jquery ) // Serialize the form elements jQuery.each( a, function(){ add( this.name, this.value ); }); // Otherwise, assume that it's an object of key/value pairs else // Serialize the key/values for ( var j in a ) // If the value is an array then the key names need to be repeated if ( jQuery.isArray(a[j]) ) jQuery.each( a[j], function(){ add( j, this ); }); else add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] ); // Return the resulting serialization return s.join("&").replace(/%20/g, "+"); } }); var elemdisplay = {}, timerId, fxAttrs = [ // height animations [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], // width animations [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], // opacity animations [ "opacity" ] ]; function genFx( type, num ){ var obj = {}; jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){ obj[ this ] = type; }); return obj; } jQuery.fn.extend({ show: function(speed,callback){ /// <summary> /// Show all matched elements using a graceful animation and firing an optional callback after completion. /// </summary> /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or /// the number of milliseconds to run the animation</param> /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param> /// <returns type="jQuery" /> if ( speed ) { return this.animate( genFx("show", 3), speed, callback); } else { for ( var i = 0, l = this.length; i < l; i++ ){ var old = jQuery.data(this[i], "olddisplay"); this[i].style.display = old || ""; if ( jQuery.css(this[i], "display") === "none" ) { var tagName = this[i].tagName, display; if ( elemdisplay[ tagName ] ) { display = elemdisplay[ tagName ]; } else { var elem = jQuery("<" + tagName + " />").appendTo("body"); display = elem.css("display"); if ( display === "none" ) display = "block"; elem.remove(); elemdisplay[ tagName ] = display; } jQuery.data(this[i], "olddisplay", display); } } // Set the display of the elements in a second loop // to avoid the constant reflow for ( var i = 0, l = this.length; i < l; i++ ){ this[i].style.display = jQuery.data(this[i], "olddisplay") || ""; } return this; } }, hide: function(speed,callback){ /// <summary> /// Hides all matched elements using a graceful animation and firing an optional callback after completion. /// </summary> /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or /// the number of milliseconds to run the animation</param> /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param> /// <returns type="jQuery" /> if ( speed ) { return this.animate( genFx("hide", 3), speed, callback); } else { for ( var i = 0, l = this.length; i < l; i++ ){ var old = jQuery.data(this[i], "olddisplay"); if ( !old && old !== "none" ) jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); } // Set the display of the elements in a second loop // to avoid the constant reflow for ( var i = 0, l = this.length; i < l; i++ ){ this[i].style.display = "none"; } return this; } }, // Save the old toggle function _toggle: jQuery.fn.toggle, toggle: function( fn, fn2 ){ /// <summary> /// Toggles displaying each of the set of matched elements. /// </summary> /// <returns type="jQuery" /> var bool = typeof fn === "boolean"; return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? this._toggle.apply( this, arguments ) : fn == null || bool ? this.each(function(){ var state = bool ? fn : jQuery(this).is(":hidden"); jQuery(this)[ state ? "show" : "hide" ](); }) : this.animate(genFx("toggle", 3), fn, fn2); }, fadeTo: function(speed,to,callback){ /// <summary> /// Fades the opacity of all matched elements to a specified opacity. /// </summary> /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or /// the number of milliseconds to run the animation</param> /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param> /// <returns type="jQuery" /> return this.animate({opacity: to}, speed, callback); }, animate: function( prop, speed, easing, callback ) { /// <summary> /// A function for making custom animations. /// </summary> /// <param name="prop" type="Options">A set of style attributes that you wish to animate and to what end.</param> /// <param name="speed" optional="true" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or /// the number of milliseconds to run the animation</param> /// <param name="easing" optional="true" type="String">The name of the easing effect that you want to use. There are two built-in values, 'linear' and 'swing'.</param> /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param> /// <returns type="jQuery" /> var optall = jQuery.speed(speed, easing, callback); return this[ optall.queue === false ? "each" : "queue" ](function(){ var opt = jQuery.extend({}, optall), p, hidden = this.nodeType == 1 && jQuery(this).is(":hidden"), self = this; for ( p in prop ) { if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) return opt.complete.call(this); if ( ( p == "height" || p == "width" ) && this.style ) { // Store display property opt.display = jQuery.css(this, "display"); // Make sure that nothing sneaks out opt.overflow = this.style.overflow; } } if ( opt.overflow != null ) this.style.overflow = "hidden"; opt.curAnim = jQuery.extend({}, prop); jQuery.each( prop, function(name, val){ var e = new jQuery.fx( self, opt, name ); if ( /toggle|show|hide/.test(val) ) e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); else { var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), start = e.cur(true) || 0; if ( parts ) { var end = parseFloat(parts[2]), unit = parts[3] || "px"; // We need to compute starting value if ( unit != "px" ) { self.style[ name ] = (end || 1) + unit; start = ((end || 1) / e.cur(true)) * start; self.style[ name ] = start + unit; } // If a +=/-= token was provided, we're doing a relative animation if ( parts[1] ) end = ((parts[1] == "-=" ? -1 : 1) * end) + start; e.custom( start, end, unit ); } else e.custom( start, val, "" ); } }); // For JS strict compliance return true; }); }, stop: function(clearQueue, gotoEnd){ /// <summary> /// Stops all currently animations on the specified elements. /// </summary> /// <param name="clearQueue" optional="true" type="Boolean">True to clear animations that are queued to run.</param> /// <param name="gotoEnd" optional="true" type="Boolean">True to move the element value to the end of its animation target.</param> /// <returns type="jQuery" /> var timers = jQuery.timers; if (clearQueue) this.queue([]); this.each(function(){ // go in reverse order so anything added to the queue during the loop is ignored for ( var i = timers.length - 1; i >= 0; i-- ) if ( timers[i].elem == this ) { if (gotoEnd) // force the next step to be the last timers[i](true); timers.splice(i, 1); } }); // start the next in the queue if the last step wasn't forced if (!gotoEnd) this.dequeue(); return this; } }); // Generate shortcuts for custom animations // jQuery.each({ // slideDown: genFx("show", 1), // slideUp: genFx("hide", 1), // slideToggle: genFx("toggle", 1), // fadeIn: { opacity: "show" }, // fadeOut: { opacity: "hide" } // }, function( name, props ){ // jQuery.fn[ name ] = function( speed, callback ){ // return this.animate( props, speed, callback ); // }; // }); // [vsdoc] The following section has been denormalized from original sources for IntelliSense. jQuery.fn.slideDown = function( speed, callback ){ /// <summary> /// Reveal all matched elements by adjusting their height. /// </summary> /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or /// the number of milliseconds to run the animation</param> /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param> /// <returns type="jQuery" /> return this.animate( genFx("show", 1), speed, callback ); }; jQuery.fn.slideUp = function( speed, callback ){ /// <summary> /// Hiding all matched elements by adjusting their height. /// </summary> /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or /// the number of milliseconds to run the animation</param> /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param> /// <returns type="jQuery" /> return this.animate( genFx("hide", 1), speed, callback ); }; jQuery.fn.slideToggle = function( speed, callback ){ /// <summary> /// Toggles the visibility of all matched elements by adjusting their height. /// </summary> /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or /// the number of milliseconds to run the animation</param> /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param> /// <returns type="jQuery" /> return this.animate( genFx("toggle", 1), speed, callback ); }; jQuery.fn.fadeIn = function( speed, callback ){ /// <summary> /// Fades in all matched elements by adjusting their opacity. /// </summary> /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or /// the number of milliseconds to run the animation</param> /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param> /// <returns type="jQuery" /> return this.animate( { opacity: "show" }, speed, callback ); }; jQuery.fn.fadeOut = function( speed, callback ){ /// <summary> /// Fades the opacity of all matched elements to a specified opacity. /// </summary> /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or /// the number of milliseconds to run the animation</param> /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param> /// <returns type="jQuery" /> return this.animate( { opacity: "hide" }, speed, callback ); }; jQuery.extend({ speed: function(speed, easing, fn) { /// <summary> /// This member is internal. /// </summary> /// <private /> var opt = typeof speed === "object" ? speed : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction(easing) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default; // Queueing opt.old = opt.complete; opt.complete = function(){ if ( opt.queue !== false ) jQuery(this).dequeue(); if ( jQuery.isFunction( opt.old ) ) opt.old.call( this ); }; return opt; }, easing: { linear: function( p, n, firstNum, diff ) { /// <summary> /// This member is internal. /// </summary> /// <private /> return firstNum + diff * p; }, swing: function( p, n, firstNum, diff ) { /// <summary> /// This member is internal. /// </summary> /// <private /> return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; } }, timers: [], fx: function( elem, options, prop ){ /// <summary> /// This member is internal. /// </summary> /// <private /> this.options = options; this.elem = elem; this.prop = prop; if ( !options.orig ) options.orig = {}; } }); jQuery.fx.prototype = { // Simple function for setting a style value update: function(){ /// <summary> /// This member is internal. /// </summary> /// <private /> if ( this.options.step ) this.options.step.call( this.elem, this.now, this ); (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); // Set display property to block for height/width animations if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style ) this.elem.style.display = "block"; }, // Get the current size cur: function(force){ /// <summary> /// This member is internal. /// </summary> /// <private /> if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) return this.elem[ this.prop ]; var r = parseFloat(jQuery.css(this.elem, this.prop, force)); return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; }, // Start an animation from one number to another custom: function(from, to, unit){ this.startTime = now(); this.start = from; this.end = to; this.unit = unit || this.unit || "px"; this.now = this.start; this.pos = this.state = 0; var self = this; function t(gotoEnd){ return self.step(gotoEnd); } t.elem = this.elem; if ( t() && jQuery.timers.push(t) && !timerId ) { timerId = setInterval(function(){ var timers = jQuery.timers; for ( var i = 0; i < timers.length; i++ ) if ( !timers[i]() ) timers.splice(i--, 1); if ( !timers.length ) { clearInterval( timerId ); timerId = undefined; } }, 13); } }, // Simple 'show' function show: function(){ /// <summary> /// Displays each of the set of matched elements if they are hidden. /// </summary> // Remember where we started, so that we can go back to it later this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); this.options.show = true; // Begin the animation // Make sure that we start at a small width/height to avoid any // flash of content this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur()); // Start by showing the element jQuery(this.elem).show(); }, // Simple 'hide' function hide: function(){ /// <summary> /// Hides each of the set of matched elements if they are shown. /// </summary> // Remember where we started, so that we can go back to it later this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); this.options.hide = true; // Begin the animation this.custom(this.cur(), 0); }, // Each step of an animation step: function(gotoEnd){ /// <summary> /// This method is internal. /// </summary> /// <private /> var t = now(); if ( gotoEnd || t >= this.options.duration + this.startTime ) { this.now = this.end; this.pos = this.state = 1; this.update(); this.options.curAnim[ this.prop ] = true; var done = true; for ( var i in this.options.curAnim ) if ( this.options.curAnim[i] !== true ) done = false; if ( done ) { if ( this.options.display != null ) { // Reset the overflow this.elem.style.overflow = this.options.overflow; // Reset the display this.elem.style.display = this.options.display; if ( jQuery.css(this.elem, "display") == "none" ) this.elem.style.display = "block"; } // Hide the element if the "hide" operation was done if ( this.options.hide ) jQuery(this.elem).hide(); // Reset the properties, if the item has been hidden or shown if ( this.options.hide || this.options.show ) for ( var p in this.options.curAnim ) jQuery.attr(this.elem.style, p, this.options.orig[p]); // Execute the complete function this.options.complete.call( this.elem ); } return false; } else { var n = t - this.startTime; this.state = n / this.options.duration; // Perform the easing function, defaults to swing this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration); this.now = this.start + ((this.end - this.start) * this.pos); // Perform the next step of the animation this.update(); } return true; } }; jQuery.extend( jQuery.fx, { speeds:{ slow: 600, fast: 200, // Default speed _default: 400 }, step: { opacity: function(fx){ jQuery.attr(fx.elem.style, "opacity", fx.now); }, _default: function(fx){ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) fx.elem.style[ fx.prop ] = fx.now + fx.unit; else fx.elem[ fx.prop ] = fx.now; } } }); if ( document.documentElement["getBoundingClientRect"] ) jQuery.fn.offset = function() { /// <summary> /// Gets the current offset of the first matched element relative to the viewport. /// </summary> /// <returns type="Object">An object with two Integer properties, 'top' and 'left'.</returns> if ( !this[0] ) return { top: 0, left: 0 }; if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement, clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; return { top: top, left: left }; }; else jQuery.fn.offset = function() { /// <summary> /// Gets the current offset of the first matched element relative to the viewport. /// </summary> /// <returns type="Object">An object with two Integer properties, 'top' and 'left'.</returns> if ( !this[0] ) return { top: 0, left: 0 }; if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); jQuery.offset.initialized || jQuery.offset.initialize(); var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem, doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement, body = doc.body, defaultView = doc.defaultView, prevComputedStyle = defaultView.getComputedStyle(elem, null), top = elem.offsetTop, left = elem.offsetLeft; while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { computedStyle = defaultView.getComputedStyle(elem, null); top -= elem.scrollTop, left -= elem.scrollLeft; if ( elem === offsetParent ) { top += elem.offsetTop, left += elem.offsetLeft; if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) ) top += parseInt( computedStyle.borderTopWidth, 10) || 0, left += parseInt( computedStyle.borderLeftWidth, 10) || 0; prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; } if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) top += parseInt( computedStyle.borderTopWidth, 10) || 0, left += parseInt( computedStyle.borderLeftWidth, 10) || 0; prevComputedStyle = computedStyle; } if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) top += body.offsetTop, left += body.offsetLeft; if ( prevComputedStyle.position === "fixed" ) top += Math.max(docElem.scrollTop, body.scrollTop), left += Math.max(docElem.scrollLeft, body.scrollLeft); return { top: top, left: left }; }; jQuery.offset = { initialize: function() { if ( this.initialized ) return; var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop, html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"cellpadding="0"cellspacing="0"><tr><td></td></tr></table>'; rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' }; for ( prop in rules ) container.style[prop] = rules[prop]; container.innerHTML = html; body.insertBefore(container, body.firstChild); innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild; this.doesNotAddBorder = (checkDiv.offsetTop !== 5); this.doesAddBorderForTableAndCells = (td.offsetTop === 5); innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative'; this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); body.style.marginTop = '1px'; this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0); body.style.marginTop = bodyMarginTop; body.removeChild(container); this.initialized = true; }, bodyOffset: function(body) { jQuery.offset.initialized || jQuery.offset.initialize(); var top = body.offsetTop, left = body.offsetLeft; if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0, left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0; return { top: top, left: left }; } }; jQuery.fn.extend({ position: function() { /// <summary> /// Gets the top and left positions of an element relative to its offset parent. /// </summary> /// <returns type="Object">An object with two integer properties, 'top' and 'left'.</returns> var left = 0, top = 0, results; if ( this[0] ) { // Get *real* offsetParent var offsetParent = this.offsetParent(), // Get correct offsets offset = this.offset(), parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 offset.top -= num( this, 'marginTop' ); offset.left -= num( this, 'marginLeft' ); // Add offsetParent borders parentOffset.top += num( offsetParent, 'borderTopWidth' ); parentOffset.left += num( offsetParent, 'borderLeftWidth' ); // Subtract the two offsets results = { top: offset.top - parentOffset.top, left: offset.left - parentOffset.left }; } return results; }, offsetParent: function() { /// <summary> /// This method is internal. /// </summary> /// <private /> var offsetParent = this[0].offsetParent || document.body; while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') ) offsetParent = offsetParent.offsetParent; return jQuery(offsetParent); } }); // Create scrollLeft and scrollTop methods jQuery.each( ['Left'], function(i, name) { var method = 'scroll' + name; jQuery.fn[ method ] = function(val) { /// <summary> /// Gets and optionally sets the scroll left offset of the first matched element. /// </summary> /// <param name="val" type="Number" integer="true" optional="true">A positive number representing the desired scroll left offset.</param> /// <returns type="Number" integer="true">The scroll left offset of the first matched element.</returns> if (!this[0]) return null; return val !== undefined ? // Set the scroll offset this.each(function() { this == window || this == document ? window.scrollTo( !i ? val : jQuery(window).scrollLeft(), i ? val : jQuery(window).scrollTop() ) : this[ method ] = val; }) : // Return the scroll offset this[0] == window || this[0] == document ? self[ i ? 'pageYOffset' : 'pageXOffset' ] || jQuery.boxModel && document.documentElement[ method ] || document.body[ method ] : this[0][ method ]; }; }); // Create scrollLeft and scrollTop methods jQuery.each( ['Top'], function(i, name) { var method = 'scroll' + name; jQuery.fn[ method ] = function(val) { /// <summary> /// Gets and optionally sets the scroll top offset of the first matched element. /// </summary> /// <param name="val" type="Number" integer="true" optional="true">A positive number representing the desired scroll top offset.</param> /// <returns type="Number" integer="true">The scroll top offset of the first matched element.</returns> if (!this[0]) return null; return val !== undefined ? // Set the scroll offset this.each(function() { this == window || this == document ? window.scrollTo( !i ? val : jQuery(window).scrollLeft(), i ? val : jQuery(window).scrollTop() ) : this[ method ] = val; }) : // Return the scroll offset this[0] == window || this[0] == document ? self[ i ? 'pageYOffset' : 'pageXOffset' ] || jQuery.boxModel && document.documentElement[ method ] || document.body[ method ] : this[0][ method ]; }; }); // Create innerHeight, innerWidth, outerHeight and outerWidth methods jQuery.each([ "Height" ], function(i, name){ var tl = i ? "Left" : "Top", // top or left br = i ? "Right" : "Bottom", // bottom or right lower = name.toLowerCase(); // innerHeight and innerWidth jQuery.fn["inner" + name] = function(){ /// <summary> /// Gets the inner height of the first matched element, excluding border but including padding. /// </summary> /// <returns type="Number" integer="true">The outer height of the first matched element.</returns> return this[0] ? jQuery.css( this[0], lower, false, "padding" ) : null; }; // outerHeight and outerWidth jQuery.fn["outer" + name] = function(margin) { /// <summary> /// Gets the outer height of the first matched element, including border and padding by default. /// </summary> /// <param name="margins" type="Map">A set of key/value pairs that specify the options for the method.</param> /// <returns type="Number" integer="true">The outer height of the first matched element.</returns> return this[0] ? jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) : null; }; var type = name.toLowerCase(); jQuery.fn[ type ] = function( size ) { /// <summary> /// Set the CSS height of every matched element. If no explicit unit /// was specified (like 'em' or '%') then &quot;px&quot; is added to the width. If no parameter is specified, it gets /// the current computed pixel height of the first matched element. /// Part of CSS /// </summary> /// <returns type="jQuery" type="jQuery" /> /// <param name="cssProperty" type="String"> /// Set the CSS property to the specified value. Omit to get the value of the first matched element. /// </param> // Get window width or height return this[0] == window ? // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] : // Get document width or height this[0] == document ? // Either scroll[Width/Height] or offset[Width/Height], whichever is greater Math.max( document.documentElement["client" + name], document.body["scroll" + name], document.documentElement["scroll" + name], document.body["offset" + name], document.documentElement["offset" + name] ) : // Get or set width or height on the element size === undefined ? // Get width or height on the element (this.length ? jQuery.css( this[0], type ) : null) : // Set the width or height on the element (default to pixels if value is unitless) this.css( type, typeof size === "string" ? size : size + "px" ); }; }); // Create innerHeight, innerWidth, outerHeight and outerWidth methods jQuery.each([ "Width" ], function(i, name){ var tl = i ? "Left" : "Top", // top or left br = i ? "Right" : "Bottom", // bottom or right lower = name.toLowerCase(); // innerHeight and innerWidth jQuery.fn["inner" + name] = function(){ /// <summary> /// Gets the inner width of the first matched element, excluding border but including padding. /// </summary> /// <returns type="Number" integer="true">The outer width of the first matched element.</returns> return this[0] ? jQuery.css( this[0], lower, false, "padding" ) : null; }; // outerHeight and outerWidth jQuery.fn["outer" + name] = function(margin) { /// <summary> /// Gets the outer width of the first matched element, including border and padding by default. /// </summary> /// <param name="margins" type="Map">A set of key/value pairs that specify the options for the method.</param> /// <returns type="Number" integer="true">The outer width of the first matched element.</returns> return this[0] ? jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) : null; }; var type = name.toLowerCase(); jQuery.fn[ type ] = function( size ) { /// <summary> /// Set the CSS width of every matched element. If no explicit unit /// was specified (like 'em' or '%') then &quot;px&quot; is added to the width. If no parameter is specified, it gets /// the current computed pixel width of the first matched element. /// Part of CSS /// </summary> /// <returns type="jQuery" type="jQuery" /> /// <param name="cssProperty" type="String"> /// Set the CSS property to the specified value. Omit to get the value of the first matched element. /// </param> // Get window width or height return this[0] == window ? // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] : // Get document width or height this[0] == document ? // Either scroll[Width/Height] or offset[Width/Height], whichever is greater Math.max( document.documentElement["client" + name], document.body["scroll" + name], document.documentElement["scroll" + name], document.body["offset" + name], document.documentElement["offset" + name] ) : // Get or set width or height on the element size === undefined ? // Get width or height on the element (this.length ? jQuery.css( this[0], type ) : null) : // Set the width or height on the element (default to pixels if value is unitless) this.css( type, typeof size === "string" ? size : size + "px" ); }; }); })();
JavaScript
/*处理js对象,序列化为json格式*/ function Serialize(obj) { if (obj == null || typeof (obj) == 'undefined') return "null"; switch (obj.constructor) { case Object: var str = "{"; for (var o in obj) { str += o + ":" + Serialize(obj[o]) + ","; } if (str.substr(str.length - 1) == ",") str = str.substr(0, str.length - 1); return str + "}"; break; case Array: var str = "["; for (var o in obj) { str += Serialize(obj[o]) + ","; } if (str.substr(str.length - 1) == ",") str = str.substr(0, str.length - 1); return str + "]"; break; case Boolean: return "\"" + obj.toString() + "\""; break; case Date: return "\"" + obj.toString() + "\""; break; case Function: break; case Number: return "\"" + obj.toString() + "\""; break; case String: return "\"" + obj.toString() + "\""; break; default: return "null"; } return "null"; }
JavaScript
/// <reference path="Common/jquery-1.4.4.js" /> function loginCallBack(isSucess) { if ($("#mod_login_tip")[0] == null) { $("body").append(errorHtml); bindCloseEvent($("#mod_login_close"), $("#mod_login_tip")); } if (!isSucess) { $("#mod_login_title").text("登录名或密码错误"); $("#mod_login_content").show(); $("#mod_login_content").html("<p class='stxt2'>1、如果登录名是邮箱地址,</p><p class='stxt'>请输入全称,例如yourname@xxxx.com</p><p class='stxt2'>2、请检查登录名大小写是否正确。</p><p class='stxt2'>3、请检查密码大小写是否正确。</p>"); setErrorDivPosition($("#mod_login_tip"), $("#loginname")); $("#mod_login_tip").show(); } else { if (arguments[1] == 0) { $("#mod_login_title").text("你的账号还没有验证"); $("#mod_login_content").show(); $("#mod_login_content").html("<p class='stxt'>如果没收到请尝试点击<a id='resend' href='javascript:void(0);' >重发</a></p><p class='stxt'>如果实在收不到,请重新注册</p>"); setErrorDivPosition($("#mod_login_tip"), $("#loginname")); $("#mod_login_tip").show(); $("#resend").click(function () { $("#mod_login_tip").hide(); App.ajax_resendEmail($("#loginname").val()); return false; }); } if (arguments[1] == 1) { window.location.href = "/User/fullinfo/"; } if (arguments[1] == 2) { window.location.href = "/"; } } } var errorHtml = "<div id='mod_login_tip' class='errorLayer'><div class='top'></div><div class='mid'><div id='mod_login_close' class='close'>x</div><div class='conn'> <p id='mod_login_title' class='bigtxt'></p><span style='padding: 0px; display: none;' id='mod_login_content' class='stxt'></span></div></div><div class='bot'></div></div>"; var checkLogin = function () { if ($("#loginname").val() == "邮箱/会员帐号/手机号" || $.trim($("#loginname").val()) == "") { if ($("#mod_login_tip")[0] == null) { $("body").append(errorHtml); bindCloseEvent($("#mod_login_close"), $("#mod_login_tip")); } $("#mod_login_title").text("请输入登录名"); $("#mod_login_content").hide(); setErrorDivPosition($("#mod_login_tip"), $("#loginname")); $("#mod_login_tip").show(); $("#loginname").focus(); $("#password").blur(); return; } if ($("#password").val() == "") { if ($("#mod_login_tip")[0] == null) { $("body").append(errorHtml); bindCloseEvent($("#mod_login_close"), $("#mod_login_tip")); } $("#password_text").focus(); $("#mod_login_title").text("请输入密码"); $("#mod_login_content").hide(); setErrorDivPosition($("#mod_login_tip"), $("#password")); $("#mod_login_tip").show(); return; } $("#mod_login_tip").hide(); $("#hdLoginname").val($("#loginname").val()); $("#hdPassword").val($("#password").val()); $("#hdReUsername").val($("#remusrname").attr("checked")); if ($.browser.msie) { window.loginForm.submit(); } else { $("#loginForm").submit(); } return false; } var bindCloseEvent = function (btnClose, needCloseDiv) { btnClose.bind("click", function () { needCloseDiv.hide(); }); } var setErrorDivPosition = function (div, inputCtr) { var offset = inputCtr.offset(); var l = offset.left; var t = offset.top - div.height(); div.css("position", "absolute"); div.css("left", l + "px"); div.css("top", t + "px"); div.css("z-index", "9999"); } var index = { init: function () { $("#loginname").focus(function () { var logininput = $(this); logininput.css("color", "rgb(51, 51, 51)"); if (logininput.val() == "邮箱/会员帐号/手机号") logininput.val(""); }); $("#loginname").blur(function () { var logininput = $(this); logininput.css("color", "rgb(153, 153, 153)"); if (logininput.val() == "") logininput.val("邮箱/会员帐号/手机号"); }); $("#password_text").focus(function () { $(this).hide(); $("#password").show(); $("#password").focus(); $("#password").click(); $("#password").css("color", "rgb(51, 51, 51)"); }); $("#password").blur(function () { if ($(this).val() == "") { $("#password_text").show(); $("#password_text").blur(); $(this).hide(); } else { $(this).css("color", "rgb(153, 153, 153)"); } }); $("#password").focus(function () { $(this).css("color", "rgb(51, 51, 51)"); }); $("#login_submit_btn").bind("click", checkLogin); $("#password").bind("keyup", function (e) { if (e.keyCode == 13) checkLogin(); }); } } //function pageX(elem) { // return elem.offsetParent ? elem.offsetLeft + pageX(elem.offsetParent) : elem.offsetLeft; //} //function pageY(elem) { // return elem.offsetParent ? elem.offsetTop + pageY(elem.offsetParent) : elem.offsetTop; //}
JavaScript
 var career = {}; career.action = "create"; career.curCareer = -1; career.createHtml = ""; career.initCreateBox = function (cobject) { var city = $("select[name='city']"); var province = $("select[name='province']"); var company = $("#company"); var remark = $("#remark"); var selCompany = $("#selCompany"); if (cobject) { var start = $("select[name='start']"); var end = $("select[name='end']"); selCompany.val(cobject.isvisible); company.val(cobject.cname); remark.val(cobject.remark); setTimeout(function () { start.val(cobject.start); end.val(cobject.end) }, 1); } App.BindCityCtrl(province, "province", 1, function () { if (cobject) { setTimeout(function () { province.val(cobject.province); }, 1); } App.BindCityCtrl(city, "City", cobject ? cobject.province : province.val(), function () { if (cobject) { setTimeout(function () { city.val(cobject.city); }, 1); } }, "/Ajax/GetCity/"); province.hide(); city.hide(); province.show(); city.show(); setTimeout(function () { App.Setup.BindSelect(selCompany); }, 1); }, "/Ajax/GetCity/"); province.change(function () { App.BindCityCtrl(city, "City", province.val(), null, "/Ajax/GetCity/"); }, "/Ajax/GetCity/"); App.Setup.BindInput(company, "请输入名称,25个字以内", App.Setup.checkCompanyName); App.Setup.BindInput(remark, "可以填写部门、组别、职位等信息,70个字以内", App.Setup.checkRemark); $("#save").click(function () { career.submit(this); }); App.autoComplete(company, function (id, name) { company.val(name) }); } career.submit = function (alink) { var city = $("select[name='city']"); var province = $("select[name='province']"); var company = $("#company"); var remark = $("#remark"); var selCompany = $("#selCompany"); var careerList = $("#careerList"); App.Setup.checkCompanyName(company); App.Setup.checkRemark(remark); if (App.Setup.isCompanyName && App.Setup.isRemark && !alink.locked) { alink.locked = true; $.ajax( { url: this.action == "create" ? "/Ajax/CreateCareer" : "/Ajax/EditCareer", datatype: "json", cache: false, data: { careerid: career.curCareer, companyName: $.trim(company.val()), remark: remark.val(), isVisible: selCompany.val(), location: city.val() > 0 ? city.val() : province.val(), startdate: $("#start").val(), enddate: $("#end").val() }, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.FullMiniTip(CodeList["A00003"], alink, 2000, 1); } else { App.FullMiniTip(CodeList[o.Code], alink, 1000, 3); if (career.action == "create") { if (o.Data != "") { var first = careerList.find("div:first"); if (first[0]) $(o.Data).insertBefore(first); else careerList.html(o.Data); } } else { if (o.Data != "") { curCarItem = $("#career_" + career.curCareer) $(o.Data).insertBefore(curCarItem); curCarItem.remove(); } } } alink.locked = false; }, error: function (request) { App.FullMiniTip(CodeList["A00003"], alink, 2000, 1); alink.locked = false; } }); } } career.del = function (id) { App.confirm("是否真的删除?", function () { $.ajax( { url: "/Ajax/DelCareer", datatype: "json", cache: false, data: { careerid: id }, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.alert(CodeList["A00003"]); } else { $("#career_" + id).remove(); } }, error: function (request) { App.alert(CodeList["A00003"]); } }); }); } career.edit = function (id) { $.ajax( { url: "/Ajax/getCareerDetail", datatype: "json", cache: false, data: { careerid: id }, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.alert(CodeList["A00003"]); } else { $("div[edit='1']").html(""); var editElem = $("#careerEdit_" + id); $("#divCreate").hide().find(".info_tab01").remove(); editElem.html("<div class='info_tab01'>" + career.createHtml + "</div>"); $("#btnCreate").show(); career.initCreateBox(o.Data); career.action = "edit"; career.curCareer = id; } }, error: function (request) { App.alert(CodeList["A00003"]); } }); } $(function () { career.createHtml = $("#divCreate .info_tab01").html(); career.initCreateBox(); App.TimerFunArray.push(App.autoCompleteTimerEvent); App.curGetLink = "autoCompleteCompany"; App.StartTimer(); $("#btnCreate a").click(function () { $("div[edit='1']").html(""); $("#divCreate").show().append("<div class='info_tab01'>" + career.createHtml + "</div>"); career.initCreateBox(); $("#btnCreate").hide(); career.action = "create"; career.curCareer = -1; }); });
JavaScript
 $(function () { var jcrop_api; var defWidth = 300; var defHeight = 300; var curWidth = 0; var curHeight = 0; var rate = defWidth / defHeight; var zoom = 1; var size = { x: 0, y: 0, x1: 300, y1: 300 }; function showPreview(coords) { showPreview_30(coords); showPreview_50(coords); showPreview_180(coords); } function showPreview_180(coords) { var rx = 180 / coords.w; var ry = 180 / coords.h; $('#preview_180').css({ width: Math.round(rx * curWidth) + 'px', height: Math.round(ry * curHeight) + 'px', marginLeft: '-' + Math.round(rx * coords.x) + 'px', marginTop: '-' + Math.round(ry * coords.y) + 'px' }); size.x = coords.x; size.y = coords.y; size.x1 = coords.x2; size.y1 = coords.y2; }; function showPreview_50(coords) { var rx = 50 / coords.w; var ry = 50 / coords.h; $('#preview_50').css({ width: Math.round(rx * curWidth) + 'px', height: Math.round(ry * curHeight) + 'px', marginLeft: '-' + Math.round(rx * coords.x) + 'px', marginTop: '-' + Math.round(ry * coords.y) + 'px' }); }; function showPreview_30(coords) { var rx = 30 / coords.w; var ry = 30 / coords.h; $('#preview_30').css({ width: Math.round(rx * curWidth) + 'px', height: Math.round(ry * curHeight) + 'px', marginLeft: '-' + Math.round(rx * coords.x) + 'px', marginTop: '-' + Math.round(ry * coords.y) + 'px' }); }; $("#CutBox").load(function () { this.style.cssText = ""; $("#loadCut").hide(); $("#load_180").hide(); $("#load_50").hide(); $("#load_30").hide(); var height = this.height; var width = this.width; if (height > defHeight || width > defWidth) { if ((width / height) > rate) { var r = width / defWidth; zoom = r; curHeight = Math.round(height / r); curWidth = Math.round(width / r); } else { var r = height / defHeight; zoom = r; curHeight = Math.round(height / r); curWidth = Math.round(width / r); } } else { curHeight = height; curWidth = width; zoom = 1; } $(this).width(curWidth); $(this).height(curHeight); if (jcrop_api) jcrop_api.destroy(); jcrop_api = $.Jcrop("#CutBox", { onChange: showPreview, onSelect: showPreview, aspectRatio: 1 }); }); $(".upload .btn_green").mousemove(function (e) { var btnX = e.pageX - $(this).offset().left; var btnY = e.pageY - $(this).offset().top; var uploadInput = $(this).find("input"); uploadInput.css("left", btnX - 60); uploadInput.css("top", btnY - 10); }); $("#frmPicUpload").find("input").change(function () { App.PicUpload("frmPicUpload", this, function () { $("#loadCut").show(); $("#load_180").show(); $("#load_50").show(); $("#load_30").show(); }); }); $("#submitAvatar").click(function () { if (this.locked) return false; this.locked = true; alink = this; $.ajax( { url: "/Ajax/cutAvatar", datatype: "json", cache: false, data: { imgSrc: $("#CutBox").attr("src"), x: size.x, y: size.y, x1: size.x1, y1: size.y1, zoom: zoom }, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.alert(CodeList["A00003"]); } else { App.fullTip(CodeList[o.Code], 2000, null, 3); } alink.locked = false; }, error: function (request) { App.alert(CodeList["A00003"]); alink.locked = false; } }); return false; }); }); function uploadCallback(path) { $("#CutBox").attr("src", path); $("#preview_180").attr("src", path); $("#preview_50").attr("src", path); $("#preview_30").attr("src", path); }
JavaScript
 var bufferCount = 0; var isLoaded = true; var ajaxGetMiniBlog = function (ishashchange, isBufferRetry) { var url; if (!window.location.hash || window.location.hash.indexOf('#!') < 0) { url = window.location.href; if (ishashchange) { $(window).scrollTop(0); $("a[action]").removeClass("current"); $("a[action='all']").attr("class", "current"); } } else { url = window.location.href.replace(App.config.Domain, "").split('!')[1]; if (ishashchange) { $(window).scrollTop(0); var urlJson = App.UlrToJson(url); $("a[action]").removeClass("current"); if (!urlJson) $("a[action='all']").attr("class", "current"); else { if (!urlJson["IsAdvanced"]) { var isAll = 1; for (var p in urlJson) { var elem = $("a[action='" + p + "']"); if (elem[0]) { isAll = 0; elem.attr("class", "current"); } } if (isAll) $("a[action='all']").attr("class", "current"); else $("a[action='all']").removeClass("current"); } } } } var loadMB = $("#loadMB"); var loadError = $("#loadError"); var loadNoResult = $("#loadNoresult"); var loadMB1 = $("#loadMB1"); var loadError1 = $("#loadError1"); var loadNoResult1 = $("#loadNoresult1"); if (ishashchange) { bufferCount = 0; loadMB.show(); loadError.hide(); loadNoResult.hide(); } else { if (!isBufferRetry) bufferCount++; loadMB1.show(); loadError1.hide(); loadNoResult1.hide(); } url = App.AddQueryToUrl(url.replace(/#/g, ""), "Buffer", bufferCount); isLoaded = false; $.ajax({ dataType: "json", url: url, cache: false, type: "get", success: function (o) { if (o.Code == "A00005") { if (ishashchange) { loadMB.hide(); $(".MIB_feed").remove(); $("#page").remove(); $(o.Data).insertAfter(loadNoResult); App.initMedia(); App.initNameCard($("#feed_list")); loadMB1.remove(); loadNoResult1.remove(); loadError1.remove(); } else { $(o.Data).insertAfter(loadNoResult1); App.initMedia("feed_list" + bufferCount); App.initNameCard($("#feed_list" + bufferCount)); loadMB1.remove(); loadNoResult1.remove(); loadError1.remove(); } } else { if (ishashchange) { loadMB.hide(); loadNoResult.show(); } else { loadMB1.hide(); loadNoResult1.show(); } } isLoaded = true; }, error: function () { if (ishashchange) { loadMB.hide(); loadNoResult.hide(); loadError.show(); } else { loadMB1.hide(); loadNoResult1.hide(); loadError1.show(); } isLoaded = true; } }); }; $(document).ready(function () { App.TimerFunArray.push(App.ajaxAtWho); App.StartTimer(); App.bindGoTop(curBorder); $(window).hashchange(ajaxGetMiniBlog); ajaxGetMiniBlog(true); $(window).scroll(function () { if ($("#loadMB1")[0]) { if ($(this).scrollTop() + $(this).height() > $("#loadMB1").offset().top) { if (bufferCount < 3 && isLoaded) { ajaxGetMiniBlog(); } } } }); }); window.onload = function () { var voteItems = $("div[type='vote']"); for (var i = 0; i < voteItems.length; i++) { var img = $(voteItems[i]).find("img")[0]; var img1 = $(voteItems[i]).find("img")[1]; $(img1).css("left", parseInt(($(img).width() - 33) / 2)).css("top", parseInt(($(img).height() - 33) / 2)).css("position", "absolute"); $(img1).show(); } }; var follow = function (id, name, alink) { if (alink.locked) return; alink.locked = true; App.FollowOne(id, name, function (ID, Name, O) { if (O.Data == 1) { $('<div class="MIB_btn_inter lf">互相关注<span class="MIB_line_sp">|</span><a onclick="cancelFollow(' + ID + ',\'' + Name + '\',this);return false;" href="javascript:void(0)" class="MIB_linkbl"><em>取消</em></a></div>').insertAfter($(alink).parent()); $(alink).parent().remove(); } if (O.Data == 2) { $('<div class="MIB_btn2 lf">已关注<span class="MIB_line_sp">|</span><a onclick="cancelFollow(' + ID + ',\'' + Name + '\',this);return false;" href="javascript:void(0)" class="MIB_linkbl"><em>取消</em></a></div>').insertAfter($(alink).parent()); $(alink).parent().remove(); } $("#more_handle").fadeIn(); $("#remark_name").fadeIn(); }, function () { alink.locked = false; }); }; var cancelFollow = function (id, name, alink) { if (alink.locked) return; App.miniConfirm("是否取消关注" + name, alink, function () { alink.locked = true; App.CancelFollow(id, function (ID, O) { if (O.Data == 3) { $('<div class="lf"><a class="btn_add" onclick="follow(' + ID + ',\'' + name + '\',this);return false;" href="javascript:void(0)"><img src="/Content/Image/transparent.gif" alt="" title="已关注你" class="ico_addGrn"><em><img src="/Content/Image/transparent.gif" alt="" class="SG_icon add_icoz">&nbsp;加关注</em></a></div>').insertAfter($(alink).parent()); $(alink).parent().remove(); } if (O.Data == 4) { $('<div class="lf"><a onclick="follow(' + ID + ',\'' + name + '\',this);return false;" href="javascript:void(0);" class="btn_add"><img class="SG_icon" src="/Content/Image/transparent.gif" title="关注"><em>加关注</em></a></div>').insertAfter($(alink).parent()); $(alink).parent().remove(); } $("#more_handle").fadeOut(); $("#remark_name").fadeOut(); }, function () { alink.locked = false; }); }); }; $("#filter_adv_show").click(function () { $("#filter_adv_panel").fadeIn(); $("#filter_key_panel").hide(); return false; }); $("#filter_adv_hide").click(function () { $("#filter_adv_panel").fadeOut(function () { $("#filter_key_panel").show(); }); return false; }); $("#filter_mkey_input").JQP_HighLineInput2({ nullCon: "搜索TA的话" }).keyup(function (e) { if (e.which == 13) { if (this.value && this.value != "搜索TA的话") { var url; if (window.location.href.indexOf("#!") >= 0) { url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1]; } else { url = "#!" + window.location.href.replace(App.config.Domain, ""); } url = App.RemoveQueryFromUrl(window.location.href, "page"); window.location.href = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim($(this).val()))); ; } } }); var advSearch = function () { var url; if (window.location.href.indexOf("#!") >= 0) { url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1]; } else { url = "#!" + window.location.href.replace(App.config.Domain, ""); } url = App.RemoveQueryFromUrl(window.location.href, "page"); url = App.AddQueryToUrl(url, "IsAdvanced", "1"); if (App.E("filter_ori").checked) { url = App.AddQueryToUrl(url, "IsOri", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsOri"); } if (App.E("filter_ret").checked) { url = App.AddQueryToUrl(url, "IsRet", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsRet"); } if (App.E("filter_text").checked) { url = App.AddQueryToUrl(url, "IsHaveLink", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveLink"); } if (App.E("filter_pic").checked) { url = App.AddQueryToUrl(url, "IsHavePic", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHavePic"); } if (App.E("filter_video").checked) { url = App.AddQueryToUrl(url, "IsHaveVideo", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveVideo"); } if (App.E("filter_music").checked) { url = App.AddQueryToUrl(url, "IsHaveMusic", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveMusic"); } if (App.E("filter_vote").checked) { url = App.AddQueryToUrl(url, "IsHaveVote", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveVote"); } if (App.E("filter_adv_input").value && App.E("filter_adv_input").value != "搜索TA的话") { url = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim(App.E("filter_adv_input").value))); } else { url = App.RemoveQueryFromUrl(url, "Key"); } if (App.E("filter_adv_stime").value && App.E("filter_adv_stime").value != "选择日期") { url = App.AddQueryToUrl(url, "StartTime", App.E("filter_adv_stime").value); } else { url = App.RemoveQueryFromUrl(url, "StartTime"); } if (App.E("filter_adv_etime").value && App.E("filter_adv_etime").value != "选择日期") { url = App.AddQueryToUrl(url, "EndTime", App.E("filter_adv_etime").value); } else { url = App.RemoveQueryFromUrl(url, "EndTime"); } window.location.href = url; } $("#filter_adv_input").JQP_HighLineInput2({ nullCon: "搜索TA的话" }).keyup(function (e) { if (e.which == 13) { advSearch(); } }); $("#filter_adv_stime").JQP_HighLineInput2({ nullCon: "选择日期" }).JQP_DatePicker({ curDate: new Date() }); $("#filter_adv_etime").JQP_DatePicker({ curDate: new Date() }); $("#filter_mkey_btn").click(function () { if ($("#filter_mkey_input").val() != "搜索TA的话") { var url; if (window.location.href.indexOf("#!") >= 0) { url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1]; } else { url = "#!" + window.location.href.replace(App.config.Domain, ""); } url = App.RemoveQueryFromUrl(window.location.href, "page"); window.location.href = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim($("#filter_mkey_input").val()))); } return false; }); $("#filter_adv_btn").click(function () { advSearch(); return false; });
JavaScript
 var btnMore = $(".moreti"); var groupList = $(".nfTaglay"); var groupItem = $(".sltmenu"); var btnMagGroup = $("#btnManageGroup"); if (groupItem[0] != null && btnMagGroup[0] != null) { groupItem.JQP_ClickOther(function () { groupItem.hide(); }); btnMagGroup.click(function (e) { e.stopPropagation(); groupItem.show(); }); } $("#MIB_creategroup").click(function () { App.popGroupDiv(); }); App.lazyEvent(btnMore, "mouseenter", "mouseleave", 500, function () { groupList.css("left", $(btnMore).offset().left - 25).css("top", $(btnMore).offset().top + 20).show() }, function () { App.lazyFunction(function () { groupList.hide(); }, 500) }); App.lazyEvent(groupList, "mouseleave", "mouseenter", 500, function () { groupList.hide(); }); var GroupSortCon = '<div class="layerBox"><div class="layerBoxTop"><div class="topCon"><strong>调整分组顺序</strong><a title="关闭" class="close" href="javascript:;"></a><div class="clear"></div></div></div><div class="layerBoxCon" style="width: 440px; height: auto;"><div class="friexpicbor"> <div class="friexpic"> <h3>首页分组显示预览</h3> <div class="fbTagB"> <ul id="ul_oriderLists"><li class="current"><span onclick="MemberShow(this)">我的班级 </span></li><li>更多</li></ul> </div> </div> </div><div class="friLayBox"> <div class="frileft"> <ul class="frititle" id="mpop_ul_frititle"> <li>分组名</li> </ul> <div class="friList"> <ul id="group_ul_lists">载入中。。。</ul> </div> </div> <div class="friright"> <a class="btn_notclick" href="javascript:void(0)" id="orderup"><em><img title="" class="chupdwn_icon dch_icon" src="/Content/Image/transparent.gif">上移</em></a> <a class="btn_notclick" href="javascript:void(0)" id="orderdown"><em><img src="/Content/Image/transparent.gif" class="chupdwn_icon uch_icon" title="">下移</em></a> </div> <p class="btn" id="mpop_p_btn"><a class="newabtngrn" href="javascript:void(0)" id="gosave"><em>保存</em></a><a class="btn_normal btns" href="javascript:void(0)" id="gocancel"><em>取消</em></a></p> </div> </div></div>'; $("#Adjust_group_order").click(function () { if (App.initDialDiv("GroupSortBox", dialDiv, false, null)) { var groupDiv = $("#GroupSortBox"); groupDiv.removeClass("4CancelAllLayer"); groupDiv.find(".mid_c").html(GroupSortCon); $("#GroupSortBox .close").add($("#gocancel")).click(function () { groupDiv.remove(); App.hideMash(); return false; }); var position = App.centerInScreen(groupDiv); groupDiv.css("left", position.left + "px"); groupDiv.css("top", position.top + "px"); App.showMash(true); $.ajax({ dataType: "json", url: "/Ajax/GetAllGroup/", cache: false, data: { fuid: 0 }, type: "post", success: function (o) { if (o.Code == "A00005") { var groupCount = o.Data.length; var up = $("#orderup").click(function () { if (this.className != "btn_notclick") { var sel = list.find(".down").parent(); var clone = sel.clone() clone.insertBefore(sel.prev()).find("a").mousedown(mouseDown); sel.remove(); preview(); enableBtn(clone); } return false; }); var down = $("#orderdown").click(function () { if (this.className != "btn_notclick") { var sel = list.find(".down").parent(); var clone = sel.clone(); clone.insertAfter(sel.next()).find("a").mousedown(mouseDown); sel.remove(); preview(); enableBtn(clone); } return false; }); $("#gosave").click(function () { if (this.locked) return false; this.locked = true; alink = this; var as = list.find("a"); var gids = ""; for (var i = 0; i < as.length; i++) { gids += $(as[i]).attr("gid") + ","; } $.ajax({ dataType: "json", url: "/Ajax/SortGroup/", cache: false, data: { gids: gids }, type: "post", success: function (o) { if (o.Code == "A00004") { App.fullTip(CodeList["A00004"], 1000, window.location.href.replace("#", ""), 3); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } alink.locked = false; }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); alink.locked = false; } }); return false; }); var top = $("#ul_oriderLists"); var list = $("#group_ul_lists"); var preview = function () { var as = list.find("a"); if (as.length <= 3) { for (var i = 0; i < as.length; i++) { $(top.find("li")[2 * i + 1]).text($(as[i]).text()); } } else { for (var i = 0; i < 3; i++) { $(top.find("li")[2 * i + 1]).text($(as[i]).text()); } } } var enableBtn = function ($elems) { var index = list.find("li").index($elems); if (index == 0) { up.attr("class", "btn_notclick"); } else { up.attr("class", "btn_normal"); } if (index == groupCount - 1) { down.attr("class", "btn_notclick"); } else { down.attr("class", "btn_normal"); } } var mouseDown = function (e) { list.find("a").attr("class", "").bind("mousemove", mouseMove); $(".frititle li").bind("mousemove", mouseMove); this.className = "down"; enableBtn($(this).parent()); $(document).bind("mouseup", mouseUp); if (this.style) this.style.MozUserSelect = "none"; return false; } var mouseMove = function (e) { if ($(e.target).attr("tagName") == "LI") { if (list.find("li:first").prev().attr("tagName") != "DIV") { list.find("div").remove(); $('<div style="cursor: move; height: 3px; background-color: rgb(51, 102, 255); overflow: hidden;"></div>').insertBefore(list.find("li:first")); } } else { if ($(this).parent().next().attr("tagName") != "DIV") { list.find("div").remove(); $('<div style="cursor: move; height: 3px; background-color: rgb(51, 102, 255); overflow: hidden;"></div>').insertAfter($(this).parent()); } } } var mouseUp = function (e) { list.find("a").unbind("mousemove", mouseMove); $(".frititle li").unbind("mousemove", mouseMove); $(document).unbind("mouseup", mouseUp); var drag = list.find("div"); if (drag[0]) { var selone = list.find(".down").parent(); var clone = selone.clone(); selone.remove(); clone.insertAfter(drag).find("a").mousedown(mouseDown); drag.remove(); preview(); enableBtn(list.find(".down").parent()); } if (this.style) this.style.MozUserSelect = ""; } list.html(""); if (o.Data.length > 0) { for (var i = 0; i < o.Data.length; i++) { var li = $('<li><a gid="{id}" href="javascript:void(0)" style="">{name}</a></li>'.replace(/\{name\}/g, o.Data[i].Name).replace(/\{id\}/g, o.Data[i].ID)); list.append(li); li.find("a").mousedown(mouseDown); if (i < 3) { var li1 = $('<li>{name}</li><li class="MIB_line_l">|</li>'.replace(/\{name\}/g, o.Data[i].Name)); li1.insertBefore(top.find("li:last")); } } } } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); } }); } });
JavaScript
 $(document).ready(function () { App.TimerFunArray.push(App.ajaxAtWho); App.StartTimer(); App.bindGoTop(curBorder); }); var follow = function (id, name, alink) { if (alink.locked) return; alink.locked = true; App.FollowOne(id, name, function (ID, Name, O) { if (O.Data == 1) { $('<div class="MIB_btn_inter lf">互相关注<span class="MIB_line_sp">|</span><a onclick="cancelFollow(' + ID + ',\'' + Name + '\',this);return false;" href="javascript:void(0)" class="MIB_linkbl"><em>取消</em></a></div>').insertAfter($(alink).parent()); $(alink).parent().remove(); } if (O.Data == 2) { $('<div class="MIB_btn2 lf">已关注<span class="MIB_line_sp">|</span><a onclick="cancelFollow(' + ID + ',\'' + Name + '\',this);return false;" href="javascript:void(0)" class="MIB_linkbl"><em>取消</em></a></div>').insertAfter($(alink).parent()); $(alink).parent().remove(); } $("#more_handle").fadeIn(); $("#remark_name").fadeIn(); }, function () { alink.locked = false; }); }; var cancelFollow = function (id, name, alink) { if (alink.locked) return; App.miniConfirm("是否取消关注" + name, alink, function () { alink.locked = true; App.CancelFollow(id, function (ID, O) { if (O.Data == 3) { $('<div class="lf"><a class="btn_add" onclick="follow(' + ID + ',\'' + name + '\',this);return false;" href="javascript:void(0)"><img src="/Content/Image/transparent.gif" alt="" title="已关注你" class="ico_addGrn"><em><img src="/Content/Image/transparent.gif" alt="" class="SG_icon add_icoz">&nbsp;加关注</em></a></div>').insertAfter($(alink).parent()); $(alink).parent().remove(); } if (O.Data == 4) { $('<div class="lf"><a onclick="follow(' + ID + ',\'' + name + '\',this);return false;" href="javascript:void(0);" class="btn_add"><img class="SG_icon" src="/Content/Image/transparent.gif" title="关注"><em>加关注</em></a></div>').insertAfter($(alink).parent()); $(alink).parent().remove(); } $("#more_handle").fadeOut(); $("#remark_name").fadeOut(); }, function () { alink.locked = false; }); }); };
JavaScript
var box; var boxSettints = { layerTitleTxt: "", noResultTipsTxt: "", sendUrl: "", sendDataPara: {}, isShowCreateNewClassLink: false, flag: 0 //0院系1 班级 用于选择院系清除班级的值 } var education = {}; // education.curSchoolType =@{@(TypeConfigs.GetSchoolRoot + 1)}; education.curSchoolType = 4071; education.curLetter = ""; education.action = "create"; education.curEducation = -1; education.createHtml = ""; education.initCreateBox = function (cobject) { var schoolType = $("select[name='school_type']"); var isVisible = $("select[name='privacy']"); var schoolName = $("#txtSchool"); var schoolID = schoolName.next(); var startDate = $(".setup_sel"); var schoolCollege = $("#schoolCollege"); var schoolCollegeID = schoolCollege.next(); var schoolClass = $("#schoolClass"); var schoolClassID = schoolClass.next(); if (cobject) { schoolType.val(cobject.Type); isVisible.val(cobject.IsVisible); schoolName.val(cobject.SchoolName); schoolID.val(cobject.SchoolID); startDate.val(cobject.StartDate); schoolCollege.val(cobject.schoolCollege); schoolCollegeID.val(cobject.schoolCollegeID); schoolClass.val(cobject.SchoolClassName); schoolClassID.val(cobject.SchoolClassID); } // App.Setup.BindInput(remark, "可以填写学院、班级、系列等信息,70个字以内", App.Setup.checkRemark); App.Setup.BindInput(startDate, "完整的入学年份,能够为你找到更多同届校友", null); $("#save").click(function () { education.submit(this); }); App.Setup.BindSelect(isVisible); schoolName.focus( function () { education.showSchoolBox($(this)); }).keydown(function () { return false; }); schoolType.change(function () { education.curSchoolType = $(this).val(); App.EmptySchoolCollegeClass(); }); //院系操作 $("#schoolCollege").focus(function () { boxSettints.layerTitleTxt = "选择院系"; boxSettints.noResultTipsTxt = "还没找到符合条件的院系"; boxSettints.sendUrl = "/Ajax/GetShoolsCollegeByLetLocType"; boxSettints.sendDataPara = { schoolID: $("#school_id").val().ToInt() }; boxSettints.isShowCreateNewClassLink = false; boxSettints.flag = 0; education.showCollegeClassBox($(this)); }).keydown(function () { return false; }); //班级操作 $("#schoolClass").focus(function () { boxSettints.layerTitleTxt = "选择班级"; boxSettints.noResultTipsTxt = "还没找到符合条件的班级"; boxSettints.sendUrl = "/Ajax/GetShoolsClassByLetLocType"; boxSettints.sendDataPara = { schoolID: $("#school_id").val().ToInt(), collegeID: $("#schoolCollege_id").val().ToInt() }; boxSettints.isShowCreateNewClassLink = true; boxSettints.flag = 1; education.showCollegeClassBox($(this)); }).keydown(function () { return false; }); } education.init = function () { box = $("#schoolBox"); var city = $("#city"); var province = $("#province"); var loadSchool = function () { var location = parseInt(city.val()) > 0 ? city.val() : (parseInt(province.val()) > 0 ? province.val() : -1); App.BindSchoolCtrl(location, education.curLetter, education.curSchoolType, function () { }, "/Ajax/GetShoolsByLetLocType/"); }; $(".btn_normal").add($(".close")).click(function () { box.hide(); App.hideMash(); return false; }); $("#btnClose1").add($(".close")).click(function () { $("#schoolCollegeBox").hide(); App.hideMash(); return false; }); $("#saveCreate").add($(".close")).click(function () { $("#CreateNewClassBox").hide(); $("#schoolClass").val($("#newSchoolClass").val()); $("#schoolClass_id").val("0"); App.hideMash(); return false; }); box.find("a[letter='1']").click(function () { if ($("a[letter='2']")[0] == this) { education.curLetter = ""; this.style.backgroundColor = ""; $(this).attr("letter", 1); } else { if ($("a[letter='2']")[0]) { $("a[letter='2']")[0].style.backgroundColor = ""; $("a[letter='2']").attr("letter", 1); } education.curLetter = $(this).attr("title"); this.style.backgroundColor = "rgb(204, 190, 190)"; $(this).attr("letter", 2); } loadSchool(); return false; }); App.BindCityCtrl(province, "province", 0, function () { App.BindCityCtrl(city, "City", province.val(), function () { }, "/Ajax/GetCity1/"); province.hide(); city.hide(); province.show(); city.show(); loadSchool(); }, "/Ajax/GetCity1/"); province.change(function () { App.BindCityCtrl(city, "City", province.val(), function () { loadSchool(); }, "/Ajax/GetCity1/"); }); city.change(function () { loadSchool(); }); var quiSearch = $("#quiSearch"); App.autoComplete(quiSearch, function (id, name) { education.schoolTxtBox.val(name); education.schoolTxtBox.next().val(id); box.hide(); App.hideMash(); }); this.createHtml = $("#divCreate .info_tab01").html(); this.initCreateBox(); $("#btnCreate a").click(function () { $("div[edit='1']").html(""); $("#divCreate").show().append("<div class='info_tab01'>" + education.createHtml + "</div>"); education.initCreateBox(); $("#btnCreate").hide(); education.action = "create"; education.curEducation = -1; }); $("#createNewClassLinkPara").click(function () { $("#CollegeClassBox").hide(); App.hideMash(); box = $("#CreateNewClassBox"); var position = App.centerInScreen(box); box.css("left", position.left).css("top", position.top); App.showMash(); this.schoolTxtBox = this; box.show(); return false; }); }; education.showSchoolBox = function (ctrl) { box = $("#schoolBox"); var position = App.centerInScreen(box); box.css("left", position.left).css("top", position.top); App.showMash(); this.schoolTxtBox = ctrl; box.show(); loadSyscschool(); }; education.showCollegeClassBox = function (ctrl) { box = $("#CollegeClassBox"); var schoolID = boxSettints.sendDataPara.schoolID; if (schoolID < 1) { App.fullTip(CodeList["A00032"], 1000, null, 1); return false; } console.log(boxSettints.sendDataPara); $.ajax({ dataType: "json", data: boxSettints.sendDataPara, url: boxSettints.sendUrl, cache: false, type: "post", success: function (o) { $("#layerTitlePara").html(boxSettints.layerTitleTxt); $("#noResultTipsPara").html(boxSettints.noResultTipsTxt); boxSettints.isShowCreateNewClassLink == false ? $("#createNewClassLinkPara").hide() : $("#createNewClassLinkPara").show(); if (o.Code == "A00003") App.fullTip(CodeList[o.Code], 1000, null, 1); else if (o.Code == "A00017") { $("#noContent").show(); $("#ContentUl").hide(); } else { $("#noContent").hide(); var schlist = $("#ContentUl").show(); schlist.html(""); $.each(o.Data, function () { var item = $("<li trueId='" + this.id + "' title='" + this.name + "'><a href='javascript:void(0);'>" + this.name + "</a></li>"); item.click(function () { education.schoolTxtBox.val(item.attr("title")); education.schoolTxtBox.next().val(item.attr("trueId")); box.hide(); App.hideMash(); boxSettints.flag == 0 ? App.EmptyClass() : ""; }); schlist.append(item); }); } }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); } }); box = $("#CollegeClassBox"); var position = App.centerInScreen(box); box.css("left", position.left).css("top", position.top); App.showMash(); this.schoolTxtBox = ctrl; box.show(); } education.submit = function (alink) { var schoolType = $("select[name='school_type']"); var isVisible = $("select[name='privacy']"); var schoolName = $("#txtSchool"); var startDate = $(".setup_sel"); var schoolCollege = $("#schoolCollege"); var educationList = $("#educationList"); var schoolClass = $("#schoolClass"); // App.Setup.checkRemark(remark); if ($.trim(schoolName.val()) != "" && $.trim(schoolClass.val()) != "") { alink.locked = true; $.ajax( { url: this.action == "create" ? "/Ajax/CreateEducation" : "/Ajax/EditEducation", datatype: "json", cache: false, data: { educationId: education.curEducation, isVisible: isVisible.val(), schoolType: schoolType.val(), schoolId: schoolName.next().val().ToInt(), schoolName: schoolName.val(), startdate: startDate.val(), schoolCollegeID: $.trim($("#schoolCollege_id").val().ToInt()), schoolCollege: $.trim(schoolCollege.val()), schoolClassID: $.trim($("#schoolClass_id").val().ToInt()), schoolClassName: $.trim(schoolClass.val()) }, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.FullMiniTip(CodeList["A00003"], alink, 2000, 1); } else { App.FullMiniTip(CodeList[o.Code], alink, 1000, 3); if (education.action == "create") { if (o.Data != "") { var first = educationList.find("div:first"); if (first[0]) $(o.Data).insertBefore(first); else educationList.html(o.Data); } } else { if (o.Data != "") { curEduItem = $("#education_" + education.curEducation) $(o.Data).insertBefore(curEduItem); curEduItem.remove(); } } } alink.locked = false; }, error: function (request) { App.FullMiniTip(CodeList["A00003"], alink, 2000, 1); alink.locked = false; } }); } else { education.showSchoolBox(schoolName); } } education.del = function (id) { App.confirm("是否真的删除?", function () { $.ajax( { url: "/Ajax/DelEducation", datatype: "json", cache: false, data: { educationId: id }, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.alert(CodeList["A00003"]); } else { $("#education_" + id).remove(); } }, error: function (request) { App.alert(CodeList["A00003"]); } }); }); } education.edit = function (id) { $.ajax( { url: "/Ajax/getEducationDetail", datatype: "json", cache: false, data: { educationId: id }, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.alert(CodeList["A00003"]); } else { $("div[edit='1']").html(""); var editElem = $("#educationEdit_" + id); $("#divCreate").hide().find(".info_tab01").remove(); editElem.html("<div class='info_tab01'>" + education.createHtml + "</div>"); $("#btnCreate").show(); education.initCreateBox(o.Data); education.action = "edit"; education.curEducation = id; } }, error: function (request) { App.alert(CodeList["A00003"]); } }); } education.schoolTxtBox = null; $(function () { education.init(); App.TimerFunArray.push(App.autoCompleteTimerEvent); App.curGetLink = "autoCompleteSchool"; App.StartTimer(); }); function loadSyscschool() { var city = $("#city"); var province = $("#province"); var location = parseInt(city.val()) > 0 ? city.val() : (parseInt(province.val()) > 0 ? province.val() : -1); App.BindSchoolCtrl(location, education.curLetter, education.curSchoolType, function () { }, "/Ajax/GetShoolsByLetLocType/"); }
JavaScript
$(document).ready(function () { App.TimerFunArray.push(App.ajaxAtWho); App.StartTimer(); App.bindGoTop(curBorder); App.initNameCard($("#feed_list")); });
JavaScript
 $(document).ready(function () { $("#reg_username").JQP_TxtTips({ txt: "请输入你的常用邮箱,如:example@example.com<br />它将成为你未来的登录帐号", VailFn: checkMail, plusId: "red_reg_username" }); $("#reg_password").JQP_TxtTips({ txt: "密码由6-16位半角字符(字母、数字、符号)组成,区分大小写", VailFn: checkPwd, plusId: "red_reg_password" }); $("#reg_password2").JQP_TxtTips({ txt: "这里要重复下你的密码", VailFn: checkRePwd, plusId: "red_reg_password2" }); $("#door").JQP_TxtTips({ txt: "验证码是又字母和数字组成,不区分大小写", VailFn: checkVailCode, plusId: "red_door" }); $("#after").JQP_TxtTips({ VailFn: checkIsAgree, plusId: "red_after", isTxtInput: false }); $("#reg_username").JQP_EmailNote({ selfn: function () { $("#reg_username").focusout(); $("#reg_username").blur(); $("#reg_password").focusin(); $("#reg_password").focus(); } }); $(".jh_yanzheng").focusin(function () { $(this).attr("class", "jh_yanzhenghover"); }); $(".jh_yanzheng").focusout(function () { $(this).attr("class", "jh_yanzheng"); }); $(".r_loginbtn").bind("click", function (e) { App.showLoginDial(e); return false }); $("#submit").click(function (e) { App.disableAtag($(this), "btn_ljzc_load"); checkIsAgree($("#after"), $("#red_after")); checkMail($("#reg_username"), $("#red_reg_username"), false); checkPwd($("#reg_password"), $("#red_reg_password")); checkRePwd($("#reg_password2"), $("#red_reg_password2")); checkVailCode($("#door"), $("#red_door"), false); if (isMail && isAgree && isPwd && isRePwd && isVailCode) { App.iframeSubmit({ formMail: $("#reg_username").val(), formPwd: $("#reg_password").val() }, "RegForm", "/User/IframeReg/", "RegIframe"); } else { App.enableAtag($(this)); } return false; }); });
JavaScript
 $(function () { var newCtrl = $("#new_password"); var compareCtrl = $("#compare_password"); var oldCtrl = $("#old_password"); var comparePwd = function () { var ctrl1 = newCtrl; var ctrl = compareCtrl; var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); if (ctrl.val() != ctrl1.val()) { errorCon.text("两次输入的密码不一致,请重新输入"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); return false; } else if (ctrl.val().length < 6 || ctrl.val().length > 16) { errorCon.text("密码长度不正确,应为6~16个字符"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); return false; } else if (!new RegExp("^([\\w\\~\\!\\@@\\#\\$\\%\\^\\&\\*\\(\\)\\+\\`\\-\\=\\[\\]\\\\{\\}\\|\\;\\'\\:\\\"\\,\\.\\/\\<\\>\\?]{6,16})$").test(ctrl.val())) { errorCon.text("密码请勿使用特殊字符"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); return false; } else { select.show(); App.Setup.normalInput(ctrl[0]); return true; } } App.Setup.BindInput(oldCtrl, "密码由6-16位半角(字母、数字、符号)组成,区分大小写", App.Setup.checkPWD); App.Setup.BindInput(newCtrl, "密码由6-16位半角(字母、数字、符号)组成,区分大小写", App.Setup.checkPWD); App.Setup.BindInput(compareCtrl, "密码由6-16位半角(字母、数字、符号)组成,区分大小写", comparePwd); newCtrl.keyup(function () { var showPower = $("#image_password img"); if (!this.value) showPower.attr("src", "/Content/Image/pwd_no.gif"); var power = App.Setup.pwdPower(this.value); if (power == 1) { showPower.attr("src", "/Content/Image/pwd_simple.gif"); } else if (power == 2) { showPower.attr("src", "/Content/Image/pwd_middle.gif"); } else if (power == 3) { showPower.attr("src", "/Content/Image/pwd_strong.gif"); } }); $("#submit_password").click(function () { if (this.locked) return false; var ispwd1 = App.Setup.checkPWD(oldCtrl); var ispwd2 = App.Setup.checkPWD(newCtrl); var ispwd3 = comparePwd(); if (ispwd1 && ispwd2 && ispwd3) { var alink = this; this.locked = true; $.ajax( { url: "/Ajax/EditPwd", datatype: "json", cache: false, data: { newpwd: newCtrl.val(), oldpwd: oldCtrl.val() }, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.FullMiniTip(CodeList["A00003"], alink, 2000, 1); } else if (o.Code == "A00020") { App.FullMiniTip(CodeList[o.Code], alink, 2000, 1); } else { App.FullMiniTip(CodeList[o.Code], alink, 1000, 3); } alink.locked = false; }, error: function (request) { App.FullMiniTip(CodeList["A00003"], alink, 2000, 1); alink.locked = false; } }); } return false; }); });
JavaScript
 var bufferCount = 0; var isLoaded = true; var ajaxGetMiniBlog = function (ishashchange, isBufferRetry) { var url; if (!window.location.hash || window.location.hash.indexOf('#!') < 0) { url = window.location.href; if (ishashchange) { $(window).scrollTop(0); $("a[action]").removeClass("current"); $("a[action='all']").attr("class", "current"); } } else { url = window.location.href.replace(App.config.Domain, "").split('!')[1]; if (ishashchange) { $(window).scrollTop(0); var urlJson = App.UlrToJson(url); $("a[action]").removeClass("current"); if (!urlJson) $("a[action='all']").attr("class", "current"); else { if (!urlJson["IsAdvanced"]) { var isAll = 1; for (var p in urlJson) { var elem = $("a[action='" + p + "']"); if (elem[0]) { isAll = 0; elem.attr("class", "current"); } } if (isAll) $("a[action='all']").attr("class", "current"); else $("a[action='all']").removeClass("current"); } } } } var loadMB = $("#loadMB"); var loadError = $("#loadError"); var loadNoResult = $("#loadNoresult"); var loadMB1 = $("#loadMB1"); var loadError1 = $("#loadError1"); var loadNoResult1 = $("#loadNoresult1"); if (ishashchange) { bufferCount = 0; loadMB.show(); loadError.hide(); loadNoResult.hide(); } else { if (!isBufferRetry) bufferCount++; loadMB1.show(); loadError1.hide(); loadNoResult1.hide(); } url = App.AddQueryToUrl(url.replace(/#/g, ""), "Buffer", bufferCount); isLoaded = false; $.ajax({ dataType: "json", url: url, cache: false, type: "get", success: function (o) { if (o.Code == "A00005") { if (ishashchange) { loadMB.hide(); $(".MIB_feed").remove(); $("#page").remove(); $(o.Data).insertAfter(loadNoResult); App.initMedia(); App.initNameCard($("#feed_list")); loadMB1.remove(); loadNoResult1.remove(); loadError1.remove(); } else { $(o.Data).insertAfter(loadNoResult1); App.initMedia("feed_list" + bufferCount); App.initNameCard($("#feed_list" + bufferCount)); loadMB1.remove(); loadNoResult1.remove(); loadError1.remove(); } } else { if (ishashchange) { loadMB.hide(); loadNoResult.show(); } else { loadMB1.hide(); loadNoResult1.show(); } } isLoaded = true; }, error: function () { if (ishashchange) { loadMB.hide(); loadNoResult.hide(); loadError.show(); } else { loadMB1.hide(); loadNoResult1.hide(); loadError1.show(); } isLoaded = true; } }); }; $(document).ready(function () { App.TimerFunArray.push(App.ajaxAtWho); App.StartTimer(); App.bindGoTop(curBorder); $(window).hashchange(ajaxGetMiniBlog); ajaxGetMiniBlog(true); $(window).scroll(function () { if ($("#loadMB1")[0]) { if ($(this).scrollTop() + $(this).height() > $("#loadMB1").offset().top) { if (bufferCount < 3 && isLoaded) { ajaxGetMiniBlog(); } } } }); }); window.onload = function () { var voteItems = $("div[type='vote']"); for (var i = 0; i < voteItems.length; i++) { var img = $(voteItems[i]).find("img")[0]; var img1 = $(voteItems[i]).find("img")[1]; $(img1).css("left", parseInt(($(img).width() - 33) / 2)).css("top", parseInt(($(img).height() - 33) / 2)).css("position", "absolute"); $(img1).show(); } }; $("#filter_adv_show").click(function () { $("#filter_adv_panel").fadeIn(); $("#filter_key_panel").hide(); return false; }); $("#filter_adv_hide").click(function () { $("#filter_adv_panel").fadeOut(function () { $("#filter_key_panel").show(); }); return false; }); $("#filter_mkey_input").JQP_HighLineInput2({ nullCon: "搜索我自己的话" }).keyup(function (e) { if (e.which == 13) { if (this.value && this.value != "搜索我自己的话") { var url; if (window.location.href.indexOf("#!") >= 0) { url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1]; } else { url = "#!" + window.location.href.replace(App.config.Domain, ""); } url = App.RemoveQueryFromUrl(url, "page"); window.location.href = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim($(this).val()))); } } }); var advSearch = function () { var url; if (window.location.href.indexOf("#!") >= 0) { url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1]; } else { url = "#!" + window.location.href.replace(App.config.Domain, ""); } url = App.RemoveQueryFromUrl(url, "page"); url = App.AddQueryToUrl(url, "IsAdvanced", "1"); if (App.E("filter_ori").checked) { url = App.AddQueryToUrl(url, "IsOri", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsOri"); } if (App.E("filter_ret").checked) { url = App.AddQueryToUrl(url, "IsRet", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsRet"); } if (App.E("filter_text").checked) { url = App.AddQueryToUrl(url, "IsHaveLink", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveLink"); } if (App.E("filter_pic").checked) { url = App.AddQueryToUrl(url, "IsHavePic", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHavePic"); } if (App.E("filter_video").checked) { url = App.AddQueryToUrl(url, "IsHaveVideo", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveVideo"); } if (App.E("filter_music").checked) { url = App.AddQueryToUrl(url, "IsHaveMusic", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveMusic"); } if (App.E("filter_vote").checked) { url = App.AddQueryToUrl(url, "IsHaveVote", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveVote"); } if (App.E("filter_adv_input").value && App.E("filter_adv_input").value != "搜索我自己的话") { url = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim(App.E("filter_adv_input").value))); } else { url = App.RemoveQueryFromUrl(url, "Key"); } if (App.E("filter_adv_stime").value && App.E("filter_adv_stime").value != "选择日期") { url = App.AddQueryToUrl(url, "StartTime", App.E("filter_adv_stime").value); } else { url = App.RemoveQueryFromUrl(url, "StartTime"); } if (App.E("filter_adv_etime").value && App.E("filter_adv_etime").value != "选择日期") { url = App.AddQueryToUrl(url, "EndTime", App.E("filter_adv_etime").value); } else { url = App.RemoveQueryFromUrl(url, "EndTime"); } window.location.href = url; } $("#filter_adv_input").JQP_HighLineInput2({ nullCon: "搜索我自己的话" }).keyup(function (e) { if (e.which == 13) { advSearch(); } }); $("#filter_adv_stime").JQP_HighLineInput2({ nullCon: "选择日期" }).JQP_DatePicker({ curDate: new Date() }); $("#filter_adv_etime").JQP_DatePicker({ curDate: new Date() }); $("#filter_mkey_btn").click(function () { if ($("#filter_mkey_input").val() != "搜索我自己的话") { var url; if (window.location.href.indexOf("#!") >= 0) { url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1]; } else { url = "#!" + window.location.href.replace(App.config.Domain, ""); } url = App.RemoveQueryFromUrl(url, "page"); window.location.href = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim($("#filter_mkey_input").val()))); } return false; }); $("#filter_adv_btn").click(function () { advSearch(); return false; });
JavaScript
 $(document).ready(function () { $("#reg_username").JQP_TxtTips({ txt: "请输入你的常用邮箱,如:example@example.com<br />它将成为你未来的登录帐号", VailFn: checkMail, plusId: "red_reg_username" }); $("#reg_password").JQP_TxtTips({ txt: "密码由6-16位半角字符(字母、数字、符号)组成,区分大小写", VailFn: checkPwd, plusId: "red_reg_password" }); $("#reg_password2").JQP_TxtTips({ txt: "这里要重复下你的密码", VailFn: checkRePwd, plusId: "red_reg_password2" }); $("#door").JQP_TxtTips({ txt: "验证码是又字母和数字组成,不区分大小写", VailFn: checkVailCode, plusId: "red_door" }); $("#after").JQP_TxtTips({ VailFn: checkIsAgree, plusId: "red_after", isTxtInput: false }); $("#reg_username").JQP_EmailNote({ selfn: function () { $("#reg_username").focusout(); $("#reg_username").blur(); $("#reg_password").focusin(); $("#reg_password").focus(); } }); $(".jh_yanzheng").focusin(function () { $(this).attr("class", "jh_yanzhenghover"); }); $(".jh_yanzheng").focusout(function () { $(this).attr("class", "jh_yanzheng"); }); $(".r_loginbtn").bind("click", function (e) { App.showLoginDial(e); return false }); $("#submit").click(function (e) { App.disableAtag($(this), "btn_ljzc_load"); checkIsAgree($("#after"), $("#red_after")); checkMail($("#reg_username"), $("#red_reg_username"), false); checkPwd($("#reg_password"), $("#red_reg_password")); checkRePwd($("#reg_password2"), $("#red_reg_password2")); checkVailCode($("#door"), $("#red_door"), false); if (isMail && isAgree && isPwd && isRePwd && isVailCode) { App.iframeSubmit({ formMail: $("#reg_username").val(), formPwd: $("#reg_password").val() }, "RegForm", "/User/IframeReg/", "RegIframe"); } else { App.enableAtag($(this)); } return false; }); });
JavaScript
 var errorStr = "<div class=\"errormt\"><i></i><strong><span></span></strong></div>"; var successStr = "<div class=\"success\"><i></i></div>"; $(document).ready(function () { $(".jh_yanzheng").focusin(function () { $(this).attr("class", "jh_yanzhenghover"); }).focusout(function () { $(this).attr("class", "jh_yanzheng"); }); $("#door").JQP_HighLineInput(); $("#nickname").JQP_HighLineInput(); App.BindCityCtrl($("#province"), "Province", 1, function () { App.BindCityCtrl($("#city"), "City", $("#province").val()); }); $("#province").change(function () { App.BindCityCtrl($("#city"), "City", $("#province").val()); }); $("#province").blur(function () { checkProvince(); }); $("#nickname").blur(function () { checkNickName(true); }); $("#door").blur(function () { checkCode(true); }); $("#submit").click(function (e) { App.disableAtag($(this)); checkCode(false); checkNickName(false); checkProvince(); if (isCheckCode && isNickName && isProvince) { App.iframeSubmit({ formNickName: $.trim($("#nickname").val()), formProvince: $("#province").val(), formCity: $("#city").val(), formSex: $("#rdoboy").attr("checked") }, "form1", "/User/IframeFullInfo/", "iframe1"); } else { App.enableAtag($(this)); } }); }); var isNickName = false; var isProvince = false; var isCheckCode = false; var checkNickName = function (asysn) { isNickName = false; if ($.trim($("#nickname").val()) == "") { $("#red_nickname").html(errorStr); $("#red_nickname .errormt").find("span").text("请输入昵称"); } else if (/^[0-9]*$/.test($.trim($("#nickname").val()))) { $("#red_nickname").html(errorStr); $("#red_nickname .errormt").find("span").text("昵称不能全是数字"); } else if (!/^[0-9a-zA-Z\u4e00-\u9fa5_]*$/.test($.trim($("#nickname").val()))) { $("#red_nickname").html(errorStr); $("#red_nickname .errormt").find("span").text("支持中英文、数字或者“_”。"); } else if ($.trim($("#nickname").val()).replace(/[^\x00-\xff]/g, 'xx').length > 20) { $("#red_nickname").html(errorStr); $("#red_nickname .errormt").find("span").text("不能超过20个字母或10个汉字"); } else { App.ajax_IsExsitNickName(function (o) { if (o.Data == "1") { $("#red_nickname").html(errorStr); $("#red_nickname .errormt").find("span").text("此昵称太受欢迎,已有人抢了"); } else { $("#red_nickname").html(successStr); isNickName = true; } }, asysn, $.trim($("#nickname").val())); } } var checkCode = function (asysn) { isCheckCode = false; if ($.trim($("#door").val()) == "") { $("#red_door").html(errorStr); $("#red_door .errormt").find("span").text("请输入验证码"); } else { App.ajax_IsValidCode(function (o) { if (o.Data == "1") { $("#red_door").html(errorStr); $("#red_door .errormt").find("span").text("验证码不对,重新输入下吧。"); } else { $("#red_door").html(successStr); isCheckCode = true; } }, asysn, $.trim($("#door").val())); } } var checkProvince = function () { isProvince = false; if ($("#province").val() == -1) { $("#red_province").html(errorStr); $("#red_province .errormt").find("span").text("请选择省份"); } else { $("#red_province").html(successStr); isProvince = true; } } var fullInfoCallBack = function (isSuccess) { if (isSuccess) { window.location.href = "/"; } else { App.alert("系统繁忙,稍后再试"); } }
JavaScript
 var atmeSearch = function () { var url = window.location.href; if ($("#searchkeyword").val() != "查找@我微博" && $.trim($("#searchkeyword").val())) { url = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim($("#searchkeyword").val()))); } else { url = App.RemoveQueryFromUrl(url, "Key"); } if ($("input[name='arelation']:checked").val() == 1) { url = App.AddQueryToUrl(url, "IsFollow", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsFollow"); } if ($("input[name='atype']:checked").val() == 1) { url = App.AddQueryToUrl(url, "IsOri", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsOri"); } window.location.href = url; } $("#startFilter").click(function () { $("#atmeFilter").fadeIn(); $("#atmeBar").hide(); }); $("#cancelFilter").click(function () { $("#atmeFilter").fadeOut(function () { $("#atmeBar").show(); }); }); $("#searchkeyword").JQP_HighLineInput2({ nullCon: "查找@我微博" }).keyup(function (e) { if (e.which == 13) { atmeSearch(); } }); $("#search_btn").click(function () { atmeSearch(); });
JavaScript
 function systole() { if (!$(".history").length) { return; } var $warpEle = $(".history-date"), $targetA = $warpEle.find("h2 a,ul li dl dt a"), parentH, eleTop = []; parentH = $warpEle.parent().height() + 80; setTimeout(function () { $warpEle.find("ul").children(":not('h2:first')").each(function (idx) { eleTop.push($(this).position().top); $(this).css({ "margin-top": -eleTop[idx] }).children().hide(); }).animate({ "margin-top": 0 }, 1600).children().fadeIn(); $warpEle.find("ul").children(":not('h2:first')").addClass("bounceInDown").css({ "-webkit-animation-duration": "2s", "-webkit-animation-delay": "0", "-webkit-animation-timing-function": "ease", "-webkit-animation-fill-mode": "both" }).end().children("h2").css({ "position": "relative" }); }, 100); $targetA.click(function () { $(this).parent().css({ "position": "relative" }); $(this).parent().siblings().slideToggle(); $warpEle.parent().removeAttr("style"); return false; }); }; var bufferCount = 1; var isLoaded = true; var ajaxGetMiniBlog = function (ishashchange, isBufferRetry) { var url; if (!window.location.hash || window.location.hash.indexOf('#!') < 0) { url = window.location.href; } else { url = window.location.href.replace(App.config.Domain, "").split('!')[1]; } var loadMB = $("#loadMB"); var loadError = $("#loadError"); var loadNoResult = $("#loadNoresult"); var loadMB1 = $("#loadMB1"); var loadError1 = $("#loadError1"); var loadNoResult1 = $("#loadNoresult1"); if (ishashchange) { bufferCount = 1; loadMB.show(); loadError.hide(); loadNoResult.hide(); } else { if (!isBufferRetry) bufferCount++; loadMB1.show(); loadError1.hide(); loadNoResult1.hide(); } url = App.AddQueryToUrl(url.replace(/#/g, ""), "Buffer", bufferCount); isLoaded = false; $.ajax({ dataType: "json", url: url, cache: false, type: "get", success: function (o) { console.log(o.Code); if (o.Code == "A00005") { if (ishashchange) { loadMB.hide(); $(".MIB_feed").remove(); $("#page").remove(); $(o.Data).insertAfter(loadNoResult); loadMB1.remove(); loadNoResult1.remove(); loadError1.remove(); } else { // $("#aMoreDate").remove(); loadMB.remove(); $(o.Data).insertAfter(loadNoResult1); loadMB1.remove(); loadNoResult1.remove(); loadError1.remove(); } } else { if (ishashchange) { loadMB.hide(); loadNoResult.show(); } else { loadMB1.hide(); loadNoResult1.show(); } } isLoaded = true; }, error: function () { if (ishashchange) { loadMB.hide(); loadMB1.hide(); loadNoResult.hide(); loadError.show(); } else { loadMB.hide(); loadError.hide(); loadMB1.hide(); loadNoResult1.hide(); //loadError1.show(); } isLoaded = true; } }); }; function moreDateClick(obj) { $(obj).remove(); ajaxGetMiniBlog(); } $(document).ready(function () { App.bindGoTop(curBorder); ajaxGetMiniBlog(true); systole(); $(window).scroll(function () { if ($("#loadMB1")[0]) { if ($(this).scrollTop() + $(this).height() > $("#loadMB1").offset().top) { if (bufferCount < 3 && isLoaded) { ajaxGetMiniBlog(); } } } if (bufferCount < 3 && $("#aMoreDate")[0]) { $("#aMoreDate").remove(); } if (bufferCount == 3 && $("#aMoreDate")[0]) { $("#loadMB").hide(); $("#loadError").hide(); $("#loadNoresult").hide(); $("#loadMB1").hide(); $("#loadError1").hide(); $("#loadNoresult1").hide(); } if (bufferCount > 3 && !$("#aMoreDate")[0]) { $("#loadMB").remove(); $("#loadError").remove(); $("#loadNoresult").remove(); $("#loadMB1").remove(); $("#loadError1").remove(); $("#loadNoresult1").remove(); } }); });
JavaScript
$(document).ready(function () { App.initMedia(); App.bindGoTop(curBorder); }); window.onload = function () { var voteItems = $("div[type='vote']"); for (var i = 0; i < voteItems.length; i++) { var img = $(voteItems[i]).find("img")[0]; var img1 = $(voteItems[i]).find("img")[1]; $(img1).css("left", parseInt(($(img).width() - 33) / 2)).css("top", parseInt(($(img).height() - 33) / 2)).css("position", "absolute"); $(img1).show(); } };
JavaScript
 var curTxt = ""; var publish_editor = null; var checkTxtLen = function () { if (curTxt != publish_editor.value) { curTxt = publish_editor.value; var normal = "你还可以输入<span class=\"pipsLim\">0</span>字"; var error = "<div class=\"word_c\"><img class=\"tipicon tip2\" alt=\"\" title=\"\" src=\"/Content/Image/transparent.gif\"><strong>已超出<span>1</span>字</strong></div><b class=\"rcorner\"></b>"; var curLen = App.getTxtLen($("#publish_editor")); if (curLen <= 280) { $("#publisher_info").html(normal); $("#publisher_info").find(".pipsLim").html(parseInt((280 - curLen) / 2)); $("#publisher_info").removeClass("error"); if (curLen != 0) { $(".postBtnBg").removeClass("bgColorA_No"); } else { $(".postBtnBg").addClass("bgColorA_No"); } return true; } else { $("#publisher_info").html(error); $("#publisher_info").find("span").html(parseInt((curLen - 280 + 1) / 2)); $("#publisher_info").addClass("error"); $(".postBtnBg").addClass("bgColorA_No"); return false; } } }; var bufferCount = 0; var isLoaded = true; var ajaxGetMiniBlog = function (ishashchange, isBufferRetry) { var url; if (!window.location.hash || window.location.hash.indexOf('#!') < 0) { url = window.location.href; if (ishashchange) { $(window).scrollTop(0); $("a[action]").removeClass("current"); $("a[action='all']").attr("class", "current"); var oriUrl = window.location.href.replace(App.config.Domain, "").replace(/#/g, ""); var curTab = $("li[isall='1']"); var preTab = $(".nfTagB .current"); if (!preTab.attr("isall")) { if (curTab[0]) { if (preTab.attr("isfriend")) { $('<li isfriend="1"><a href="#!' + oriUrl + '?IsFriendShip=1">相互关注</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } else { var preGid = preTab.attr("gid"); var preTxt = preTab.find("span").text(); $('<li gid="' + preGid + '"><a href="#!' + oriUrl + '?gid=' + preGid + '">' + preTxt + '</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } } $('<li class="current" isall="1"><span>所有分组</span></li>').insertAfter(curTab.next()); curTab.next().remove(); curTab.remove(); $("a[action]").each(function () { if ($(this).attr("action") != "all") $(this).attr("href", "#!" + oriUrl + "?" + $(this).attr("action") + "=1"); else $(this).attr("href", "#"); }); } } } else { url = window.location.href.replace(App.config.Domain, "").split('!')[1]; if (ishashchange) { $(window).scrollTop(0); var urlJson = App.UlrToJson(url); $("a[action]").removeClass("current"); if (!urlJson) { $("a[action='all']").attr("class", "current"); } else { if (!urlJson["IsAdvanced"]) { var isAll = 1; for (var p in urlJson) { var elem = $("a[action='" + p + "']"); if (elem[0]) { isAll = 0; elem.attr("class", "current"); } } if (isAll) $("a[action='all']").attr("class", "current"); else $("a[action='all']").removeClass("current"); } if (urlJson["gid"]) { var curTab = $("li[gid='" + urlJson["gid"] + "']"); var oriUrl = url.split('?')[0]; if (curTab[0]) { if (!curTab.attr("pop")) { if (!curTab.attr("class")) { var preTab = $(".nfTagB .current"); if (preTab[0]) { if (preTab.attr("isall")) { $('<li isall="1"><a href="#">所有分组</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } else if (preTab.attr("isfriend")) { $('<li isfriend="1"><a href="#!' + oriUrl + '?IsFriendShip=1">相互关注</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } else { var preGid = preTab.attr("gid"); var preTxt = preTab.find("span").text(); $('<li gid="' + preGid + '"><a href="#!' + oriUrl + '?gid=' + preGid + '">' + preTxt + '</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } } var txt = curTab.find("a").text(); $('<li gid="' + urlJson["gid"] + '" class="current"><span title="' + txt + '">' + txt + '<a class="arrow" onclick="$(this).parent().next().show();return false;" id="btnManageGroup" href="javascript:void(0);"><cite class="arr_m"></cite></a></span><ul style="display: none;" class="sltmenu"><li><a href="' + App.config.curUid + '/Follow?gid=' + urlJson["gid"] + '"><img src="/Content/Image/transparent.gif" class="iconsetup" title="管理分组">管理分组</a></li></ul></li>').insertAfter(curTab.next()); curTab.next().remove(); curTab.remove(); App.elemBlur($(".sltmenu"), $("#btnManageGroup")); } } else { var preTab = $(".nfTagB .current"); if (preTab[0]) { if (preTab.attr("isall")) { $('<li isall="1"><a href="#">所有分组</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } else if (preTab.attr("isfriend")) { $('<li isfriend="1"><a href="#!' + oriUrl + '?IsFriendShip=1">相互关注</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } else { var preGid = preTab.attr("gid"); var preTxt = preTab.find("span").text(); $('<li gid="' + preGid + '"><a href="#!' + oriUrl + '?gid=' + preGid + '">' + preTxt + '</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } } var more = $("li[tip='1']"); var curTxt = curTab.find("a").text(); var lastGid = more.prev().prev().attr("gid"); var lastTxt = more.prev().prev().find("a").text(); more.prev().remove(); more.prev().remove(); $('<li gid="' + urlJson["gid"] + '" class="current"><span title="' + curTxt + '">' + curTxt + '<a class="arrow" onclick="$(this).parent().next().show();return false;" id="btnManageGroup" href="javascript:void(0);"><cite class="arr_m"></cite></a></span><ul style="display: none;" class="sltmenu"><li><a href="' + App.config.curUid + '/Follow?gid=' + urlJson["gid"] + '"><img src="/Content/Image/transparent.gif" class="iconsetup" title="管理分组">管理分组</a></li></ul></li>').insertBefore(more); App.elemBlur($(".sltmenu"), $("#btnManageGroup")); $('<li class="txt" gid="' + lastGid + '" pop="1"><a href="#!' + oriUrl + '?gid=' + lastGid + '">' + lastTxt + '</a></li>').insertBefore(curTab); curTab.remove(); } $("a[action]").each(function () { if ($(this).attr("action") != "all") $(this).attr("href", "#!" + oriUrl + "?" + $(this).attr("action") + "=1&gid=" + urlJson["gid"]); else $(this).attr("href", "#!" + oriUrl + "?" + "gid=" + urlJson["gid"]); }); } } if (urlJson["IsFriendShip"]) { var oriUrl = url.split('?')[0]; var curTab = $("li[isfriend='1']"); var preTab = $(".nfTagB .current"); if (curTab[0]) { if (!curTab.attr("class")) { if (preTab.attr("isall")) { $('<li isall="1"><a href="#">所有分组</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } else { var preGid = preTab.attr("gid"); var preTxt = preTab.find("span").text(); $('<li gid="' + preGid + '"><a href="#!' + oriUrl + '?gid=' + preGid + '">' + preTxt + '</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab); preTab.remove(); } $('<li class="current" isfriend="1"><span>相互关注</span></li>').insertAfter(curTab.next()); curTab.next().remove(); curTab.remove(); $("a[action]").each(function () { if ($(this).attr("action") != "all") $(this).attr("href", "#!" + oriUrl + "?" + $(this).attr("action") + "=1&IsFriendShip=1"); else $(this).attr("href", "#!" + oriUrl + "?IsFriendShip=1"); }); } } } } } } var loadMB = $("#loadMB"); var loadError = $("#loadError"); var loadNoResult = $("#loadNoresult"); var loadMB1 = $("#loadMB1"); var loadError1 = $("#loadError1"); var loadNoResult1 = $("#loadNoresult1"); if (ishashchange) { bufferCount = 0; loadMB.show(); loadError.hide(); loadNoResult.hide(); } else { if (!isBufferRetry) bufferCount++; loadMB1.show(); loadError1.hide(); loadNoResult1.hide(); } url = App.AddQueryToUrl(url.replace(/#/g, ""), "Buffer", bufferCount); isLoaded = false; $.ajax({ dataType: "json", url: url, cache: false, type: "get", success: function (o) { if (o.Code == "A00005") { if (ishashchange) { loadMB.hide(); $(".MIB_feed").remove(); $("#page").remove(); $(o.Data).insertAfter(loadNoResult); App.initMedia(); App.initNameCard($("#feed_list")); loadMB1.remove(); loadNoResult1.remove(); loadError1.remove(); } else { $(o.Data).insertAfter(loadNoResult1); App.initMedia("feed_list" + bufferCount); App.initNameCard($("#feed_list" + bufferCount)); loadMB1.remove(); loadNoResult1.remove(); loadError1.remove(); } } else { if (ishashchange) { loadMB.hide(); loadNoResult.show(); } else { loadMB1.hide(); loadNoResult1.show(); } } isLoaded = true; }, error: function () { if (ishashchange) { loadMB.hide(); loadNoResult.hide(); loadError.show(); } else { loadMB1.hide(); loadNoResult1.hide(); loadError1.show(); } isLoaded = true; } }); }; $(document).ready(function () { publish_editor = $("#publish_editor")[0]; $("#publisher_faces").click(function (e) { e.stopPropagation(); return App.showExpression($("#publish_editor"), this); }); $("#publisher_pic").click(function (e) { e.stopPropagation(); return App.showPicUpload(this); }); $("#publisher_video").click(function (e) { e.stopPropagation(); return App.ShowVideoDiaDiv($("#publish_editor"), this); }); $("#publisher_music").click(function () { return App.showMusicDiaDiv($("#publish_editor"), this); }); $("#publisher_vote").click(function () { return App.showVote($("#publish_editor"), this); }); App.bindTxtarea($("#publish_editor")[0]); $("#publisher_topic").click(function () { App.insertTopic($("#publish_editor")[0]); }); $("#publisher_submit").click(function () { if ($("#publish_editor").val() == "") { App.highLineTxtBox($("#publish_editor")); return; } curTxt = ""; if (!checkTxtLen()) { App.alert("超过字数了"); return; } App.disableAtag($(this)); App.CreateOriginalMiniBlog($("#publish_editor"), function () { App.tip("发布成功", 1000, window.location.href); $("#publish_editor").val(""); }, function () { App.enableAtag($("#publisher_submit")); }); }); App.TimerFunArray.push(checkTxtLen); App.TimerFunArray.push(App.ajaxAtWho); App.StartTimer(); App.bindGoTop(curBorder); $(window).hashchange(ajaxGetMiniBlog); ajaxGetMiniBlog(true); $(window).scroll(function () { if ($("#loadMB1")[0]) { if ($(this).scrollTop() + $(this).height() > $("#loadMB1").offset().top) { if (bufferCount < 3 && isLoaded) { ajaxGetMiniBlog(); } } } }); }); window.onload = function () { var voteItems = $("div[type='vote']"); for (var i = 0; i < voteItems.length; i++) { var img = $(voteItems[i]).find("img")[0]; var img1 = $(voteItems[i]).find("img")[1]; $(img1).css("left", parseInt(($(img).width() - 33) / 2)).css("top", parseInt(($(img).height() - 33) / 2)).css("position", "absolute"); $(img1).show(); } }; var btnMore = $(".moreti"); var groupList = $(".nfTaglay"); var groupItem = $(".sltmenu"); var btnMagGroup = $("#btnManageGroup"); if (groupItem[0] != null && btnMagGroup[0] != null) { groupItem.JQP_ClickOther(function () { groupItem.hide(); }); btnMagGroup.click(function (e) { e.stopPropagation(); groupItem.show(); }); } $("#MIB_creategroup").click(function () { App.popGroupDiv(); }); App.lazyEvent(btnMore, "mouseenter", "mouseleave", 500, function () { groupList.css("left", $(btnMore).offset().left - 25).css("top", $(btnMore).offset().top + 20).show() }, function () { App.lazyFunction(function () { groupList.hide(); }, 500) }); App.lazyEvent(groupList, "mouseleave", "mouseenter", 500, function () { groupList.hide(); }); var GroupSortCon = '<div class="layerBox"><div class="layerBoxTop"><div class="topCon"><strong>调整分组顺序</strong><a title="关闭" class="close" href="javascript:;"></a><div class="clear"></div></div></div><div class="layerBoxCon" style="width: 440px; height: auto;"><div class="friexpicbor"> <div class="friexpic"> <h3>首页分组显示预览</h3> <div class="fbTagB"> <ul id="ul_oriderLists"><li class="current"><span>所有分组 </span></li><li>更多</li></ul> </div> </div> </div><div class="friLayBox"> <div class="frileft"> <ul class="frititle" id="mpop_ul_frititle"> <li>分组名</li> </ul> <div class="friList"> <ul id="group_ul_lists">载入中。。。</ul> </div> </div> <div class="friright"> <a class="btn_notclick" href="javascript:void(0)" id="orderup"><em><img title="" class="chupdwn_icon dch_icon" src="/Content/Image/transparent.gif">上移</em></a> <a class="btn_notclick" href="javascript:void(0)" id="orderdown"><em><img src="/Content/Image/transparent.gif" class="chupdwn_icon uch_icon" title="">下移</em></a> </div> <p class="btn" id="mpop_p_btn"><a class="newabtngrn" href="javascript:void(0)" id="gosave"><em>保存</em></a><a class="btn_normal btns" href="javascript:void(0)" id="gocancel"><em>取消</em></a></p> </div> </div></div>'; $("#Adjust_group_order").click(function () { if (App.initDialDiv("GroupSortBox", dialDiv, false, null)) { var groupDiv = $("#GroupSortBox"); groupDiv.removeClass("4CancelAllLayer"); groupDiv.find(".mid_c").html(GroupSortCon); $("#GroupSortBox .close").add($("#gocancel")).click(function () { groupDiv.remove(); App.hideMash(); return false; }); var position = App.centerInScreen(groupDiv); groupDiv.css("left", position.left + "px"); groupDiv.css("top", position.top + "px"); App.showMash(true); $.ajax({ dataType: "json", url: "/Ajax/GetAllGroup/", cache: false, data: { fuid: 0 }, type: "post", success: function (o) { if (o.Code == "A00005") { var groupCount = o.Data.length; var up = $("#orderup").click(function () { if (this.className != "btn_notclick") { var sel = list.find(".down").parent(); var clone = sel.clone() clone.insertBefore(sel.prev()).find("a").mousedown(mouseDown); sel.remove(); preview(); enableBtn(clone); } return false; }); var down = $("#orderdown").click(function () { if (this.className != "btn_notclick") { var sel = list.find(".down").parent(); var clone = sel.clone(); clone.insertAfter(sel.next()).find("a").mousedown(mouseDown); sel.remove(); preview(); enableBtn(clone); } return false; }); $("#gosave").click(function () { if (this.locked) return false; this.locked = true; alink = this; var as = list.find("a"); var gids = ""; for (var i = 0; i < as.length; i++) { gids += $(as[i]).attr("gid") + ","; } $.ajax({ dataType: "json", url: "/Ajax/SortGroup/", cache: false, data: { gids: gids }, type: "post", success: function (o) { if (o.Code == "A00004") { App.fullTip(CodeList["A00004"], 1000, window.location.href.replace("#", ""), 3); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } alink.locked = false; }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); alink.locked = false; } }); return false; }); var top = $("#ul_oriderLists"); var list = $("#group_ul_lists"); var preview = function () { var as = list.find("a"); if (as.length <= 3) { for (var i = 0; i < as.length; i++) { $(top.find("li")[2 * i + 1]).text($(as[i]).text()); } } else { for (var i = 0; i < 3; i++) { $(top.find("li")[2 * i + 1]).text($(as[i]).text()); } } } var enableBtn = function ($elems) { var index = list.find("li").index($elems); if (index == 0) { up.attr("class", "btn_notclick"); } else { up.attr("class", "btn_normal"); } if (index == groupCount - 1) { down.attr("class", "btn_notclick"); } else { down.attr("class", "btn_normal"); } } var mouseDown = function (e) { list.find("a").attr("class", "").bind("mousemove", mouseMove); $(".frititle li").bind("mousemove", mouseMove); this.className = "down"; enableBtn($(this).parent()); $(document).bind("mouseup", mouseUp); if (this.style) this.style.MozUserSelect = "none"; return false; } var mouseMove = function (e) { if ($(e.target).attr("tagName") == "LI") { if (list.find("li:first").prev().attr("tagName") != "DIV") { list.find("div").remove(); $('<div style="cursor: move; height: 3px; background-color: rgb(51, 102, 255); overflow: hidden;"></div>').insertBefore(list.find("li:first")); } } else { if ($(this).parent().next().attr("tagName") != "DIV") { list.find("div").remove(); $('<div style="cursor: move; height: 3px; background-color: rgb(51, 102, 255); overflow: hidden;"></div>').insertAfter($(this).parent()); } } } var mouseUp = function (e) { list.find("a").unbind("mousemove", mouseMove); $(".frititle li").unbind("mousemove", mouseMove); $(document).unbind("mouseup", mouseUp); var drag = list.find("div"); if (drag[0]) { var selone = list.find(".down").parent(); var clone = selone.clone(); selone.remove(); clone.insertAfter(drag).find("a").mousedown(mouseDown); drag.remove(); preview(); enableBtn(list.find(".down").parent()); } if (this.style) this.style.MozUserSelect = ""; } list.html(""); if (o.Data.length > 0) { for (var i = 0; i < o.Data.length; i++) { var li = $('<li><a gid="{id}" href="javascript:void(0)" style="">{name}</a></li>'.replace(/\{name\}/g, o.Data[i].Name).replace(/\{id\}/g, o.Data[i].ID)); list.append(li); li.find("a").mousedown(mouseDown); if (i < 3) { var li1 = $('<li>{name}</li><li class="MIB_line_l">|</li>'.replace(/\{name\}/g, o.Data[i].Name)); li1.insertBefore(top.find("li:last")); } } } } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); } }); } }); $("#filter_adv_show").click(function () { $("#filter_adv_panel").fadeIn(); $("#filter_key_panel").hide(); return false; }); $("#filter_adv_hide").click(function () { $("#filter_adv_panel").fadeOut(function () { $("#filter_key_panel").show(); }); return false; }); $("#filter_mkey_input").JQP_HighLineInput2({ nullCon: "搜索关注人说的话" }).keyup(function (e) { if (e.which == 13) { if (this.value && this.value != "搜索关注人说的话") { var url; if (window.location.href.indexOf("#!") >= 0) { url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1]; } else { url = "#!" + window.location.href.replace(App.config.Domain, ""); } url = App.RemoveQueryFromUrl(window.location.href, "page"); window.location.href = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim($(this).val()))); ; } } }); var advSearch = function () { var url; if (window.location.href.indexOf("#!") >= 0) { url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1]; } else { url = "#!" + window.location.href.replace(App.config.Domain, ""); } url = App.RemoveQueryFromUrl(window.location.href, "page"); url = App.AddQueryToUrl(url, "IsAdvanced", "1"); if (App.E("filter_ori").checked) { url = App.AddQueryToUrl(url, "IsOri", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsOri"); } if (App.E("filter_ret").checked) { url = App.AddQueryToUrl(url, "IsRet", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsRet"); } if (App.E("filter_text").checked) { url = App.AddQueryToUrl(url, "IsHaveLink", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveLink"); } if (App.E("filter_pic").checked) { url = App.AddQueryToUrl(url, "IsHavePic", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHavePic"); } if (App.E("filter_video").checked) { url = App.AddQueryToUrl(url, "IsHaveVideo", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveVideo"); } if (App.E("filter_music").checked) { url = App.AddQueryToUrl(url, "IsHaveMusic", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveMusic"); } if (App.E("filter_vote").checked) { url = App.AddQueryToUrl(url, "IsHaveVote", "1"); } else { url = App.RemoveQueryFromUrl(url, "IsHaveVote"); } if (App.E("filter_adv_input").value && App.E("filter_adv_input").value != "搜索关注人说的话") { url = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim(App.E("filter_adv_input").value))); } else { url = App.RemoveQueryFromUrl(url, "Key"); } if (App.E("filter_adv_stime").value && App.E("filter_adv_stime").value != "选择日期") { url = App.AddQueryToUrl(url, "StartTime", App.E("filter_adv_stime").value); } else { url = App.RemoveQueryFromUrl(url, "StartTime"); } if (App.E("filter_adv_etime").value && App.E("filter_adv_etime").value != "选择日期") { url = App.AddQueryToUrl(url, "EndTime", App.E("filter_adv_etime").value); } else { url = App.RemoveQueryFromUrl(url, "EndTime"); } window.location.href = url; } $("#filter_adv_input").JQP_HighLineInput2({ nullCon: "搜索关注人说的话" }).keyup(function (e) { if (e.which == 13) { advSearch(); } }); $("#filter_adv_stime").JQP_HighLineInput2({ nullCon: "选择日期" }).JQP_DatePicker({ curDate: new Date() }); $("#filter_adv_etime").JQP_DatePicker({ curDate: new Date() }); $("#filter_mkey_btn").click(function () { if ($("#filter_mkey_input").val() != "搜索关注人说的话") { var url; if (window.location.href.indexOf("#!") >= 0) { url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1]; } else { url = "#!" + window.location.href.replace(App.config.Domain, ""); } url = App.RemoveQueryFromUrl(window.location.href, "page"); window.location.href = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim($("#filter_mkey_input").val()))); } return false; }); $("#filter_adv_btn").click(function () { advSearch(); return false; });
JavaScript
 var blackList = {}; blackList.remove = function (alink, bid) { if (alink.locked) return false; App.confirm("真的要解除?", function () { alink.locked = true; $.ajax( { url: "/Ajax/DelBlackList", datatype: "json", cache: false, data: { bid: bid }, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.alert(CodeList["A00003"]); } else { $(alink).parent().parent().remove(); App.fullTip(CodeList[o.Code], 2000, window.location.href, 3); } alink.locked = false; }, error: function (request) { App.alert(CodeList["A00003"]); alink.locked = false; } }); }); };
JavaScript
if (!domkey) { var domkey = {} } var $C = function (C) { return document.createElement(C) }; domkey.Date = function (n, z, q, F, g, b, v) { var x = this; x.startDate = g || new Date(); x.decDays = b || 7; var s = function (C) { return document.createElement(C) }; var r = function (C) { return document.getElementById(C) }; var h = function (C, H) { var G = 0; var E = C % 400 ? (C % 4 ? false : (C % 100 ? true : false)) : true; switch (parseInt(H)) { case 0: case 2: case 4: case 6: case 7: case 9: case 11: G = 31; break; case 3: case 5: case 8: case 10: G = 30; break; case 1: if (E) { G = 29 } else { G = 28 } } return G }; this.year = q || (new Date()).getFullYear(); this.month = F || (new Date()).getMonth(); this.hlDay = v || false; this.fun = z || function () { }; var B = s("DIV"); var D = s("SELECT"); var m = s("DIV"); var w = s("INPUT"); var a = s("INPUT"); var j = s("INPUT"); var p = s("UL"); this.oDate = s("UL"); B.className = "selector"; D.className = "month"; m.className = "year"; w.className = "yearval"; a.className = "yearbtn"; j.className = "yearbtn2"; p.className = "weeks"; this.oDate.className = "days"; a.type = "button"; j.type = "button"; var o = function (C, G, E) { x.curYear = G || (new Date().getFullYear()); x.curMonth = E || (new Date().getMonth()); x.whiteDay = (new Date(x.curYear, x.curMonth, 1)).getDay(); x.length = h(x.curYear, x.curMonth); x.setDateInterval(x.startDate, x.decDays) }; for (var A = 0; A < this.monthText.length; A++) { D.options[D.length] = new Option(this.monthText[A], A) } for (var A = 0; A < this.weekText.length; A++) { var u = s("LI"); u.innerHTML = this.weekText[A]; p.appendChild(u) } B.appendChild(D); B.appendChild(m); m.appendChild(w); m.appendChild(a); m.appendChild(j); n.appendChild(B); n.appendChild(p); n.appendChild(this.oDate); D.value = this.month; w.value = this.year; D.onchange = function () { o(z, parseInt(w.value), D.value) }; a.onclick = function () { var C = parseInt(w.value) + 1; w.value = C; o(z, parseInt(w.value), D.value) }; j.onclick = function () { var C = parseInt(w.value) - 1; w.value = C; o(z, parseInt(w.value), D.value) }; w.onblur = function () { var C = parseInt(this.value); if (C < 1900) { C = 1990 } if (C > 2100) { C = 2010 } this.value = C; o(z, parseInt(w.value), D.value) }; w.onkeypress = function (C) { if (C.keyCode == 13) { var E = parseInt(this.value); if (E < 1900) { E = 1990 } if (E > 2100) { E = 2010 } this.value = E; o(z, parseInt(w.value), D.value) } }; o(z, q, F) }; $CLTMSG = { CL0501:"一月",CL0502:"二月",CL0503:"三月",CL0504:"四月",CL0505:"五月",CL0506:"六月",CL0507:"七月",CL0508:"八月",CL0509:"九月",CL0510:"十月",CL0511:"十一月",CL0512:"十二月",CL0302:"日",CL0304:"月",CL0309:"一",CL0310:"二",CL0311:"三",CL0312:"四",CL0313:"五",CL0314:"六" } domkey.Date.prototype = { monthText: [$CLTMSG.CL0501, $CLTMSG.CL0502, $CLTMSG.CL0503, $CLTMSG.CL0504, $CLTMSG.CL0505, $CLTMSG.CL0506, $CLTMSG.CL0507, $CLTMSG.CL0508, $CLTMSG.CL0509, $CLTMSG.CL0510, $CLTMSG.CL0511, $CLTMSG.CL0512], weekText: [$CLTMSG.CL0302, $CLTMSG.CL0309, $CLTMSG.CL0310, $CLTMSG.CL0311, $CLTMSG.CL0312, $CLTMSG.CL0313, $CLTMSG.CL0314], setDateInterval: function (a, o) { var j = this; var b = new Date(a.getFullYear(), a.getMonth(), a.getDate()); var n = new Date(a.getFullYear(), a.getMonth(), a.getDate()); n.setHours(o * -24); j.oDate.innerHTML = ""; for (var h = 0; h < j.whiteDay; h++) { j.oDate.appendChild($C("LI")) } for (var h = 0; h < this.length; h++) { var m = $C("LI"); var p = new Date(j.curYear, j.curMonth, h); if (p.getTime() >= n.getTime() && p.getTime() < b.getTime()) { var g = $C("A"); g.href = "javascript:void(0)"; g.setAttribute("day", h + 1); g.setAttribute("month", this.month); g.onclick = function () { j.fun(j.curYear, j.curMonth, this.getAttribute("day")) }; g.innerHTML = "<strong>" + (h + 1) + "</strong>"; m.appendChild(g); if (j.hlDay) { if (j.curYear == j.year && j.curMonth == j.month) { if (j.hlDay == (h + 1)) { g.className = "day" } } } } else { m.innerHTML = h + 1; m.title = "" } j.oDate.appendChild(m) } } }; $.fn.JQP_DatePicker = function (options) { var curDate; if (this.val() == "" || this.val() == "点击选择日期") curDate = new Date(); else curDate = new Date(this.val().replace(/-/g, "/")); var deafult = { curDate: curDate, toDate: new Date(2002, 0, 1) }; var ops = $.extend(deafult, options); var txt = this; var dateElem = $("<div class='pc_caldr' style='position:absolute;z-Index:3000;left:0px;top:0px'></div>"); var clickDoc = function () { dateElem.html(""); dateElem.hide(); $(this).unbind("click", clickDoc); }; var countDays = function (s) { var L = 1000 * 60; var K = L * 60; var M = K * 24; return (Math.round(s / M)) }; txt.click(function (e) { dateElem.html(""); dateElem.hide(); e.stopPropagation(); dateElem.bind("click", function (e) { e.stopPropagation(); }); $(document).bind("click", clickDoc); $("body").append(dateElem); var days; if (ops.curDate > ops.toDate) { days = countDays(ops.curDate.getTime()) - countDays(ops.toDate.getTime()) + 1; new domkey.Date(dateElem[0], function (x, y, z) { txt.val(x + "-" + (parseInt(y) + 1) + "-" + z); dateElem.html(""); dateElem.hide(); }, ops.curDate.getFullYear(), ops.curDate.getMonth(), ops.curDate, days, ops.curDate.getDate()); } else { days = countDays(ops.toDate.getTime()) - countDays(ops.curDate.getTime()) + 1; new domkey.Date(dateElem[0], function (x, y, z) { txt.val(x + "-" + (parseInt(y) + 1) + "-" + z); dateElem.html(""); dateElem.hide(); }, ops.curDate.getFullYear(), ops.curDate.getMonth(), ops.toDate, days, ops.curDate.getDate()); } dateElem.show(); dateElem.css("top", txt.offset().top + txt.height()).css("left", txt.offset().left); }); return this; };
JavaScript
 function PhotoClick(obj) { var classPhotoID = $(obj).attr("classPhotoID"); var url = window.location.href; url= App.AddQueryToUrl(url, "classPhotoID",classPhotoID); $(obj).attr("href",url); } function hotoDetails(obj) { $("#gallery").show(); $("#albumWrap").hide(); $("#page").hide(); $("#photoComment").hide(); } App.delPhoto = function (obj) { var photoName = $(obj).parent().prev().text(); var photoID = $(obj).parent().parent().prev().find("img").attr("photoid"); App.confirm("确定要删除\" " + photoName + " \"这张照片吗?", function () { $.ajax({ async: true, dataType: "json", data: { photoID: photoID }, url: "/Ajax/DelPhoto/", cache: false, type: "post", success: function (o) { if (o.Code == "A00018") { $(obj).parent().parent().parent().remove(); App.fullTip("删除成功", 1000, null, 3); return; } if (o.Code == "A00001") { App.showLoginDial(); return; } if (o.Code == "A00003") { App.alert(CodeList[o.Code]); return; } }, error: function () { App.alert(CodeList["A00003"]); } }); }); } App.delPhotoFolder = function (obj) { var photoName = $(obj).parent().prev().text(); var photoID = $(obj).parent().parent().prev().find("img").attr("photoid"); App.confirm("确定要删除\" " + photoName + " \"这张照片吗?<br />此分组下的人不会被取消关注。", function () { $.ajax({ async: true, dataType: "json", data: { photoID: photoID }, url: "/Ajax/DelPhoto/", cache: false, type: "post", success: function (o) { if (o.Code == "A00018") { $(obj).parent().parent().parent().remove(); App.fullTip("删除成功", 1000, null, 3); return; } if (o.Code == "A00001") { App.showLoginDial(); return; } if (o.Code == "A00003") { App.alert(CodeList[o.Code]); return; } }, error: function () { App.alert(CodeList["A00003"]); } }); }); }
JavaScript
jQuery.fn.extend({ JQP_ClickOther: function () { // function isInside(e, target) { // var x = e.pageX; // var y = e.pageY; // var left = target.offset().left; // var width = target.width(); // var top = target.offset().top; // var height = target.height(); // if (x > left && x < left + width && y > top && y < top + height) return true; // return false; // } // if (window.click_other == null) { // window.click_other = new Array(); // } // this.except = null; // var func = arguments[0]; // if (typeof (func) == "string") { // this.except = document.getElementById(func); // func = arguments[1]; // } // window.click_other.push({ target: this, func: func }); // $(document).click(function (e) { // for (var i = 0; i < click_other.length; i++) { // var item = window.click_other[i]; // var target = $(item.target); // if (isInside(e, target)) continue; // if (item.target.except) { // var except = $(item.target.except); // if (isInside(e, except)) continue; // } // item.func(); // } // }); // }, if (window.click_other == null) { window.click_other = new Array(); } window.click_other.push({ target: this, func: arguments[0] }); $(document.body).click(function (e) { for (var i = 0; i < click_other.length; i++) { var item = window.click_other[i]; var target = item.target; if (typeof (target) == "String") target = $(target)[0]; if (e.target == target) { continue; } var index = $(e.target).parents().index(target); if (index == -1) { item.func(); } } }); // var foo = arguments[0]; // this.bind("click", function (e) { e.stopPropagation(); }); // $(document.body).bind("click",foo); }, JQP_UnClickOther: function () { if (window.click_other == null) { return; } for (var i = 0; i < window.click_other.length; i++) { var item = window.click_other[i]; if (item.target[0] == this[0]) { window.click_other.splice(i, 1); break; } } } });
JavaScript
(function ($) { var itemindex = 1; var itemcount = 0; $.fn.JQP_EmailNote = function (options) { var deafult = { arrayEmail: ["sina.com", "sina.com.cn", "163.com", "qq.com", "sohu.com"], //默认邮箱数组 selfn: null//选择之后触发的时间 }; var ops = $.extend(deafult, options); itemcount = 0; itemindex = 1; var InitNote = function (loginCtr, arrayEmail) { if (typeof (loginCtr) == "object" && typeof (arrayEmail) == "object") { var offset = loginCtr.offset(); var ulStr = "<div><ul style='display:none;width:198px;left:" + offset.left + "px;top:" + (parseInt(offset.top) + parseInt(loginCtr.height())) + "px' id='sinaNote' class='passCard'><li class='note'>请选择邮箱类型</li><li id='sinaNote_MenuItem_Title' style='color: rgb(0, 0, 0); background-color: rgb(232, 244, 252);'></li></ul></div>"; if ($("#sinaNote")[0] == null) $("body").append(ulStr); var note = $("#sinaNote"); loginCtr[0].onkeyup = function (e) { var currKey = 0, e = e || event; currKey = e.keyCode || e.which || e.charCode; offset = loginCtr.offset(); $("#sinaNote").css("left", offset.left + "px"); $("#sinaNote").css("top", (parseInt(offset.top) + parseInt(loginCtr.height())) + "px"); if (currKey != 38 && currKey != 40 && currKey != 13) { initliItem(loginCtr, arrayEmail); note.show(); itemindex = 1; itemcount = $("ul.passCard>li").length - 1; } else { note.show(); var lis = $("ul.passCard>li") switch (currKey) { case 38: if (itemindex == 1) { itemindex = lis.length - 1; liSelected($(lis[itemindex])); } else { itemindex--; liSelected($(lis[itemindex])); } break; case 40: if (itemindex == lis.length - 1) { itemindex = 1; liSelected($(lis[itemindex])); } else { itemindex++; liSelected($(lis[itemindex])); } break; case 13: $(this).val($(lis[itemindex]).text()); note.hide(); itemcount = 0; itemindex = 1; ops.selfn(); //$("#password_text").focus(); break; } } }; $(document).bind("click", function () { note.hide(); itemcount = 0; itemindex = 1; }); $("ul.passCard").hover(function (e) { }, function () { liSelected($("#sinaNote_MenuItem_Title")); itemcount = 0; itemindex = 1; }); } }; var initliItem = function (loginCtr, arrayEmail) { var value = $.trim(loginCtr.val()); $("#sinaNote").html("<li class='note'>请选择邮箱类型</li><li id='sinaNote_MenuItem_Title' select='1' style='color: rgb(0, 0, 0); background-color: rgb(232, 244, 252);'></li>"); $("#sinaNote_MenuItem_Title").text(value); $("#sinaNote_MenuItem_Title").attr("title", value); BindLiEvent($("ul.passCard li:last-child"), loginCtr); $.each(arrayEmail, function (i, v) { if (value.indexOf('@@') < 0) { if (value.indexOf('@') >= 0 && value.split('@')[1] != "") { if (value.split('@')[1] == v || v.indexOf(value.split('@')[1]) == 0) { var sd = "<li select='0' title='" + value.split('@')[0] + "@" + v + "' id='sinaNote_MenuItem_" + v + "'>" + value.split('@')[0] + "@" + v + "</li>"; $("#sinaNote").append(sd); } } else { if (value.indexOf('@') >= 0) $("#sinaNote").append("<li select='0' title='" + value + v + "' id='sinaNote_MenuItem_" + v + "'>" + value + v + "</li>"); else $("#sinaNote").append("<li select='0' title='" + value + "@" + v + "' id='sinaNote_MenuItem_" + v + "'>" + value + "@" + v + "</li>"); } BindLiEvent($("ul.passCard li:last-child"), loginCtr); } }); }; var BindLiEvent = function (li, loginCtr) { if (typeof (li) == "object") { li.bind("click", function () { loginCtr.val(li.text()); ops.selfn(); //$("#password_text").focus(); }); li.hover(function (e) { liSelected(li); }); } }; var liSelected = function (li) { if (typeof (li) == "object") { $("li[select='1']").css("color", "rgb(153, 153, 153)"); $("li[select='1']").css("background-color", "white"); $("li[select='1']").attr("select", "0"); li.css("color", "rgb(0, 0, 0)"); li.css("background-color", "rgb(232, 244, 252)"); li.attr("select", "1"); } }; InitNote(this, ops.arrayEmail); } })(jQuery);
JavaScript
/// <reference path="Common/jquery-1.4.4.min.js" /> /// <reference path="App.js" /> var curTxt = ""; var publish_editor =null; var checkTxtLen = function () { if (curTxt != publish_editor.value) { curTxt = publish_editor.value; var normal = "你还可以输入<span class=\"pipsLim\">0</span>字"; var error = "<div class=\"word_c\"><img class=\"tipicon tip2\" alt=\"\" title=\"\" src=\"/Content/Image/transparent.gif\"><strong>已超出<span>1</span>字</strong></div><b class=\"rcorner\"></b>"; var curLen = App.getTxtLen($("#publish_editor")); if (curLen <= 280) { $("#publisher_info").html(normal); $("#publisher_info").find(".pipsLim").html(parseInt((280 - curLen) / 2)); $("#publisher_info").removeClass("error"); if (curLen != 0) { $(".postBtnBg").removeClass("bgColorA_No"); } else { $(".postBtnBg").addClass("bgColorA_No"); } return true; } else { $("#publisher_info").html(error); $("#publisher_info").find("span").html(parseInt((curLen - 280 + 1) / 2)); $("#publisher_info").addClass("error"); $(".postBtnBg").addClass("bgColorA_No"); return false; } } }; $(document).ready(function () { publish_editor = $("#publish_editor")[0]; $("#publisher_faces").click(function (e) { e.stopPropagation(); return App.showExpression($("#publish_editor"), this); }); $("#publisher_pic").click(function (e) { e.stopPropagation(); return App.showPicUpload(this); }); $("#publisher_video").click(function (e) { e.stopPropagation(); return App.ShowVideoDiaDiv($("#publish_editor"), this); }); $("#publisher_music").click(function () { return App.showMusicDiaDiv($("#publish_editor"), this); }); $("#publisher_vote").click(function () { return App.showVote($("#publish_editor"), this); }); App.bindTxtarea($("#publish_editor")[0]); $("#publisher_topic").click(function () { App.insertTopic($("#publish_editor")[0]); }); $("#publisher_submit").click(function () { if ($("#publish_editor").val() == "") { App.highLineTxtBox($("#publish_editor")); return; } curTxt = ""; if (!checkTxtLen()) { App.alert("超过字数了"); return; } App.disableAtag($(this)); App.CreateOriginalMiniBlog($("#publish_editor"), function () { App.tip("发布成功", 1000, window.location.href); $("#publish_editor").val(""); }, function () { App.enableAtag($("#publisher_submit")); }); }); App.TimerFunArray.push(checkTxtLen); App.TimerFunArray.push(App.ajaxAtWho); App.StartTimer(); App.initMedia(); App.bindGoTop(curBorder); App.initNameCard($("#feed_list")); }); window.onload = function () { var voteItems = $("div[type='vote']"); for (var i = 0; i < voteItems.length; i++) { var img = $(voteItems[i]).find("img")[0]; var img1 = $(voteItems[i]).find("img")[1]; $(img1).css("left", parseInt(($(img).width() - 33) / 2)).css("top", parseInt(($(img).height() - 33) / 2)).css("position", "absolute"); $(img1).show(); } };
JavaScript
/// <reference path="Common/jquery-1.4.4.js" /> function loginCallBack(isSucess) { if ($("#mod_login_tip")[0] == null) { $("body").append(errorHtml); bindCloseEvent($("#mod_login_close"), $("#mod_login_tip")); } if (!isSucess) { $("#mod_login_title").text("登录名或密码错误"); $("#mod_login_content").show(); $("#mod_login_content").html("<p class='stxt2'>1、如果登录名是邮箱地址,</p><p class='stxt'>请输入全称,例如yourname@xxxx.com</p><p class='stxt2'>2、请检查登录名大小写是否正确。</p><p class='stxt2'>3、请检查密码大小写是否正确。</p>"); setErrorDivPosition($("#mod_login_tip"), $("#loginname")); $("#mod_login_tip").show(); } else { if (arguments[1] == 0) { $("#mod_login_title").text("你的账号还没有验证"); $("#mod_login_content").show(); $("#mod_login_content").html("<p class='stxt'>如果没收到请尝试点击<a id='resend' href='javascript:void(0);' \">重发</a></p><p class='stxt'>如果实在收不到,请重新注册</p>"); setErrorDivPosition($("#mod_login_tip"), $("#loginname")); $("#mod_login_tip").show(); $("#resend").click(function () { $("#mod_login_tip").hide(); App.ajax_resendEmail($("#loginname").val()); return false; }); } if (arguments[2] != null) { window.location.href = arguments[2]; return; } if (arguments[1] == 1) { window.location.href = "/User/fullinfo/"; } if (arguments[1] == 2) { window.location.href = "/"; } } } var errorHtml = "<div id='mod_login_tip' style=\"display:none;\" class='errorLayer'><div class='top'></div><div class='mid'><div id='mod_login_close' class='close'>x</div><div class='conn'> <p id='mod_login_title' class='bigtxt'></p><span style='padding: 0px; display: none;' id='mod_login_content' class='stxt'></span></div></div><div class='bot'></div></div>"; var checkLogin = function () { if ($("#loginname").val() == "邮箱/会员帐号/手机号" || $.trim($("#loginname").val()) == "") { if ($("#mod_login_tip")[0] == null) { $("body").append(errorHtml); bindCloseEvent($("#mod_login_close"), $("#mod_login_tip")); } $("#mod_login_title").text("请输入登录名"); $("#mod_login_content").hide(); setErrorDivPosition($("#mod_login_tip"), $("#loginname")); $("#mod_login_tip").show(); $("#loginname").focus(); $("#password_text").blur(); return; } if ($("#password").val() == "") { if ($("#mod_login_tip")[0] == null) { $("body").append(errorHtml); bindCloseEvent($("#mod_login_close"), $("#mod_login_tip")); } $("#password_text").focus(); $("#mod_login_title").text("请输入密码"); $("#mod_login_content").hide(); setErrorDivPosition($("#mod_login_tip"), $("#password")); $("#mod_login_tip").show(); return; } $("#mod_login_tip").hide(); $("#hdLoginname").val($("#loginname").val()); $("#hdPassword").val($("#password").val()); $("#hdReUsername").val($("#remusrname").attr("checked")); if (App.request("BackUrl") != "") { var action = $("#loginForm").attr("action"); action += ("/?BackUrl=" + App.request("BackUrl")); $("#loginForm").attr("action", action); } if ($.browser.msie) { window.loginForm.submit(); } else { $("#loginForm").submit(); } } var bindCloseEvent = function (btnClose, needCloseDiv) { btnClose.bind("click", function () { needCloseDiv.hide(); }); } var setErrorDivPosition = function (div, inputCtr) { var offset = inputCtr.offset(); var l = offset.left; var t = offset.top - div.height(); div.css("position", "absolute"); div.css("left", l + "px"); div.css("top", t + "px"); div.css("z-index", "9999"); } var index = { init: function () { $("#loginname").focus(function () { var logininput = $(this); logininput.css("color", "rgb(51, 51, 51)"); if (logininput.val() == "邮箱/会员帐号/手机号") logininput.val(""); }); $("#loginname").blur(function () { var logininput = $(this); logininput.css("color", "rgb(153, 153, 153)"); if (logininput.val() == "") logininput.val("邮箱/会员帐号/手机号"); }); $("#password_text").focus(function () { $(this).hide(); $("#password").show(); $("#password").focus(); $("#password").click(); $("#password").css("color", "rgb(51, 51, 51)"); }); $("#password").blur(function () { if ($(this).val() == "") { $("#password_text").show(); $("#password_text").blur(); $(this).hide(); } else { $(this).css("color", "rgb(153, 153, 153)"); } }); $("#password").focus(function () { $(this).css("color", "rgb(51, 51, 51)"); }); $("#login_submit_btn").bind("click", checkLogin); $("#password").bind("keyup", function (e) { if (e.keyCode == 13) checkLogin(); }); } } //function pageX(elem) { // return elem.offsetParent ? elem.offsetLeft + pageX(elem.offsetParent) : elem.offsetLeft; //} //function pageY(elem) { // return elem.offsetParent ? elem.offsetTop + pageY(elem.offsetParent) : elem.offsetTop; //}
JavaScript
/// <reference path="App.js" /> App.FriendManage = { groupList: [], curGroup: null, initFollowAssignBox: function () { var addedContaner = $(".tagList"); var addInput = addedContaner.find("input"); var addedValue = $("#group_member_add_input"); addedContaner.click(function () { addInput.focus(); if (addInput.val() == "") { App.appendToBody($(".mbf_input_layer"), "<div class=\"mbf_input_layer\" style=\"position: absolute; z-index: 1200; display: none;\">可输入关注人名称</div>"); var offset = addInput.offset(); $(".mbf_input_layer").show().css("left", offset.left).css("top", offset.top + addInput.height() + 5); } else { $(".mbf_input_layer").hide(); } }); addInput.keyup(function () { if (addInput.val().length > 0) { addInput.css("width", addInput.val().length * 13 + 6); $(".mbf_input_layer").hide(); } }).blur(function () { $(".mbf_input_layer").hide(); }); App.autoComplete(addInput, function (id, name) { if (new RegExp("a" + id + "a", "i").test(addedValue.val())) return; var newitem = $("<li id='tag{1}' class=\"tagListli\">{0}<a href=\"javascript:void(0);\" class=\"close\"><img src=\"/Content/Image/close.gif\"></a></li>".replace("{0}", name).replace("{1}", id)); newitem.insertBefore(addInput.parent()); newitem.find(".close").click(function () { addedValue.val(addedValue.val().replace("a" + newitem.attr("id").replace("tag", "") + "a,", "")); newitem.remove(); }); addInput.css("width", 6); addInput.val(""); App.OriKey = ""; addedValue.val(addedValue.val() + "a" + id + "a,"); }, "GetFollowListByKey"); $(".arrowup").click(function (e) { e.stopPropagation(); App.FriendManage.showFollowLayer(addedContaner, function () { }); }); $("#group_member_add_btton").click(function () { if (addedValue.val() == "") { return; } if (this.locked) return; this.locked = true; var btn = this; $.ajax({ dataType: "json", data: { gid: App.FriendManage.curGroup.ID, follows: addedValue.val().replace(/a/ig, "") }, url: "/Ajax/AssignFollowsToGroup/", cache: false, type: "post", success: function (o) { if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00003") { App.alert(CodeList[o.Code]); } else if (o.Code = "A00004") { App.fullTip(CodeList[o.Code], 1000, "/"+App.config.curUid+"/follow", 3); } btn.locked = false; }, error: function () { App.alert(CodeList["A00003"]); btn.locked = false; } }); }); }, followLayer: "<div class=\"mbFollowLayer\" style=\"position: absolute;z-index: 900;\"><div class=\"mflshadow_right\"></div><div class=\"mflshadow_bottom\"></div><div class=\"mbf_tag\"><ul></ul></div><div class=\"mbFL_person\"></div><div class=\"mbFL_comment\" style=\"display: none;\"><p class=\"txt\"><img title=\"\" alt=\"\" src=\"/Content/Image/transparent.gif\" class=\"tipicon tip5\">&nbsp;该分组没有关注人。</p></div><div class=\"mbFL_person_bottom\"><a id='closeLayer' class=\"btn_normal btnxs lf\" href=\"javascript:void(0);\"><em>关闭</em></a><div id='boxPage' class=\"fanye rt\"></div></div></div>", showFollowLayer: function (showWhere, itemClickCallBack) { var layer = $(".mbFollowLayer"); if (App.appendToBody($(".mbFollowLayer"), this.followLayer)) { layer = $(".mbFollowLayer"); layer.JQP_ClickOther(function () { layer.hide(); }); $("#closeLayer").click(function () { layer.hide(); }); tagTemplate = "<li title=\"{name}\"><div class=\"mbf_tago\"><span onclick=\"App.FriendManage.TabFollowLayer(this);App.FriendManage.getFollowsToAssignBox('{type}','{gid}',1,12)\" style=\"display: none;\"><a href=\"javascript:void(0)\">{name}</a></span><span style=\"\">{name}</span></div></li>"; tagTemplate1 = "<li title=\"{name}\"><div class=\"mbf_tagn\"><span gid='{gid}' onclick=\"App.FriendManage.TabFollowLayer(this);App.FriendManage.getFollowsToAssignBox('{type}','{gid}',1,12)\" style=\"\"><a href=\"javascript:void(0)\">{name}</a></span><span style=\"display: none;\">{name}</span></div></li>"; var str = []; str.push(tagTemplate.replace(/\{name\}/ig, "全部").replace("{type}", "all").replace(/\{gid\}/gi, -1)); str.push(tagTemplate1.replace(/\{name\}/ig, "未分组").replace("{type}", "ng").replace(/\{gid\}/gi, -1)); if (this.groupList.length < 4) { for (var i = 0; i < this.groupList.length; i++) { var name = ""; if (App.byteLength(this.groupList[i].Name) > 8) { name = App.GetStringByte(this.groupList[i].Name, 8) + "..."; } else { name = this.groupList[i].Name; } str.push(tagTemplate1.replace(/\{name\}/ig, name).replace("{type}", "-1").replace(/\{gid\}/gi, this.groupList[i].ID)); } } else { for (var i = 0; i < 4; i++) { var name = ""; if (App.byteLength(this.groupList[i].Name) > 8) { name = App.GetStringByte(this.groupList[i].Name, 8) + "..."; } else { name = this.groupList[i].Name; } str.push(tagTemplate1.replace(/\{name\}/ig, name).replace("{type}", "-1").replace(/\{gid\}/gi, this.groupList[i].ID)); } str.push("<li><div class=\"mbf_last\"><span><a href=\"javascript:void(0);\"><img class=\"mbfl_sicon\" src=\"/Content/Image/transparent.gif\"></a></span></div><div class=\"mbfl_other\" style=\"top: 29px; left: -99px; z-index: 1000;display:none;\"><ul>"); for (var i = 4; i < this.groupList.length; i++) { str.push(("<li gid='{gid}' onclick=\"App.FriendManage.getFollowsToAssignBox('{type}','{gid}',1,12);App.FriendManage.liToTab(this,event);\"><a href=\"javascript:void(0);\">" + this.groupList[i].Name + "</a></li>").replace("{type}", -1).replace(/\{gid\}/gi, this.groupList[i].ID)); } str.push("</ul></div></div></li>"); } layer.find(".mbf_tag ul").html(str.join("")); var otherLayer = $(".mbfl_other"); otherLayer.JQP_ClickOther(function () { otherLayer.hide(); }); $(".mbf_last").click(function (e) { e.stopPropagation(); otherLayer.show(); }); } showWhere = $(showWhere); var offset = showWhere.offset(); layer.css("left", offset.left).css("top", offset.top + showWhere.height() + 5); layer.show(); $(".mbf_tag li:first span:first").click(); }, TabFollowLayer: function (ctrl) { if (ctrl.style.display != "none") { $(".mbf_tago").attr("class", "mbf_tagn").find("span").hide()[0].style.display = "block"; $(ctrl).hide().next().show().parent().attr("class", "mbf_tago"); } }, liToTab: function (ctrl, event) { $(".mbf_tago").attr("class", "mbf_tagn").find("span").hide()[0].style.display = "block"; var li = $(ctrl); var tab = $($(".mbf_tag li")[5]); var liName = li.find("a").text(); var tabName = $(tab.find("span")[1]).text(); var ligid = li.attr("gid"); var tabgid = tab.find("span:first").attr("gid"); tab.html("<div class=\"mbf_tago\"><span gid='{gid}' onclick=\"App.FriendManage.TabFollowLayer(this);App.FriendManage.getFollowsToAssignBox('{type}','{gid}',1,12)\" style=\"display: none;\"><a href=\"javascript:void(0)\">{name}</a></span><span style=\"\">{name}</span></div>".replace(/\{name\}/ig, liName).replace("{type}", "-1").replace(/\{gid\}/gi, ligid)); tab.attr("title", liName); $(("<li gid='{gid}' onclick=\"App.FriendManage.getFollowsToAssignBox('{type}','{gid}',1,12);App.FriendManage.liToTab(this,event);\"><a href=\"javascript:void(0);\">" + tabName + "</a></li>").replace("{type}", -1).replace(/\{gid\}/gi, tabgid)).insertAfter(li); li.remove(); if ($.browser.msie) { event.cancelBubble = true; event.returnValue = false; } else { event.preventDefault(); event.stopPropagation(); } }, getFollowsToAssignBox: function (type, gid, page, pagesize) { var container = $(".mbFL_person"); var noperson = $(".mbFL_comment"); $.ajax({ dataType: "json", data: { type: type, gid: gid, page: page, pagesize: pagesize }, url: "/Ajax/GetFollowByAssignBox/", cache: false, type: "post", success: function (o) { if (o.Code == "A00017") { container.hide(); noperson.show(); $("#boxPage").html(""); return; } if (o.Code == "A00001") { App.showLoginDial(); return; } if (o.Code == "A00003") { App.alert(CodeList[o.Code]); return; } var template = "<li id='li{ID}' style=\"display: block;\" class=\"\" title=\"{Name}\"><div class=\"mbFL_top\"></div><div class=\"mbFL_cen\"><div class=\"head_pic\"><a><img class=\"picborder_l\" src=\"{avatar}\"></a><img class=\"tipicon tip3\" src=\"/Content/Image/transparent.gif\" style=\"display: none;\"></div><div class=\"mbFLcen_con\"><p class=\"head_name\">{Title}</p><p></p></div></div><div class=\"mbFL_bottom\"></div></li>"; var template1 = "<li id='li{ID}' style=\"display: block;\" class=\"mbFL_current\" title=\"{Name}\"><div class=\"mbFL_top\"></div><div class=\"mbFL_cen\"><div class=\"head_pic\"><a><img class=\"picborder_l\" src=\"{avatar}\"></a><img class=\"tipicon tip3\" src=\"/Content/Image/transparent.gif\" style=\"\"></div><div class=\"mbFLcen_con\"><p class=\"head_name\">{Title}</p><p></p></div></div><div class=\"mbFL_bottom\"></div></li>"; var str = []; str.push("<ul>"); var follows = o.Data; for (var i = 0; i < follows.length; i++) { var isSel = false; if (new RegExp("a" + follows[i].ID + "a", "i").test($("#group_member_add_input").val())) isSel = true; if (isSel) str.push(template1.replace("{Name}", follows[i].NickName).replace("{ID}", follows[i].ID).replace("{Title}", follows[i].Title).replace("{avatar}", follows[i].avatar)); else str.push(template.replace("{Name}", follows[i].NickName).replace("{ID}", follows[i].ID).replace("{Title}", follows[i].Title).replace("{avatar}", follows[i].avatar)); } str.push("</ul>"); container.show(); noperson.hide(); container.html(str.join("")); container.find("li").mouseenter(function () { if (this.className != "mbFL_current") this.className = "mbFL_hover" }).mouseleave(function () { if (this.className != "mbFL_current") this.className = "" }).click(function () { var addedContaner = $(".tagList"); var addInput = addedContaner.find("input"); var addedValue = $("#group_member_add_input"); var id = $(this).attr("id").replace("li", ""); if (this.className == "mbFL_current") { $(this).find("img:last").hide(); this.className = ""; addedValue.val(addedValue.val().replace("a" + id + "a,", "")); $("#tag" + id).remove(); } else { if (new RegExp("a" + id + "a", "i").test(addedValue.val())) return; var newitem = $("<li id='tag{1}' class=\"tagListli\">{0}<a href=\"javascript:void(0);\" class=\"close\"><img src=\"/Content/Image/close.gif\"></a></li>".replace("{0}", $(this).attr("title")).replace("{1}", id)); newitem.insertBefore(addInput.parent()); newitem.find(".close").click(function () { addedValue.val(addedValue.val().replace("a" + newitem.attr("id").replace("tag", "") + "a,", "")); newitem.remove(); }); this.className = "mbFL_current"; addedValue.val(addedValue.val() + "a" + id + "a,"); $(this).find("img:last").show(); } var layer = $(".mbFollowLayer"); var offset = addedContaner.offset(); layer.css("left", offset.left).css("top", offset.top + addedContaner.height() + 5); layer.show(); }); App.FriendManage.buildFollowPage(o, type, gid, page, pagesize); }, error: function () { if (o.Code == "A00003") { App.alert(CodeList[o.Code]); return; } } }); }, buildFollowPage: function (data, type, gid, page, pagesize) { if (typeof (data) == "object") { if (data.Count > 0) { var t = []; var size = pagesize; var pageNum = parseInt(data['Count'] / size); //get the total page number if (data['Count'] % size > 0) { pageNum++; }; if (pageNum > 0) { //the section of prev page if (page > 1) { t.push('<a class="btn_num" href="javascript:;" onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + (page - 1) + ',' + pagesize + ');return false;"><em>上一页</em></a> '); } //if the total page number less than 6 if (pageNum < 6) { for (var i = 1; i <= pageNum; i++) { if (page == i) { t.push('<span>' + i + '</span> '); } else { t.push('<a class="btn_num" href="javascript:;"onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + i + ',' + pagesize + ');return false;"><em>' + i + '</em></a> '); } } } else { //if the current page nummber less than 4 if (page < 4) { for (var i = 1; i <= 5; i++) { if (page == i) { t.push('<span>' + i + '</span> '); } else { t.push('<a class="btn_num" href="javascript:;"onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + i + ',' + pagesize + ');return false;"><em>' + i + '</em></a> '); } } t.push('...<a href="javascript:;" class="btn_num" onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + pageNum + ',' + pagesize + ');return false;"><em>' + pageNum + '</em></a> '); } else if ((pageNum - 3) < page) { t.push('<a class="btn_num" href="javascript:;" onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + 1 + ',' + pagesize + ');return false;"><em>' + 1 + '</em></a>...'); for (var i = (pageNum - 4); i <= pageNum; i++) { if (page == i) { t.push('<span>' + i + '</span> '); } else { t.push('<a class="btn_num" href="javascript:;"onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + i + ',' + pagesize + ');return false;"><em>' + i + '</em></a> '); } } } else if (3 < page < (pageNum - 2)) { t.push('<a class="btn_num" href="javascript:;" onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + 1 + ',' + pagesize + ');return false;"><em>' + 1 + '</em></a>...'); for (var i = (parseInt(page) - 2); i <= (parseInt(page) + 2); i++) { if (page == i) { t.push('<span>' + i + '</span> '); } else { t.push('<a class="btn_num" href="javascript:;"onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + i + ',' + pagesize + ');return false;"><em>' + i + '</em></a> '); } } t.push('...<a class="btn_num" href="javascript:;" onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + pageNum + ',' + pagesize + ');return false;"><em>' + pageNum + '</em></a> '); } }; //the section of next page if (page < pageNum) { t.push('<a class="btn_num" href="javascript:;" onclick="App.FriendManage.getFollowsToAssignBox(\'' + type + '\',\'' + gid + '\',' + (page + 1) + ',' + pagesize + ');return false;"><em>下一页</em></a>'); } }; $("#boxPage").html(t.join('')); } else { $("#boxPage").html(''); } } } } App.FriendManage.delGroup = function (ctrl, gid) { App.confirm("确定要删除\" " + this.curGroup.Name + " \"分组吗?<br />此分组下的人不会被取消关注。", function () { $.ajax({ dataType: "json", data: { gid: gid }, url: "/Ajax/DelGroup/", cache: false, type: "post", success: function (o) { if (o.Code == "A00018") { App.fullTip("删除成功", 1000, "/" + App.config.curUid + "/follow", 3); return; } if (o.Code == "A00001") { App.showLoginDial(); return; } if (o.Code == "A00003") { App.alert(CodeList[o.Code]); return; } }, error: function () { App.alert(CodeList["A00003"]); } }); }); } App.FriendManage.showGroupSelector = function (ctrl) { ctrl = $(ctrl); var layer = $(".cetdowme"); layer.attr("curUid", ctrl.attr("personid")); var offset = ctrl.offset(); layer.css("top", offset.top + 5 + ctrl.height()).css("left", offset.left).show(); var groupArr = ctrl.attr("groupids").replace(/a/ig, "").split(','); layer.find('input:checkbox').each(function () { this.checked = false; }); for (var i = 0; i < groupArr.length - 1; i++) { $("#group_selector_item_" + groupArr[i])[0].checked = true; } } App.FriendManage.initGroupCheckClick = function (checkbox) { var layer = $(".cetdowme"); $(checkbox).click(function () { if (this.checked) { var uid = layer.attr("curUid"); var gid = $(this).attr("ID").replace(/[^0-9]+/ig, ""); $.ajax({ dataType: "json", data: { uid: uid, gid: gid }, url: "/Ajax/EditFollowGroup/", cache: false, type: "post", success: function (o) { if (o.Code == "A00004") { var groupNames = o.Data.split('|')[0]; var groupIds = o.Data.split('|')[1]; $("a[personid='" + uid + "']").attr("title", groupNames).attr("groupids", groupIds).find("em").html(groupNames + "<img class=\"small_icon down_arrow\" src=\"/Content/Image/transparent.gif\">"); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); } }); } else { var uid = layer.attr("curUid"); var gid = $(this).attr("ID").replace(/[^0-9]+/ig, ""); $.ajax({ dataType: "json", data: { uid: uid, gid: gid }, url: "/Ajax/DelFollowGroup/", cache: false, type: "post", success: function (o) { if (o.Code == "A00004") { var groupNames = o.Data.split('|')[0]; var groupIds = o.Data.split('|')[1]; $("a[personid='" + uid + "']").attr("title", groupNames).attr("groupids", groupIds).find("em").html(groupNames + "<img class=\"small_icon down_arrow\" src=\"/Content/Image/transparent.gif\">"); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); } }); } }); } App.FriendManage.initGroupSelector = function () { var layer = $(".cetdowme"); var error = layer.find(".error_color"); var checkboxs = layer.find("input[type='checkbox']"); this.initGroupCheckClick(checkboxs); $(".btn_privacy").click(function (e) { e.stopPropagation(); App.FriendManage.showGroupSelector(this) }); layer.JQP_ClickOther(function () { layer.hide(); layer.attr("curUid", ""); }); var groupSelItems = $("p[sel='1']"); groupSelItems.mouseenter(function () { groupSelItems.css("class", ""); this.className = "hover"; }).mouseleave(function () { this.className = ""; }); layer.find("#gcBtn").click(function () { $(this).parent().prev().hide().next().hide().nextAll().show(); $(".cetdowme .error_color").hide(); }); layer.find(".btn").find("a:last").click(function () { layer.find(".MIB_linedot1").show().next().show().nextAll().hide(); }).prev().click(function () { var input = layer.find("input[type='text']"); if ($.trim(input.val()) == "") { error.text("请输入分组名"); error.show(); return false; } var len = App.byteLength(input.val()); if (len > 16) { error.text("请不要超过16个字符"); error.show(); return false; } if (this.locked) return false; this.locked = true; var thisBtn = this; $.ajax({ dataType: "json", data: { Name: $.trim(input.val()) }, url: "/Ajax/AddGroup/", cache: false, type: "post", success: function (o) { if (o.Code == "A00009") { if (groupSelItems[0]) $("<p sel=\"1\"><input type=\"checkbox\" class=\"labelbox\" id=\"group_selector_item_{id}\"><label for=\"group_selector_item_{id}\" title=\"{name}\">{name}</label></p>".replace(/\{name\}/ig, o.Data.Name).replace(/\{id\}/ig, o.Data.ID)).insertAfter(groupSelItems.last()); else $("<p sel=\"1\"><input type=\"checkbox\" class=\"labelbox\" id=\"group_selector_item_{id}\"><label for=\"group_selector_item_{id}\" title=\"{name}\">{name}</label></p>".replace(/\{name\}/ig, o.Data.Name).replace(/\{id\}/ig, o.Data.ID)).insertBefore(layer.find(".MIB_linedot1")); if ($(".mbFollowLayer")[0]) $(".mbFollowLayer").remove(); App.FriendManage.groupList.push(o.Data); App.FriendManage.initGroupCheckClick($("#group_selector_item_" + o.Data.ID)); $("p[sel='1'] :last").mouseenter(function () { $("p[sel='1']").css("class", ""); this.className = "hover"; }).mouseleave(function () { this.className = ""; }); layer.find(".MIB_linedot1").show().next().show().nextAll().hide(); } else if (o.Code == "A00015") { error.text(CodeList[o.Code]); error.show(); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } thisBtn.locked = false; }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); thisBtn.locked = false; } }); }); } App.FriendManage.cancelFollow = function (id, name, alink) { if (alink.locked) return; App.miniConfirm("是否取消关注" + name, alink, function () { alink.locked = true; App.CancelFollow(id, function (ID, O) { $("li[id='" + id + "']").fadeOut(); }, function () { alink.locked = false; }); }); }; App.FriendManage.cancelFan = function (id, name, alink) { if (alink.locked) return; App.miniConfirm("是否移除" + name, alink, function () { alink.locked = true; App.CancelFan(id, function (ID, O) { $("li[id='" + id + "']").fadeOut(); }, function () { alink.locked = false; }); }); }; App.FriendManage.follow = function (id, name, alink) { if (alink.locked) return false; alink.locked = true; App.FollowOne(id, name, function (Id, Name, o) { $('<p class="mutual"><img class="small_icon sicon_atteo" title="互相关注中" src="/Content/Image/transparent.gif"></p>').insertAfter($(alink).parent()); $(alink).parent().remove(); }, function () { alink.locked = false; }); } App.FriendManage.followOne = function (id, name, alink) { if (alink.locked) return false; alink.locked = true; App.FollowOne(id, name, function (Id, Name, o) { $("<a href='javascript:void(0);' class='concernBtn_Yet'><span class='add_yet'></span>已关注</a>").insertAfter($(alink)); $(alink).remove(); }, function () { alink.locked = false; }); };
JavaScript
(function ($) { $.fn.JQP_HighLineInput = function (options) { var deafult = { focusColor: "rgb(51, 51, 51)", blurColor: "rgb(153, 153, 153)" }; var ops = $.extend(deafult, options); this.focus(function () { $(this).css("color", ops.focusColor); }); this.blur(function () { $(this).css("color", ops.blurColor); }); } })(jQuery); (function ($) { $.fn.JQP_HighLineInput2 = function (options) { var deafult = { focusColor: "rgb(51, 51, 51)", blurColor: "rgb(153, 153, 153)", nullCon:"请输入内容" }; var ops = $.extend(deafult, options); this.focus(function () { $(this).css("color", ops.focusColor); if($(this).val()==ops.nullCon){ $(this).val(""); } }); this.blur(function () { $(this).css("color", ops.blurColor); if($(this).val()==""){ $(this).val(ops.nullCon); } }); return this; } })(jQuery);
JavaScript
$(function(){ $("#guide-step .tipSwitch").live("click",function(){ showSearchTip(); setSearchTip(); SetCookie("tStatus",1); }); }) function nextStep(next){ $(".tipbox").css({"visibility":"hidden","display":"none"}); $(".tipbar").hide(); $("#step" + next).css({"visibility":"visible","display":"block"}); $("#tipbar" + (next -1)).show(); if(next == 2) { $("#searchTip").css("top","307px"); }else if(next == 3) { $("#searchTip").css("top","770px"); }else{ $("#searchTip").css("top","630px"); } if(next == 4){ $(".tipSwitchAnimate").css("top","539px"); }else if(next == 6){ $(".tipSwitchAnimate").css("top","357px"); }else { $(".tipSwitchAnimate").css("top","352px"); } $(".tipSwitchAnimate").css("left","410px"); } //关闭提示框 function hideTip(){ $("#searchTipBg").hide(); $("#searchTip").hide(); $(".tipbar").hide(); $(".tipbox").css({"visibility":"hidden","display":"none"}); $("#step1").css({"visibility":"visible","display":"block"}); SetCookie("tipVisible","no"); $(".tipSwitchAnimate").show().animate({ "left":"1015px", "top": "5px" },500,function(){ $(".tipSwitchAnimate").css({ "left": "410px", "top": "5px" }).hide(); }); } function setSearchTip(){ var windowW = $(window).width(), windowH = $(window).height(), width = $("#searchTip").width(), ml = width/2; if($("#searchTip").length > 0 && $("#searchTipBg").length > 0){ if($.browser.msie && $.browser.version == '6.0' && !$.support.style){ var scrollT = $(window).scrollTop(), scrollL = $(window).scrollLeft(); $("#searchTipBg").css({"width":windowW + scrollL,"height":windowH + scrollT}); }else { $("#searchTipBg").css({"width":windowW,"height":windowH}); } $("#searchTip").css({"margin-left":-ml}); } } function noShow(){ if(document.getElementById("notip").checked){ SetCookie("neverShow","no",{expires:37230}); } } function showSearchTip(){ var position = $.browser.msie && $.browser.version == '6.0' && !$.support.style ? "absolute" : "fixed"; var searchTipBar = "<div class='tipbarwrap'><div class='tipbardiv'>"; searchTipBar += "<div class='tipbar' id='tipbar1'><div class='tipbarInner'><div class='arrow'></div><div class='tipBarword'></div></div></div>"; searchTipBar += "<div class='tipbar' id='tipbar2'><div class='tipbarInner'><div class='arrow'></div><div class='tipBarword'></div></div></div>"; searchTipBar += "<div class='tipbar' id='tipbar3'><div class='tipbarInner'><div class='arrow'></div><div class='tipBarword'></div></div></div>"; searchTipBar += "</div></div>"; var searchTipInner = "<div class='tipbox' id='step1'><div class='tipword'></div><span class='tipboxBtn' onclick='hideTip()'></span><span class='tipboxNextbtn' onclick='nextStep(2)'></span><ol class='progress'><li class='on'></li><li></li><li></li><li></li></ol></div>"; searchTipInner += "<div class='tipbox' id='step2'><div class='tipword'></div><span class='tipboxBtn' onclick='hideTip()'></span><a class='tipboxNextbtn' onclick='nextStep(3)'></a><ol class='progress'><li></li><li class='on'></li><li></li><li></li></ol></div>"; searchTipInner += "<div class='tipbox' id='step3'><div class='tipword'></div><span class='tipboxBtn' onclick='hideTip()'></span><a class='tipboxNextbtn' onclick='nextStep(4)'></a><ol class='progress'><li></li><li></li><li class='on'></li><li></li></ol></div>"; searchTipInner += "<div class='tipbox' id='step4'><div class='tipword'></div><span class='tipboxBtn' onclick='hideTip()'></span><span class='tipboxNextbtn' onclick='hideTip();noShow()'></span><div class='notip'><input type='checkbox' id='notip' /><label for='notip'>不再提示</label></div></div>"; var switchBtn = "<div class='tipSwitchAnimate tipSwitch' style='display:none; left:410px; top:353px;'></div>"; if($("#searchTip").length == 0){ $("#guide-step").before("<div id='searchTipBg' style='width:100%; height:100%; left:0px; top:0px; z-index:999; background-color:#000; opacity:0.55; filter:alpha(opacity=55);position:"+ position +"'></div>"); $("#guide-step").before("<div id='searchTip' style='left:50%; top:270px; z-index:1005; background-color:transparent; position:absolute;'>"+ searchTipInner +"</div>"); $("#guide-step").before(searchTipBar); $(switchBtn).appendTo($(".tipbardiv")); $("#step1").css({"visibility":"visible","display":"block"}); if(GetCookie("tipVisible") == "no" || GetCookie("neverShow") == "no"){ $("#step4 .notip").hide(); } } if($("#searchTip").css("display") == "none"){ $("#searchTip").css("top","270px").show(); $("#searchTipBg").show(); $(".tipbox").css({"visibility":"hidden","display":"none"}); $("#step1").css({"visibility":"visible","display":"block"}); } if($(".tipbarwrap").css("display") == "none"){ $(".tipbarwrap").show(); } } function GetCookie(name){ var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null) return decodeURIComponent(arr[2]); return null; } function SetCookie(name,value,options){ var expires = '', path = '', domain = '', secure = ''; if(options) { if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var exp; if (typeof options.expires == 'number') { exp = new Date(); exp.setTime(exp.getTime() + options.expires*24*60*60*1000); } else{ exp = options.expires; } expires = ';expires=' + exp.toUTCString(); } path = options.path ? '; path=' + options.path : ''; domain = options.domain ? ';domain=' + options.domain : ''; secure = options.secure ? ';secure' : ''; } document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); }
JavaScript
/// <reference path="Common/jquery-1.4.4.js" /> Date.prototype.format = function (format) //author: meizz { var o = { "M+": this.getMonth() + 1, //month "d+": this.getDate(), //day "h+": this.getHours(), //hour "m+": this.getMinutes(), //minute "s+": this.getSeconds(), //second "q+": Math.floor((this.getMonth() + 3) / 3), //quarter "S": this.getMilliseconds() //millisecond } if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); return format; } //wat_sun 2012年12月3日16:32:36 //校验是否全由数字组成 function isDigit(s) { var patrn = /^[0-9]{1,20}$/; if (!patrn.exec(s)) return false; return true; } //wat_sun 2012年12月3日16:32:36 //校验是否全由数字组成 function isDigit(s) { var patrn = /^[0-9]{1,20}$/; if (!patrn.exec(s)) return false; return true; } String.prototype.ToInt = function () { var result = parseInt(this); if (this.length < 1 || isNaN(this) || result < 0) { return 0; } return result; } String.prototype.ToFloat = function () { var result = parseFloat(this); if (this.length < 1 || isNaN(this) || result < 0) { return 1; } return this; } //Layer var dialDiv = "<div {id} class='4CancelAllLayer' style='position: absolute; z-index: 1600;'><table class='mBlogLayer'><tbody><tr><td class='top_l'></td><td class='top_c'></td><td class='top_r'></td></tr><tr><td class='mid_l'></td><td class='mid_c'></td><td class='mid_r'></td></tr><tr><td class='bottom_l'></td><td class='bottom_c'></td><td class='bottom_r'></td></tr></tbody></table></div>"; var mashDiv = "<div id='mashDiv' style=\"position: fixed;width:100%;height:100%;left:0px;top:0px; background-color: rgb(0, 0, 0); z-index: 599; opacity: 0.15; filter:alpha(opacity=15);\"></div>"; //Login var loginConDiv = "<div class=\"layerBox\"><div style=\" width:530px;\" class=\"layerBoxCon\"><div class=\"layerSmartlogin\"><div class=\"layerMedia_close\"><a class=\"close\" href=\"javascript:void(0);\"></a></div><div id=\"mod_reg_login_yellow\" class=\"yellowBg\" style=\"display: none;\">如果你已开通过微博账号,可以直接<a onclick=\"App.showLoginDialBackLogin();\" href=\"javascript:void(0);\">登录</a></div><div id=\"mod_reg_information_box\" class=\"infoForm\" style=\"display: none;\"><div class=\"infoReg\"><table class=\"tab2\"> <tbody><tr><th><span>电子邮箱:</span></th><td class=\"td1\"><input type=\"text\" name=\"username\" id=\"mod_reg_username\" autocomplete=\"off\" class=\"inp\"></td><td id=\"mod_red_reg_username\"></td></tr><tr><th><span>设置密码:</span></th><td class=\"td1\"><input type=\"password\" name=\"password\" id=\"mod_reg_password\" class=\"inp\"> </td><td id=\"mod_red_reg_password\"></td></tr><tr><th><span>再次输入密码:</span></th><td class=\"td1\"><input type=\"password\" name=\"password2\" id=\"mod_reg_repassword\" class=\"inp\"></td><td id=\"mod_red_reg_repassword\"></td></tr><tr><th><span>验证码:</span></th><td class=\"td1\"><input type=\"text\" style=\"width:40px\" name=\"basedoor\" id=\"mod_reg_door\" class=\"inp w1\"><img width=\"90\" height=\"31\" align=\"absmiddle\" id=\"mod_reg_check_img\" style=\"margin:5px 0;\" src=\"/user/GetCheckCode/\"><a href=\"javascript:App.refreshCheckCode('mod_reg_check_img');\">换一个</a></td><td id=\"mod_red_reg_door\"></td></tr><tr><th>&nbsp;</th><td class=\"td1\"><div class=\"lf\"><input type=\"checkbox\" value=\"1\" name=\"after\" checked=\"checked\" class=\"labelbox\" id=\"mod_reg_after\"><label for=\"chbb\">我同意<a target=\"_blank\" href=\"##\">《网络使用协议》</a></label></div></td><td id=\"mod_red_reg_after\"></td></tr><tr><th>&nbsp;</th><td class=\"td1\"><a id=\"mod_reg_submit\" class=\"btnlogin1\" href=\"javascript:void(0);\" onclick=\"\"></a></td><td>&nbsp;</td></tr></tbody></table></div> <div class=\"clearit\"></div></div><div id=\"mod_reg_login_box\" class=\"infoForm\"><div class=\"infoLeft\"><table class=\"tab1\"><caption>已有新浪博客、新浪邮箱账号,可直接登录</caption><tbody><tr> <th scope=\"row\" ><div style=\"display: none; position: absolute; margin-top: -40px; margin-left: 0px; z-index: 2000;\" id=\"mod_login_tip\" class=\"errorLayer\"><div class=\"top\"></div><div class=\"mid\"><div id=\"mod_login_close\" onclick=\"$('#mod_login_tip').hide();\" class=\"close\">x</div><div class=\"conn\"><p id=\"mod_login_title\" class=\"bigtxt\"></p><span style=\"padding: 0px; display: none;\" id=\"mod_login_content\" class=\"stxt\"></span></div></div><div class=\"bot\"></div></div></th></tr><tr><td><div class=\"lgsz_wrap\"><input type=\"text\" id=\"mod_loginname\" class=\"inp\" style=\"color: rgb(153, 153, 153);\" autocomplete=\"off\" value=\"邮箱/会员帐号/手机号\" title=\"邮箱/会员帐号/手机号\" alt=\"邮箱/会员帐号/手机号\"></div></td></tr><tr><td><input type=\"text\" value=\"请输入密码\" id=\"mod_password_text\" class=\"inp\" style=\"color: rgb(153, 153, 153);\"><input type=\"password\" id=\"mod_password\" class=\"inp\" style=\"display: none;\"></td></tr> <tr><th><a id=\"mod_login_submit\" class=\"btn_normal\" href=\"javascript:void(0);\"><em>登录</em></a><input type=\"checkbox\" checked=\"checked\" class=\"chkb\" id=\"mod_isremember\"><label for=\"mod_isremember\">下次自动登录</label></th></tr></tbody></table></div><div class=\"infoRight\"><p class=\"p1\">还未开通?赶快免费注册一个吧!</p><p class=\"p2\"><a onclick=\"App.showLoginDial2Reg();return false;\" class=\"btnlogin1\" href=\"javascript:void(0);\" ></a></p></div><div class=\"clearit\"></div></div></div></div></div>"; var vailRedDiv = "<span class=\"iswhat iserro\"><img title=\"\" alt=\"\" src=\"/Content/Image/transparent.gif\" class=\"tipicon tip2\"><em>请输入验证码</em></span>"; var vailOk = "<span class=\"iswhat isok\"><img title=\"\" alt=\"\" src=\"/Content/Image/transparent.gif\" class=\"tipicon tip3\"></span>"; //Tip var alertConDiv = "<div class=\"layerBox\"><div class=\"layerBoxTop\"><div class=\"topCon\"><strong>提示</strong><a title=\"关闭\" class=\"close\" href=\"javascript:;\"></a><div class=\"clear\"></div></div></div><div class=\"layerBoxCon\" style=\"width: 360px; height: auto;\"><div class=\"commonLayer2\"><div class=\"layerL\"><img align=\"absmiddle\" title=\"\" alt=\"\" src=\"/Content/Image/PY_ib.gif\" class=\"PY_ib PY_ib_1\"></div><div class=\"layerR\"></div><div class=\"clear\"></div> <div class=\"MIB_btn\"> <a class=\"btn_normal\" id=\"btn_AlterClose\" href=\"javascript:;\"><em>确定</em></a></div></div></div></div>"; var confirmConDiv = "<div class=\"layerBox\"><div class=\"layerBoxTop\"><div class=\"topCon\"><strong>提示</strong><a title=\"关闭\" class=\"close\" href=\"javascript:;\"></a><div class=\"clear\"></div></div></div><div class=\"layerBoxCon\" style=\"width: 390px; height: auto;\"><div class=\"commonLayer2\"> <div class=\"layerL\"><img align=\"absmiddle\" title=\"\" alt=\"\" src=\"/Content/Image/PY_ib.gif\" class=\"PY_ib PY_ib_4\"></div><div class=\"layerR\"><strong></strong><div class=\"MIB_btn\"><a class=\"btn_normal\" id=\"Btn_ConfirmOk\" href=\"javascript:;\"><em>确定</em></a> <a class=\"btn_notclick\" id=\"Btn_ConfirmCancel\" href=\"javascript:;\"><em>取消</em></a></div></div><div class=\"clear\"></div></div></div></div>"; var tipConDiv = "<div class=\"layerBox\"><div class=\"layerBoxTop\"><div class=\"topCon\"><strong>提示</strong><a title=\"关闭\" class=\"close\" href=\"javascript:;\"></a><div class=\"clear\"></div></div></div><div class=\"layerBoxCon\" style=\"width: 490px; height: auto;\"> <div style=\"padding-top:0\" class=\"commonLayer2\"> <div class=\"zok\"> </div> </div></div></div>"; var fullTipConDiv = "<div class=\"layerBox\"><div class=\"layerBoxTop\"><div class=\"topCon\"><strong>提示</strong><a title=\"关闭\" class=\"close\" href=\"javascript:;\"></a><div class=\"clear\"></div></div></div><div class=\"layerBoxCon\" style=\"width: 360px; height: auto;\"><div class=\"commonLayer2\"><div class=\"layerL\"><img align=\"absmiddle\" title=\"\" alt=\"\" src=\"/Content/Image/PY_ib.gif\" class=\"PY_ib PY_ib_3\"></div><div class=\"layerR\"> <strong>设置成功!</strong></div><div class=\"clear\"></div> <div style=\"height:0;\" class=\"MIB_btn\"> <a class=\"btn_normal\" id=\"btn_1316141348355\" href=\"javascript:;\"><em>确定</em></a></div></div></div></div>"; //Mini var miniConfirmDiaDiv = "<div id='miniConfirm' style=\"position: absolute; clear: both; z-index: 1701;width: 202px; height:0px;\"><div style=\"\"><div style=\"width:200px;\" class=\"miniPopLayer\"><div class=\"txt1 gray6\"><img src=\"/Content/Image/PY_ib.gif\" class=\"tipicon tip4\"><div id='Content'></div></div><div class=\"btn\" style=\"\"><span><a href=\"javascript:void(0)\" class=\"newabtn_ok\" style=\"width:39px;\"><em>确定</em></a></span><span><a href=\"javascript:void(0)\" class=\"newabtn_ok\" style=\"width:39px;\"><em>取消</em></a></span></div></div></div></div>"; var miniTipDiaDiv = "<div id=\"miniTip\" style=\"position: absolute; clear: both; z-index: 1700; width: 202px; height: 0px; overflow: hidden;\"><div style=\"\"><div style=\"width:200px;\" class=\"miniPopLayer\"><div class=\"txt1 gray6\"><img src=\"/Content/Image/PY_ib.gif\" class=\"tipicon tip3\"><div id=\"Content\"></div></div><div class=\"btn\" style=\"display:none\"></div></div></div></div>"; //Expression var expressionConDiv = "<div class=\"layerBox phiz_layerN\"><div class=\"layerBoxTop\"><div style=\"left:6px;\" class=\"layerArrow\"></div><div class=\"topCon\"><ul class=\"phiz_menu\"><li class=\"cur\"><a onclick=\"this.blur();return false;\" href=\"#\">常用表情</a></li></ul><a class=\"close\" title=\"关闭\" onclick=\"return false;\" href=\"#\"></a><div class=\"clearit\"></div></div></div><div class=\"magicT\"><div class=\"magicTL\"><ul></ul></div><div class=\"magicTR\"><a title=\"上一页\" class=\"magicbtnL01\" onclick=\"return false;\" href=\"#\"></a><a class=\"magicbtnR02\" title=\"下一页\" onclick=\"return false;\" href=\"#\"></a></div><div class=\"clear\"></div></div><div style=\"width:450px;\" class=\"layerBoxCon\"><div class=\"faceItemPicbgT\"><ul></ul><div class=\"clearit\"></div></div><div class=\"faceItemPicbg\"><ul><center><img src=\"/Content/Image/loading.gif\" style=\"margin-top:10px;margin-bottom:10px\"></center></ul><div class=\"clearit\"></div></div><div class=\"magicB\"></div></div></div>"; //picUpload var picUploadCondiv = "<div class=\"layerBox phiz_layerN\"><div class=\"layerBoxTop\" style=\"width: 100%;\"><div class=\"layerArrow\"></div><div class=\"topCon\" style=\"width: 378px;\"><ul class=\"phiz_menu\"><li class=\"cur\"><a href=\"javascript:void(0)\">上传图片</a></li></ul><a class=\"close\" href=\"javascript:void(0)\" title=\"关闭\"></a><div class=\"clearit\"></div></div></div><div><div class=\"layerBoxCon\"><div style=\"position:relative;\" class=\"local_pic\"><a href=\"javascript:void(0)\" style=\"overflow:hidden;position:relative;\" class=\"btn_green\"><em>从电脑选择图片</em><form target=\"ifrPicUpload\" id=\"frmPicUpload\" enctype=\"multipart/form-data\" method=\"POST\" action=\"/PicUpload/MyProfileUpload/\"><input type=\"file\" name=\"pic1\" style=\"outline: medium none; width: 75px; height: 25px; \" hidefoucs=\"true\"></form></a><p class=\"gray9\">仅支持JPG、GIF、PNG图片文件,且文件小于5M</p></div></div></div></div>"; var picUploadingCondiv = "<div class=\"layerBox phiz_layerN\"><div><div style=\"width:258px;\" class=\"layerBoxCon1\"><div class=\"layerMedia\"><div style=\"left:25px\" class=\"layerArrow\"></div><div class=\"statusBox\"><span class=\"status_p\"><img src=\"/Content/Image/loading.gif\">请等待图片上传 ...</span><span class=\"status_b\"><a class=\"btn_normal\" href=\"javascript:void(0)\"><em> 取消上传 </em></a></span></div></div></div></div></div>"; var picUploadedCondiv = "<div class=\"layerBox phiz_layerN\"><div><div style=\"width:258px;\" class=\"layerBoxCon1\"><div class=\"layerMedia\"><div style=\"left:25px\" class=\"layerArrow\"></div><div class=\"cur_status\"><a class=\"dele\" href=\"javascript:void(0)\">删除</a><strong></strong></div><div class=\"cur_pic\"><center><img style=\"display: none;\" onload=\"this.style.display='block';\"></center></div></div></div></div></div>"; //videoLink var videoCondiv = "<div class=\"layerBox\"><div class=\"layerBoxCon1\" style=\"width: 368px; height: auto;\"><div class=\"layerMedia\"><div class=\"layerArrow\"></div><div class=\"layerMedia_close\"><strong></strong><a title=\"关闭\" class=\"close\" href=\"javascript:void(0);\"></a></div> <div class=\"layerMedia_tip02\"><em class=\"num\">1.</em><span class=\"title\">输入视频网站播放页链接地址</span><br>目前已支持<a target=\"_blank\" href=\"http://www.youku.com\">优酷网</a>、<a target=\"_blank\" href=\"http://www.tudou.com\">土豆网</a>、<a target=\"_blank\" href=\"http://www.ku6.com/\">酷6网</a>、<a target=\"_blank\" href=\"http://www.56.com/\">56网</a>等网站</div> <div class=\"layerMedia_input\" id=\"musicinput\"> <input type=\"text\" class=\"layerMusic_txt\" id=\"vinput\" style=\"color: rgb(153, 153, 153);\"> <a href=\"javascript:void(0)\" class=\"btn_normal\" id=\"vsubmit\"><em>确定</em></a> </div> <p style=\"display:none\" class=\"layerMedia_err error_color\" id=\"vredinfo\">你输入的链接地址无法识别:)</p> <p style=\"display:none;\" class=\"mail_pl\" id=\"normalact\"><a id=\"vcancel\" href=\"javascript:void(0);\">取消操作</a>或者<a id=\"vback\" href=\"javascript:void(0);\">作为普通的链接发布</a>。</p></div></div></div>"; //musicUpload var musicCondiv = "<div class=\"layerBox\"><div class=\"layerBoxCon1\" style=\"width: 450px; height: auto;\"><div class=\"layerMedia\"><div class=\"layerArrow\"></div><div class=\"layerMedia_close\"><strong></strong><a title=\"关闭\" href=\"javascript:void(0);\" class=\"close\"></a></div><div class=\"lv_nav\"><ul id=\"music_tit\"> <li class=\"cur\" id=\"uploadsong\"><span><a href=\"javascript:void(0)\">上传歌曲</a></span></li><li id=\"inputmusiclink\"><span><a href=\"javascript:void(0);\">输入歌曲链接</a></span></li></ul></div><div id=\"music_content\"><div id=\"uploadsongdiv\"><div style=\"padding: 30px 0px;text-align: center;\"><span id=\"swfuploadspan\"></span><p class=\"gray9\" style=\"padding-top:10px;\">仅支持MP3文件,且文件小于10M,为方便搜索,请以歌名命名</p></div></div><div style=\"display:none; margin-bottom: 10px; width: 400px;\" class=\"upload-container\" id=\"upload_Container\"><div class=\"lists\" id=\"lists\"></div></div><div style=\"display: none;\" id=\"linksongdiv\"><div class=\"layerMedia_input\" id=\"linksonginput\"><input type=\"text\" style=\"color: rgb(153, 153, 153);\" class=\"layerMusic_txt\" value=\"请输入以MP3结尾的链接\" id=\"mlinkinput\"><a style=\"\" href=\"javascript:void(0);\" class=\"btn_normal\" id=\"mlinksubmit\"><em>添加</em></a></div><p class=\"layerMedia_err error_color\" style=\"display: none;\" id=\"mlinkredinfo\">你输入的链接地址无法识别:)</p><p style=\"display: none;\" class=\"mail_pl\" id=\"mlinkre\"><a id=\"mlinkback\" href=\"javascript:void(0);\">作为普通的链接发布</a>或者<a id=\"mlinkcancel\" href=\"javascript:void(0);\">取消操作</a>。</p></div></div></div></div></div>"; //feed var feedTabDiv = "<div class=\"layerBox\"><div class=\"layervote layerMoveto\"><div class=\"layerMedia_close\"><a class=\"close\"onclick=\"return false;\"title=\"关闭\"href=\"javascript:;\"></a></div><div class=\"lv_nav\"><ul><li class=\"cur\"><span>转发到微博</span></li><li class=\"\"><span>转发到私信</span></li></ul></div><div class=\"layerBoxCon\"style=\"width: 450px;\"></div></div></div>"; var feedConDiv = "<div class=\"shareLayer\"><div class=\"laymoveText\"></div><div class=\"enterBox_topline\"><div class=\"lf\"><a title=\"表情\"href=\"javascript:void(0);\"class=\"faceicon1\"></a></div><div class=\"rt\"style=\"color: #008800; height: 22px; line-height: 22px; overflow: hidden\"><span class=\"normal\">还可以输入00个汉字</span></div></div><textarea id=\"PY_txt\" class=\"PY_textarea\"style=\"font-family: Tahoma,宋体;font-size: 14px; line-height: 18px; color: rgb(51, 51, 51); overflow: hidden;border: 1px solid rgb(204, 204, 204); word-wrap: break-word;\"></textarea><div class=\"selSend\"><p><input type=\"checkbox\"name=\"isLast\"id=\"isLast\"/><label for=\"isLast\"></label></p><p><input type=\"checkbox\"name=\"isRoot\"id=\"isRoot\"/><label for=\"isRoot\"></label></p></div><div class=\"MIB_btn\"><a class=\"newabtn_ok\"onclick=\"return false;\"href=\"javascript:;\"><em>转发</em></a><a class=\"btn_notclick\"onclick=\"return false;\"href=\"javascript:;\"><em>取消</em></a></div></div>"; var mesgConDiv = "<div class=\"shareLayer\"><table><tbody><tr><th>收件人:</th><td><input type=\"text\"value=\"\"class=\"inputtxt1\"style=\"color: rgb(153, 153, 153);\"/></td></tr><tr><th class=\"layerTop\">内容:</th><td><div class=\"enterBox_topline\"><div class=\"lf\"><a title=\"表情\"href=\"javascript:void(0);\"class=\"faceicon1\"></a></div><div class=\"rt\"style=\"color: #008800; height: 22px; line-height: 22px; overflow: hidden\"><span class=\"normal\">还可以输入00个汉字</span></div></div><textarea id=\"PY_txt\" class=\"PY_textarea\"style=\"font-family: Tahoma,宋体;font-size: 14px; line-height: 18px; color: rgb(51, 51, 51); overflow: hidden; border: 1px solid rgb(204, 204, 204); word-wrap: break-word; height: 132px;\"></textarea></td></tr></tbody></table><div class=\"MIB_btn\"><a class=\"newabtn_ok\"onclick=\"return false;\"href=\"javascript:;\"><em>转发</em></a><a class=\"btn_notclick\"onclick=\"return false;\"href=\"javascript:;\"><em>取消</em></a></div></div>"; // var mediaConDiv = "<div class=\"layerBox\"><div style=\"padding:3px 0 3px 5px\"><a onclick=\"return false;\" id=\"pop_video_window_close\" href=\"javascript:void(0);\"><img class=\"small_icon cls\" src=\"/Content/Image/transparent.gif\">关闭</a></div> <div id=\"pop_video_window\" style=\"width:440px;\" class=\"layerBoxCon\"><div><div id=\"mediaCon\" style=\"padding-top: 10px\"></div></div></div></div>"; //poppublishMB var popMBConDiv = "<div class=\"layerBox\"><div class=\"layerBoxTop\"><div class=\"topCon\"><strong>有什么新鲜事想告诉大家?</strong><a title=\"关闭\"class=\"close\"href=\"javascript:;\"></a><div class=\"clear\"></div></div></div><div class=\"layerBoxCon\"style=\"width: 490px; height: auto;\"><div style=\"padding-top: 14px;\"class=\"commonLayer2\"><div class=\"zPoster\"><div class=\"ztips\"><div class=\"lf gray6\">可以直接输入音乐或视频的url地址</div><div id=\"publisher_info2\"class=\"writeScores\">还可以输入<span class=\"pipsLim\">140</span>字</div></div><div class=\"ztxtarea\"><textarea name=\"\"cols=\"\"rows=\"\"id=\"publish_editor2\"range=\"0&0\"></textarea></div><div class=\"sendor\"><span ><a id=\"face\" href=\"javascript:void(0);\"><img align=\"absmiddle\"src=\"/Content/Image/transparent.gif\"alt=\"\"class=\"zmotionico\">表情</a></span><span style=\"display: \"id=\"publisher_image2\"><img align=\"absmiddle\"class=\"zpostorimgico\"alt=\"\"src=\"/Content/Image/transparent.gif\">图片</span><a id=\"publisher_submit2\" title=\"发布\"href=\"javascript:void(0);\"><img class=\"submit_notclick\"alt=\"发布\"src=\"/Content/Image/transparent.gif\"></a></div></div><div class=\"clearit\"></div></div></div></div>"; //group var GroupConDiv = "<div class=\"layerBox\"><div class=\"layerBoxTop\"><div class=\"topCon\"><strong>{title}</strong><a title=\"关闭\" class=\"close\" href=\"javascript:;\"></a><div class=\"clear\"></div></div></div><div class=\"layerBoxCon\" style=\"width: 300px; height: auto;\"><div class=\"groupLayer\"><div class=\"inputBox\">分组名:<input type=\"text\" value=\"输入分组名字\" id=\"group_newname\"></div><div style=\"display:none\" class=\"errorTs\" id=\"errorTs\"></div><div class=\"btns\"><a class=\"btn_normal\" href=\"javascript:void(0)\" id=\"group_submit\"><em>确定</em></a><a class=\"btn_normal\" href=\"javascript:void(0)\" id=\"group_cancel\"><em>取消</em></a></div></div></div></div>"; var GroupAssignDiv = '<div class="layerBox"><div class="layerBoxTop"><div class="topCon"><strong><img class="tipicon tip3" src="/Content/Image/PY_ib.gif" alt="" title="">设置分组</strong><a title="关闭" class="close" href="javascript:;"></a><div class="clear"></div></div></div><div class="layerBoxCon" style="width: 390px; height: auto;"><div class="shareLayer groupNewBox"><div id="shareTxt" class="shareTxt clearFix"><span class="lf">为"{name}"选择分组:</span></div><div class="group_nb_bg"><ul class="group_list" id="group_list_D"></ul><div class="addNew"><a href="javascript:void(0);" id="creategrp"><em>+</em>创建新分组</a></div><div style="display:none" class="newBox" id="newgrp"><div class="newBox_input"><input type="text" class="newBox_txt" value="新分组" id="group_input" style="color: rgb(153, 153, 153);"><a class="btn_normal" id="create_group" href="javascript:void(0);"><em>创建</em></a><a id="cancel_group" href="javascript:void(0);">取消</a></div><p style="display:none" class="newBox_err error_color" id="group_error">不超过8个汉字</p></div></div><div class="addNew"> 备注姓名:<input type="text" value="设置备注" style="color: rgb(153, 153, 153);" id="set_group_remark"><span class="errorTs2 error_color" style="display:none" id="set_group_remark_err"></span></div><div class="MIB_btn"><a class="btn_normal" id="g_submit" href="javascript:void(0)"><em>保存</em></a><a class="btn_normal" id="g_nogroup" href="javascript:void(0)"><em>取消</em></a></div></div></div></div>'; var createNewBox = "<table id=\"CreateNewBox\" class=\"mBlogLayer\" style=\"position: absolute; z-index:1000;\"><tbody> <tr> <td class=\"top_l\"> </td> <td class=\"top_c\"></td><td class=\"top_r\"> </td></tr><tr> <td class=\"mid_l\"></td><td class=\"mid_c\"><div class=\"layerBox\"><div class=\"layerBoxTop\"> <div class=\"topCon\"><strong id=\"layerTitle1\">创建相册</strong> <a title=\"关闭\" class=\"close\" href=\"javascript:void(0)\"></a> </div> </div><div style=\"width: 350px; height: 90px;\" class=\"layerBoxCon\"><div class=\"schSearchLayer\"><div class=\"clearFix\"><div class=\"\"><ul id=\"schoolClassUl1\"><table style=\"line-height: 30px; font-size: 12px; font-family: Monospace; margin-top: 10px;\"><tbody><tr><th class=\"gray6\"><span style=\"width: 100px; text-align: right; float: right\">相册名称:</span> </th> <td> <input type=\"text\" class=\"PY_input gray9\" name=\"newSchoolClass\" id=\"newSchoolClass\" style=\"\"></td> </tr> </tbody></table> </ul></div></div><div style=\"margin-top: 10px; float: right;\"> <a href=\"javascript:;\" class=\"newabtngrn\" id=\"saveCreate\"><em>保存</em></a> <a href=\"javascript:;\" class=\"btn_normal btns close\" node-type=\"cancel\"><em>取消</em></a> </div> </div></div> </div> </td></tr></tbody></table>"; var Hashtable = function () { this.items = {}; this.itemsCount = 0; this.add = function (key, value) { if (!this.containsKey(key)) { this.items[key] = value; this.itemsCount++; } else throw "key '" + key + "' allready exists." }; this.get = function (key) { if (this.containsKey(key)) return this.items[key]; else return null; }; this.remove = function (key) { if (this.containsKey(key)) { delete this.items[key]; this.itemsCount--; } else throw "key '" + key + "' does not exists." }; this.containsKey = function (key) { return typeof (this.items[key]) != "undefined"; }; this.containsValue = function containsValue(value) { for (var item in this.items) { if (this.items[item] == value) return true; } return false; }; this.contains = function (keyOrValue) { return this.containsKey(keyOrValue) || this.containsValue(keyOrValue); }; this.clear = function () { this.items = {}; itemsCount = 0; }; this.size = function () { return this.itemsCount; }; this.isEmpty = function () { return this.size() == 0; }; }; var ajaxUrlHash = function (event) { this.isSupport = ('onhashchange' in window) && ((typeof document.documentMode === 'undefined') || document.documentMode >= 8); this.preHash = window.location.hash; this.hashChangeFire = event; this.init(); if (event) event(); }; ajaxUrlHash.prototype.isHashChanged = function () { if (this.preHash != window.location.hash) { this.preHash = window.location.hash; return true; } else return false; } ajaxUrlHash.prototype.init = function () { if (this.isSupport) { window.onhashchange = this.hashChangeFire; } else { cusSetInterval(function () { var o = arguments[0]; if (o.isHashChanged()) { o.hashChangeFire(); } }, 150, this); } } var cusSetInterval = function (fRef, mDelay) { if (typeof fRef == "function") { var argu = Array.prototype.slice.call(arguments, 2); var f = (function () { fRef.apply(null, argu); }); return setInterval(f, mDelay); } return setInterval(fRef, mDelay); }; $(window).resize(function () { if (App.isVisible($("#mashDiv"))) App.showMash(); }); var App = { config: { curUid: -1 }, E: function (s) { if (typeof s === "string") { return document.getElementById(s); } else return null; }, UlrToJson: function (url) { var json = {}; var temp = url.split('?'); if (temp && temp.length >= 2) { url = temp[1]; } else return null; var arr = url.split('&'); for (var i = 0; i < arr.length; i++) { if (arr[i]) { var key = arr[i].split('=')[0]; var value = arr[i].split('=')[1]; if (key && value) { json[key] = value; } } } return json; }, $doc: $(document), showMash: function () { if (App.appendToBody($("#mashDiv"), mashDiv)) { $("#mashDiv").bgiframe(); } if ($.browser.msie && ($.browser.version == "6.0")) { $("#mashDiv").css("position", "absolute").width($(window).width()).height($(document).height()); } $("#mashDiv").show(); }, hideMash: function () { $("#mashDiv").hide(); }, checkLogin: function () { if ($("#mod_loginname").val() == "邮箱/会员帐号/手机号" || $.trim($("#mod_loginname").val()) == "") { $("#mod_login_title").text("请输入登录名"); $("#mod_login_content").hide(); $("#mod_login_tip").css("margin-top", $.browser.msie ? "-50px" : "-40px"); $("#mod_login_tip").show(); $("#mod_loginname").focus(); $("#mod_password_text").blur(); return; } if ($("#mod_password").val() == "") { $("#mod_password_text").focus(); $("#mod_login_title").text("请输入密码"); $("#mod_login_content").hide(); $("#mod_login_tip").css("margin-top", $.browser.msie ? "-10px" : "0px"); $("#mod_login_tip").show(); return; } $("#mod_login_tip").hide(); App.iframeSubmit({ hdLoginname: $("#mod_loginname").val(), hdPassword: $("#mod_password").val(), hdReUsername: $("#mod_isremember").attr("checked") }, "loginForm", "/User/IframeModLogin/", "loginFrame"); return false; }, initLoginDialCon: function () { $("#mod_loginname").focus(function () { var logininput = $(this); logininput.css("color", "rgb(51, 51, 51)"); if (logininput.val() == "邮箱/会员帐号/手机号") logininput.val(""); }); $("#mod_loginname").blur(function () { var logininput = $(this); logininput.css("color", "rgb(153, 153, 153)"); if (logininput.val() == "") logininput.val("邮箱/会员帐号/手机号"); }); $("#mod_password_text").focus(function () { $(this).hide(); $("#mod_password").show(); $("#mod_password").focus(); $("#mod_password").click(); $("#mod_password").css("color", "rgb(51, 51, 51)"); }); $("#mod_password").blur(function () { if ($(this).val() == "") { $("#mod_password_text").show(); $("#mod_password_text").blur(); $(this).hide(); } else { $(this).css("color", "rgb(153, 153, 153)"); } }); $("#mod_password").focus(function () { $(this).css("color", "rgb(51, 51, 51)"); }); $("#mod_loginname").JQP_EmailNote({ selfn: function () { $("#mod_password_text").focus(); $("#mod_loginname").blur(); } }); $("#mod_login_submit").bind("click", App.checkLogin); $("#mod_password").bind("keyup", function (e) { if (e.keyCode == 13) App.checkLogin(); }); }, showLoginDial: function () { App.initCheckRegObj(); App.showMash(); App.initDialDiv("LoginDiaDiv", dialDiv, false, function () { App.hideLoginDial() }); $("#LoginDiaDiv").find(".mid_c").html(loginConDiv); App.bindVailCtrl(); App.initLoginDialCon(); var position = App.centerInScreen($("#LoginDiaDiv")); $("#LoginDiaDiv").css("left", position.left + "px"); $("#LoginDiaDiv").css("top", position.top + "px"); $("#LoginDiaDiv").find(".layerMedia_close .close").bind("click", function () { App.hideLoginDial(); }); $("#LoginDiaDiv").show(); }, showLoginDial2Reg: function () { $("#mod_reg_login_box").hide(); $("#mod_reg_login_yellow").show(); $("#mod_reg_information_box").show(); App.refreshCheckCode("mod_reg_check_img"); return false; }, showLoginDialBackLogin: function () { $("#mod_reg_login_box").show(); $("#mod_reg_login_yellow").hide(); $("#mod_reg_information_box").hide(); return false; }, hideLoginDial: function () { $("#LoginDiaDiv").hide(); $("#mashDiv").hide(); }, initDialDiv: function (selector, str, isClickOther, clickOtherFn) { var obj = $("#" + selector); if (typeof obj == "object" && typeof str == "string") { if (obj[0] == null) { $("body").append(str.replace(/{id}/, "id=" + selector)); if (isClickOther && typeof clickOtherFn == "function") $(obj.selector).JQP_ClickOther(clickOtherFn); return true; } } return false; }, isVisible: function (obj) { return obj.is(":visible"); }, centerInScreen: function (obj) { if (typeof obj == "object") { return { left: (($(document).width()) / 2 - (parseInt(obj.width()) / 2)), top: (((($(window).height() - obj.height()) / 2) + $(document).scrollTop())) }; } }, appendToBody: function (obj, str) { if (typeof obj == "object" && typeof str == "string") { if (obj[0] == null) { $("body").append(str); return true; } } return false; }, createIframeForm: function (array, formId, formAction, iframeId) { var formStr = "<form name=\"" + formId + "\" id=\"" + formId + "\" method=\"post\" action=\"" + formAction + "\" style=\"display:none\" target=\"" + iframeId + "\">"; for (var p in array) { formStr += "<input type=\"password\" id=\"" + p + "\" name=\"" + p + "\" />"; } formStr += "</form>"; App.appendToBody($("#" + formId), formStr); var iframeStr = "<iframe name=\"" + iframeId + "\" id=\"" + iframeId + "\" style=\"display:none\"></iframe>"; App.appendToBody($("#" + iframeId), iframeStr); }, iframeSubmit: function (array, formId, formAction, iframeId) { App.createIframeForm(array, formId, formAction, iframeId); for (var p in array) { $("#" + p).val(array[p]); } if ($.browser.msie) { eval("window." + formId + ".submit()"); } else { $("#" + formId).submit(); } }, loginCallBack: function (isSucess) { if (!isSucess) { $("#mod_login_title").text("登录名或密码错误"); $("#mod_login_content").hide(); $("#mod_login_tip").css("margin-top", $.browser.msie ? "-50px" : "-40px"); $("#mod_login_tip").show(); } else { if (arguments[1] == 0) { $("#mod_login_title").text("你的账号还没有验证"); $("#mod_login_content").hide(); $("#mod_login_tip").css("margin-top", $.browser.msie ? "-50px" : "-40px"); $("#mod_login_tip").show(); } if (arguments[1] == 1) { window.location.href = "/User/fullinfo/"; } if (arguments[1] == 2) { window.location.href = "/"; } } }, regCallBack: function (isSuccess, email) { if (isSuccess) { window.location.href = "/User/RegSuccess/?email=" + email; } else { App.alert("系统繁忙,稍后再试!"); } }, checkRegObj: { isMail: false, isPwd: false, isRePwd: false, isVailCode: false, isAgree: false }, initCheckRegObj: function () { for (var p in App.checkRegObj) { App.checkRegObj[p] = false; } }, checkIsMail: function (inputCtr, plus) { App.checkRegObj.isMail = false; var regStr = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/; if ($.trim(inputCtr.val()) == "") { plus.html(vailRedDiv); plus.find("em").html("请输入常用邮箱。"); plus.show(); } else if (!regStr.test(inputCtr.val())) { plus.html(vailRedDiv); plus.find("em").html("请输入正确的邮箱地址。"); plus.show(); } else { App.ajax_IsExsitEmail(function (o) { if (o.Data == "1") { plus.html(vailRedDiv); plus.find("em").html("该邮箱地址已被注册。"); plus.show(); } else { App.checkRegObj.isMail = true; plus.html(vailOk); plus.show(); } }, arguments[2] != null ? arguments[2] : true, $.trim(inputCtr.val())); } }, checkIsPwd: function (inputCtr, plus) { App.checkRegObj.isPwd = false; var regStr = /\s+/; if (regStr.test(inputCtr.val())) { plus.html(vailRedDiv); plus.find("em").html("密码请勿使用特殊字符。"); plus.show(); } else if (inputCtr.val() == "") { plus.html(vailRedDiv); plus.find("em").html("密码太短了,最少6位。"); plus.show(); } else if (inputCtr.val().length < 6) { plus.html(vailRedDiv); plus.find("em").html("密码太短了,最少6位。"); plus.show(); } else if (inputCtr.val().length > 16) { plus.html(vailRedDiv); plus.find("em").html("密码太长了,最多16位。"); plus.show(); } else { App.checkRegObj.isPwd = true; plus.html(vailOk); plus.show(); } }, checkIsRePwd: function (inputCtr, plus) { App.checkRegObj.isRePwd = false; if (inputCtr.val() != $("#mod_reg_password").val()) { plus.html(vailRedDiv); plus.find("em").html("两次输入的密码不同。"); plus.show(); } else { if ($("#mod_reg_password").val() != "") { App.checkRegObj.isRePwd = true; plus.html(vailOk); plus.show(); } } }, checkIsVailCode: function (inputCtr, plus) { App.checkRegObj.isVailCode = false; if (inputCtr.val() == "") { plus.html(vailRedDiv); plus.find("em").html("请输入验证码。"); plus.show(); } else { App.ajax_IsValidCode(function (o) { if (o.Data == "1") { plus.html(vailRedDiv); plus.find("em").html("验证码不正确。"); plus.show(); } else { App.checkRegObj.isVailCode = true; plus.html(vailOk); plus.show(); } }, arguments[2] != null ? arguments[2] : true, $.trim(inputCtr.val())); } }, checkIsAgree: function (inputCtr, plus) { App.checkRegObj.isAgree = false; if (inputCtr.attr("checked") != true) { plus.html(vailRedDiv); plus.find("em").html("需同意使用协议。"); plus.show(); } else { App.checkRegObj.isAgree = true; plus.html(vailOk); plus.show(); } }, bindVailCtrl: function () { $("#mod_reg_username").JQP_EmailNote({ selfn: function () { $("#mod_reg_password").focus(); $("#mod_reg_username").blur(); } }); $("#mod_reg_username").bind("blur", function () { App.checkIsMail($(this), $(" #mod_red_reg_username")) }); $("#mod_reg_password").bind("blur", function () { App.checkIsPwd($(this), $("#mod_red_reg_password")) }); $("#mod_reg_repassword").bind("blur", function () { App.checkIsRePwd($(this), $("#mod_red_reg_repassword")) }); $("#mod_reg_door").bind("blur", function () { App.checkIsVailCode($(this), $("#mod_red_reg_door")) }); $("#mod_reg_after").bind("click", function () { App.checkIsAgree($(this), $("#mod_red_reg_after")) }); $("#mod_reg_submit").bind("click", function () { App.disableAtag($(this)); App.checkIsAgree($("#mod_reg_after"), $("#mod_red_reg_after")); App.checkIsMail($("#mod_reg_username"), $(" #mod_red_reg_username"), false); App.checkIsPwd($("#mod_reg_password"), $("#mod_red_reg_password")); App.checkIsRePwd($("#mod_reg_repassword"), $("#mod_red_reg_repassword")); App.checkIsVailCode($("#mod_reg_door"), $("#mod_red_reg_door"), false); if (App.checkRegObj.isAgree && App.checkRegObj.isMail && App.checkRegObj.isPwd && App.checkRegObj.isRePwd && App.checkRegObj.isVailCode) { App.iframeSubmit({ formMail: $("#mod_reg_username").val(), formPwd: $("#mod_reg_password").val() }, "RegForm", "/User/IframeModReg/", "RegIframe"); } else { App.enableAtag($(this)); } return false; }); }, refreshCheckCode: function (imgCtr) { $("#" + imgCtr).attr("src", '/User/GetCheckCode/' + Math.random()); }, ajax_IsExsitEmail: function (callback, async, val) { $.ajax( { async: async, url: "/Ajax/CheckEmail/", datatype: "json", cache: false, data: { email: val }, type: "post", success: function (o) { callback(o); }, error: function (request) { } } ); }, ajax_IsExsitNickName: function (callback, async, val, url) { if (!url) { url = "/Ajax/CheckNickName/"; } $.ajax( { async: async, url: url, datatype: "json", cache: false, data: { name: val }, type: "post", success: function (o) { callback(o); }, error: function (request) { } } ); }, ajax_IsValidCode: function (callback, async, val) { $.ajax( { async: async, url: "/Ajax/CheckCode/", datatype: "json", cache: false, data: { Code: val }, type: "post", success: function (o) { callback(o); }, error: function (request) { } } ); }, ajax_resendEmail: function (val) { $.ajax( { async: false, url: "/Ajax/ReSendEmail/", datatype: "json", cache: false, data: { Email: val }, type: "post", success: function (o) { if (o.Data == "1") { App.tip("发送成功,请查收!", 2000); } else { App.confirm("系统繁忙,请稍后再试一试"); } }, error: function (request) { } } ); }, disableAtag: function (o, css, isNotAdd) { var a = o.clone(); a.insertAfter(o); o.hide(); a.removeAttr("onclick"); if (css != null) { if (arguments[2] == null) a.addClass(css); else a.attr("class", css); } }, enableAtag: function (o) { o.show(); o.next().remove(); }, alert: function (text) { App.showMash(); App.initDialDiv("AlertDiaDiv", dialDiv, false, function () { $("#AlertDiaDiv").hide(); App.hideMash(); }); $("#AlertDiaDiv").find(".mid_c").html(alertConDiv); $("#AlertDiaDiv").css("z-index", 2000); $("#AlertDiaDiv").find(".close").bind("click", function () { $("#AlertDiaDiv").hide(); App.hideMash(); }); $("#AlertDiaDiv").find("#btn_AlterClose").bind("click", function () { $("#AlertDiaDiv").hide(); App.hideMash(); }); $("#AlertDiaDiv").find(".layerR").html("<strong>" + text + "</strong>"); var position = App.centerInScreen($("#AlertDiaDiv")); $("#AlertDiaDiv").css("left", position.left + "px"); $("#AlertDiaDiv").css("top", position.top + "px"); $("#AlertDiaDiv").show(); }, confirm: function (text, callBack) { App.showMash(); App.initDialDiv("ConfirmDiaDiv", dialDiv, false, function () { $("#ConfirmDiaDiv").hide(); App.hideMash(); }); $("#ConfirmDiaDiv").find(".mid_c").html(confirmConDiv); $("#ConfirmDiaDiv").find(".close").bind("click", function () { $("#ConfirmDiaDiv").hide(); App.hideMash(); }); $("#ConfirmDiaDiv").find("#Btn_ConfirmOk").bind("click", function () { $("#ConfirmDiaDiv").hide(); App.hideMash(); callBack(); return false; }); $("#ConfirmDiaDiv").find("#Btn_ConfirmCancel").bind("click", function () { $("#ConfirmDiaDiv").hide(); App.hideMash(); return false; }); $("#ConfirmDiaDiv").find(".layerR strong").html(text); var position = App.centerInScreen($("#ConfirmDiaDiv")); $("#ConfirmDiaDiv").css("left", position.left + "px").css("z-index", 1700).css("top", position.top + "px").show(); }, tip: function (text, timeout, href) { App.initDialDiv("TipDiaDiv", dialDiv, false, function () { $("#TipDiaDiv").hide(); }); $("#TipDiaDiv").find(".mid_c").html(tipConDiv); $("#TipDiaDiv").find(".close").bind("click", function () { $("#TipDiaDiv").hide(); }); var position = App.centerInScreen($("#TipDiaDiv")); $("#TipDiaDiv").css("left", position.left + "px").css("top", position.top + "px").css("z-index", 1700).show(); $(".zok").html("<img align=\"absmiddle\" title=\"\" alt=\"\" src=\"/Content/Image/transparent.gif\" class=\"PY_ib PY_ib_3\">" + text); setTimeout(function () { $("#TipDiaDiv").hide(); if (href != null) { window.location.href = href; } }, timeout); }, fullTip: function (text, timeout, href, type) { App.initDialDiv("FullTipDiaDiv", dialDiv, false, function () { $("#FullTipDiaDiv").hide(); }); var fullElem = $("#FullTipDiaDiv"); fullElem.find(".mid_c").html(fullTipConDiv); fullElem.find(".close").bind("click", function () { fullElem.hide(); }); var position = App.centerInScreen(fullElem); fullElem.css("left", position.left + "px"); fullElem.css("top", position.top + "px"); fullElem.css("z-index", 1700); fullElem.find(".PY_ib").attr("class", "PY_ib PY_ib_" + type); fullElem.find(".layerR").html("<strong>" + text + "</strong>") fullElem.show(); setTimeout(function () { fullElem.hide(); if (href != null) { window.location.href = href; } }, timeout); }, miniConfirm: function (text, popWhere, callBack) { $("#miniConfirm").remove(); App.appendToBody($("#miniConfirm"), miniConfirmDiaDiv); if ($.browser.msie) { $("#miniConfirm").css("width", 210); } var left = $(popWhere).offset().left - ((210 - $(popWhere).width()) / 2); var top = $(popWhere).offset().top - ($.browser.msie ? 85 : 77); $("#miniConfirm").find("#Content").html(text); $("#miniConfirm").css("z-index", 2001).css("left", left).css("top", $(popWhere).offset().top).css("overflow", "hidden").animate({ "height": ($.browser.msie ? 85 : 77), "top": top }, 300, function () { $("#miniConfirm").css("overflow", ""); }); $($("#miniConfirm").find(".newabtn_ok")[0]).click(function () { $("#miniConfirm").css("overflow", "hidden"); $("#miniConfirm").animate({ "height": 0, "top": top + ($.browser.msie ? 85 : 77) }, 300, function () { if (callBack != null) { callBack(); } }); return false; }); $($("#miniConfirm").find(".newabtn_ok")[1]).click(function () { $("#miniConfirm").css("overflow", "hidden"); $("#miniConfirm").animate({ "height": 0, "top": top + ($.browser.msie ? 85 : 77) }, 300); return false; }); return false; }, FullMiniTip: function (text, popWhere, timeout, type) { $("#miniTip").remove(); App.appendToBody($("#miniTip"), miniTipDiaDiv); if ($.browser.msie) { $("#miniTip").css("width", 210); } var left = $(popWhere).offset().left - ((210 - $(popWhere).width()) / 2); var top = $(popWhere).offset().top - ($.browser.msie ? 54 : 46); var $minitip = $("#miniTip"); $minitip.find("#Content").html(text); $minitip.find(".tipicon").attr("class", "tipicon tip" + type); $minitip.css("z-index", 2001); $minitip.css("left", left); $minitip.css("top", $(popWhere).offset().top); $minitip.css("overflow", "hidden"); $minitip.animate({ "height": ($.browser.msie ? 54 : 46), "top": top }, 300, function () { $minitip.css("overflow", ""); }); setTimeout(function () { $minitip.css("overflow", "hidden"); $minitip.animate({ "height": 0, "top": top + ($.browser.msie ? 54 : 46) }, 300); }, timeout); return false; }, miniTip: function (text, popWhere, timeout) { $("#miniTip").remove(); App.appendToBody($("#miniTip"), miniTipDiaDiv); if ($.browser.msie) { $("#miniTip").css("width", 210); } var left = $(popWhere).offset().left - ((210 - $(popWhere).width()) / 2); var top = $(popWhere).offset().top - ($.browser.msie ? 54 : 46); var $minitip = $("#miniTip"); $minitip.find("#Content").html(text); $minitip.css("left", left); $minitip.css("top", $(popWhere).offset().top); $minitip.css("overflow", "hidden"); $minitip.animate({ "height": ($.browser.msie ? 54 : 46), "top": top }, 300, function () { $minitip.css("overflow", ""); }); setTimeout(function () { $minitip.css("overflow", "hidden"); $minitip.animate({ "height": 0, "top": top + ($.browser.msie ? 54 : 46) }, 300); }, timeout); return false; }, BindSchoolCtrl: function (location, letter, type, callBack, url) { var items = ""; if (!url) { url = "/Ajax/GetShoolsByLetLocType/"; } $.ajax({ dataType: "json", data: { letter: letter, location: location, type: type }, url: url, cache: false, type: "post", success: function (o) { if (o.Code == "A00003") App.fullTip(CodeList[o.Code], 1000, null, 1); else if (o.Code == "A00017") { $("#noschool").show(); $("#schoolUl").hide(); } else { $("#noschool").hide(); var schlist = $("#schoolUl").show(); schlist.html(""); $.each(o.Data, function () { var item = $("<li trueId='" + this.ID + "' title='" + this.Name + "'><a href='javascript:void(0);'>" + this.Name + "</a></li>"); item.click(function () { education.schoolTxtBox.val(item.attr("title")); education.schoolTxtBox.next().val(item.attr("trueId")); box.hide(); App.hideMash(); App.EmptyCollegeClass(); }); schlist.append(item); }); } if (callBack) callBack(); }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); } }); }, BindCityCtrl: function (ctrl, type, val, callBack, url) { var items = ""; if (!url) { url = "/Ajax/GetCity/"; } $.ajax( { async: true, url: url, datatype: "json", cache: false, data: { Type: type, Val: val }, type: "get", success: function (o) { for (var i = 0; i < o.Data.length; i++) { items = items + "<option value='" + o.Data[i].ID + "'>" + o.Data[i].Name + "</option>"; } ctrl.html(items); if (callBack) callBack(); }, error: function (request) { } } ); }, BindSelectCtr: function (ctrl, dataJsonWhere, callBack, url) { var items = ""; $.ajax( { async: true, url: url, datatype: "json", cache: false, data: dataJsonWhere, type: "get", success: function (o) { if (!o.Data) { items = items + "<option value=-1'>请选择班级相册</option>"; ctrl.html(items); if (callBack) callBack(); } else { for (var i = 0; i < o.Data.length; i++) { items = items + "<option value='" + o.Data[i].ID + "'>" + o.Data[i].PhotoName + "</option>"; } ctrl.html(items); if (callBack) callBack(); } }, error: function (request) { ctrl.hide(); } } ); }, insertTxt2Txtarea: function (txtCtrl, insertVal) { $(txtCtrl).focus(); var con = $(txtCtrl)[0].value; var start = parseInt($(txtCtrl).attr("range").split("&")[0]); var sel = parseInt($(txtCtrl).attr("range").split("&")[1]); var pre = con.substr(0, start); var last = con.substr(start + sel); $(txtCtrl).val(pre + insertVal + last); var pos = start + insertVal.length; var ctrl = $(txtCtrl)[0]; App.setSelectRange(ctrl, pos, pos); App.saveTxtCtrlRangePos(ctrl); }, saveTxtCtrlRangePos: function (textBox) { if (document.selection) { textBox.focus(); var ds = document.selection; var range = ds.createRange(); var stored_range = range.duplicate(); stored_range.moveToElementText(textBox); stored_range.setEndPoint("EndToEnd", range); textBox.selectionStart = stored_range.text.length - range.text.length; textBox.selectionEnd = textBox.selectionStart + range.text.length; } $(textBox).attr("range", textBox.selectionStart + "&0"); }, ExpressionsObj: null, TargetTextarea: null, IsLoadExpression: false, showExpression: function (txtCtrl, showWhere) { App.TargetTextarea = txtCtrl; App.HideAllDiaDiv(); if (App.initDialDiv("divExpression", dialDiv, true, function () { $("#divExpression").hide(); })) { $("#divExpression").css("z-index", 2000); $("#divExpression").find(".mid_c").html(expressionConDiv); var showWhere = $(showWhere).offset(); $("#divExpression").css("left", showWhere.left - 15); $("#divExpression").css("top", showWhere.top + 20); $("#divExpression").show(); $.ajax({ type: "Post", url: "/Ajax/GetExpressionType/", datatype: "json", cache: false, success: function (o) { var typeEles = "<ul Page=\"1|1\">"; for (var i = 0; i < parseInt(o.Data.length / 7) + 1; i++) { for (var j = i * 7; j < (7 * (i + 1)); j++) { if (o.Data[j] != null) { typeEles += ("<li group=\"" + i + "\" style=\"display:" + (j < 7 ? "block" : "none") + "\"><a href=\"javascript:void(0);\" class='" + (j == 0 ? "magicTcur" : "") + "' type=\"" + o.Data[j].ID + "\" >" + o.Data[j].Name + "</a></li>"); if ((j + 1) % 7 != 0 && j != o.Data.length - 1) { typeEles += ("<li class=\"magiclicur\" style=\"display:" + (j < 7 ? "block" : "none") + "\" group=\"" + i + "\" >|</li>"); } } else { break; } } } typeEles += "</ul>"; $(".magicTL").html(typeEles); $(".magicTL").find("ul").attr("Page", "1|" + (parseInt(o.Data.length / 7) + 1)); $.ajax({ type: "Post", url: "/Ajax/GetExpressions/", datatype: "json", cache: false, success: function (obj) { App.IsLoadExpression = true; App.ExpressionsObj = obj.Data; var defaultExpressionEles = "<ul>"; var topExpressionEles = "<ul>"; for (var k = 0; k < obj.Data.length; k++) { if (obj.Data[k].IsTop == 1) { topExpressionEles += ("<li title=\"" + obj.Data[k].Name + "\"><a class=\"forElive\" href=\"javascript:void(0);\"><img src=\"" + obj.Data[k].Url + "\" alt=\"" + obj.Data[k].Name + "\"></a></li>"); } if (obj.Data[k].IsDefault == 1) { defaultExpressionEles += ("<li title=\"" + obj.Data[k].Name + "\"><a class=\"forElive\" href=\"javascript:void(0);\"><img src=\"" + obj.Data[k].Url + "\" alt=\"" + obj.Data[k].Name + "\"></a></li>"); } } topExpressionEles += "</ul><div class=\"clearit\"></div>"; defaultExpressionEles += "</ul><div class=\"clearit\"></div>"; $(".faceItemPicbgT").html(topExpressionEles); $(".faceItemPicbg").html(defaultExpressionEles); $(".magicTL").find("a").bind("click", function () { $(".faceItemPicbgT").hide(); var expElse = "<ul>"; var type = $(this).attr("type"); if (App.ExpressionsObj != null) { var data = App.ExpressionsObj; for (var n = 0; n < data.length; n++) { if (data[n].Type == type) { expElse += ("<li title=\"" + data[n].Name + "\"><a class=\"forElive\" href=\"javascript:void(0);\"><img src=\"" + data[n].Url + "\" alt=\"" + data[n].Name + "\"></a></li>"); } } expElse += "</ul><div class=\"clearit\"></div>"; $(".faceItemPicbg").html(expElse); $(".magicTcur").removeClass("magicTcur"); $(this).addClass("magicTcur").blur(); } return false; }); $($(".magicTL").find("a")[0]).bind("click", function () { $(".faceItemPicbgT").show(); var expTopElse = "<ul>"; var expDefaultElse = "<ul>"; if (App.ExpressionsObj != null) { var data = App.ExpressionsObj; for (var m = 0; m < data.length; m++) { if (data[m].IsTop == 1) { expTopElse += ("<li title=\"" + data[m].Name + "\"><a class=\"forElive\" href=\"javascript:void(0);\"><img src=\"" + data[m].Url + "\" alt=\"" + data[m].Name + "\"></a></li>"); } if (data[m].IsDefault == 1) { expDefaultElse += ("<li title=\"" + data[m].Name + "\"><a class=\"forElive\" href=\"javascript:void(0);\"><img src=\"" + data[m].Url + "\" alt=\"" + data[m].Name + "\"></a></li>"); } } expTopElse += "</ul><div class=\"clearit\"></div>"; expDefaultElse += "</ul><div class=\"clearit\"></div>"; $(".faceItemPicbgT").html(expTopElse); $(".faceItemPicbg").html(expDefaultElse); $(".magicTcur").removeClass("magicTcur"); $(this).addClass("magicTcur").blur(); } return false; }); $($(".magicTR").find("a")[0]).bind("click", function () { if ($(this).attr("class") == "magicbtnL01") return false; if ($(this).next().attr("class") == "magicbtnR01") $(this).next().attr("class", "magicbtnR02") var curPage = parseInt($(".magicTL").find("ul").attr("Page").split("|")[0]); var pageCount = parseInt($(".magicTL").find("ul").attr("Page").split("|")[1]); $("li[group='" + (curPage - 1) + "']").hide(); curPage = curPage - 1; $("li[group='" + (curPage - 1) + "']").show(); $(".magicTL").find("ul").attr("Page", curPage + "|" + pageCount); if (curPage == 1) { $(this).attr("class", "magicbtnL01"); } return false; }); $($(".magicTR").find("a")[1]).bind("click", function () { if ($(this).attr("class") == "magicbtnR01") return false; if ($(this).prev().attr("class") == "magicbtnL01") $(this).prev().attr("class", "magicbtnL02") var curPage = parseInt($(".magicTL").find("ul").attr("Page").split("|")[0]); var pageCount = parseInt($(".magicTL").find("ul").attr("Page").split("|")[1]); $("li[group='" + (curPage - 1) + "']").hide(); curPage = curPage + 1; $("li[group='" + (curPage - 1) + "']").show(); $(".magicTL").find("ul").attr("Page", curPage + "|" + pageCount); if (curPage == pageCount) { $(this).attr("class", "magicbtnR01"); } return false; }); $("#divExpression").find(".close").bind("click", function () { $("#divExpression").hide(); }); $(".forElive").live("click", function () { var val = "[" + $(this).find("img").attr("alt") + "] "; App.insertTxt2Txtarea(App.TargetTextarea, val); $("#divExpression").hide(); }); }, error: function (request) { } }); }, error: function (request) { } }); } else { var showWhere = $(showWhere).offset(); $("#divExpression").css("left", showWhere.left - 15); $("#divExpression").css("top", showWhere.top + 20); $("#divExpression").show(); if (App.IsLoadExpression) { $($(".magicTL").find("a")[0]).click(); var prevBtn = $($(".magicTR").find("a")[0]); var nextBtn = $($(".magicTR").find("a")[1]); prevBtn.attr("class", "magicbtnL01"); nextBtn.attr("class", "magicbtnR02"); var curPage = parseInt($(".magicTL").find("ul").attr("Page").split("|")[0]); var pageCount = parseInt($(".magicTL").find("ul").attr("Page").split("|")[1]); $(".magicTL").find("li").hide(); curPage = 1; $("li[group='" + (curPage - 1) + "']").show(); $(".magicTL").find("ul").attr("Page", curPage + "|" + pageCount); } } return false; }, showPicUpload: function (showWhere) { if (App.isVisible($("#divPicUploadLoding"))) return; if (App.isVisible($("#divPicUploadLoded"))) return; App.HideAllDiaDiv(); if (App.initDialDiv("divPicUpload", dialDiv, true, function () { $("#divPicUpload").hide(); })) { $("#divPicUpload").find(".mid_c").html(picUploadCondiv); var showWhere = $(showWhere).offset(); App.picUploadPos = showWhere; $("#divPicUpload").css("left", showWhere.left - 35); $("#divPicUpload").css("top", showWhere.top + 20); $("#divPicUpload").show(); $("#divPicUpload").find(".close").click(function () { $("#divPicUpload").hide(); }); $("#divPicUpload").find(".btn_green").mousemove(function (e) { var btnX = e.pageX - $(this).offset().left; var btnY = e.pageY - $(this).offset().top; var uploadInput = $(this).find("input"); uploadInput.css("left", btnX - 60); uploadInput.css("top", btnY - 10); }); $("#frmPicUpload").find("input").change(function () { App.PicUpload("frmPicUpload", this, function () { App.ShowUploadPicLoding(); }); }); } else { $("#divPicUpload").show(); } return false; }, HideAllDiaDiv: function () { $(".4CancelAllLayer").hide(); }, PicUpload: function (formid, uploadCtrl, callBack) { if (!(/\.(gif|jpg|png|jpeg)$/i.test($(uploadCtrl).val()))) { App.alert("请上传jpg、gif、png格式的图片。"); return false; } else { var iframeStr = "<iframe class=\"fb_img_iframe\" frameborder=\"0\" name=\"ifrPicUpload\" id=\"ifrPicUpload\" src=\"about:blank\" style=\"display:none;\" ></iframe>"; App.appendToBody($("#ifrPicUpload"), iframeStr); if ($.browser.msie) { eval("window." + formid + ".submit();"); } else { $("#" + formid).submit(); } callBack(); } var clone = $(uploadCtrl).clone(); clone.removeAttr("value"); $(uploadCtrl).remove(); $("#" + formid).html(clone); $("#" + formid).find("input").change(function () { App.PicUpload(formid, this, callBack); }); }, ShowUploadPicLoding: function () { App.HideAllDiaDiv(); if (App.initDialDiv("divPicUploadLoding", dialDiv, false, null)) { $("#divPicUploadLoding").find(".mid_c").html(picUploadingCondiv); $("#divPicUploadLoding").css("left", App.picUploadPos.left - 35); $("#divPicUploadLoding").css("top", App.picUploadPos.top + 20); $("#divPicUploadLoding").show(); $("#divPicUploadLoding").removeClass("4CancelAllLayer"); $("#divPicUploadLoding").find(".btn_normal").click(function () { $("#ifrPicUpload").remove(); $("#divPicUploadLoding").hide(); }); } else { $("#divPicUploadLoding").show(); } }, picUploadPos: null, ShowUploadPicLoded: function (img, name, id) { if (App.initDialDiv("divPicUploadLoded", dialDiv, false, null)) { $("#divPicUploadLoded").find(".mid_c").html(picUploadedCondiv); $("#divPicUploadLoded").css("left", App.picUploadPos.left - 35); $("#divPicUploadLoded").css("top", App.picUploadPos.top + 20); $("#divPicUploadLoded").show(); $("#divPicUploadLoded").removeClass("4CancelAllLayer"); $("#divPicUploadLoded").find(".dele").click(function () { $("#divPicUploadLoded").hide(); $("#divPicUploadLoded").find("img").hide(); App.attachPic = -1; }); } else { $("#divPicUploadLoded").show(); } $("#divPicUploadLoded").find("img")[0].src = img + "?m=" + Math.random() * 10000; $("#divPicUploadLoded").find(".cur_status").find("strong").html(name); App.attachPic = id; }, PicUploadCallBack: function (status, imgSrc, imgName, imgID) { $("#divPicUploadLoding").hide(); if (status == 1) { App.ShowUploadPicLoded(arguments[1], arguments[2], arguments[3]); } if (status == -1) { App.alert("上传有异常失败,请稍后再试。"); } if (status == -2) { App.alert("上传图片超过5M,请重新上传。"); } }, ShowVideoDiaDiv: function (txtCtrl, showWhere) { App.HideAllDiaDiv(); App.TargetTextarea = txtCtrl; if (App.initDialDiv("divVidoLink", dialDiv, true, function () { $("#divVidoLink").hide(); })) { $("#divVidoLink").find(".mid_c").html(videoCondiv); var showWhere = $(showWhere).offset(); $("#divVidoLink").css("left", showWhere.left - 143); $("#divVidoLink").css("top", showWhere.top + 20); $("#divVidoLink").show(); $("#divVidoLink").find(".close").click(function () { $("#divVidoLink").hide(); }); $("#divVidoLink").find("#vsubmit").click(function () { var txt = $("#divVidoLink").find("#vinput"); var infoP = $("#divVidoLink").find("#vredinfo"); var infoP1 = $("#divVidoLink").find("#normalact"); if ($.trim(txt.val()) == "") { infoP.html("请输入Url"); infoP1.show(); infoP.show(); return false; } $.ajax({ url: "/Ajax/CheckVideoUrl/", type: "POST", cache: false, dataType: "json", data: { Url: $.trim(txt.val()) }, success: function (o) { if (o.Code == "A00007") { infoP.html(CodeList[o.Code]); infoP1.show(); infoP.show(); } else { $("#divVidoLink").hide(); App.insertTxt2Txtarea(App.TargetTextarea, o.Data + " "); } } }); return false; }); $("#divVidoLink").find("#vcancel").click(function () { $("#divVidoLink").hide(); }); $("#divVidoLink").find("#vback").click(function () { $("#divVidoLink").hide(); var txt = $("#divVidoLink").find("#vinput"); App.insertTxt2Txtarea(App.TargetTextarea, $.trim(txt.val()) + " "); }); $("#divVidoLink").find("#vinput").focus(function () { this.style.color = "rgb(51, 51, 51)"; }).blur(function () { this.style.color = "rgb(153, 153, 153)"; }); } else { $("#divVidoLink").show(); $("#divVidoLink").find("#vredinfo").hide(); $("#divVidoLink").find("#normalact").hide(); $("#divVidoLink").find("#vinput").val(""); } return false; }, showMusicDiaDiv: function (txtCtrl, showWhere) { App.HideAllDiaDiv(); App.TargetTextarea = txtCtrl; if (App.initDialDiv("divMusicDiaDiv", dialDiv, false, null)) { $("#divMusicDiaDiv").removeClass("4CancelAllLayer"); $("#divMusicDiaDiv").find(".mid_c").html(musicCondiv); var showWhere = $(showWhere).offset(); $("#divMusicDiaDiv").css("left", showWhere.left - 143); $("#divMusicDiaDiv").css("top", showWhere.top + 20); $("#divMusicDiaDiv").show(); $("#divMusicDiaDiv").find(".close").click(function () { $("#divMusicDiaDiv").hide(); }); App.initSwfUpload(); $("#divMusicDiaDiv #inputmusiclink").find("a").click( function () { $("#divMusicDiaDiv #linksongdiv").show(); $("#divMusicDiaDiv #uploadsongdiv").hide(); $("#divMusicDiaDiv #upload_Container").hide(); $("#divMusicDiaDiv #uploadsong").attr("class", ""); $("#divMusicDiaDiv #inputmusiclink").attr("class", "cur"); }); $("#divMusicDiaDiv #uploadsong").find("a").click( function () { $("#divMusicDiaDiv #linksongdiv").hide(); $("#divMusicDiaDiv #uploadsongdiv").show(); $("#divMusicDiaDiv #uploadsong").attr("class", "cur"); $("#divMusicDiaDiv #inputmusiclink").attr("class", ""); }); $("#divMusicDiaDiv #mlinkinput").focus(function () { $(this).css("color", "rgb(51, 51, 51)"); if ($.trim($(this).val()) == "请输入以MP3结尾的链接") $(this).val(""); }).blur(function () { if ($(this).val() == "") { $(this).val("请输入以MP3结尾的链接"); } $(this).css("color", "rgb(153, 153, 153)"); }); $("#divMusicDiaDiv").find("#mlinksubmit").click(function () { var txt = $("#divMusicDiaDiv").find("#mlinkinput"); var infoP = $("#divMusicDiaDiv").find("#mlinkredinfo"); var infoP1 = $("#divMusicDiaDiv").find("#mlinkre"); if ($.trim(txt.val()) == "请输入以MP3结尾的链接") { infoP.html("请输入Url"); infoP1.show(); infoP.show(); return false; } $.ajax({ url: "/Ajax/CheckMusicUrl/", type: "POST", cache: false, dataType: "json", data: { Url: $.trim(txt.val()) }, success: function (o) { if (o.Code == "A00007") { infoP.html(CodeList[o.Code]); infoP1.show(); infoP.show(); } else { $("#divMusicDiaDiv").hide(); App.insertTxt2Txtarea(App.TargetTextarea, o.Data + " "); } } }); return false; }); $("#divMusicDiaDiv").find("#mlinkcancel").click(function () { $("#divMusicDiaDiv").hide(); }); $("#divMusicDiaDiv").find("#mlinkback").click(function () { $("#divMusicDiaDiv").hide(); var txt = $("#divMusicDiaDiv").find("#mlinkinput"); App.insertTxt2Txtarea(App.TargetTextarea, $.trim(txt.val()) + " "); }); } else { $("#divMusicDiaDiv").show(); } return false; }, swfu: null, initSwfUpload: function () { var settings = { flash_url: "/swfupload/swfupload.swf", upload_url: "/Music/Upload/", post_params: {}, file_size_limit: "10 MB", file_types: "*.mp3", file_types_description: "mp3音频文件", file_upload_limit: 0, file_queue_limit: 1, custom_settings: { progressTarget: "lists", progressBarDiv: "upload_Container", musicDiaDiv: "divMusicDiaDiv", txtArea: App.TargetTextarea }, debug: false, // Button settings button_image_url: "/swfupload/public_btn_01.png", button_width: "75", button_height: "28", button_placeholder_id: "swfuploadspan", button_text: '<span class="theFont">上传音乐</span>', button_text_style: ".theFont { font-size: 14; }", button_text_left_padding: 5, button_text_top_padding: 3, button_window_mode: SWFUpload.WINDOW_MODE.OPAQUE, // The event handler functions are defined in handlers.js file_queued_handler: fileQueued, file_queue_error_handler: fileQueueError, file_dialog_complete_handler: fileDialogComplete, upload_start_handler: uploadStart, upload_progress_handler: uploadProgress, upload_error_handler: uploadError, upload_success_handler: uploadSuccess, upload_complete_handler: uploadComplete, queue_complete_handler: queueComplete // Queue plugin event }; App.swfu = new SWFUpload(settings); }, setSelectRange: function (textarea, start, end) { if (typeof textarea.createTextRange != 'undefined')// IE { var length = start; for (var i = 1; i < length; i++) { if (textarea.value.charAt(i) == '\n') { start--; end--; } } var range = textarea.createTextRange(); // 先把相对起点移动到0处 range.moveStart("character", 0) range.moveEnd("character", 0); range.collapse(true); // 移动插入光标到start处 range.moveEnd("character", end); range.moveStart("character", start); range.select(); } // if else if (typeof textarea.setSelectionRange != 'undefined') { textarea.setSelectionRange(start, end); textarea.focus(); } // else }, insertTopic: function (txtarea) { var index; index = $(txtarea)[0].value.indexOf("#请在这里输入自定义话题#"); if (index != -1) { App.setSelectRange(txtarea, index + 1, index + 12); App.selPos(txtarea); } else { App.insertTxt2Txtarea(txtarea, "#请在这里输入自定义话题#"); App.insertTopic(txtarea); } }, getTxtLen: function (obj) { return $(obj)[0].value.replace(/[^\x00-\xff]/g, 'xx').length; }, TimerFunArray: [], Timer: null, StartTimer: function () { App.Timer = setInterval(function () { for (var i = 0; i < App.TimerFunArray.length; i++) { App.TimerFunArray[i](); } }, 1000); }, StopTimer: function () { clearInterval(App.Timer); }, attachPic: -1, CreateOriginalMiniBlog: function (txtCtr, successCallBack, defaultCallBack) { var con = $.trim($(txtCtr).val()).replace(/\n/g, ""); con = App.htmlencode(con); var data = { Content: con, AttachPic: App.attachPic }; $.ajax({ url: "/Ajax/CreateOriginalMiniBlog/", type: "POST", cache: false, dataType: "json", data: data, success: function (o) { if (o.Code == "A00009") { App.tip(CodeList[o.Code], 1000); if (successCallBack) successCallBack(); } else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00016") { App.alert(CodeList[o.Code]); } else { App.alert(CodeList["A00003"]); } if (defaultCallBack) defaultCallBack(); }, error: function () { App.alert(CodeList["A00003"]); if (defaultCallBack) defaultCallBack(); } }); }, CreateOriginalSchoolMiniBlog: function (txtCtr, schoolClassID, successCallBack, defaultCallBack) { var con = $.trim($(txtCtr).val()).replace(/\n/g, ""); con = App.htmlencode(con); var data = { Content: con, AttachPic: App.attachPic, schoolClassID: schoolClassID }; $.ajax({ url: "/Ajax/CreateOriginalSchoolMiniBlog/", type: "POST", cache: false, dataType: "json", data: data, success: function (o) { if (o.Code == "A00009") { App.tip(CodeList[o.Code], 1000); if (successCallBack) successCallBack(); } else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00016") { App.alert(CodeList[o.Code]); } else { App.alert(CodeList["A00003"]); } if (defaultCallBack) defaultCallBack(); }, error: function () { App.alert(CodeList["A00003"]); if (defaultCallBack) defaultCallBack(); } }); }, CreateQuoteMiniBlog: function (txtCtr, oriMid, quoMid, isRoot, isLast, successCallBack, defaultCallBack) { var con = $.trim($(txtCtr).val()).replace(/\n/g, ""); con = App.htmlencode(con); var data = { Content: con, oriMid: oriMid, quoMid: quoMid, isRoot: isRoot, isLast: isLast }; $.ajax({ url: "/Ajax/CreateQuoteMiniBlog/", type: "POST", cache: false, dataType: "json", data: data, success: function (o) { if (o.Code == "A00010") { App.tip(CodeList[o.Code], 1000); if (successCallBack) successCallBack(); } else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00016") { App.alert(CodeList[o.Code]); } else { App.alert(CodeList["A00003"]); } if (defaultCallBack) defaultCallBack(); }, error: function () { App.alert(CodeList["A00003"]); if (defaultCallBack) defaultCallBack(); } }); }, request: function (paras) { var url = location.href; var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&"); var paraObj = {} for (i = 0; j = paraString[i]; i++) { paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length); } var returnValue = paraObj[paras.toLowerCase()]; if (typeof (returnValue) == "undefined") { return ""; } else { return returnValue; } }, scaleImg: function (imgA, mid) { var dispDiv = $("#disp_" + mid); var prevDiv = $("#prev_" + mid); var isOri = $("#mid_" + mid).find(".source")[0] == null; var imgCon = "<div class=\"blogPicOri\"><p><cite><a id=\"back_" + mid + "\" href=\"javascript:;\"><img src=\"/Content/Image/transparent.gif\" class=\"small_icon cls\" title=\"收起\">收起</a><cite class=\"MIB_line_l\">|</cite></cite><cite><a id=\"oriImg_" + mid + "\" target=\"_blank\" href=\"\"><img src=\"/Content/Image/transparent.gif\" class=\"small_icon original\" title=\"查看大图\">查看大图</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"left_" + mid + "\" href=\"javascript:;\" ><img src=\"/Content/Image/transparent.gif\" class=\"small_icon turn_l\" title=\"向左转\">向左转</a></cite><cite><a id=\"right_" + mid + "\" class=\"last_turn_r\" href=\"javascript:;\" ><img src=\"/Content/Image/transparent.gif\" class=\"small_icon turn_r\" title=\"向右转\">向右转</a></cite></p><img src=\"\" class=\"imgSmall\" id=\"load_" + mid + "\"></div>"; var elseCon = ""; var loadIco = $(imgA).next(); var thumImg = $(imgA).find("img"); var midImgSrc = thumImg.attr("src").replace("Thum", "Middle"); var larImgSrc = thumImg.attr("src").replace("Thum", "Large"); if (isOri) { elseCon = "<div class=\"MIB_assign\"><div class=\"MIB_assign_t\"></div><div class=\"MIB_assign_c MIB_txtbl\">{0}</div><div class=\"MIB_assign_b\"></div></div>"; } else { elseCon = "<div class=\"MIB_linedot_l1\"></div>{0}"; } dispDiv.html(elseCon.replace("{0}", imgCon)); loadIco.css("top", parseInt(($(thumImg).height() - 16) / 2)); loadIco.css("left", parseInt(($(thumImg).width() - 16) / 2)); loadIco.show(); $("#oriImg_" + mid).attr("href", larImgSrc); $("#load_" + mid).load(function () { loadIco.hide(); prevDiv.hide(); dispDiv.show(); }).add($("#back_" + mid)).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); $("#load_" + mid).attr("src", midImgSrc); var R = function (g) { g.className = "imgSmall"; $(g).click(function () { prevDiv.show(); dispDiv.html("").hide(); }); g.style.display = "none"; g.style.display = "inline"; dispDiv[0].style.cssText = "text-align:center;width:100%;"; }; $("#left_" + mid).click(function () { App.rotate.rotateLeft("load_" + mid, 90, R, 440); return false; }); $("#right_" + mid).click(function () { App.rotate.rotateRight("load_" + mid, 90, R, 440); return false; }); }, openVideo: function (mid, vid) { var xmlrequst = App.ajaxRequstList.get("mid_" + mid); if (xmlrequst != null) { xmlrequst.abort(); } var dispDiv = $("#disp_" + mid); var prevDiv = $("#prev_" + mid); var isOri = $("#mid_" + mid).find(".source")[0] == null; var vCon = "<div style=\"margin-bottom: 1px;\"><div><div id=\"videoShow_" + mid + "\" style=\"padding-top: 10px\"></div></div></div>"; var errorCon = "<div>很抱歉,该内容无法显示,请重试。</div>"; var loadCon = "<div><center><img src=\"/Content/Image/loading.gif\" style=\"padding-top:20px;padding-bottom:20px\"></center></div>"; var allCon = ""; if (isOri) { allCon = "<div class=\"MIB_assign\"><div class=\"MIB_assign_t\"></div><div class=\"MIB_assign_c MIB_txtbl\"><div class=\"blogPicOri\"><p><cite><a id=\"back_" + mid + "\" href=\"javascript:;\" title=\"收起\" onclick=\"return false;\"><img title=\"收起\" class=\"small_icon cls\" src=\"/Content/Image/transparent.gif\">收起</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"title_" + mid + "\" title=\"\" href=\"\" target=\"_blank\"><img class=\"small_icon original\" src=\"/Content/Image/transparent.gif\">载入中...</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"pop_" + mid + "\" onclick=\"return false;\" href=\"####\"><img alt=\"\" title=\"\" class=\"small_icon turn_r\" src=\"/Content/Image/transparent.gif\">弹出</a></cite></p>{0}</div></div><div class=\"MIB_assign_b\"></div></div>"; } else { allCon = "<div class=\"MIB_linedot_l1\"></div><p><cite><a id=\"back_" + mid + "\" href=\"javascript:;\" title=\"收起\" onclick=\"return false;\"><img title=\"收起\" class=\"small_icon cls\" src=\"/Content/Image/transparent.gif\">收起</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"title_" + mid + "\" title=\"\" href=\"\" target=\"_blank\"><img class=\"small_icon original\" src=\"/Content/Image/transparent.gif\">载入中...</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"pop_" + mid + "\" onclick=\"return false;\" href=\"####\"><img alt=\"\" title=\"\" class=\"small_icon turn_r\" src=\"/Content/Image/transparent.gif\">弹出</a></cite></p>{0}"; } dispDiv.html(allCon.replace("{0}", loadCon)); dispDiv.show(); prevDiv.hide(); $("#back_" + mid).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); var xmlrequst = App.ajaxRequstList.get("mid_" + mid); if (xmlrequst != null) { xmlrequst.abort(); } }); App.ajaxRequstList.add("mid_" + mid, $.ajax({ dataType: "json", data: { Vid: vid }, url: "/Ajax/GetVideo/", cache: false, type: "post", success: function (o) { if (o.Data != null) { if (o.Code == "A00003") dispDiv.html(allCon.replace("{0}", errorCon)); else if (o.Code == "A00001") { App.showLoginDial(); } else { dispDiv.html(allCon.replace("{0}", vCon)); $("#videoShow_" + mid).html(o.Data.Flv); $("#title_" + mid).attr("href", o.Data.Url); $("#title_" + mid).attr("title", o.Data.Url); $("#title_" + mid).html("<img class=\"small_icon original\" src=\"/Content/Image/transparent.gif\">" + o.Data.Title); } App.ajaxRequstList.remove("mid_" + mid); $("#back_" + mid).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); $("#pop_" + mid).click(function () { App.showMediaDiv(o.Data.Flv); prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); } }, error: function () { dispDiv.html(allCon.replace("{0}", errorCon)); App.ajaxRequstList.remove("mid_" + mid); $("#back_" + mid).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); } })); }, playMusic: function (mid, musicid) { var xmlrequst = App.ajaxRequstList.get("mid_" + mid); if (xmlrequst != null) { xmlrequst.abort(); } var dispDiv = $("#disp_" + mid); var prevDiv = $("#prev_" + mid); var isOri = $("#mid_" + mid).find(".source")[0] == null; var vCon = "<div style=\"margin-bottom: 1px;\"><div><div id=\"videoShow_" + mid + "\" style=\"padding-top: 10px\"></div></div></div>"; var errorCon = "<div>很抱歉,该内容无法显示,请重试。</div>"; var loadCon = "<div><center><img src=\"/Content/Image/loading.gif\" style=\"padding-top:20px;padding-bottom:20px\"></center></div>"; var allCon = ""; if (isOri) { allCon = "<div class=\"MIB_assign\"><div class=\"MIB_assign_t\"></div><div class=\"MIB_assign_c MIB_txtbl\"><div class=\"blogPicOri\"><p><cite><a id=\"back_" + mid + "\" href=\"javascript:;\" title=\"收起\" onclick=\"return false;\"><img title=\"收起\" class=\"small_icon cls\" src=\"/Content/Image/transparent.gif\">收起</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"title_" + mid + "\" title=\"\" href=\"\" target=\"_blank\"><img class=\"small_icon original\" src=\"/Content/Image/transparent.gif\">载入中...</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"pop_" + mid + "\" onclick=\"return false;\" href=\"####\"><img alt=\"\" title=\"\" class=\"small_icon turn_r\" src=\"/Content/Image/transparent.gif\">弹出</a></cite></p>{0}</div></div><div class=\"MIB_assign_b\"></div></div>"; } else { allCon = "<div class=\"MIB_linedot_l1\"></div><p><cite><a id=\"back_" + mid + "\" href=\"javascript:;\" title=\"收起\" onclick=\"return false;\"><img title=\"收起\" class=\"small_icon cls\" src=\"/Content/Image/transparent.gif\">收起</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"title_" + mid + "\" title=\"\" href=\"\" target=\"_blank\"><img class=\"small_icon original\" src=\"/Content/Image/transparent.gif\">载入中...</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"pop_" + mid + "\" onclick=\"return false;\" href=\"####\"><img alt=\"\" title=\"\" class=\"small_icon turn_r\" src=\"/Content/Image/transparent.gif\">弹出</a></cite></p>{0}"; } dispDiv.html(allCon.replace("{0}", loadCon)); dispDiv.show(); prevDiv.hide(); $("#back_" + mid).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); var xmlrequst = App.ajaxRequstList.get("mid_" + mid); if (xmlrequst != null) { xmlrequst.abort(); } }); App.ajaxRequstList.add("mid_" + mid, $.ajax({ dataType: "json", data: { MusicID: musicid }, url: "/Ajax/GetMusic/", cache: false, type: "post", success: function (o) { if (o.Data != null) { if (o.Code == "A00003") dispDiv.html(allCon.replace("{0}", errorCon)); else if (o.Code == "A00001") { App.showLoginDial(); } else { dispDiv.html(allCon.replace("{0}", vCon)); $("#videoShow_" + mid).html(o.Data.Flv); $("#title_" + mid).attr("href", o.Data.Url); $("#title_" + mid).attr("title", o.Data.Url); $("#title_" + mid).html("<img class=\"small_icon original\" src=\"/Content/Image/transparent.gif\">" + o.Data.Title); } App.ajaxRequstList.remove("mid_" + mid); $("#back_" + mid).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); $("#pop_" + mid).click(function () { App.showMediaDiv(o.Data.Flv); prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); } }, error: function () { dispDiv.html(allCon.replace("{0}", errorCon)); App.ajaxRequstList.remove("mid_" + mid); $("#back_" + mid).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); } })); }, startVote: function (mid, voteid) { var xmlrequst = App.ajaxRequstList.get("mid_" + mid); if (xmlrequst != null) { xmlrequst.abort(); } var dispDiv = $("#disp_" + mid); var prevDiv = $("#prev_" + mid); var isOri = $("#mid_" + mid).find(".source")[0] == null; var vCon = "<div style=\"margin-bottom: 1px;\"><div><div id=\"videoShow_" + mid + "\" style=\"padding-top: 10px\"></div></div></div>"; var errorCon = "<div>很抱歉,该内容无法显示,请重试。</div>"; var loadCon = "<div><center><img src=\"/Content/Image/loading.gif\" style=\"padding-top:20px;padding-bottom:20px\"></center></div>"; var allCon = ""; if (isOri) { allCon = "<div class=\"MIB_assign\"><div class=\"MIB_assign_t\"></div><div class=\"MIB_assign_c MIB_txtbl\"><div class=\"blogPicOri\"><p><cite><a id=\"back_" + mid + "\" href=\"javascript:;\" title=\"收起\" onclick=\"return false;\"><img title=\"收起\" class=\"small_icon cls\" src=\"/Content/Image/transparent.gif\">收起</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"title_" + mid + "\" title=\"\" href=\"\" target=\"_blank\"><img class=\"small_icon original\" src=\"/Content/Image/transparent.gif\">载入中...</a></cite></p><div><div class=\"MIB_linedot_l1\"></div>{0}</div></div></div><div class=\"MIB_assign_b\"></div></div>"; } else { allCon = "<div class=\"MIB_linedot_l1\"></div><p><cite><a id=\"back_" + mid + "\" href=\"javascript:;\" title=\"收起\" onclick=\"return false;\"><img title=\"收起\" class=\"small_icon cls\" src=\"/Content/Image/transparent.gif\">收起</a></cite><cite class=\"MIB_line_l\">|</cite><cite><a id=\"title_" + mid + "\" title=\"\" href=\"\" target=\"_blank\"><img class=\"small_icon original\" src=\"/Content/Image/transparent.gif\">载入中...</a></cite></p><div><div class=\"MIB_linedot_l1\"></div>{0}</div>"; } dispDiv.html(allCon.replace("{0}", loadCon)); dispDiv.show(); prevDiv.hide(); $("#back_" + mid).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); var xmlrequst = App.ajaxRequstList.get("mid_" + mid); if (xmlrequst != null) { xmlrequst.abort(); } }); App.ajaxRequstList.add("mid_" + mid, $.ajax({ dataType: "json", data: { mid: mid, vid: voteid }, url: "/Ajax/GetVoteFeedHtml/", cache: false, type: "post", success: function (o) { if (o.Data != null) { if (o.Code == "A00003") dispDiv.html(allCon.replace("{0}", errorCon)); else if (o.Code == "A00001") { App.showLoginDial(); } else { dispDiv.html(allCon.replace("{0}", vCon)); $("#videoShow_" + mid).html(o.Data); // $("#title_" + mid).attr("href", o.Url); $("#title_" + mid).attr("title", o.Url); $("#title_" + mid).html("<img class=\"small_icon original\" src=\"/Content/Image/transparent.gif\">" + o.Title); var voteDiv = $("div[voteDiv='" + voteid + "']"); var isJoined = voteDiv.attr("isJoined") == "true"; var isExpire = voteDiv.attr("isExpire") == "true"; var maxSel = parseInt(voteDiv.attr("maxSel")); var voteBtn = voteDiv.find(".onvote_btn02"); var optionCount = parseInt(voteDiv.attr("optionCount")); if (!isJoined && !isExpire) { var optionCtls = voteDiv.find("input[name='item_id']").change(function () { if (maxSel != -1) { var selectedCount = 0; for (var i = 1; i <= optionCount; i++) { if ($("#checked_" + voteid + "_" + i)[0].checked) { selectedCount++; } } if (selectedCount <= maxSel && selectedCount != 0) { voteBtn.attr("class", "onvote_btn01"); } else { voteBtn.attr("class", "onvote_btn02"); } } else if (this.checked) { voteBtn.attr("class", "onvote_btn01"); } }); } voteBtn.click(function () { if (this.className == "onvote_btn01" && !this.locked) { this.locked = true; this.className = "onvote_btn02" var selItemIDs = ""; for (var i = 1; i <= optionCount; i++) { if ($("#checked_" + voteid + "_" + i)[0].checked) { selItemIDs += $("#checked_" + voteid + "_" + i)[0].value + ","; } } var curbtn = this; var niming = voteDiv.find("#niming")[0].checked ? 1 : ""; var feedMiniblog = voteDiv.find("#share")[0].checked ? 1 : ""; $.ajax({ dataType: "json", data: { vid: voteid, selItemIDs: selItemIDs, niMing: niming, feedMiniBlog: feedMiniblog }, url: "/Ajax/JoinVote/", cache: false, type: "post", success: function (o) { if (o.Code == "A00003") App.fullTip(CodeList[o.Code], 1000, null, 1); else if (o.Code == "A00001") { App.showLoginDial(); } else { $("#back_" + mid).click(); App.fullTip(CodeList[o.Code], 1000, null, 1); } curbtn.className = "onvote_btn01"; curbtn.locked = false; }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); curbtn.className = "onvote_btn01"; curbtn.locked = false; } }); } }); } App.ajaxRequstList.remove("mid_" + mid); $("#back_" + mid).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); $("#pop_" + mid).click(function () { App.showMediaDiv(o.Data.Flv); prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); } }, error: function () { dispDiv.html(allCon.replace("{0}", errorCon)); App.ajaxRequstList.remove("mid_" + mid); $("#back_" + mid).click(function () { prevDiv.show(); dispDiv.html(""); dispDiv.hide(); }); } })); }, showFeedDiv: function (mid, isOri, oriMid) { $.ajax({ dataType: "json", url: "/Ajax/InitQuoteBox/", data: { mid: mid }, cache: false, type: "post", success: function (o) { if (o.Code == "A00005") { if (App.initDialDiv("divFeedTabDiv", dialDiv, false, null)) { $("#divFeedTabDiv").removeClass("4CancelAllLayer"); $("#divFeedTabDiv").find(".mid_c").html(feedTabDiv); App.showMash(); $("#divFeedTabDiv .layerBoxCon").html(feedConDiv); var position = App.centerInScreen($("#divFeedTabDiv")); $("#divFeedTabDiv").css("left", position.left + "px"); $("#divFeedTabDiv").css("top", position.top + "px"); $("#divFeedTabDiv").find(".close").click(function () { $("#divFeedTabDiv").remove(); App.hideMash(); }); var tabs = $("#divFeedTabDiv .lv_nav").find("li"); tabs.click(function () { if (this.className == "cur") return; else { if ($(this).next()[0] != null) { App.tabToFeed(mid, isOri, oriMid, o.Data); this.className = "cur"; $(this).next()[0].className = ""; } else { App.tabToMes(mid, isOri, o.Data); this.className = "cur"; $(this).prev()[0].className = ""; } this.className = "cur"; } }); } App.tabToFeed(mid, isOri, oriMid, o.Data); return false; } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.alert(CodeList["A00003"]); } }, error: function () { App.alert(CodeList["A00003"]); } }); }, tabToMes: function (mid, isOri, Data) { $("#divFeedTabDiv .layerBoxCon").html(mesgConDiv); var txtName = $("#divFeedTabDiv").find(".inputtxt1"); var txtCon = $("#divFeedTabDiv").find("#PY_txt"); var sendLink = $(".MIB_btn").find("a")[0]; var $sendLink = $(sendLink); var calLink = $(".MIB_btn").find("a")[1]; var $calLink = $(calLink); var numshowElem = $("#divFeedTabDiv .rt"); App.bindTxtarea(txtCon[0], { IsEnableAuto: true, keyUpCallBack: function () { if (!App.checkTxtLen(numshowElem, ["<span class=\"normal\">还可以输入{0}个汉字</span>", "<span class=\"wrong\">已超出{0}个汉字</span>"], txtCon)) { sendLink.locked = true; $sendLink.attr("class", "btn_notclick"); } else { sendLink.locked = false; $sendLink.attr("class", "newabtn_ok"); } } }); if (isOri == 1) { txtCon.val("给你推荐一条微博://" + Data.Name + ":" + Data.Content + "-原文地址:" + Data.url); } else { txtCon.val("给你推荐一条微博://" + Data.Name + ":" + Data.Content + "//" + Data.oriName + ":" + Data.oriContent + "-原文地址:" + Data.url); } this.autoComplete(txtName, function (id, name) { txtName.val(name); App.OriKey = "" }, "GetFollowListByKey"); var isPush = false; for (var i = 0; i < App.TimerFunArray.length; i++) { if (App.TimerFunArray[i] == this.autoCompleteTimerEvent) { isPush = true; } } if (!isPush) { App.TimerFunArray.push(this.autoCompleteTimerEvent); } $calLink.click(function () { $("#divFeedTabDiv").remove(); App.hideMash(); }); $("#divFeedTabDiv .faceicon1").click(function () { return App.showExpression(txtCon, $(this)); }); App.setCursorPosition(txtCon[0], 0); txtCon.mouseup(); txtCon.attr("range", "0&0"); if (!App.checkTxtLen(numshowElem, ["<span class=\"normal\">还可以输入{0}个汉字</span>", "<span class=\"wrong\">已超出{0}个汉字</span>"], txtCon)) { sendLink.locked = true; $sendLink.attr("class", "btn_notclick"); } else { sendLink.locked = false; $sendLink.attr("class", "newabtn_ok"); } $sendLink.click(function () { if (sendLink.locked) return; if (!App.checkTxtLen(numshowElem, ["<span class=\"normal\">还可以输入{0}个汉字</span>", "<span class=\"wrong\">已超出{0}个汉字</span>"], txtCon)) { sendLink.locked = true; $sendLink.attr("class", "btn_notclick"); return; } if ($.trim(txtName.val()) == "") { App.highLineTxtBox(txtName); return; } if ($.trim(txtCon.val()) == "") { App.highLineTxtBox(txtCon); return; } if (this.locked) return; this.locked = true; var thisBtn = this; App.AddMessage($.trim(txtName.val()), $.trim(txtCon.val()), function () { $("#divFeedTabDiv").remove(); App.hideMash(); App.fullTip("发送成功", 1000, null, 3); }, function () { thisBtn.locked = false; }); }); }, tabToFeed: function (mid, isOri, oriMid, Data) { $("#divFeedTabDiv .layerBoxCon").html(feedConDiv); var $txtbox = $("#divFeedTabDiv").find("#PY_txt"); var txtbox = $txtbox[0]; var sms = $("#mid_" + mid).find(".sms"); var source = $("#mid_" + mid).find(".source"); if (isOri == 1) { $(".laymoveText").html(sms.html()); $("#isLast").next().text("同时评论给 " + Data.Name); $("#isRoot").hide().next().hide(); } else { $(".laymoveText").html(source.html()); $("#isLast").next().text("同时评论给 " + Data.Name); $("#isRoot").next().text("同时评论给原作者 " + Data.oriName); $txtbox.val("//@" + Data.Name + ":" + Data.Content); } $("#divFeedTabDiv .faceicon1").click(function () { return App.showExpression($txtbox, $(this)); }); var sendLink = $(".MIB_btn").find("a")[0]; var $sendLink = $(sendLink); var calLink = $(".MIB_btn").find("a")[1]; var $calLink = $(calLink); var numshowElem = $("#divFeedTabDiv .rt"); App.bindTxtarea(txtbox, { IsEnableAuto: true, keyUpCallBack: function () { if (!App.checkTxtLen(numshowElem, ["<span class=\"normal\">还可以输入{0}个汉字</span>", "<span class=\"wrong\">已超出{0}个汉字</span>"], $txtbox)) { sendLink.locked = true; $sendLink.attr("class", "btn_notclick"); } else { sendLink.locked = false; $sendLink.attr("class", "newabtn_ok"); } } }); App.setCursorPosition(txtbox, 0); $txtbox.mouseup(); $txtbox.attr("range", "0&0"); $calLink.click(function () { $("#divFeedTabDiv").remove(); App.hideMash(); }); if (!App.checkTxtLen(numshowElem, ["<span class=\"normal\">还可以输入{0}个汉字</span>", "<span class=\"wrong\">已超出{0}个汉字</span>"], $txtbox)) { sendLink.locked = true; $sendLink.attr("class", "btn_notclick"); } else { sendLink.locked = false; $sendLink.attr("class", "newabtn_ok"); } $txtbox.JQP_HighLineInput2({ nullCon: "随便说点什么吧..." }); $sendLink.click(function () { if (sendLink.locked) return; if (!App.checkTxtLen(numshowElem, ["<span class=\"normal\">还可以输入{0}个汉字</span>", "<span class=\"wrong\">已超出{0}个汉字</span>"], $txtbox)) { sendLink.locked = true; $sendLink.attr("class", "btn_notclick"); return; } var quoMid = mid; if (oriMid == "-1") { oriMid = quoMid; } var isLast = null; var isRoot = null; if ($("#isLast")[0] != null) { if ($("#isLast")[0].checked) { isLast = 1; } } if ($("#isRoot")[0] != null) { if ($("#isRoot")[0].checked) { isRoot = 1; } } sendLink.locked = true; $sendLink.attr("class", "btn_notclick"); App.CreateQuoteMiniBlog($txtbox, oriMid, quoMid, isRoot, isLast, function () { App.tip("转发成功", 1000); }, function () { sendLink.locked = false; $sendLink.attr("class", "newabtn_ok"); $("#divFeedTabDiv").remove(); App.hideMash(); }); }); }, htmlencode: function (str) { var s = ""; if (str.length == 0) return ""; s = str.replace(/&/g, "&amp;"); s = s.replace(/</g, "&lt;"); s = s.replace(/>/g, "&gt;"); return s; }, htmldecode: function (str) { var s = ""; if (str.length == 0) return ""; s = str.replace(/&amp;/g, "&"); s = s.replace(/&lt;/g, "<"); s = s.replace(/&gt;/g, ">"); return s; }, oKey: "", isShowAtWho: false, isKeyUp: false, ajaxAtWho: function () { if (App.isKeyUp) { App.isKeyUp = false; if ($(App.TargetTextarea)[0] == null) return; var atStart = App.getAtPos($(App.TargetTextarea)[0]); var key = ""; if (atStart != -1) { $("#preSpan").html($(App.TargetTextarea)[0].value.substr(0, atStart).replace(/\n/g, "<br>").replace(/\s/g, $.browser.msie ? "<PRE style=\"DISPLAY: inline; OVERFLOW: hidden;font-family: Tahoma,宋体;WORD-WRAP: break-word\"> </PRE>" : "<span style='white-space:pre-wrap;font-family: Tahoma,宋体;'> </span>")); $("#rearSpan").html($(App.TargetTextarea)[0].value.substr(atStart + 1).replace(/\n/g, "<br>").replace(/\s/g, $.browser.msie ? "<PRE style=\"DISPLAY: inline; OVERFLOW: hidden;font-family: Tahoma,宋体;WORD-WRAP: break-word\"> </PRE>" : "<span style='white-space:pre-wrap;font-family: Tahoma,宋体;'> </span>")); $("#HideTextArea").scrollTop($(App.TargetTextarea).scrollTop()); var offset = $("#atSpan").offset(); offset.top += 20; $(".Atwho").css("top", offset.top).css("left", offset.left); var curpos = App.getPos(App.TargetTextarea); var atLength = curpos.start - atStart - 1; var key = $(App.TargetTextarea)[0].value.substr(atStart + 1, atLength); if (App.oKey == key) return; else if ($("#rearSpan").text() == "") { $(".Atwho").hide(); App.isShowAtWho = false; App.oKey = ""; return; } else { $(".Atwho").show(); App.isShowAtWho = true; App.oKey = key; $.ajax({ dataType: "json", data: { key: key }, url: "/Ajax/GetFollowListByKey/", cache: false, type: "post", success: function (o) { var str = "<div style=\"height:20px;color:#999999;padding-left:8px;padding-top:2px;line-height:18px;font-size:12px;Tahoma,宋体;\">想用@提到谁?</div>"; if (o.Code == "A00017") { str += ("<li curName='" + key + "' class='cur'>" + key + "</li>"); } else { for (var i = 0; i < o.Data.length; i++) { if (i == 0) str += ("<li curName='" + o.Data[i].NickName + "' class='cur'>" + o.Data[i].Title.replace(new RegExp("(" + key + ")", "gi"), "<b>$1</b>") + "</li>"); else str += ("<li curName='" + o.Data[i].NickName + "'>" + o.Data[i].Title.replace(new RegExp("(" + key + ")", "gi"), "<b>$1</b>") + "</li>"); } } $(".Atwho ul").html(str); $(".Atwho ul").find("li").hover(function () { $(".Atwho ul").find("li").removeClass("cur"); $(this).addClass("cur"); }).click(function () { App.setAtVal($(App.TargetTextarea)[0], $(this).attr("curName") + " "); $(".Atwho").hide(); App.isShowAtWho = false; }); } }); } } else { App.oKey = ""; $(".Atwho").hide(); App.isShowAtWho = false; } } }, getPos: function (textBox) { start = parseInt($(textBox).attr("range").split("&")[0]); var sel = parseInt($(textBox).attr("range").split("&")[1]); return { start: start, sel: sel }; }, getAtPos: function (textBox) { var pos = App.getPos(textBox); while (pos.start >= 0) { pos.start = pos.start - 1; if (textBox.value.substr(pos.start, 1) == "@") return pos.start; else if (textBox.value.substr(pos.start, 1) == " ") return -1; else if (textBox.value.substr(pos.start, 1) == "\n") return -1; else if (textBox.value.substr(pos.start, 1) == ":") return -1; else if (textBox.value.substr(pos.start, 1) == ":") return -1; } return -1; }, setAtVal: function (textBox, insertVal) { var con = $(textBox)[0].value; var start = App.getAtPos(textBox) + 1; var end = parseInt($(textBox).attr("range").split("&")[0]); var pre = con.substr(0, start); var last = con.substr(end); $(textBox).val(pre + insertVal + last); App.setCursorPosition(textBox, (pre + insertVal).length); App.saveTxtCtrlRangePos(textBox); }, setCursorPosition: function (ctrl, pos) { if (ctrl.setSelectionRange) { ctrl.focus(); ctrl.setSelectionRange(pos, pos); } else if (ctrl.createTextRange) { var length = pos; for (var i = 1; i < length; i++) { if (ctrl.value.charAt(i) == '\n') { pos--; } } var range = ctrl.createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); } }, checkTxtLen: function (insertWhere, insertTemp, txtCtr) { var normal = insertTemp[0]; var error = insertTemp[1]; var curLen = App.getTxtLen($(txtCtr)); if (curLen <= 280) { $(insertWhere).html(normal.replace("{0}", parseInt((280 - curLen) / 2))); return true; } else { $(insertWhere).html(error.replace("{0}", parseInt((curLen - 280 + 1) / 2))); return false; } }, GetStringByte: function (g, a) { var b = g.replace(/\*/g, " ").replace(/[^\x00-\xff]/g, "**"); g = g.slice(0, b.slice(0, a).replace(/\*\*/g, " ").replace(/\*/g, "").length); if (App.byteLength(g) > a) { g = g.slice(0, g.length - 1) } return g }, byteLength: function (b) { if (typeof b == "undefined") { return 0 } var a = b.match(/[^\x00-\x80]/g); return (b.length + (!a ? 0 : a.length)) }, rotate: { rotateRight: function (a, g, h, b) { this._img[a] = this._img[a] || {}; this._img[a]._right = this._img[a]._right || 0; this._img[a]._right++; this._rotate(a, g == undefined ? 90 : g, h, b) }, rotateLeft: function (a, g, h, b) { this._img[a] = this._img[a] || {}; this._img[a]._left = this._img[a]._left || 0; this._img[a]._left++; this._rotate(a, g == undefined ? -90 : -g, h, b) }, _img: {}, _rotate: function (m, h, s, r) { var b = App.E(m); b.angle = ((b.angle == undefined ? 0 : b.angle) + h) % 360; if (b.angle >= 0) { var u = Math.PI * b.angle / 180 } else { var u = Math.PI * (360 + b.angle) / 180 } var q = Math.cos(u); var j = Math.sin(u); if (document.all && !window.opera) { var g = document.createElement("img"); g.src = b.src; g.height = b.height; g.width = b.width; if (!this._img[m]._initWidth) { this._img[m]._initWidth = g.width; this._img[m]._initHeight = g.height } if (g.height > r + 8) { g._w1 = g.width; g._h1 = g.height; g.height = r - 4; g.width = (g._w1 * g.height) / g._h1 } g.style.filter = "progid:DXImageTransform.Microsoft.Matrix(M11=" + q + ",M12=" + (-j) + ",M21=" + j + ",M22=" + q + ",SizingMethod='auto expand')"; var o = this; setTimeout(function () { var v = o._img[m]._left, p = o._img[m]._right; if (p % 2 == 0 || v % 2 == 0 || Math.abs(p - v) % 2 == 0) { g.width = o._img[m]._initWidth - 4; g.height = o._img[m]._initHeight - 4 } if ((v === 1 && !p) || (!v && p === 1)) { o._img[m]._width = g.width; o._img[m]._height = g.height } if (p > 0 && v > 0 && Math.abs(p - v) % 2 != 0) { g.width = o._img[m]._width - 4; g.height = o._img[m]._height - 4 } }, 0) } else { var g = document.createElement("canvas"); if (!b.oImage) { g.oImage = b } else { g.oImage = b.oImage } g.style.width = g.width = Math.abs(q * g.oImage.width) + Math.abs(j * g.oImage.height); g.style.height = g.height = Math.abs(q * g.oImage.height) + Math.abs(j * g.oImage.width); if (g.width > r) { g.style.width = r + "px" } var a = g.getContext("2d"); a.save(); if (u <= Math.PI / 2) { a.translate(j * g.oImage.height, 0) } else { if (u <= Math.PI) { a.translate(g.width, -q * g.oImage.height) } else { if (u <= 1.5 * Math.PI) { a.translate(-q * g.oImage.width, g.height) } else { a.translate(0, -j * g.oImage.width) } } } a.rotate(u); try { a.drawImage(g.oImage, 0, 0, g.oImage.width, g.oImage.height) } catch (n) { } a.restore() } g.id = b.id; g.angle = b.angle; b.parentNode.replaceChild(g, b); if (s && typeof s === "function") { s(g) } } }, removeTag: function (str) { var reg = new RegExp("<img\\s+title=\"?([^\"]+)\"?\\s+src=\"[^>]*\">", "gi"); str = str.replace(reg, "[$1]"); reg = new RegExp("<[^>]*>", "gi"); str = str.replace(reg, ""); return $.trim(str); }, ajaxRequstList: new Hashtable(), showMediaDiv: function (media) { if (App.initDialDiv("MediaConDiv", dialDiv, false, null)) { $("#MediaConDiv").removeClass("4CancelAllLayer"); $("#MediaConDiv").find(".mid_c").html(mediaConDiv); $("#MediaConDiv").find("#mediaCon").html(media); $("#MediaConDiv").show(); } else { $("#MediaConDiv").find("#mediaCon").html(media); $("#MediaConDiv").show(); } if ($.browser.msie && $.browser.version == "6.0") { var st = $(document).scrollTop(), winh = $(window).height(); winw = $(window).width(); var mWidth = $("#MediaConDiv").width(); var mHeight = $("#MediaConDiv").height(); $("#MediaConDiv").css("top", st + winh - mHeight); $("#MediaConDiv").css("left", winw - mWidth); $(window).unbind(".sjj"); $(window).bind("scroll.sjj", function () { st = $(document).scrollTop(); $("#MediaConDiv").css("top", st + winh - mHeight); $("#MediaConDiv").css("left", winw - mWidth); }); } else { $("#MediaConDiv").css("position", "fixed").css("bottom", 0).css("right", 0); } $("#pop_video_window_close").click(function () { $("#MediaConDiv").hide(); $("#MediaConDiv").find("#mediaCon").html(""); }); }, DelCommentFromBox: function (alink, cid, mid) { this.confirm("是否删除该条评论", function () { if (alink.locked) return false; alink.locked = true; App.DelComment(cid, function (data) { var list = $("#comment_list_" + mid); list.find(".PL_list").remove(); list.find(".moreheight").remove(); list.find(".MIB_assign_c").append(data); App.initNameCard(list); }, function () { alink.locked = false; }); return false; }); return false; }, DelCommentFromPager: function (alink, cid, mid) { this.confirm("是否删除该条评论", function () { if (alink.locked) return false; alink.locked = true; App.DelComment(cid, function (data) { $(alink).parent().parent().fadeOut(); }, function () { alink.locked = false; }); return false; }); return false; }, InsertCommentBox: function (mid, ownerUid) { var xmlrequst = App.ajaxRequstList.get("mid_c" + mid); if (xmlrequst != null) { xmlrequst.abort(); } if ($.trim($("#comment_list_" + mid).html()) == "") { $("#comment_list_" + mid).html("<div style=\"padding:30px 0;text-align:center\"><img src=\"/Content/Image/loading.gif\"></div>"); App.ajaxRequstList.add("mid_c" + mid, $.ajax({ dataType: "json", data: { Mid: mid, OwnerUid: ownerUid }, url: "/Ajax/GetComments/", cache: false, type: "post", success: function (o) { if (o.Code == "A00003") App.alert(CodeList[o.Code]); else if (o.Code == "A00011") App.alert(CodeList[o.Code]); else if (o.Code == "A00001") { App.showLoginDial(); } else { var list = $("#comment_list_" + mid).html(o.Data); App.initNameCard(list); var $textbox = $("#comment_content_" + mid); var textbox = $textbox[0]; list.find(".faceicon1").click(function (e) { e.stopPropagation(); App.showExpression(textbox, this); }); App.bindTxtarea(textbox, { IsEnableAuto: true, keyUpCallBack: function () { if (App.getTxtLen(textbox) > 280) { textbox.value = App.GetStringByte(textbox.value, 280); } } }); var post = $("#comment_post_" + mid).click(function () { $textbox.keyup(); if ($.trim(textbox.value) == "") { App.alert("请输入内容"); textbox.focus(); return; } if (this.locked) { App.alert("ff"); return; } this.locked = true; var alink = this; $(this).attr("class", "btn_notclick"); var replyUID = null; var replyCID = null; if (textbox.value.lastIndexOf("回复@" + textbox.nickName) == 0) { replyCID = textbox.replycid; replyUID = textbox.replyuid; if (textbox.value.length <= ("回复@" + textbox.nickName + ":").length) { App.alert("请输入内容"); textbox.focus(); return; } } var agree = null; var isRoot = null; if ($("#isroot_" + mid)[0] != null) { if ($("#isroot_" + mid)[0].checked) { isRoot = 1; } } if ($("#agree_" + mid)[0] != null) { if ($("#agree_" + mid)[0].checked) { agree = 1; } } App.addComment(mid, ownerUid, textbox.value, replyCID, replyUID, agree, isRoot, function (Data) { list.find(".PL_list").remove(); list.find(".moreheight").remove(); list.find(".MIB_assign_c").append(Data); App.initNameCard(list); }, function () { alink.locked = false; $(alink).attr("class", "btn_normal"); textbox.value = ""; }); return false; }); } var x = App.ajaxRequstList.get("mid_c" + mid); if (x != null) App.ajaxRequstList.remove("mid_c" + mid); }, error: function () { var x = App.ajaxRequstList.get("mid_c" + mid); if (x != null) App.ajaxRequstList.remove("mid_c" + mid); } })); } else { $("#comment_list_" + mid).html(""); } }, addComment: function (Mid, OwnerUid, content, replyCid, replyUid, agree, isRoot, successCallback, defaultCallback) { if (App.byteLength(content) > 280) { content = App.GetStringByte(content, 280); } content = App.htmlencode(content); $.ajax({ dataType: "json", data: { Mid: Mid, OwnerUid: OwnerUid, content: content, replyCid: replyCid, replyUid: replyUid, agree: agree, isRoot: isRoot }, url: "/Ajax/AddComment/", cache: false, type: "post", success: function (o) { if (o.Code == "A00003") App.alert(CodeList[o.Code]); else if (o.Code == "A00011") App.alert(CodeList[o.Code]); else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00016") { App.alert(CodeList[o.Code]); } else if (o.Code == "A00026") { App.alert(CodeList[o.Code]); } else if (o.Code == "A00028") { App.alert(CodeList[o.Code]); } else { if (successCallback) { successCallback(o.Data); } } if (defaultCallback) { defaultCallback(); } }, error: function () { App.alert(CodeList["A00003"]); if (defaultCallback) { defaultCallback(); } } }); }, DelComment: function (cid, successCallback, defaultCallback) { $.ajax({ dataType: "json", data: { cid: cid }, url: "/Ajax/DelComment/", cache: false, type: "post", success: function (o) { if (o.Code == "A00003") App.alert(CodeList[o.Code]); else if (o.Code == "A00011") App.alert(CodeList[o.Code]); else if (o.Code == "A00001") { App.showLoginDial(); } else { if (successCallback) { successCallback(o.Data); } } if (defaultCallback) { defaultCallback(); } }, error: function () { App.alert(CodeList["A00003"]); if (defaultCallback) { defaultCallback(); } } }); }, bindAddComment: function (alink, mid, ownerUid, txtboxid, agreeid, rootid) { var $textbox = $("#" + txtboxid); var textbox = $textbox[0]; $textbox.keyup(); if ($.trim(textbox.value) == "") { App.alert("请输入内容"); textbox.focus(); return; } var replyUID = null; var replyCID = null; if (textbox.value.lastIndexOf("回复@" + textbox.nickName) == 0) { replyCID = textbox.replycid; replyUID = textbox.replyuid; if (textbox.value.length <= ("回复@" + textbox.nickName + ":").length) { App.alert("请输入内容"); textbox.focus(); return; } } if (alink.locked) { App.alert("ff"); return; } alink.locked = true; $(alink).attr("class", "btn_notclick"); var agree = null; var isRoot = null; if ($("#" + rootid)[0] != null) { if ($("#" + rootid)[0].checked) { isRoot = 1; } } if ($("#" + agreeid)[0] != null) { if ($("#" + agreeid)[0].checked) { agree = 1; } } App.addComment(mid, ownerUid, textbox.value, replyCID, replyUID, agree, isRoot, function (Data) { }, function () { alink.locked = false; $(alink).attr("class", "btn_normal"); textbox.value = ""; App.GetPagerComments(mid, ownerUid, 0, 1, 20); $('.navStyle .lf').hide()[0].style.display = 'block'; }); }, GetPagerComments: function (mid, ownerUid, isFollow, page, pagesize) { $.ajax( { async: false, url: "/Ajax/GetPagerCommentsList/", datatype: "json", cache: false, data: { Mid: mid, OwnerUid: ownerUid, Page: page, PageSize: pagesize, isFollow: isFollow }, type: "post", success: function (o) { if (o.Code == "A00003") App.alert(CodeList[o.Code]); else if (o.Code == "A00011") App.alert(CodeList[o.Code]); else { $(".commentsList").html(o.Data); App.initNameCard($(".commentsList")); $("#CommentCount").text(o.Count); if (parseInt(o.Count) > 20) { if ($(".fanye")[0] == null) { $(".commentsmanage").append("<div class=\"fanye MIB_txtbl MIB_linedot3\"></div>"); $(".navStyle").append("<div class=\"fanye MIB_txtbl\"></div>"); } App.buildCommentPage(o, mid, ownerUid, page, pagesize, isFollow); } else { if ($(".fanye")[0]) { $(".fanye").remove(); } } } }, error: function (request) { App.alert(CodeList["A00003"]); } } ); }, ReplyComment: function (cid, cuid, nickName, mid) { var $textbox = $("#comment_content_" + mid); var textbox = $textbox[0]; textbox.replycid = cid; textbox.replyuid = cuid; textbox.nickName = nickName; textbox.value = ""; App.insertTxt2Txtarea(textbox, "回复@" + nickName + ":"); }, ReplyComment4Details: function (cid, cuid, nickName, mid) { var $replyElem = $("#comment_reply_" + mid + "_" + cid); if (!App.isVisible($replyElem)) { $replyElem.show(); var $textbox = $("#comment_content_" + mid + "_" + cid); var $face = $("#comment_face_" + mid + "_" + cid); var textbox = $textbox[0]; textbox.replycid = cid; textbox.replyuid = cuid; textbox.nickName = nickName; textbox.value = ""; App.bindTxtarea(textbox, { IsEnableAuto: true, keyUpCallBack: function () { if (App.getTxtLen(textbox) > 280) { textbox.value = App.GetStringByte(textbox.value, 280); } } }); $face.click(function (e) { e.stopPropagation(); App.showExpression($textbox, this); return false; }); App.insertTxt2Txtarea(textbox, "回复@" + nickName + ":"); } else { $replyElem.hide(); } }, bindAddCommentBtn: function (alink, mid, ownerUid, txtboxid, agreeid, rootid) { var $textbox = $("#" + txtboxid); var textbox = $textbox[0]; $textbox.keyup(); if ($.trim(textbox.value) == "") { App.alert("请输入内容"); textbox.focus(); return; } var replyUID = null; var replyCID = null; if (textbox.value.lastIndexOf("回复@" + textbox.nickName) == 0) { replyCID = textbox.replycid; replyUID = textbox.replyuid; if (textbox.value.length <= ("回复@" + textbox.nickName + ":").length) { App.alert("请输入内容"); textbox.focus(); return; } } if (alink.locked) { App.alert("ff"); return; } alink.locked = true; $(alink).attr("class", "btn_notclick"); var agree = null; var isRoot = null; if ($("#" + rootid)[0] != null) { if ($("#" + rootid)[0].checked) { isRoot = 1; } } if ($("#" + agreeid)[0] != null) { if ($("#" + agreeid)[0].checked) { agree = 1; } } App.addComment(mid, ownerUid, textbox.value, replyCID, replyUID, agree, isRoot, function (Data) { App.fullTip("回复成功", 1000, null, 3); }, function () { alink.locked = false; $(alink).attr("class", "btn_normal"); textbox.value = ""; }); }, hideExtendBtn: function (ctrl) { $(ctrl).find("div[extend='true']").css("visibility", "hidden"); $(ctrl).find("a[extend='true']").css("visibility", "hidden"); $(ctrl).find("span[extend='true']").css("visibility", "hidden"); $(ctrl).find("p[extend='true']").css("visibility", "hidden"); $(ctrl).find("em[extend='true']").css("visibility", "hidden"); }, showExtendBtn: function (ctrl) { $(ctrl).find("div[extend='true']").css("visibility", "visible"); $(ctrl).find("a[extend='true']").css("visibility", "visible"); $(ctrl).find("span[extend='true']").css("visibility", "visible"); $(ctrl).find("p[extend='true']").css("visibility", "visible"); $(ctrl).find("em[extend='true']").css("visibility", "visible"); }, writeDebug: function (txt) { App.showMediaDiv(txt); }, selPos: function (textBox) { var start = 0; var end = 0; if (document.selection) { var range = document.selection.createRange(); if (range.parentElement().id == textBox.id) { var range_all = document.body.createTextRange(); range_all.moveToElementText(textBox); for (start = 0; range_all.compareEndPoints("StartToStart", range) < 0; start++) range_all.moveStart('character', 1); for (var i = 0; i <= start; i++) { if (textBox.value.charAt(i) == '\n') start++; } var range_all = document.body.createTextRange(); range_all.moveToElementText(textBox); for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end++) range_all.moveStart('character', 1); for (var i = 0; i <= end; i++) { if (textBox.value.charAt(i) == '\n') end++; } } } else { start = textBox.selectionStart; end = textBox.selectionEnd; } $(textBox).attr("range", start + "&" + (end - start)); }, bindTxtarea: function (txtbox, options) { var settings = $.extend({ IsEnableAuto: false, width: 398, keyUpCallBack: null }, options); var start = 0; var end = 0; var hideTxtareaDiv = "<div style='display:none;' id=\"HideTextArea\"><span id=\"preSpan\"></span> <span id=\"atSpan\">@</span><span id=\"rearSpan\"></span></div>"; var atWhoDiv = "<div style=\"z-index: 2000; position: absolute; display: none; \" class=\"Atwho\"><ul><div><div style=\"height:20px;color:#999999;padding-left:8px;padding-top:2px;line-height:18px;font-size:12px;Tahoma,宋体;\">想用@提到谁?</div></div></ul></div>"; if (settings.IsEnableAuto) { App.autoHeightTextArea(txtbox, null, 1000000); } if ($("#HideTextArea")[0] == null) { $("body").append(hideTxtareaDiv); } if ($(".Atwho")[0] == null) { $("body").append(atWhoDiv); $(".Atwho").JQP_ClickOther(function () { $(".Atwho").hide(); App.isShowAtWho = false; }); } var init = function (box) { App.TargetTextarea = box; $("#HideTextArea").attr("style", $(box).attr("style")); $("#HideTextArea").css("z-index", -1000); $("#HideTextArea").css("left", $(box).offset().left); $("#HideTextArea").css("top", $(box).offset().top); $("#HideTextArea").css("position", "absolute"); $("#HideTextArea").css("word-wrap", "break-word"); if ($.browser.msie) { $("#HideTextArea").css("filter", "alpha(opacity=0)"); } else $("#HideTextArea").css("opacity", "0"); if (settings.IsEnableAuto) { $("#HideTextArea").css('overflow-y', 'hiden'); $("#HideTextArea").css("height", ""); } else { $("#HideTextArea").css("overflow-y", "auto"); $("#HideTextArea").css("height", $(box).height()); } $("#HideTextArea").css("width", $(box).width()); $("#HideTextArea").css("paddingLeft", $(box).css("paddingLeft")); $("#HideTextArea").css("paddingRight", $(box).css("paddingRight")); $("#HideTextArea").css("paddingTop", $(box).css("paddingTop")); $("#HideTextArea").css("paddingBottom", $(box).css("paddingBottom")); $("#HideTextArea").css("line-height", $(box).css("line-height")); $("#HideTextArea").css("font-size", $(box).css("font-size")); $("#HideTextArea").css("font-family", $(box).css("font-family")); $("#HideTextArea").show(); }; init(txtbox); $(txtbox).mouseup(function () { App.isKeyUp = true; App.selPos(this); init(this); return; }); $(txtbox).mousedown(function () { App.selPos(this); return; }); $(txtbox).keydown(function (e) { if (App.isShowAtWho) { var curLi = $(".Atwho ul").find(".cur"); var index = $(".Atwho ul").find("li").index(curLi); var length = $(".Atwho ul").find("li").length; $(".Atwho ul").find("li").removeClass("cur"); switch (e.which) { case 38: if (index == 0) { $($(".Atwho ul").find("li")[length - 1]).addClass("cur"); } else $($(".Atwho ul").find("li")[index - 1]).addClass("cur"); e.preventDefault(); break; case 40: if (index == length - 1) { $($(".Atwho ul").find("li")[0]).addClass("cur"); } else $($(".Atwho ul").find("li")[index + 1]).addClass("cur"); e.preventDefault(); break; case 13: App.setAtVal(this, curLi.attr("curName") + " "); e.preventDefault(); $(".Atwho").hide(); App.isShowAtWho = false; break; } } return; }); $(txtbox).keyup(function (e) { App.isKeyUp = true; if (settings.keyUpCallBack) settings.keyUpCallBack(); App.saveTxtCtrlRangePos(this); if (e.shiftKey && e.which == 50) { $(".Atwho").hide(); App.isShowAtWho = false; return; } return; }); }, getTextAreaHeight: function (b) { b = $(b); if (b[0].defaultHeight == null) { b[0].defaultHeight = window.parseInt(b.height()); } var g; if ($.browser.msie) { g = Math.max(b[0].scrollHeight, b[0].defaultHeight); } else { var a = $("#_____textarea_____"); if (a[0] == null) { a[0] = document.createElement("textarea"); a[0].id = "_____textarea_____"; document.getElementsByTagName("body")[0].appendChild(a[0]) } if (a.currentTarget != b) a[0].style.top = "-1000px"; a[0].style.height = "0px"; a[0].style.position = "absolute"; a[0].style.overflow = "hidden"; a[0].style.width = b.css("width"); a[0].style.fontSize = b.css("fontSize"); a[0].style.fontFamily = b.css("fontFamily"); a[0].style.lineHeight = b.css("lineHeight"); a[0].style.paddingLeft = b.css("paddingLeft"); a[0].style.paddingRight = b.css("paddingRight"); a[0].style.paddingTop = b.css("paddingTop"); a[0].style.paddingBottom = b.css("paddingBottom") a[0].value = b[0].value; g = Math.max(a[0].scrollHeight, b[0].defaultHeight); a.currentTarget = b; } return g; }, autoHeightTextArea: function (h, b, g) { h = h; b = b || function () { }; var a = function (p, n) { if (b) { b() } var j; var m; var o = App.getTextAreaHeight(p); n = n || o; if (o > n) { j = n; if (p.style.overflowY === "hidden") { p.style.overflowY = "auto" } } else { j = o; if (p.style.overflowY === "auto") { p.style.overflowY = "hidden" } } p.style.height = Math.min(n, o) + "px" }; if (h.binded == null) { $(h).keyup(function () { a(h, g) }); $(h).focus(function () { a(h, g) }); $(h).blur(function () { a(h, g) }); h.binded = true; h.style.overflowY = "hidden"; h.style.overflowX = "hidden" } }, mouseoutIco: function (img) { if ($.browser.msie) { img.style.filter = "alpha(opacity=50)"; } else img.style.opacity = 0.5; }, mouseoverIco: function (img) { if ($.browser.msie) { img.style.filter = "alpha(opacity=80)"; } else img.style.opacity = 0.8; }, initMedia: function ($range) { if ($range) { $("#" + $range).find("div[type='video']").click(function () { App.openVideo($(this).attr("mid"), $(this).attr("vid")); }); $("#" + $range).find(" a[type='video']").click(function () { var mid = $(this).parent().attr("mid"); App.openVideo(mid, $(this).attr("mediaID")); return false; }); $("#" + $range).find(" div[type='music']").click(function () { App.playMusic($(this).attr("mid"), $(this).attr("musicid")); }); $("#" + $range).find("a[type='music']").click(function () { var mid = $(this).parent().attr("mid"); App.playMusic(mid, $(this).attr("mediaID")); return false; }); $("#" + $range).find(" div[type='vote']").click(function () { App.startVote($(this).attr("mid"), $(this).attr("voteid")); }); $("#" + $range).find(" a[type='vote']").click(function () { var mid = $(this).parent().attr("mid"); App.startVote(mid, $(this).attr("mediaID")); return false; }); } else { $("div[type='video']").click(function () { App.openVideo($(this).attr("mid"), $(this).attr("vid")); }); $("a[type='video']").click(function () { var mid = $(this).parent().attr("mid"); App.openVideo(mid, $(this).attr("mediaID")); return false; }); $("div[type='music']").click(function () { App.playMusic($(this).attr("mid"), $(this).attr("musicid")); }); $("a[type='music']").click(function () { var mid = $(this).parent().attr("mid"); App.playMusic(mid, $(this).attr("mediaID")); return false; }); $("div[type='vote']").click(function () { App.startVote($(this).attr("mid"), $(this).attr("voteid")); }); $("a[type='vote']").click(function () { var mid = $(this).parent().attr("mid"); App.startVote(mid, $(this).attr("mediaID")); return false; }); } }, buildCommentPage: function (data, mid, ownerUid, page, pagesize, isFollow) { if (typeof (data) == "object") { if (data.Count > 0) { var t = []; var size = pagesize; var pageNum = parseInt(data['Count'] / size); //get the total page number if (data['Count'] % size > 0) { pageNum++; }; if (pageNum > 0) { //the section of prev page if (page > 1) { t.push('<a class="btn_normal btns" href="javascript:;" onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + (page - 1) + ',' + pagesize + ');return false;"><em>上一页</em></a> '); } //if the total page number less than 6 if (pageNum < 6) { for (var i = 1; i <= pageNum; i++) { if (page == i) { t.push('<span>' + i + '</span> '); } else { t.push('<a class="btn_num" href="javascript:;"onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + i + ',' + pagesize + ');return false;"><em>' + i + '</em></a> '); } } } else { //if the current page nummber less than 4 if (page < 4) { for (var i = 1; i <= 5; i++) { if (page == i) { t.push('<span>' + i + '</span> '); } else { t.push('<a class="btn_num" href="javascript:;"onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + i + ',' + pagesize + ');return false;"><em>' + i + '</em></a> '); } } t.push('...<a href="javascript:;" class="btn_num" onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + pageNum + ',' + pagesize + ');return false;"><em>' + pageNum + '</em></a> '); } else if ((pageNum - 3) < page) { t.push('<a class="btn_num" href="javascript:;" onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + 1 + ',' + pagesize + ');return false;"><em>' + 1 + '</em></a>...'); for (var i = (pageNum - 4); i <= pageNum; i++) { if (page == i) { t.push('<span>' + i + '</span> '); } else { t.push('<a class="btn_num" href="javascript:;"onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + i + ',' + pagesize + ');return false;"><em>' + i + '</em></a> '); } } } else if (3 < page < (pageNum - 2)) { t.push('<a class="btn_num" href="javascript:;" onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + 1 + ',' + pagesize + ');return false;"><em>' + 1 + '</em></a>...'); for (var i = (parseInt(page) - 2); i <= (parseInt(page) + 2); i++) { if (page == i) { t.push('<span>' + i + '</span> '); } else { t.push('<a class="btn_num" href="javascript:;"onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + i + ',' + pagesize + ');return false;"><em>' + i + '</em></a> '); } } t.push('...<a class="btn_num" href="javascript:;" onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + pageNum + ',' + pagesize + ');return false;"><em>' + pageNum + '</em></a> '); } }; //the section of next page if (page < pageNum) { t.push('<a class="btn_normal btns" href="javascript:;" onclick="App.GetPagerComments(' + mid + ',' + ownerUid + ',' + isFollow + ',' + (page + 1) + ',' + pagesize + ');return false;"><em>下一页</em></a>'); } }; $(".fanye").html(t.join('')); } else { $(".fanye").html(''); } } }, showPopMiniBlog: function (txt) { App.showMash(); if (App.initDialDiv("PopMiniBlog", dialDiv, false, null)) { var pop = $("#PopMiniBlog"); pop.find(".mid_c").html(popMBConDiv); pop.removeClass("4CancelAllLayer"); var position = App.centerInScreen(pop); pop.css("left", position.left + "px"); pop.css("top", position.top + "px"); pop.show(); var $txtbox = pop.find("#publish_editor2"); if (txt) { $txtbox.val(txt); } var txtbox = $txtbox[0]; pop.find(".close").click(function () { pop.hide(); App.hideMash(); }); pop.find("#face").click(function (e) { e.stopPropagation(); App.showExpression($txtbox, this); }); var $submit = pop.find("#publisher_submit2"); var submit = $submit[0]; App.bindTxtarea(txtbox, { keyUpCallBack: function () { var curLen = App.getTxtLen(txtbox); if (curLen > 280) { $("#publisher_info2").html("已超过<span class=\"pipsLim\">140</span>字"); $(".pipsLim").css("color", "#FF3300"); $(".pipsLim").text(parseInt((curLen - 280 + 1) / 2)); } else { $("#publisher_info2").html("还可以输入<span class=\"pipsLim\">140</span>字"); $(".pipsLim").text(parseInt((280 - curLen) / 2)); } } }); pop.find("#publisher_image2").click(function (e) { e.stopPropagation(); App.showPicUpload(this); }); $submit.click(function () { if ($.trim(txtbox.value) == "") { App.highLineTxtBox($(txtbox)); return false; } var curLen = App.getTxtLen(txtbox); if (curLen > 280) { $("#publisher_info2").html("已超过<span class=\"pipsLim\">140</span>字"); $(".pipsLim").css("color", "#FF3300"); $(".pipsLim").text(parseInt((curLen - 280 + 1) / 2)); submit.locked = true; } else { $("#publisher_info2").html("还可以输入<span class=\"pipsLim\">140</span>字"); $(".pipsLim").text(parseInt((280 - curLen) / 2)); submit.locked = false; } if (submit.locked) return; App.CreateOriginalMiniBlog($txtbox, function () { App.tip("发布成功", 1000, window.location.reload()); $txtbox.val(""); }, function () { submit.locked = false; }); }); } else { var pop = $("#PopMiniBlog"); var position = App.centerInScreen(pop); pop.css("left", position.left + "px"); pop.css("top", position.top + "px"); pop.show(); } }, bindGoTop: function (skin) { var backTopEle = $('<a class="goTop" style="position: fixed; bottom: 30px;"><span class="goTopbg ' + skin + '"></span><span class="goTopcon"><em class="toparr">&lt;</em><span>返回顶部</span></span></a>').appendTo($("body")).click(function () { $("html, body").scrollTop(0); }); var backTopFun = function () { var st = $(document).scrollTop(), winh = $(window).height(); (st > 300) ? backTopEle.show() : backTopEle.hide(); if (!window.XMLHttpRequest) { backTopEle.css("top", st + winh - 100); backTopEle.css("position", "absolute"); } } $(window).bind("scroll", backTopFun); $(function () { backTopFun(); }); }, AddFavorite: function (uid, mid, alink) { if (!alink.isFav) { $.ajax( { url: "/Ajax/AddFavorite/", datatype: "json", cache: false, data: { UID: uid, MID: mid }, type: "post", success: function (o) { if (o.Code == "A00003") { App.FullMiniTip(CodeList["A00003"], alink, 2000, 1); } else if (o.Code == "A00011") { App.FullMiniTip(CodeList[o.Code], alink, 1000, 1); } else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00012") { App.FullMiniTip(CodeList[o.Code], alink, 1000, 3); $(alink).text("取消收藏"); alink.isFav = true; } }, error: function (request) { App.FullMiniTip(CodeList["A00003"], alink, 1000, 1); } }); } else { $.ajax( { url: "/Ajax/DelFavorite/", datatype: "json", cache: false, data: { UID: uid, MID: mid }, type: "post", success: function (o) { if (o.Code == "A00003") { App.FullMiniTip(CodeList["A00003"], alink, 1000, 1); } else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00013") { App.FullMiniTip(CodeList[o.Code], alink, 1000, 3); $(alink).text("收藏"); alink.isFav = false; } }, error: function (request) { App.FullMiniTip(CodeList["A00003"], alink, 1000, 1); } }); } }, showVote: function (txtCtrl, showWhere) { App.TargetTextarea = txtCtrl; App.HideAllDiaDiv(); if (App.initDialDiv("divVote", dialDiv, true, function () { $("#divVote").hide(); })) { $("#divVote").css("z-index", 2000); var showWhere = $(showWhere).offset(); $("#divVote").css("left", showWhere.left - 195); $("#divVote").css("top", showWhere.top + 20); $("#divVote").css("width", 420); $("#divVote").find(".mBlogLayer").css("width", "100%"); $("#divVote .mid_c").html("<div class=\"layerBox\"><div class=\"layerBox_loading\"><div class=\"layerBox_loading\" id=\"loading\"><div class=\"ll_info\"><img width=\"16\" height=\"16\" src=\"/Content/Image/loading.gif\"><p id=\"msg\"></p></div></div></div></div>"); $("#divVote").show(); $.ajax( { url: "/Ajax/GetVoteDiaHtml/", datatype: "json", cache: false, type: "post", success: function (o) { if (o.Code == "A00003") { App.alert(CodeList["A00003"]); } else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00005") { $("#divVote .mid_c").html(o.Data); $("#divVote .layerMedia_close a").click(function () { $("#divVote").hide(); }); $(".lv_input3").focus(function () { $(this).addClass("lv_focus"); }).blur(function () { $(this).removeClass("lv_focus"); }).keyup(function () { this.value = App.GetStringByte(this.value, 50); }); ; $(".lv_inputsub input").live("focus", function () { $(this).parent().addClass("lv_focus"); }).live("blur", function () { $(this).parent().removeClass("lv_focus"); }).live("keyup", function () { this.value = App.GetStringByte(this.value, 40); }); $('.lv_textarea').focus(function () { $(this).addClass("lv_focus"); }).blur(function () { $(this).removeClass("lv_focus"); }).keyup(function () { this.value = App.GetStringByte(this.value, 480); }); $(".vote_addicon").next().click(function () { var l = $(".lv_inputsub").length; if (l < 20) { var txt = ""; for (var i = l; i < l + 5; i++) { txt += "<p class=\"lv_inputsub\"><span>" + (i + 1) + ".</span><input type=\"text\" name=\"items\" act=\"vitem\"></p><p>"; } if (App.E("optionType").value == 2) { var options = ""; for (var k = 2; k <= l + 5; k++) { options += "<option value=\"" + k + "\">" + k + "项</option>"; } $("#optionNum").html(options); } $(txt).insertBefore($(".vote_addicon").parent()); } }); $("#uploadingPic a").click(function () { $("#uploadimg_iframe").remove(); $("#addPic").show(); $("#uploadingPic").hide(); $("#addPic").append($("<iframe id=\"uploadimg_iframe\" name=\"uploadimg_iframe\" src=\"about:blank\" style=\"display: none\"></iframe>")); }); $("#delPic a").click(function () { $("#addPic").show(); $("#delPic").hide(); $("#voteImgID").val(""); }); $("#voteError .close").click(function () { $("#voteError").hide(); }); $("#voteFile").change(function () { App.votePicUpload(App.votePicUploading); }); $("#PublishVote").click(function () { }); $('.lv_calendar').JQP_DatePicker({ toDate: new Date(2555, 0, 1) }).keydown(function () { return false; }); $("#optionType").change(function () { if (this.value == 2) { var ls = $(".lv_inputsub input").length; var options = "" for (var k = 2; k <= ls; k++) { options += "<option value=\"" + k + "\">" + k + "项</option>"; } $("#optionNum").show().html(options); } else { $("#optionNum").hide(); } }); $("#PublishVote").click(function () { if ($.trim($(".lv_input3").val()) == "") { $("#voteError .bigtxt").text("投票标题错误"); $("#voteError .stxt").text("标题必须有哦,最多25个汉字"); $("#voteError").show(); return false; } else { var ls = $(".lv_inputsub input").length; var count = 0; for (var i = 0; i < ls; i++) { if ($.trim($(".lv_inputsub input")[i].value) != "") count++; } if (count < 2) { $("#voteError .bigtxt").text("投票选项错误"); $("#voteError .stxt").text("选项太少啦,至少2个哦"); $("#voteError").show(); return false; } } if (this.locked) return false; this.locked = true; var title = App.htmlencode(App.GetStringByte($(".lv_form .lv_input3").val(), 50)); var remark = ""; var lvtxtarea = $(".lv_form .lv_textarea"); if ($.trim(lvtxtarea.val()) != "") { remark = App.htmlencode(App.GetStringByte(lvtxtarea.val(), 480).replace(/\n/g, "")); } var imgPid = ""; var hPid = $("#voteImgID"); if ($.trim(hPid.val()) != "") { imgPid = hPid.val(); } var options = ""; var inputOpts = $(".lv_inputsub input"); var ls = inputOpts.length; for (var i = 0; i < ls; i++) { if ($.trim(inputOpts[i].value) != "") options += App.htmlencode(App.GetStringByte(inputOpts[i].value, 40)) + ","; } var displayType = 2; if ($(".lv_form .lv_input2")[0].checked) { displayType = 1; } var optiontype = ""; var optionNum = ""; if (App.E("optionType").value == 1) { optiontype = "1"; } else { optiontype = "2"; optionNum = App.E("optionNum").value; } var calendar = $(".lv_calendar"); var expireTime = calendar.val() + " " + calendar.next().val() + ":" + calendar.next().next().val(); $.ajax({ url: "/Ajax/CreateVote/", data: { Title: title, Remark: remark, ImgPid: imgPid, Options: options, DisplayType: displayType, OptionType: optiontype, OptionNum: optionNum, ExpireTime: expireTime }, datatype: "json", cache: false, type: "post", success: function (o) { if (o.Code == "A00003") { App.FullMiniTip(CodeList["A00003"], App.E("PublishVote"), 1000, 1); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.FullMiniTip(CodeList[o.Code], App.E("PublishVote"), 1000, 3); setTimeout(function () { $("#divVote").JQP_UnClickOther(); $("#divVote").remove(); App.insertTxt2Txtarea(App.TargetTextarea, o.Data); }, 1000); } App.E("PublishVote").locked = false; }, error: function () { App.FullMiniTip(CodeList["A00003"], App.E("PublishVote"), 1000, 1); App.E("PublishVote").locked = false; } }); }); $("li[nav='new']").click(function () { $("div[tab='new']").show(); $("div[tab='list']").hide(); $("li[nav='new']").attr("class", "cur"); $("li[nav='list']").attr("class", ""); }); $("li[nav='list']").click(function () { $("div[tab='list']").show(); $("div[tab='new']").hide(); $("li[nav='list']").attr("class", "cur"); $("li[nav='new']").attr("class", ""); }); } }, error: function () { App.alert(CodeList["A00003"]); } }); } else { $("#divVote").show(); } return false; }, votePicUpload: function (callBack) { if (!(/\.(gif|jpg|png|jpeg)$/i.test($("#voteFile").val()))) { $("#voteError .bigtxt").text("图片格式不正确"); $("#voteError .stxt").text("只支持jpg,png,gif"); $("#voteError").show(); return false; } else { if ($.browser.msie) { eval("window.voteForm.submit();"); } else { $("#voteForm").submit(); } callBack(); } var clone = $("#voteFile").clone(); clone.removeAttr("value"); $("#voteFile").remove(); $("#voteForm").append(clone); $("#voteForm").find("input").change(function () { App.votePicUpload(callBack); }); }, votePicUploading: function () { $("#uploadingPic").show(); $("#addPic").hide(); $("#uploadingPic a").click(function () { $("#uploadimg_iframe").remove(); $("#addPic").show(); $("#uploadingPic").hide(); $("#addPic").append($("<iframe id=\"uploadimg_iframe\" name=\"uploadimg_iframe\" src=\"about:blank\" style=\"display: none\"></iframe>")); }); }, votePicCallBack: function (status, imgID, imgName) { $("#uploadingPic").hide(); if (status == 1) { App.votePicUploaded(imgID, imgName); } if (status == -1) { $("#voteError .bigtxt").text("上传失败"); $("#voteError .stxt").text("请重试"); $("#voteError").show(); $("#addPic").show(); } if (status == -2) { $("#voteError bigtxt").text("上传失败"); $("#voteError stxt").text("上传图片超过5M,请重新上传。"); $("#voteError").show(); $("#addPic").show(); } }, votePicUploaded: function (imgID, imgName) { $("#voteImgID").val(imgID); $("#uploadingPic").hide(); $("#delPic").show(); $("#votePicName").text(imgName); }, lazyObject: null, lazyFunction: function (func, lazyTime) { if (lazyTime > 0 && func != null) { this.lazyObject = setTimeout(func, lazyTime); } }, lazyEvent: function (obj, eventName, eventName1, lazyTime, func, func1) { if (obj != null && eventName != "" && eventName1 != null) { $(obj).bind(eventName, function (e) { if (func && lazyTime > 0) { App.lazyObject = setTimeout(function () { func(obj); }, lazyTime); } }).bind(eventName1, function (e) { if (App.lazyObject) { clearTimeout(App.lazyObject); if (func1 != null) { func1(); } } }); } }, curGetLink: null, curAutoCompleteTxtBox: null, curAutoCompleteCallBack: null, OriKey: "", autoIsKeyUp: false, autoCompleteTimerEvent: function () { if (!App.autoIsKeyUp) return; if (!App.curGetLink) return; if (!App.curAutoCompleteTxtBox) return; if ($.trim(App.curAutoCompleteTxtBox.val()) == "") return; if (App.curAutoCompleteTxtBox.val() == App.OriKey) return; App.OriKey = App.curAutoCompleteTxtBox.val(); var layer = $(".layerMedia_menu"); App.autoIsKeyUp = false; $.ajax({ dataType: "json", data: { key: App.OriKey }, url: "/Ajax/" + App.curGetLink + "/", cache: false, type: "post", success: function (o) { if (o.Code == "A00017") { layer.hide(); return; } if (o.Code == "A00001") { App.showLoginDial(); return; } if (o.Code == "A00003") { App.alert(CodeList[o.Code]); return; } var str = ""; for (var i = 0; i < o.Data.length; i++) { if (i == 0) str += "<li style=\"overflow: hidden; height: 20px;\" id=\"" + o.Data[i].ID + "\" val='" + o.Data[i].NickName + "' class=\"cur\">" + o.Data[i].Title.replace(new RegExp("(" + App.OriKey + ")", "gi"), "<b>$1</b>") + "</li>" else str += ("<li style=\"overflow: hidden; height: 20px;\" id=\"" + o.Data[i].ID + "\" val='" + o.Data[i].NickName + "'>" + o.Data[i].Title.replace(new RegExp("(" + App.OriKey + ")", "gi"), "<b>$1</b>") + "</li>"); } layer.show(); var offset = App.curAutoCompleteTxtBox.offset(); layer.css("left", offset.left).css("top", offset.top + App.curAutoCompleteTxtBox.height() + 5); layer.find("ul").html(str).find("li").hover(function () { layer.find("li").removeClass("cur"); $(this).addClass("cur"); }).click(function () { layer.hide(); App.OriKey = ""; if (App.curAutoCompleteCallBack) { App.curAutoCompleteCallBack($(this).attr("id"), $(this).attr("val")); } }); } }); }, autoCompleteLayer: "<div class=\"layerMedia_menu\" style=\"width: 161px; position: absolute; z-index: 1601; display: none;\"><ul></ul></div>", autoComplete: function (ctrl, callBack, requestAction) { var layer = $(".layerMedia_menu") if (App.appendToBody(layer, this.autoCompleteLayer)) { layer = $(".layerMedia_menu"); layer.JQP_ClickOther(function () { layer.hide(); App.OriKey = ""; }); } $(ctrl).keydown(function (e) { App.autoIsKeyUp = true; var curLi = layer.find(".cur"); var index = layer.find("li").index(curLi); var length = layer.find("li").length; var lis = layer.find("li").removeClass("cur"); switch (e.which) { case 38: if (index == 0) { $(lis[length - 1]).addClass("cur"); } else $(lis[index - 1]).addClass("cur"); e.preventDefault(); break; case 40: if (index == length - 1) { $(lis[0]).addClass("cur"); } else $(lis[index + 1]).addClass("cur"); e.preventDefault(); break; case 13: App.OriKey = ""; if (callBack) { if (curLi.attr("val") && layer.is(":visible")) callBack(curLi.attr("id"), curLi.attr("val")); } e.preventDefault(); layer.hide(); App.autoIsKeyUp = false; break; } }).focus(function () { if (requestAction) { App.curGetLink = requestAction; } App.curAutoCompleteTxtBox = $(this); if (callBack) App.curAutoCompleteCallBack = callBack; }); } }; App.addGroup = function (name, sucCallback, defCallback) { $.ajax({ dataType: "json", data: { Name: name }, url: "/Ajax/AddGroup/", cache: false, type: "post", success: function (o) { if (o.Code == "A00009") { if (sucCallback) sucCallback(o); } else if (o.Code == "A00015") { App.fullTip(CodeList[o.Code], 1000, null, 1); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } if (defCallback) defCallback(); }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); if (defCallback) defCallback(); } }); } App.editGroupName = function (gid, name, sucCallback, defCallback) { $.ajax({ dataType: "json", data: { Name: name, Gid: gid }, url: "/Ajax/EditGroupName/", cache: false, type: "post", success: function (o) { if (o.Code == "A00004") { if (sucCallback) sucCallback(o); } else if (o.Code == "A00015") { App.fullTip(CodeList[o.Code], 1000, null, 1); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } if (defCallback) defCallback(); }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); if (defCallback) defCallback(); } }); } App.popGroupDiv = function (gid, gName) { if (App.initDialDiv("GroupDiv", dialDiv, false, null)) { var groupDiv = $("#GroupDiv"); groupDiv.removeClass("4CancelAllLayer"); groupDiv.find(".mid_c").html(GroupConDiv.replace("{title}", gName != null ? "编辑分组名" : "创建分组")); $("#GroupDiv .close").add($("#group_cancel")).click(function () { groupDiv.remove(); App.hideMash(); }); var txtGroup = $("#group_newname"); txtGroup.JQP_HighLineInput2({ nullCon: "输入分组名字" }); if (gName) txtGroup.val(gName); var position = App.centerInScreen(groupDiv); groupDiv.css("left", position.left + "px"); groupDiv.css("top", position.top + "px"); App.showMash(); var error = $("#errorTs"); var btnSubmit = $("#group_submit").click(function () { if (this.locked) return false; this.locked = true; if (txtGroup.val() == "输入分组名字") { this.locked = false; error.text("请输入分组名"); error.show(); return false; } var len = App.byteLength(txtGroup.val()); if (len > 16) { this.locked = false; error.text("请不要超过16个字符"); error.show(); return false; } if (gName) { App.editGroupName(gid, $.trim(txtGroup.val()), function (o) { App.fullTip(CodeList[o.Code], 1000, window.location.href.replace("#", ""), 3); }, function () { App.E("group_submit").locked = false; }); } else { App.addGroup($.trim(txtGroup.val()), function (o) { App.fullTip(CodeList[o.Code], 1000, window.location.href.replace("#", ""), 3); }, function () { App.E("group_submit").locked = false; }); } return false; }); } } App.editRemarkConDiv = "<div class=\"layerBox\"><div class=\"layerBoxTop\"><div class=\"topCon\"><strong>设置备注名</strong><a title=\"关闭\" class=\"close\" href=\"javascript:;\"></a><div class=\"clear\"></div></div></div><div class=\"layerBoxCon\" style=\"width: 390px; height: auto;\"><div class=\"layerBoxCon\" style=\"width: 390px;\"><div class=\"inviteLayer\"><p class=\"flName\">给朋友加个备注名,方便认出他是谁</p><div class=\"inviteLayerInput\"><input type=\"text\" value=\"\" id=\"remark\" class=\"PY_input\"><a class=\"btn_normal\" href=\"javascript:void(0);\" id=\"submit\"><em>保存</em></a></div><p style=\"display:none;\" id=\"errorTip\" class=\"errorTs yellow2\">超过8个字啦!为他起个常用名吧</p></div></div></div></div>"; App.showEditRemarkBox = function (ctrl, uid) { if (App.initDialDiv("EditRemarkBox", dialDiv, false, null)) { var box = $("#EditRemarkBox"); box.removeClass("4CancelAllLayer"); box.find(".mid_c").html(this.editRemarkConDiv); box.find(".close").click(function () { box.remove(); App.hideMash(); }); } ctrl = $(ctrl); var box = $("#EditRemarkBox"); var position = this.centerInScreen(box); var input = $("#remark"); if (ctrl.text() != "设置备注") input.val(ctrl.text()); box.css("top", position.top).css("left", position.left); this.showMash(); box.show(); box.find("#remark").focus().keyup(function () { if (App.byteLength(this.value) > 16) { this.value = App.GetStringByte(this.value, 16); } }); box.find("#submit").click(function () { if (App.byteLength(input[0].value) > 16) { box.find("#errorTip").show(); return; } if (this.locked) { return; } this.locked = true; var thisBtn = this; $.ajax({ dataType: "json", data: { uid: uid, remark: $.trim(input.val()) }, url: "/Ajax/EditRemark/", cache: false, type: "post", success: function (o) { if (o.Code == "A00004") { App.fullTip(CodeList[o.Code], 1000, null, 3); if ($.trim(input.val()) == "") ctrl.text("设置备注"); else ctrl.text($.trim(input.val())); box.remove(); App.hideMash(); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.alert(CodeList["A00003"]); } thisBtn.locked = false; }, error: function () { App.alert(CodeList["A00003"]); thisBtn.locked = false; } }); }); } App.MessageConDiv = "<div class=\"layerBox\"><div class=\"layerBoxTop\"><div class=\"topCon\"><strong>发私信</strong><a title=\"关闭\" class=\"close\" href=\"javascript:;\"></a><div class=\"clear\"></div></div></div><div class=\"layerBoxCon\" style=\"width: 430px; height: auto;\"><table class=\"noteTab2\"><tbody> <tr> <th>发私信给:&nbsp;</th><td><input type=\"text\" class=\"PY_input\" id=\"popUpNick\" style=\"color: rgb(153, 153, 153);\">&nbsp;&nbsp;</td></tr><tr class=\"tPadding\"><th>私信内容:&nbsp;</th><td><textarea class=\"PY_input\" id=\"popUpEditor\" range=\"0&0\" style=\"overflow: hidden;\"></textarea></td></tr><tr class=\"tPadding1\"><th></th><td><a title=\"表情\" href=\"javascript:void(0);\" id=\"insert_face_icon\" class=\"faceicon1\"></a></td></tr> <tr><th></th><td><a class=\"btn_normal\" href=\"javascript:void(0);\" id=\"popUpSubmit\"><em>发送</em></a> <span class=\"errorTs2 error_color\" style=\"display:none\" id=\"popUpError\">密码错误</span></td></tr><tr><td></td><td><p class=\"inviteLayer_tip gray9\">说明:长度不能超过300字</p></td></tr></tbody></table></div></div>"; App.showMessageBox = function (toName) { if (App.initDialDiv("MessageBox", dialDiv, false, null)) { var box = $("#MessageBox"); box.removeClass("4CancelAllLayer"); box.find(".mid_c").html(this.MessageConDiv); box.find(".close").click(function () { box.remove(); App.hideMash(); }); var textarea = $("#popUpEditor").keyup(function () { if (App.byteLength(this.value) > 600) this.value = App.GetStringByte(this.value, 600); }); var input = $("#popUpNick"); input.JQP_HighLineInput(); $("#insert_face_icon").click(function (e) { e.stopPropagation(); App.showExpression(textarea, this); }); this.bindTxtarea(textarea[0], { IsEnableAuto: true, keyUpCallBack: function () { } }); this.autoComplete(input, function (id, name) { input.val(name); App.OriKey = "" }, "GetFollowListByKey"); var isPush = false; for (var i = 0; i < App.TimerFunArray.length; i++) { if (App.TimerFunArray[i] == this.autoCompleteTimerEvent) { isPush = true; } } if (!isPush) { App.TimerFunArray.push(this.autoCompleteTimerEvent); } $("#popUpSubmit").click(function () { var popUpError = $("#popUpError"); if ($.trim(input.val()) == "") { popUpError.show(); popUpError.text("请输入收信人昵称"); return; } if (App.byteLength(textarea.val()) > 600) { popUpError.show(); popUpError.text("内容超过300字"); return; } if ($.trim(textarea.val()) == "") { popUpError.show(); popUpError.text("内容不能为空"); return; } if (this.locked) return; this.locked = true; var thisBtn = this; App.AddMessage($.trim(input.val()), $.trim(textarea.val()), function () { box.remove(); App.hideMash(); App.fullTip("发送成功", 1000, null, 3); }, function () { thisBtn.locked = false; }); }); } var box = $("#MessageBox"); var position = this.centerInScreen(box); var input = $("#popUpNick"); var textarea = $("#popUpEditor"); if (toName) input.val(toName); box.css("top", position.top).css("left", position.left); App.showMash(); box.show(); } App.AddMessage = function (nickname, content, susCallBack, defCallBack) { content = App.htmlencode(content); $.ajax({ dataType: "json", data: { NickName: nickname, Content: content }, url: "/Ajax/CreateMessage/", cache: false, type: "post", success: function (o) { if (o.Code == "A00009") { if (susCallBack) susCallBack(); } else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00019") { App.fullTip(CodeList[o.Code], 1000, null, 1); } else if (o.Code == "A00002") { App.fullTip(CodeList[o.Code], 1000, null, 1); } else if (o.Code == "A00026") { App.fullTip(CodeList[o.Code], 1000, null, 1); } else if (o.Code == "A00027") { App.fullTip(CodeList[o.Code], 1000, null, 1); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } if (defCallBack) defCallBack(); }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); if (defCallBack) defCallBack(); } }); } App.AddQueryToUrl = function (oriUrl, key, value) { if (oriUrl.indexOf("?") > 0) { if (oriUrl.indexOf("&" + key) > 0 || oriUrl.indexOf("?" + key) > 0) { oriUrl = oriUrl.replace(RegExp("&*" + key + "=[^&]+", "ig"), ""); } if (oriUrl.split('?')[1] == "") { oriUrl += key + "=" + value; } else { oriUrl += "&" + key + "=" + value; } } else { oriUrl += "?" + key + "=" + value; } return oriUrl; } App.RemoveQueryFromUrl = function (oriUrl, key) { if (oriUrl.indexOf("&" + key) > 0 || oriUrl.indexOf("?" + key) > 0) { oriUrl = oriUrl.replace(RegExp("&*" + key + "=[^&]+", "ig"), ""); } return oriUrl; } App.AddUserTopic = function (name, susCallBack, defCallBack) { $.ajax({ dataType: "json", data: { name: name }, url: "/Ajax/AddUserTopic/", cache: false, type: "post", success: function (o) { if (o.Code == "A00009") { if (susCallBack) susCallBack(o); } else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00025") { App.fullTip(CodeList[o.Code], 1000, null, 1); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } if (defCallBack) defCallBack(); }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); if (defCallBack) defCallBack(); } }); } App.DelUserTopic = function (id, susCallBack, defCallBack) { $.ajax({ dataType: "json", data: { id: id }, url: "/Ajax/DelUserTopic/", cache: false, type: "post", success: function (o) { if (o.Code == "A00018") { if (susCallBack) susCallBack(CodeList[o.Code]); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } if (defCallBack) defCallBack(); }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); if (defCallBack) defCallBack(); } }); } App.FollowOne = function (id, name, susCallBack, defCallBack) { $.ajax({ dataType: "json", data: { id: id }, url: "/Ajax/FollowOne/", cache: false, type: "post", success: function (o) { if (o.Code == "A00009") { if (susCallBack) susCallBack(id, name, o); App.showGroupAssignBox(id, name); } else if (o.Code == "A00001") { App.showLoginDial(); } else if (o.Code == "A00026") { App.fullTip(CodeList[o.Code], 1000, null, 1); } else if (o.Code == "A00029") { App.confirm(CodeList[o.Code], function () { App.outBlackList(id, function (d) { App.fullTip(CodeList[d.Code], 1000, null, 3); }, null); }); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } if (defCallBack) defCallBack(); }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); if (defCallBack) defCallBack(); } }); } App.CancelFollow = function (id, susCallBack, defCallBack) { $.ajax({ dataType: "json", data: { id: id }, url: "/Ajax/CancelFollow/", cache: false, type: "post", success: function (o) { if (o.Code == "A00018") { if (susCallBack) susCallBack(id, o); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } if (defCallBack) defCallBack(); }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); if (defCallBack) defCallBack(); } }); }; App.CancelFan = function (id, susCallBack, defCallBack) { $.ajax({ dataType: "json", data: { id: id }, url: "/Ajax/CancelFan/", cache: false, type: "post", success: function (o) { if (o.Code == "A00018") { if (susCallBack) susCallBack(id, o); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } if (defCallBack) defCallBack(); }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); if (defCallBack) defCallBack(); } }); } App.yellowTip = $("#yellowtip"); App.tipIstop = true; App.UnreadTimeCount = 0; App.GetUnreadJsonpEvent = function () { if (App.UnreadTimeCount % 30 == 0) { $("head").append("<script type=\"text/javascript\" src=\"/Jsonp/Unread/?r=" + Math.random() + "\"></script>") }; App.UnreadTimeCount++; }; App.showUnread = function (o) { var data = o.Data; if (data.followCount > 0) { $("#unreadFollowCount").html(data.followCount + "位新粉丝,<a href=\"\">查看我的粉丝</a>").show(); } else { $("#unreadFollowCount").hide(); } if (data.commentCount > 0) { $("#unreadCommentCount").html(data.commentCount + "条新评论,<a href=\"\">查看我的评论</a>").show(); } else { $("#unreadCommentCount").hide(); } if (data.msgCount > 0) { $("#unreadMsgCount").html(data.msgCount + "条新信息,<a href=\"\">查看我的私信</a>").show(); } else { $("#unreadMsgCount").hide(); } if (data.atmeCount > 0) { $("#unreadAtmeCount").html(data.atmeCount + "条@我的微博,<a href=\"\">查看@我的微博</a>").show(); } else { $("#unreadAtmeCount").hide(); } if (data.atcmtCount > 0) { $("#unreadAtcmtCount").html(data.atcmtCount + "条@我的评论,<a href=\"\">查看@我的评论</a>").show(); } else { $("#unreadAtcmtCount").hide(); } if (data.noticeCount > 0) { $("#unreadNoticeCount").html(data.noticeCount + "条通知,<a href=\"\">查看我的通知</a>").show(); $("#unreadLayer").show(); } else { $("#unreadNoticeCount").hide(); } if (data.followCount > 0 || data.commentCount > 0 || data.msgCount > 0 || data.atmeCount > 0 || data.atcmtCount > 0 || data.noticeCount > 0) { $("#unreadLayer").show(); } else { $("#unreadLayer").hide(); } }; App.showGroupAssignBox = function (uid, name) { if (App.initDialDiv("GroupAssignBox", dialDiv, false, null)) { var groupDiv = $("#GroupAssignBox"); groupDiv.removeClass("4CancelAllLayer"); groupDiv.find(".mid_c").html(GroupAssignDiv.replace("{name}", name)); $("#GroupAssignBox .close").add($("#g_nogroup")).click(function () { groupDiv.remove(); App.hideMash(); }); var txtSetRemark = $("#set_group_remark"); txtSetRemark.JQP_HighLineInput2({ nullCon: "设置备注" }); var position = App.centerInScreen(groupDiv); groupDiv.css("left", position.left + "px"); groupDiv.css("top", position.top + "px"); App.showMash(); $.ajax({ dataType: "json", url: "/Ajax/GetAllGroup/", cache: false, data: { fuid: uid }, type: "post", success: function (o) { if (o.Code == "A00005") { var ul = $("#group_list_D"); if (o.Data.length > 0) { for (var i = 0; i < o.Data.length; i++) { var li; if (o.Data[i].IsSet == 0) { li = $('<li><input id="g{id}" class="labelbox" type="checkbox" name="g{id}" value="{id}"><label title="{name}" for="g{id}" style="cursor:pointer;">{name}</label></li>'.replace(/\{name\}/g, o.Data[i].Name).replace(/\{id\}/g, o.Data[i].ID)); } else { li = $('<li><input id="g{id}" checked class="labelbox" type="checkbox" name="g{id}" value="{id}"><label title="{name}" for="g{id}" style="cursor:pointer;">{name}</label></li>'.replace(/\{name\}/g, o.Data[i].Name).replace(/\{id\}/g, o.Data[i].ID)); } li.mouseover(function () { this.className = "hover"; }).mouseout(function () { this.className = "" }); ul.append(li); } } var newgrp = $("#newgrp"); $("#creategrp").click(function () { newgrp.fadeIn(); return false; }); $("#cancel_group").click(function () { newgrp.fadeOut(); return false; }); var groupInput = $("#group_input").JQP_HighLineInput2({ nullCon: "新分组" }); var error = $("#group_error"); var btnAdd = $("#create_group").click(function () { if (this.locked) return false; this.locked = true; if (groupInput.val() == "新分组") { this.locked = false; error.text("请输入分组名"); error.show(); return false; } var len = App.byteLength(groupInput.val()); if (len > 16) { this.locked = false; error.text("请不要超过16个字符"); error.show(); return false; } App.addGroup($.trim(groupInput.val()), function (o) { var li = $('<li><input id="g{id}" class="labelbox" type="checkbox" name="g{id}" value="{id}"><label title="{name}" for="g{id}" style="cursor:pointer;">{name}</label></li>'.replace(/\{name\}/g, o.Data.Name).replace(/\{id\}/g, o.Data.ID)); li.mouseover(function () { this.className = "hover"; }).mouseout(function () { this.className = "" }); ul.append(li); }, function () { btnAdd[0].locked = false; }); return false; }); $("#g_submit").click(function () { if (this.locked) return false; if (App.byteLength(txtSetRemark.val()) > 16) { $("#set_group_remark_err").show().text("只能输入16个字节"); return false; } var gids = ""; var remark = txtSetRemark.val(); var inputs = ul.find("input"); for (var i = 0; i < inputs.length; i++) { if (inputs[i].checked) { gids += inputs[i].value + ","; } } if (remark == "设置备注") remark = ""; this.locked = true; var btn = this; $.ajax({ dataType: "json", url: "/Ajax/SetGroup/", cache: false, data: { gids: gids, remark: remark, fuid: uid }, type: "post", success: function (o) { if (1 == 1) { App.fullTip(CodeList["A00004"], 1000, null, 3); groupDiv.remove(); App.hideMash(); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } btn.locked = false; }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); btn.locked = false; } }); return false; }); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); } }); } }; App.getDivShowPosition = function (height, ctrl) { ctrl = $(ctrl); var scrollTop = $(document).scrollTop(); var offset = ctrl.offset(); if (offset.top - height > scrollTop) { return { type: "down", left: offset.left, top: offset.top - height }; } else { return { type: "up", left: offset.left, top: offset.top + ctrl.height() + 5 }; } }; App.NameCardHashTable = new Hashtable(); App.removeNcItemInHsTable = function (key) { this.NameCardHashTable.remove(key); }; App.ShowNameCard = function (elem) { var $elem = $(elem); var nameCard = $("#NameCard"); nameCard.find(".mid_c").html('<div class="layerBox"><div style="width: 298px;" class="layerBoxCon1"><div class="name_card"><div class="layerArrow"></div></div></div></div>'); var uname = $elem.attr("uname"); var curData = this.NameCardHashTable.get(uname); if (curData) { nameCard.find(".name_card").append(curData) var curPosition = App.getDivShowPosition(nameCard.height(), $elem); if (curPosition.type == "down") { nameCard.find(".layerArrow").addClass("layerArrow_d"); } nameCard.css("left", curPosition.left).css("top", curPosition.top).show(); } else { var loadCon = $('<div style="width: 295px;" class="layerBox"><div class="layerBox_loading"><div class="ll_info"><img width="16" height="16" src="/Content/Image/loading.gif" alt="" title=""><p>正在加载,请稍候。。。</p></div></div></div>'); nameCard.find(".name_card").append(loadCon); var curPosition = this.getDivShowPosition(nameCard.height(), $elem); if (curPosition.type == "down") { nameCard.find(".layerArrow").addClass("layerArrow_d"); } nameCard.css("left", curPosition.left).css("top", curPosition.top).show(); $.ajax({ dataType: "json", url: "/Ajax/GetNameCard/", data: { name: uname }, cache: false, type: "post", success: function (o) { if (o.Code == "A00005") { App.NameCardHashTable.add(uname, o.Data); nameCard.hide().find(".mid_c").html('<div class="layerBox"><div style="width: 298px;" class="layerBoxCon1"><div class="name_card"><div class="layerArrow"></div></div></div></div>').find(".name_card").append(o.Data); curPosition = App.getDivShowPosition(nameCard.height(), $elem); if (curPosition.type == "down") { nameCard.find(".layerArrow").addClass("layerArrow_d"); } nameCard.css("left", curPosition.left).css("top", curPosition.top).show(); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.alert(CodeList["A00003"]); } }, error: function () { App.alert(CodeList["A00003"]); } }); } }; App.initNameCard = function (container) { var $NameCard = null; if (App.initDialDiv("NameCard", dialDiv, false, null)) { $NameCard = $("#NameCard"); App.lazyEvent($NameCard, "mouseleave", "mouseenter", 500, function () { $NameCard.hide(); }); } else { $NameCard = $("#NameCard"); } var $elems = container.find("a[namecard='true']"); for (var i = 0; i < $elems.length; i++) { App.lazyEvent($elems[i], "mouseenter", "mouseleave", 500, function (o) { App.ShowNameCard(o); }, function () { App.lazyFunction(function () { $NameCard.hide(); }, 500) }); } var $elems = container.find("img[namecard='true']"); for (var i = 0; i < $elems.length; i++) { App.lazyEvent($elems[i], "mouseenter", "mouseleave", 500, function (o) { App.ShowNameCard(o); }, function () { App.lazyFunction(function () { $NameCard.hide(); }, 500) }); } }; App.NameCardFollow = function (id, name, alink) { if (alink.locked) return; alink.locked = true; App.FollowOne(id, name, function (ID, Name, O) { App.removeNcItemInHsTable(Name); }, function () { alink.locked = false; }); }; App.CancelNameCardFollow = function (id, name, alink) { if (alink.locked) return; App.miniConfirm("是否取消关注" + name, alink, function () { alink.locked = true; App.CancelFollow(id, function (ID, O) { App.removeNcItemInHsTable(name); }, function () { alink.locked = false; }); }); }; App.pullBlackList = function (id, successCallBack, defCallBack) { $.ajax({ dataType: "json", url: "/Ajax/AddBlackList/", data: { id: id }, cache: false, type: "post", success: function (o) { if (o.Code == "A00030") { if (successCallBack) successCallBack(o); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.alert(CodeList["A00003"]); } if (defCallBack) defCallBack(); }, error: function () { App.alert(CodeList["A00003"]); if (defCallBack) defCallBack(); } }); }; App.outBlackList = function (id, successCallback, defCallBack) { $.ajax({ dataType: "json", url: "/Ajax/DelBlackListByUID/", data: { uid: id }, cache: false, type: "post", success: function (o) { if (o.Code == "A00023") { if (successCallback) successCallback(o); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.alert(CodeList["A00003"]); } if (defCallBack) defCallBack(); }, error: function () { App.alert(CodeList["A00003"]); if (defCallBack) defCallBack(); } }); }; App.miniblogDel = function (mid, alink) { this.miniConfirm("是否删除该条微博", alink, function () { $.ajax({ dataType: "json", url: "/Ajax/DelMiniBlog/", data: { mid: mid }, cache: false, type: "post", success: function (o) { if (o.Code == "A00018") { $("#mid_" + mid).fadeOut(); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.alert(CodeList["A00003"]); } }, error: function () { App.alert(CodeList["A00003"]); } }); }); }; App.DelMessageByMid = function (mid, sucCallBack, defCallBack) { $.ajax({ dataType: "json", url: "/Ajax/DelMessageByMid/", data: { mid: mid }, cache: false, type: "post", success: function (o) { if (o.Code == "A00018") { if (sucCallBack) sucCallBack(); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.alert(CodeList["A00003"]); } if (defCallBack) defCallBack(); }, error: function () { App.alert(CodeList["A00003"]); if (defCallBack) defCallBack(); } }); }; App.DelMessageByUID = function (uid, toUid, sucCallBack, defCallBack) { $.ajax({ dataType: "json", url: "/Ajax/DelMessageByUid/", data: { uid: uid, toUid: toUid }, cache: false, type: "post", success: function (o) { if (o.Code == "A00018") { if (sucCallBack) sucCallBack(); } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.alert(CodeList["A00003"]); } if (defCallBack) defCallBack(); }, error: function () { App.alert(CodeList["A00003"]); if (defCallBack) defCallBack(); } }); }; App.showReportBox = function (alink, uid, type, typeid) { if (alink.locked) return false; alink.locked = true; $.ajax({ dataType: "json", url: "/Ajax/GetComplaintContent/", data: { ToUID: uid, ConType: type, ConID: typeid }, cache: false, type: "post", success: function (o) { if (o.Code == "A00005") { if (App.initDialDiv("ReportBox", dialDiv, false, null)) { var box = $("#ReportBox"); box.removeClass("4CancelAllLayer"); box.find(".mid_c").html(o.Data); $("#ReportBox .close").click(function () { box.remove(); App.hideMash(); }); var position = App.centerInScreen(box); box.css("left", position.left + "px"); box.css("top", position.top + "px"); App.showMash(); $("#SendReport").click(function () { if (this.locked) return false; this.locked = true; sendLink = this; $.ajax({ dataType: "json", url: "/Ajax/CreateComplaint/", data: { ToUID: uid, ComplaintConType: type, ComplaintConID: typeid, ComplaintReason: $("input[name='reportType']:checked").val(), ComplaintSupplement: $("#supplement").val() }, cache: false, type: "post", success: function (od) { if (od.Code == "A00031") { box.remove(); App.hideMash(); App.fullTip(CodeList["A00031"], 1000, null, 3); } else if (od.Code == "A00001") { App.showLoginDial(); } else { App.fullTip(CodeList["A00003"], 1000, null, 1); } sendLink.locked = false; }, error: function () { App.fullTip(CodeList["A00003"], 1000, null, 1); sendLink.locked = false; } }); }); } } else if (o.Code == "A00001") { App.showLoginDial(); } else { App.alert(CodeList["A00003"]); } alink.locked = false; }, error: function () { App.alert(CodeList["A00003"]); alink.locked = false; } }); }; App.highLineTxtBox = function ($txtbox) { $txtbox.css("backgroundColor", 'rgb(255, 180, 180)'); $txtbox.animate({ backgroundColor: 'rgb(255, 255, 255)' }, 300, function () { $txtbox.css("backgroundColor", 'rgb(255, 180, 180)'); $txtbox.animate({ backgroundColor: 'rgb(255, 255, 255)' }, 300); }); }; App.elemBlur = function ($elem, $clickElem) { var clickDoc = function () { $elem.hide(); $(this).unbind("click", clickDoc); }; $clickElem.click(function (e) { e.stopPropagation(); $(document).bind("click", clickDoc); }); $elem.bind("click", function (e) { e.stopPropagation(); }); }; App.EmptySchoolCollegeClass = function () { $("#txtSchool").val(""); $("#school_id").val(""); $("#remark").val(""); $("#schoolCollege_id").val(""); $("#schoolClass").val(""); $("#schoolClass_id").val(""); }; App.EmptyCollegeClass = function () { $("#remark").val(""); $("#schoolCollege_id").val(""); $("#schoolClass").val(""); $("#schoolClass_id").val(""); }; App.EmptyClass = function () { $("#schoolClass").val(""); $("#schoolClass_id").val(""); }; App.getUrlValue = function (name) { var str = window.location.href; if (str.indexOf(name) != -1) { var pos_start = str.indexOf(name) + name.length + 1; var pos_end = str.indexOf("&", pos_start); if (pos_end == -1) { return str.substring(pos_start); } else { return str.substring(pos_start, pos_end) } } else { return "-1"; } }; App.hideMoreClass = function () { var liSize = $("#ulClassList li").size(); if (liSize < 8) { var obj = $(".moreti").parent(); obj.hide(); } }; // 说明:用 JavaScript 实现网页图片等比例缩放 // 整理:http://www.CodeBit.cn App.DrawImage = function (ImgD, FitWidth, FitHeight) { var image = new Image(); image.src = ImgD.src; if (image.width > 0 && image.height > 0) { if (image.width / image.height >= FitWidth / FitHeight) { if (image.width > FitWidth) { ImgD.width = FitWidth; ImgD.height = (image.height * FitWidth) / image.width; } else { ImgD.width = image.width; ImgD.height = image.height; } } else { if (image.height > FitHeight) { ImgD.height = FitHeight; ImgD.width = (image.width * FitHeight) / image.height; } else { ImgD.width = image.width; ImgD.height = image.height; } } } }
JavaScript
App.Setup = { BindSelect: function (ctrl) { ctrl = $(ctrl); var showTemp = "<div class=\"setup_info\"><div class=\"info_tip2\"><img title=\"\" alt=\"\" src=\"/Content/Image/transparent.gif\" class=\"tipicon tip3\" style=\"display: none;\"></div><div class=\"info_tip1\"><span class=\"info_tabTip\"><a href=\"javascript:void(0);\" class=\"btn_privacy\"><em><span></span><img title=\"展开\" class=\"small_icon down_arrow\" src=\"/Content/Image/transparent.gif\"></em></a></span></div></div>"; var listTemp = "<div class=\"info_tip1\" style=\"display:none;position:absolute\"><div style=\"z-index:300\" class=\"downmenu\"></div></div>"; var itemTemp = "<p><a href=\"javascript:void(0)\">{name}</a></p>"; var selOption = ctrl.find("option:selected"); var list = $(listTemp); $("body").append(list); var show = $(showTemp); show.insertBefore(ctrl); show.find(".btn_privacy").click(function (e) { e.stopPropagation(); var offset = show.offset(); list.css("left", offset.left + 13).css("top", offset.top + 5); list.show(); }).find("span").text(selOption.text()); list.JQP_ClickOther(function () { list.hide(); }); var options = ctrl.find("option").each(function (i) { var item = $(itemTemp.replace("{name}", $(this).text())).click(function () { show.find(".btn_privacy span").text($(options[i]).text()); list.hide(); ctrl.val(i + 1); }); list.find(".downmenu").append(item); }); }, BindInput: function (ctrl, focusText, blurCallBack) { ctrl = $(ctrl); var tipTemp = "<table class=\"cudTs\" style=\"margin-left: 0px; position: absolute; display: none;\" ><tbody><tr><td class=\"topL\"></td><td></td><td class=\"topR\"></td></tr><tr><td></td><td class=\"tdCon\">" + focusText + "</td><td></td></tr><tr><td class=\"botL\"></td><td></td><td class=\"botR\"></td></tr></tbody></table>"; var tipElem = $(tipTemp); $("body").append(tipElem); var errorTemp = "<table class=\"cudTs3\" style=\"display:none;\"><tbody><tr><td class=\"topL\"></td><td></td><td class=\"topR\"></td></tr><tr><td></td><td class=\"tdCon\"></td><td></td></tr><tr><td class=\"botL\"></td><td></td><td class=\"botR\"></td></tr></tbody></table>"; var errorElem = $(errorTemp); var select = ctrl.parent().next().append(errorElem).find(".setup_info"); ctrl.focus(function () { this.style.borderColor = "rgb(165,199,96)"; this.style.backgroundColor = "rgb(244,255,212)"; errorElem.hide(); var offset = ctrl.offset(); tipElem.css("left", ctrl.width() + offset.left + 20).css("top", offset.top + 2); tipElem.show(); select.hide(); }); ctrl.blur(function () { tipElem.hide(); if (blurCallBack) blurCallBack(ctrl); }); }, redInput: function (ctrl) { ctrl.style.borderColor = "rgb(255, 0, 0)"; ctrl.style.backgroundColor = "rgb(255, 204, 204)"; }, normalInput: function (ctrl) { ctrl.style.borderColor = "rgb(153, 153, 153) rgb(201, 201, 201) rgb(201, 201, 201) rgb(153, 153, 153)"; ctrl.style.backgroundColor = "rgb(255, 255, 255)"; }, isNickName: false, CheckNickName: function (ctrl, asysn) { this.isNickName = false; ctrl = $(ctrl); var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); if ($.trim(ctrl.val()) == "") { errorCon.text("请输入昵称"); error.show(); App.Setup.redInput(ctrl[0]); select.hide(); } else if (/^[0-9]*$/.test($.trim(ctrl.val()))) { errorCon.text("昵称不能全是数字"); error.show(); App.Setup.redInput(ctrl[0]); select.hide(); } else if (!/^[0-9a-zA-Z\u4e00-\u9fa5_]*$/.test($.trim(ctrl.val()))) { errorCon.text("支持中英文、数字或者“_”"); error.show(); App.Setup.redInput(ctrl[0]); select.hide(); } else if ($.trim(ctrl.val()).replace(/[^\x00-\xff]/g, 'xx').length > 20) { errorCon.text("不能超过20个字母或10个汉字"); error.show(); App.Setup.redInput(ctrl[0]); select.hide(); } else { App.ajax_IsExsitNickName(function (o) { if (o.Data == "1") { errorCon.text("此昵称太受欢迎,已有人抢了"); App.Setup.redInput(ctrl[0]); error.show(); } else { App.Setup.isNickName = true; App.Setup.normalInput(ctrl[0]); error.hide(); select.show(); } }, asysn, $.trim(ctrl.val()), "/Ajax/CheckNickName1/"); } }, isRealName: false, checkRealName: function (ctrl) { this.isRealName = false; ctrl = $(ctrl); var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); if ($.trim(ctrl.val()) == "") { select.show(); this.isRealName = true; App.Setup.normalInput(ctrl[0]); return; } if ($.trim(ctrl.val()).replace(/[^\x00-\xff]/g, 'xx').length > 16 || $.trim(ctrl.val()).replace(/[^\x00-\xff]/g, 'xx').length < 4) { App.Setup.redInput(ctrl[0]); errorCon.text("请输入真实姓名"); error.show(); select.hide(); } else if (/[0-9]+/.test($.trim(ctrl.val()))) { errorCon.text("请输入真实姓名"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); } else { select.show(); this.isRealName = true; App.Setup.normalInput(ctrl[0]); } }, isQQ: false, checkQQ: function (ctrl) { this.isQQ = false; ctrl = $(ctrl); var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); if ($.trim(ctrl.val()) == "") { select.show(); this.isQQ = true; App.Setup.normalInput(ctrl[0]); return; } if (!/^[1-9][0-9]{4,11}$/.test($.trim(ctrl.val()))) { errorCon.text("请输入正确的QQ号"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); } else if ($.trim(ctrl.val()).length < 5 || $.trim(ctrl.val()).length > 12) { App.Setup.redInput(ctrl[0]); errorCon.text("请输入正确的QQ号"); error.show(); select.hide(); } else { select.show(); this.isQQ = true; App.Setup.normalInput(ctrl[0]); } }, isMsn: false, checkMsn: function (ctrl) { this.isMsn = false; ctrl = $(ctrl); var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); if ($.trim(ctrl.val()) == "") { select.show(); this.isMsn = true; App.Setup.normalInput(ctrl[0]); return; } if (!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test($.trim(ctrl.val()))) { errorCon.text("请输入正确的MSN地址"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); } else { select.show(); this.isMsn = true; App.Setup.normalInput(ctrl[0]); } }, isMydec: false, checkMydec: function (ctrl) { this.isMydec = false; ctrl = $(ctrl); var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); if ($.trim(ctrl.val()) == "") { select.show(); this.isMydec = true; App.Setup.normalInput(ctrl[0]); return; } if ($.trim(ctrl.val()).replace(/[^\x00-\xff]/g, 'xx').length > 140) { errorCon.text("你输入的个人简介不能超过70个字 "); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); } else { select.show(); this.isMydec = true; App.Setup.normalInput(ctrl[0]); } }, isRealBlog: false, checkRealBlog: function (ctrl) { this.isRealBlog = false; ctrl = $(ctrl); var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); var strRegex = "^((https|http|ftp|rtsp|mms)?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@ + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184 + "|" // 允许IP和DOMAIN(域名) + "([0-9a-z_!~*'()-]+\.)*" // 域名- www. + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名 + "[a-z]{2,6})" // first level domain- .com or .museum + "(:[0-9]{1,4})?" // 端口- :80 + "((/?)|" // a slash isn't required if there is no file name + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; var re = new RegExp(strRegex); if ($.trim(ctrl.val()) == "") { select.show(); this.isRealBlog = true; App.Setup.normalInput(ctrl[0]); return; } if (!re.test($.trim(ctrl.val()))) { errorCon.text("请输入正确的博客地址"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); } else { select.show(); this.isRealBlog = true; App.Setup.normalInput(ctrl[0]); } }, isCompanyName: false, checkCompanyName: function (ctrl) { this.isCompanyName = false; ctrl = $(ctrl); var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); if ($.trim(ctrl.val()).replace(/[^\x00-\xff]/g, 'xx').length > 50) { errorCon.text("请输入正确的单位名称,限制在25字以内"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); } else if ($.trim(ctrl.val()) == "") { errorCon.text("请输入正确的单位名称"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); } else { select.show(); this.isCompanyName = true; App.Setup.normalInput(ctrl[0]); } }, isRemark: false, checkRemark: function (ctrl) { this.isRemark = false; ctrl = $(ctrl); var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); if ($.trim(ctrl.val()) == "") { select.show(); this.isRemark = true; App.Setup.normalInput(ctrl[0]); return; } if ($.trim(ctrl.val()).replace(/[^\x00-\xff]/g, 'xx').length > 140) { errorCon.text("最多可以输入70字以内的备注"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); } else { select.show(); this.isRemark = true; App.Setup.normalInput(ctrl[0]); } }, editEmailCon: "<div class=\"layerBox\"><div class=\"layerBoxTop\"><div class=\"topCon\"><strong node-type=\"titlestring\">修改常用邮箱</strong><a title=\"关闭\" class=\"close\" href=\"javascript:void(0)\"></a><div class=\"clearit\"></div></div></div><div style=\"height:auto; width:390px;\" class=\"layerBoxCon\"><div class=\"mailBoxLayer\"><div node-type=\"before\"><p class=\"gray6\">请填写自己常用的邮箱地址,方便大家联系你!</p><div class=\"inputBox\">邮箱地址: <input type=\"text\" value=\"\" class=\" \" style=\"border-color: rgb(153, 153, 153) rgb(201, 201, 201) rgb(201, 201, 201) rgb(153, 153, 153); background-color: rgb(255, 255, 255);\"></div><p style=\"display:none\" node-type=\"errorTip\" class=\"errorTs error_color\">请输入正确的邮箱地址</p><div class=\"btns\"><a id='BtnSave' class=\"btn_normal\" href=\"javascript:void(0);\"><em>保存</em></a><a id=\"btnCancel\" class=\"btn_normal\" href=\"javascript:void(0);\"><em>取消</em></a></div></div></div></div></div>", showEditEmailBox: function (email, callBack) { if (App.initDialDiv("editEmailBox", dialDiv, false, null)) { var box = $("#editEmailBox"); box.removeClass("4CancelAllLayer"); box.find(".mid_c").html(this.editEmailCon); box.find(".close").add(box.find("#btnCancel")).click(function () { box.remove(); App.hideMash(); }); } var box = $("#editEmailBox"); var position = App.centerInScreen(box); box.css("top", position.top).css("left", position.left); App.showMash(); box.show(); var txtbox = box.find("input"); var saveBtn = box.find("#BtnSave"); if (email) txtbox.val(email); txtbox.focus(function () { this.style.borderColor = "rgb(165,199,96)"; this.style.backgroundColor = "rgb(244,255,212)"; }).blur(function () { if (!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test($.trim(txtbox.val()))) { box.find(".errorTs").show(); App.Setup.redInput(this); } else { box.find(".errorTs").hide(); App.Setup.normalInput(ctrl[0]); } }); saveBtn.click(function () { if (!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test($.trim(txtbox.val()))) { box.find(".errorTs").show(); App.Setup.redInput(this); return false; } else { if (callBack) { callBack($.trim(txtbox.val())); } box.hide(); App.hideMash(); } }); }, bindDate: function (ctrlYear, ctrlMonth, ctrlDay, curYear, curMonth, curDay) { var option; for (var i = 1900; i <= (new Date()).getFullYear(); i++) { if (!curYear || ctrlYear != i) option += "<option value=" + i + ">" + i + "</option>"; } ctrlYear.html($(option)); if (curYear) { if ($.browser.msie && $.browser.version == 6) { setTimeout(function () { ctrlYear.val(curYear); }, 1); } else { ctrlYear.val(curYear); } } option = ""; for (var j = 1; j < 13; j++) { option += "<option value=" + j + ">" + j + "</option>"; } ctrlMonth.html($(option)); if (curMonth) { if ($.browser.msie && $.browser.version == 6) { setTimeout(function () { ctrlMonth.val(curMonth); }, 1); } else { ctrlMonth.val(curMonth); } } option = ""; var Ie7SelectFix = function () { ctrlDay.hide(); ctrlMonth.hide(); ctrlYear.hide(); ctrlDay.show(); ctrlMonth.show(); ctrlYear.show(); } var getDayCount = function (year, month) { var G = 0; var E = year % 400 ? (year % 4 ? false : (year % 100 ? true : false)) : true; switch (parseInt(month) - 1) { case 0: case 2: case 4: case 6: case 7: case 9: case 11: G = 31; break; case 3: case 5: case 8: case 10: G = 30; break; case 1: if (E) { G = 29 } else { G = 28 } } return G; } ctrlYear.change(function () { var G = getDayCount(this.value, ctrlMonth.val()); for (var k = 1; k < G + 1; k++) { option += "<option value=" + k + ">" + k + "</option>"; } ctrlDay.html($(option)); option = ""; Ie7SelectFix(); }); ctrlMonth.change(function () { var G = getDayCount(ctrlYear.val(), this.value); for (var k = 1; k < G + 1; k++) { option += "<option value=" + k + ">" + k + "</option>"; } ctrlDay.html($(option)); option = ""; Ie7SelectFix(); }); for (var z = 1; z < getDayCount(ctrlYear.val(), ctrlMonth.val()) + 1; z++) { option += "<option value=" + z + ">" + z + "</option>"; } ctrlDay.html($(option)); if (curDay) { if ($.browser.msie && $.browser.version == 6) { setTimeout(function () { ctrlDay.val(curDay); }, 1); } else { ctrlDay.val(curDay); } } option = ""; Ie7SelectFix(); }, pwdPower: function (l) { function k(n) { if (n >= 65 && n <= 90) { return 2 } else { if (n >= 97 && n <= 122) { return 4 } else { if (n >= 48 && n <= 57) { return 1 } else { return 8 } } } } function j(n) { var o = 0; for (i = 0; i < 4; i++) { if (n & 1) { o++ } n >>>= 1 } return o } var h = 0, g = l.length; if (g < 6) { return 1 } for (i = 0; i < g; i++) { h |= k(l.charCodeAt(i)) } var m = j(h); if (l.length >= 10) { m++ } switch (m) { case 1: return 1; case 2: return 2; case 3: case 4: return 3; default: return 1 } }, checkPWD: function (ctrl) { ctrl = $(ctrl); var error = ctrl.parent().next().find(".cudTs3"); var errorCon = error.find(".tdCon"); var select = ctrl.parent().next().find(".setup_info"); if (ctrl.val().length < 6 || ctrl.val().length > 16) { errorCon.text("密码长度不正确,应为6~16个字符"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); return false; } else if (!new RegExp("^([\\w\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\+\\`\\-\\=\\[\\]\\\\{\\}\\|\\;\\'\\:\\\"\\,\\.\\/\\<\\>\\?]{6,16})$").test(ctrl.val())) { errorCon.text("密码请勿使用特殊字符"); App.Setup.redInput(ctrl[0]); error.show(); select.hide(); return false; } else { select.show(); App.Setup.normalInput(ctrl[0]); return true; } } }
JavaScript
/// <reference path="Common/jquery-1.4.4.js" /> (function ($) { var tipsDiv = "<div id='newTips' class='new_plus' style='position: absolute; z-index: 251;display: none;'><div class='mentip'><div class='tpbg'></div><div class='maincent'></div><div class='btbg'></div></div></div>"; $.fn.JQP_TxtTips = function (options) { var deafult = { txt: "请输入提示内容", //默认提示内容 VailFn: null, //验证函数 plusId: null, //显示块ID isTxtInput: true //是否为Text类型输入标签 }; var ops = $.extend(deafult, options); if (!ops.isTxtInput) { $(this).click(function () { ops.VailFn($(this), $("#" + ops.plusId)); }); } if (ops.isTxtInput) { $(this).focus(function () { $(this).css("color", "rgb(51,51,51)"); $("#" + ops.plusId).show(); var x = $("#" + ops.plusId).offset().left; var y = $("#" + ops.plusId).offset().top; $("#" + ops.plusId).hide(); if ($("#newTips")[0] == null) { $("body").append(tipsDiv); } if ($.trim($(this).val()) == "") { $("#newTips").css("top", y + "px"); $("#newTips").css("left", x + "px"); $("#newTips").show(); $(".maincent").html(ops.txt); $("#" + ops.plusId).hide() } else { ops.VailFn($(this), $("#" + ops.plusId),true); } }); } if (ops.isTxtInput) { $(this).blur(function () { $("#newTips").hide(); $(this).css("color", "rgb(153,153,153)"); $(this).val($.trim($(this).val())); ops.VailFn($(this), $("#" + ops.plusId),true); }); } } })(jQuery); var isMail = false; var isPwd = false; var isRePwd = false; var isVailCode = false; var isAgree = false; var checkMail = function (inputCtr, plus,async) { isMail = false; var regStr = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/; if ($.trim(inputCtr.val()) == "") { plus.html("<div class='errormt'>" + "<strong><span>" + "请输入常用邮箱。" + "</span></strong></div>"); plus.show(); } else if (!regStr.test(inputCtr.val())) { plus.html("<div class='errormt'>" + "<strong><span>" + "请输入正确的邮箱地址。" + "</span></strong></div>"); plus.show(); } else { App.ajax_IsExsitEmail(function (o) { if (o.Data == "1") { plus.html("<div class='errormt'>" + "<strong><span>" + "该邮箱地址已被注册,<a href='#' onclick=''>登陆</a>" + "</span></strong></div>"); plus.show(); } else { isMail = true; plus.html("<div class='success'><img class='tipicon tip3' src='/Content/Image/transparent.gif'/></div>"); plus.show(); } }, async, $.trim(inputCtr.val())); } } var checkPwd = function (inputCtr, plus) { isPwd = false; var regStr = /\s+/; if (regStr.test(inputCtr.val())) { plus.html("<div class='errormt'>" + "<strong><span>" + "密码请勿使用特殊字符。" + "</span></strong></div>"); plus.show(); } else if (inputCtr.val() == "") { plus.html("<div class='errormt'>" + "<strong><span>" + "密码太短了,最少6位。" + "</span></strong></div>"); plus.show(); } else if (inputCtr.val().length < 6) { plus.html("<div class='errormt'>" + "<strong><span>" + "密码太短了,最少6位。" + "</span></strong></div>"); plus.show(); } else if (inputCtr.val().length > 16) { plus.html("<div class='errormt'>" + "<strong><span>" + "密码太长了,最多16位。" + "</span></strong></div>"); plus.show(); } else { isPwd = true; plus.html("<div class='success'><img class='tipicon tip3' src='/Content/Image/transparent.gif'/></div>"); plus.show(); } } var checkRePwd = function (inputCtr, plus) { isRePwd = false; if (inputCtr.val() != $("#reg_password").val()) { plus.html("<div class='errormt'>" + "<strong><span>" + "两次输入的密码不同" + "</span></strong></div>"); plus.show(); } else { if ($("#reg_password").val() != "") { isRePwd = true; plus.html("<div class='success'><img class='tipicon tip3' src='/Content/Image/transparent.gif'/></div>"); plus.show(); } } } var checkVailCode = function (inputCtr, plus, async) { isVailCode = false; if (inputCtr.val() == "") { plus.html("<div class='errormt'>" + "<strong><span>" + "请输入验证码" + "</span></strong></div>"); plus.show(); } else { App.ajax_IsValidCode(function (o) { if (o.Data == "1") { plus.html("<div class='errormt'>" + "<strong><span>" + "验证码不正确" + "</span></strong></div>"); plus.show(); } else { isVailCode = true; plus.html("<div class='success'><img class='tipicon tip3' src='/Content/Image/transparent.gif'/></div>"); plus.show(); } }, async,$.trim(inputCtr.val())); } } var checkIsAgree = function (inputCtr, plus) { isAgree = false; if (inputCtr.attr("checked") != true) { plus.html("<div class='errormt'>" + "<strong><span>" + "需同意使用协议" + "</span></strong></div>"); plus.show(); } else { isAgree = true; plus.html("<div class='success'><img class='tipicon tip3' src='/Content/Image/transparent.gif'/></div>"); plus.show(); } } var RegCallback = function (isSuccess,email) { if (isSuccess) { window.location.href = "/User/RegSuccess/?email="+email; } else { App.alert("系统繁忙,稍后再试!"); } }
JavaScript
//注:每个嵌入页必须定义该方法,供父窗口调用,并且返回true或false来告之父窗口是否关闭 function Ok() { var newPhotoName = $("#newPhoto").val(); var gid = App.getUrlValue("gid"); $.ajax( { url: "/NewWindow/CreateNewPhotoName", datatype: "json", cache: false, async: false, //就是这个防止重复提交 data: { newPhotoName: newPhotoName,gid:gid }, type: "post", success: function (o) { return true; //返回true模态窗口关闭;返回false模态窗口不关闭; }, error: function (request) { return false; } }); parent.refreshFun(); return true; }
JavaScript
var CodeList = { A00000: "已登录", A00001:"还没有登录", A00002:"用户不存在", A00003:"出错,请稍后再试", A00004:"保存成功", A00005:"返回成功", A00006:"参数有误", A00007: "你输入的链接地址无法识别:)", A00008: "上传成功", A00009:"创建成功", A00010:"转发成功", A00011: "此微博已删除", A00012: "收藏成功", A00013: "取消收藏成功", A00014:"投票成功", A00015:"已存在分组", A00016: "不要太贪心哦,发一次就够啦。", A00017:"没找到任何结果", A00018:"删除成功", A00019:"不能发私信给自己", A00020: "密码错误", A00021: "最多可添加10个标签", A00022: "你已经添加此标签", A00023: "解除黑名单成功", A00024: "这个域名被别人抢到啦,换一个吧!", A00025: "你已经添加了该话题", A00026:"你应经被拉入黑名单", A00027:"人家设置不能发送信息", A00028:"你不能评论- -", A00029: "你把人家拉入黑名单了哦,是否解除?", A00030:"拉入黑名单成功", A00031:"举报成功", A00032: "请先选择学校", A00033: "请先选择院系" };
JavaScript
jQuery.extend({ createUploadIframe: function(id, uri) { //create frame var frameId = 'jUploadFrame' + id; if (window.ActiveXObject) { var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />'); if (typeof uri == 'boolean') { io.src = 'javascript:false'; } else if (typeof uri == 'string') { io.src = uri; } } else { var io = document.createElement('iframe'); io.id = frameId; io.name = frameId; } io.style.position = 'absolute'; io.style.top = '-1000px'; io.style.left = '-1000px'; document.body.appendChild(io); return io }, createUploadForm: function(id, fileElementId) { //create form var formId = 'jUploadForm' + id; var fileId = 'jUploadFile' + id; var form = $('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>'); var oldElement = $('#' + fileElementId); var newElement = $(oldElement).clone(); $(oldElement).attr('id', fileId); $(oldElement).before(newElement); $(oldElement).appendTo(form); //set attributes $(form).css('position', 'absolute'); $(form).css('top', '-1200px'); $(form).css('left', '-1200px'); $(form).appendTo('body'); return form; }, ajaxFileUpload: function(s) { // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout s = jQuery.extend({}, jQuery.ajaxSettings, s); var id = new Date().getTime() var form = jQuery.createUploadForm(id, s.fileElementId); var io = jQuery.createUploadIframe(id, s.secureuri); var frameId = 'jUploadFrame' + id; var formId = 'jUploadForm' + id; // Watch for a new set of requests if (s.global && !jQuery.active++) { jQuery.event.trigger("ajaxStart"); } var requestDone = false; // Create the request object var xml = {} if (s.global) jQuery.event.trigger("ajaxSend", [xml, s]); // Wait for a response to come back var uploadCallback = function(isTimeout) { var io = document.getElementById(frameId); try { if (io.contentWindow) { xml.responseText = io.contentWindow.document.body ? io.contentWindow.document.body.innerHTML : null; xml.responseXML = io.contentWindow.document.XMLDocument ? io.contentWindow.document.XMLDocument : io.contentWindow.document; } else if (io.contentDocument) { xml.responseText = io.contentDocument.document.body ? io.contentDocument.document.body.innerHTML : null; xml.responseXML = io.contentDocument.document.XMLDocument ? io.contentDocument.document.XMLDocument : io.contentDocument.document; } } catch (e) { jQuery.handleError(s, xml, null, e); } if (xml || isTimeout == "timeout") { requestDone = true; var status; try { status = isTimeout != "timeout" ? "success" : "error"; // Make sure that the request was successful or notmodified if (status != "error") { // process the data (runs the xml through httpData regardless of callback) var data = jQuery.uploadHttpData(xml, s.dataType); // If a local callback was specified, fire it and pass it the data if (s.success) s.success(data, status); // Fire the global callback if (s.global) jQuery.event.trigger("ajaxSuccess", [xml, s]); } else jQuery.handleError(s, xml, status); } catch (e) { status = "error"; jQuery.handleError(s, xml, status, e); } // The request was completed if (s.global) jQuery.event.trigger("ajaxComplete", [xml, s]); // Handle the global AJAX counter if (s.global && ! --jQuery.active) jQuery.event.trigger("ajaxStop"); // Process result if (s.complete) s.complete(xml, status); jQuery(io).unbind() setTimeout(function() { try { $(io).remove(); $(form).remove(); } catch (e) { jQuery.handleError(s, xml, null, e); } }, 100) xml = null } } // Timeout checker if (s.timeout > 0) { setTimeout(function() { // Check to see if the request is still happening if (!requestDone) uploadCallback("timeout"); }, s.timeout); } try { // var io = $('#' + frameId); var form = $('#' + formId); $(form).attr('action', s.url); $(form).attr('method', 'POST'); $(form).attr('target', frameId); if (form.encoding) { form.encoding = 'multipart/form-data'; } else { form.enctype = 'multipart/form-data'; } $(form).submit(); } catch (e) { jQuery.handleError(s, xml, null, e); } if (window.attachEvent) { document.getElementById(frameId).attachEvent('onload', uploadCallback); } else { document.getElementById(frameId).addEventListener('load', uploadCallback, false); } return { abort: function() { } }; }, uploadHttpData: function(r, type) { var data = !type; data = type == "xml" || data ? r.responseXML : r.responseText; // If the type is "script", eval it in global context if (type == "script") jQuery.globalEval(data); // Get the JavaScript object, if JSON is used. if (type == "json") eval("data = " + data); // evaluate scripts within html if (type == "html") jQuery("<div>").html(data).evalScripts(); //alert($('param', data).each(function(){alert($(this).attr('value'));})); return data; } })
JavaScript
var map = null; var x1 = null; var x2 = null; var y1 = null; var y2 = null; var priceFrom = 0; var priceEnd = 0; var roomNum = 0; var acrFrom = 0; var acrEnd = 0; var strSource = null; var communityID = null; var totalPage = null; var HouseType = 3; var page_prev; var page_next; var page_count; var page_size = 6; var page_index = 1; function logadMap(strSourceType) { if (GBrowserIsCompatible()) { strSource = strSourceType map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(31.949302, 118.759371), 10); //上海 北纬 22.52分 东经121度 第三个参数是缩放比例 map.setUIToDefault(); mapsize = map.getSize(); map.enableScrollWheelZoom(); this.IntMapEvent(); this.GetMapLngAndLat(); this.ObtainCommunity(); getMapAreaList(); } } function GetMapLngAndLat() { /// <summary>获取经纬度</summary> var E = 100; var G = map.fromContainerPixelToLatLng(new GPoint(64, E / 2)); var D = map.fromContainerPixelToLatLng(new GPoint(mapsize.width - E / 2, mapsize.height - E / 2)); this.x1 = G.lng(); this.x2 = D.lng(); this.y1 = D.lat(); this.y2 = G.lat(); } function GetPhotoHouse() { ClearHouse(); if ($("#chkPhoto").attr("checked") == true) { page_index = 1; GetHouseData(communityID, '1', 'pudate', page_index, page_size); } else { GetHouseData(communityID, '0', 'pudate', page_index, page_size); } } function OrderBy(strType) { if (strType == "1") { $("#link_Price").addClass("orderdown"); $("#link_SquareMeter").removeClass("orderdown"); $("#link_PubDate").removeClass("orderdown"); ClearHouse(); if ($("#chkPhoto").attr("checked") == true) { page_index = 1; GetHouseData(communityID, '1', 'strPrice', page_index, page_size); } else { GetHouseData(communityID, '0', 'strPrice', page_index, page_size); } } if (strType == "2") { HouseType = "2"; $("#link_Price").removeClass("orderdown"); $("#link_SquareMeter").addClass("orderdown"); $("#link_PubDate").removeClass("orderdown"); ClearHouse(); if ($("#chkPhoto").attr("checked") == true) { GetHouseData(communityID, '1', 'strSquareMeter', page_index, page_size); } else { GetHouseData(communityID, '0', 'strSquareMeter', page_index, page_size); } } if (strType == "3") { HouseType = "3"; $("#link_Price").removeClass("orderdown"); $("#link_SquareMeter").removeClass("orderdown"); $("#link_PubDate").addClass("orderdown"); ClearHouse(); if ($("#chkPhoto").attr("checked") == true) { GetHouseData(communityID, '1', 'pudate', page_index, page_size); } else { GetHouseData(communityID, '0', 'pudate', page_index, page_size); } } } function ObtainCommunity() { var icon = new GIcon(); icon.image = "../../Content/Image/marker_trans.png"; icon.shadow = "../../Content/Image/marker_trans.png"; icon.iconSize = new GSize(21, 35); icon.shadowSize = new GSize(37, 35); icon.iconAnchor = new GPoint(10, 35); icon.infoWindowAnchor = new GPoint(10, 3); map.clearOverlays(); $.ajax( { url: "/Ajax/SerachMap/", datatype: "json", cache: false, data: { x1: x1, x2: x2, y1: y1, y2: y2, SearchTypeID: $("#hidSearchType").val(), ID: $("#hidID").val() }, type: "post", success: function (o) { var t = eval('(' + o + ')'); //强制转换一下json字符串,生成json对象 if (t.Code == "A00005") { $.each(t.Data, function (i, item) { var lblNumID = "lblNumberID" + i; var markerRight = "markerRight" + i; var strHtmlContent = "<div onmouseover=\"onmouseOver(this.id,'" + markerRight + "','" + lblNumID + "')\" onclick=\"ShowWindow(this.id)\" id=\"" + this.ID + "\" onmouseout=\"onmouseOut(this.id,'" + markerRight + "','" + lblNumID + "')\" class=\"maskleft\">" + item.RealName + "<label class=\"lblHidden\" id='" + lblNumID + "'> " + item.NickName + " </label><div id='" + markerRight + "' class=\"maskright\"/></div>"; var point = new GLatLng(item.LocationLat, item.LocationLng); var marker = CreateMarkers(point, icon, strHtmlContent); setTimeout(function () { map.addOverlay(marker); }, i * 100); }); } }, error: function (request) { } }); } function CloseContainer() { $("#HouseContainer").addClass("styleContainer"); } function ShowWindow(strCommunityID) { ClearHouse(); var clickType = $("#hidSearchType").val(); page_index = 1; $("#chkPhoto").attr("checked", false); communityID = strCommunityID; // GetHouseData(clickType,strCommunityID, page_index, page_size); GetHouseData(clickType, strCommunityID); var strElementID = "#" + strCommunityID; var X = $(strElementID).offset().top; var Y = $(strElementID).offset().left; $("#HouseContainer").removeClass("styleContainer"); $("#dvHouseWindPanel").css({ position: "absolute", display: "block", top: X / 2 + "px", left: Y / 2 + "px" }); } function GetHouseData(clickType, strCommunityID) { $.ajax( { url: "/Ajax/ObtainMapUserInfo", datatype: "json", cache: false, data: { "clickType": clickType, "UID": strCommunityID }, type: "post", success: function (data) { var t = eval('(' + data + ')'); console.log(t.Data.CurrUser.NickName); $("#userPhoto").attr("src", t.Data.CurrUser.MidAvartar); $("#UserName").html(t.Data.CurrUser.RealName + "(" + t.Data.CurrUser.NickName + ")"); $("#lblDesc").html(t.Data.CurrUser.Description); $("#aAddr").html(t.Data.CurrUser.provinceName + t.Data.CurrUser.cityName + t.Data.CurrUser.locationDetailsDesc); var url = "/" + t.Data.CurrUser.ID + "/"; $("#UserName").attr("href", url); $("#map2_propwind_listlink").attr("href", url); $("#olContent").html(""); var html = ""; $.each(t.Data.Top3MiniBlogs, function (i, item) { html += "<li style='background-color: white;' class=''> <a>" + (i + 1) + "." + item.OriginalContent + "&nbsp;</a> </li>"; $("#olContent").html(html); }); } }); } function IntMapEvent() { GEvent.addListener(map, 'movestart', function () { CloseContainer(); }); GEvent.addListener(map, 'moveend', function () { RefreshMap(); }); } function RefreshMap() { GetMapLngAndLat(); ObtainCommunity(); } function ClearHouse() { //$("#trOne").html(""); // $("#trTwo").html(""); } function CreateMarkers(point, ico, label) { return new LabeledMarker(point, { icon: ico, labelText: label }); } function CreateMarker(point, icon, label) { var marker = new LabeledMarker(point, { icon: icon, labelText: label, labelOffset: new GSize(-6, -10) }); GEvent.addListener(marker, 'click', function () { alert("经度为:" + point.lng() + "纬度为:" + point.lat()); }); return marker; } function onmouseOver(id, strRight, strLblID) { map.disableDragging(); var elementLeft = "#" + id; var elementRight = "#" + strRight; var elementLbl = "#" + strLblID; $(elementLeft).removeClass("maskleft"); $(elementLeft).addClass("left_hover"); $(elementLeft).parent().css({ zIndex: "10001" }); $(elementRight).removeClass("maskright"); $(elementRight).addClass("right_hover"); $(elementLbl).removeClass("lblHidden"); $(elementLbl).addClass("lblShow"); } function onmouseOut(id, strRight, strLblID) { map.enableDragging(); var elementLeft = "#" + id; var elementRight = "#" + strRight; var elementLbl = "#" + strLblID; $(elementLeft).removeClass("left_hover"); $(elementLeft).addClass("maskleft"); $(elementLeft).parent().css({ zIndex: "-999" }); $(elementRight).removeClass("right_hover"); $(elementRight).addClass("maskright"); $(elementLbl).removeClass("lblShow"); $(elementLbl).addClass("lblHidden"); } function IntNav() { totalPage = page_count / page_size; var rex = /^-?\d+$/; if (rex.test(totalPage) != true) { totalPage = Math.floor(page_count / page_size) + 1; } $("#recordinfo").text(page_index + "/" + totalPage); } function goPrevPage() { if (page_index != 1) { page_index = page_index - 1; GetWindowSource(); } } function goNextPage() { if (page_index < totalPage) { page_index = page_index + 1; GetWindowSource(); } } function GetWindowSource() { if (HouseType == "1") { ClearHouse(); if ($("#chkPhoto").attr("checked") == true) { GetHouseData(communityID, '1', 'strPrice', page_index, page_size); } else { GetHouseData(communityID, '0', 'strPrice', page_index, page_size); } } if (HouseType == "2") { ClearHouse(); if ($("#chkPhoto").attr("checked") == true) { GetHouseData(communityID, '1', 'strSquareMeter', page_index, page_size); } else { GetHouseData(communityID, '0', 'strSquareMeter', page_index, page_size); } } if (HouseType == "3") { ClearHouse(); if ($("#chkPhoto").attr("checked") == true) { GetHouseData(communityID, '1', 'pudate', page_index, page_size); } else { GetHouseData(communityID, '0', 'pudate', page_index, page_size); } } } function getMapAreaList() { //$("#dllAreaList").FillOptions("/Service/ObtainHouseSource.html?strGetArea=GetAreaList", { datatype: "json", textfield: "AreaName", valuefiled: "LngAndLat" }); // $("#dllPrice").FillOptions("/Service/ObtainHouseSource.html?strPrice=strPrice", { datatype: "json", textfield: "PriceTitle", valuefiled: "PriceRange" }); // $("#dllAcr").FillOptions("/Service/ObtainHouseSource.html?strAcr=strAcr", { datatype: "json", textfield: "AcrTitle", valuefiled: "AcrRange" }); // $("#dllRoom").FillOptions("/Service/ObtainHouseSource.html?strRoom=strRoom", { datatype: "json", textfield: "RoomTitle", valuefiled: "RoomNum" }); // $("#dllPrice").AddOption("价格不限", "-1", true, 0); // $("#dllAcr").AddOption("选择面积", "-1", true, 0); // $("#dllRoom").AddOption("选择房型", "-1", true, 0); // $("#dllAreaList").AddOption("选择区域", "-1", true, 0); // $("#dllBlockList").AddOption("选择板块", "-1", true, 0); } function getBlockList(strEval) { var strLng = strEval.substring(0, strEval.lastIndexOf(",")); var strLat = strEval.substring(strEval.lastIndexOf(",") + 1, strEval.lastIndexOf("|")); var strAreaID = strEval.substring(strEval.lastIndexOf("|") + 1); if (strLng == null || strLng == "") { return; } $("#dllBlockList").FillOptions("/Service/ObtainHouseSource.html?strAreaID=" + strAreaID, { datatype: "json", textfield: "BlockName", valuefiled: "LngAndLat" }); $("#dllBlockList").AddOption("选择板块", "-1", true, 0); var point = new GLatLng(strLat, strLng); map.panTo(point); } function setNewPoint(strEval) { var strLng = strEval.substring(0, strEval.lastIndexOf(",")); var strLat = strEval.substring(strEval.lastIndexOf(",") + 1); var point = new GLatLng(strLat, strLng); map.panTo(point); } function setPrice(strEval) { var strFrom = strEval.substring(0, strEval.lastIndexOf(",")); var strEnd = strEval.substring(strEval.lastIndexOf(",") + 1); priceFrom = strFrom; priceEnd = strEnd; ObtainCommunity(); } function SetRoomNum(strEval) { roomNum = strEval; ObtainCommunity(); } function SetAcr(strEval) { var strFrom = strEval.substring(0, strEval.lastIndexOf(",")); var strEnd = strEval.substring(strEval.lastIndexOf(",") + 1); acrFrom = strFrom; acrEnd = strEnd; ObtainCommunity(); } function SetPoint() { var strName = "" + $("#txtHouseText").val(); var geocoder; geocoder = new GClientGeocoder(); geocoder.getLocations(strName, findGlatLng); } function findGlatLng(response) { if (response || response.Status.code == 200) { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); map.panTo(point); map.addOverlay(new GMarker(point)); } }
JavaScript
var text; var value; var type; var selected; var keep; jQuery.fn.FillOptions = function(url,options){ if(url.length == 0) throw "request is required"; text = options.textfield || "text"; value = options.valuefiled || "value"; type = options.datatype.toLowerCase() || "json"; if(type != "xml")type="json"; keep = options.keepold?true:false; selected = options.selectedindex || 0; $.ajaxSetup({async:false}); var datas; if(type == "xml") { $.get(url,function(xml){datas=xml;}); } else { $.getJSON(url,function(json){datas=json;}); } if(datas == undefined) { alert("no datas"); return; } this.each(function(){ if(this.tagName == "SELECT") { var select = this; if(!keep)$(select).html(""); addOptions(select,datas); } }); } function addOptions(select,datas) { var options; var datas; if(type == "xml") { $(text,datas).each(function(i){ option = new Option($(this).text(),$($(value,datas)[i]).text()); if(i==selected)option.selected=true; select.options.add(option); }); } else { $.each(datas,function(i,n){ option = new Option(eval("n."+text),eval("n."+value)); if(i==selected)option.selected=true; select.options.add(option); }); } }
JavaScript
var $lang={ errAlertMsg: "Invalid date or the date out of range,redo or not?", aWeekStr: ["wk", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], aLongWeekStr:["wk","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"], aMonStr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], aLongMonStr: ["January","February","March","April","May","June","July","August","September","October","November","December"], clearStr: "Clear", todayStr: "Today", okStr: "OK", updateStr: "OK", timeStr: "Time", quickStr: "Quick Selection", err_1: 'MinDate Cannot be bigger than MaxDate!' }
JavaScript
var langList = [ {name:'en', charset:'UTF-8'}, {name:'zh-cn', charset:'gb2312'}, {name:'zh-tw', charset:'GBK'} ]; var skinList = [ {name:'default', charset:'gb2312'}, {name:'whyGreen', charset:'gb2312'} ];
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == */ (function() { // IE6 doens't handle absolute positioning properly (it is always in quirks // mode). This function fixes the sizes and positions of many elements that // compose the skin (this is skin specific). var fixSizes = window.DoResizeFixes = function() { var fckDlg = window.document.body ; for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ ) { var child = fckDlg.childNodes[i] ; switch ( child.className ) { case 'contents' : child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 ) ; // -left -right child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 ) ; // -bottom -top break ; case 'blocker' : case 'cover' : child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 + 4 ) ; // -left -right + 4 child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 + 4 ) ; // -bottom -top + 4 break ; case 'tr' : child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ; break ; case 'tc' : child.style.width = Math.max( 0, fckDlg.clientWidth - 16 - 16 ) ; break ; case 'ml' : child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ; break ; case 'mr' : child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ; child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ; break ; case 'bl' : child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ; break ; case 'br' : child.style.left = Math.max( 0, fckDlg.clientWidth - 30 ) ; child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ; break ; case 'bc' : child.style.width = Math.max( 0, fckDlg.clientWidth - 30 - 30 ) ; child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ; break ; } } } var closeButtonOver = function() { this.style.backgroundPosition = '-16px -687px' ; } ; var closeButtonOut = function() { this.style.backgroundPosition = '-16px -651px' ; } ; var fixCloseButton = function() { var closeButton = document.getElementById ( 'closeButton' ) ; closeButton.onmouseover = closeButtonOver ; closeButton.onmouseout = closeButtonOut ; } var onLoad = function() { fixSizes() ; fixCloseButton() ; window.attachEvent( 'onresize', fixSizes ) ; window.detachEvent( 'onload', onLoad ) ; } window.attachEvent( 'onload', onLoad ) ; })() ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == */ (function() { // IE6 doens't handle absolute positioning properly (it is always in quirks // mode). This function fixes the sizes and positions of many elements that // compose the skin (this is skin specific). var fixSizes = window.DoResizeFixes = function() { var fckDlg = window.document.body ; for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ ) { var child = fckDlg.childNodes[i] ; switch ( child.className ) { case 'contents' : child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 ) ; // -left -right child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 ) ; // -bottom -top break ; case 'blocker' : case 'cover' : child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 + 4 ) ; // -left -right + 4 child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 + 4 ) ; // -bottom -top + 4 break ; case 'tr' : child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ; break ; case 'tc' : child.style.width = Math.max( 0, fckDlg.clientWidth - 16 - 16 ) ; break ; case 'ml' : child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ; break ; case 'mr' : child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ; child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ; break ; case 'bl' : child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ; break ; case 'br' : child.style.left = Math.max( 0, fckDlg.clientWidth - 30 ) ; child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ; break ; case 'bc' : child.style.width = Math.max( 0, fckDlg.clientWidth - 30 - 30 ) ; child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ; break ; } } } var closeButtonOver = function() { this.style.backgroundPosition = '-16px -687px' ; } ; var closeButtonOut = function() { this.style.backgroundPosition = '-16px -651px' ; } ; var fixCloseButton = function() { var closeButton = document.getElementById ( 'closeButton' ) ; closeButton.onmouseover = closeButtonOver ; closeButton.onmouseout = closeButtonOut ; } var onLoad = function() { fixSizes() ; fixCloseButton() ; window.attachEvent( 'onresize', fixSizes ) ; window.detachEvent( 'onload', onLoad ) ; } window.attachEvent( 'onload', onLoad ) ; })() ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == */ (function() { // IE6 doens't handle absolute positioning properly (it is always in quirks // mode). This function fixes the sizes and positions of many elements that // compose the skin (this is skin specific). var fixSizes = window.DoResizeFixes = function() { var fckDlg = window.document.body ; for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ ) { var child = fckDlg.childNodes[i] ; switch ( child.className ) { case 'contents' : child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 ) ; // -left -right child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 ) ; // -bottom -top break ; case 'blocker' : case 'cover' : child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 + 4 ) ; // -left -right + 4 child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 + 4 ) ; // -bottom -top + 4 break ; case 'tr' : child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ; break ; case 'tc' : child.style.width = Math.max( 0, fckDlg.clientWidth - 16 - 16 ) ; break ; case 'ml' : child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ; break ; case 'mr' : child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ; child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ; break ; case 'bl' : child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ; break ; case 'br' : child.style.left = Math.max( 0, fckDlg.clientWidth - 30 ) ; child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ; break ; case 'bc' : child.style.width = Math.max( 0, fckDlg.clientWidth - 30 - 30 ) ; child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ; break ; } } } var closeButtonOver = function() { this.style.backgroundPosition = '-16px -687px' ; } ; var closeButtonOut = function() { this.style.backgroundPosition = '-16px -651px' ; } ; var fixCloseButton = function() { var closeButton = document.getElementById ( 'closeButton' ) ; closeButton.onmouseover = closeButtonOver ; closeButton.onmouseout = closeButtonOut ; } var onLoad = function() { fixSizes() ; fixCloseButton() ; window.attachEvent( 'onresize', fixSizes ) ; window.detachEvent( 'onload', onLoad ) ; } window.attachEvent( 'onload', onLoad ) ; })() ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Compatibility code for Adobe AIR. */ if ( FCKBrowserInfo.IsAIR ) { var FCKAdobeAIR = (function() { /* * ### Private functions. */ var getDocumentHead = function( doc ) { var head ; var heads = doc.getElementsByTagName( 'head' ) ; if( heads && heads[0] ) head = heads[0] ; else { head = doc.createElement( 'head' ) ; doc.documentElement.insertBefore( head, doc.documentElement.firstChild ) ; } return head ; } ; /* * ### Public interface. */ return { FCKeditorAPI_Evaluate : function( parentWindow, script ) { // TODO : This one doesn't work always. The parent window will // point to an anonymous function in this window. If this // window is destroyied the parent window will be pointing to // an invalid reference. // Evaluate the script in this window. eval( script ) ; // Point the FCKeditorAPI property of the parent window to the // local reference. parentWindow.FCKeditorAPI = window.FCKeditorAPI ; }, EditingArea_Start : function( doc, html ) { // Get the HTML for the <head>. var headInnerHtml = html.match( /<head>([\s\S]*)<\/head>/i )[1] ; if ( headInnerHtml && headInnerHtml.length > 0 ) { // Inject the <head> HTML inside a <div>. // Do that before getDocumentHead because WebKit moves // <link css> elements to the <head> at this point. var div = doc.createElement( 'div' ) ; div.innerHTML = headInnerHtml ; // Move the <div> nodes to <head>. FCKDomTools.MoveChildren( div, getDocumentHead( doc ) ) ; } doc.body.innerHTML = html.match( /<body>([\s\S]*)<\/body>/i )[1] ; //prevent clicking on hyperlinks and navigating away doc.addEventListener('click', function( ev ) { ev.preventDefault() ; ev.stopPropagation() ; }, true ) ; }, Panel_Contructor : function( doc, baseLocation ) { var head = getDocumentHead( doc ) ; // Set the <base> href. head.appendChild( doc.createElement('base') ).href = baseLocation ; doc.body.style.margin = '0px' ; doc.body.style.padding = '0px' ; }, ToolbarSet_GetOutElement : function( win, outMatch ) { var toolbarTarget = win.parent ; var targetWindowParts = outMatch[1].split( '.' ) ; while ( targetWindowParts.length > 0 ) { var part = targetWindowParts.shift() ; if ( part.length > 0 ) toolbarTarget = toolbarTarget[ part ] ; } toolbarTarget = toolbarTarget.document.getElementById( outMatch[2] ) ; }, ToolbarSet_InitOutFrame : function( doc ) { var head = getDocumentHead( doc ) ; head.appendChild( doc.createElement('base') ).href = window.document.location ; var targetWindow = doc.defaultView; targetWindow.adjust = function() { targetWindow.frameElement.height = doc.body.scrollHeight; } ; targetWindow.onresize = targetWindow.adjust ; targetWindow.setTimeout( targetWindow.adjust, 0 ) ; doc.body.style.overflow = 'hidden'; doc.body.innerHTML = document.getElementById( 'xToolbarSpace' ).innerHTML ; } } ; })(); /* * ### Overrides */ ( function() { // Save references for override reuse. var _Original_FCKPanel_Window_OnFocus = FCKPanel_Window_OnFocus ; var _Original_FCKPanel_Window_OnBlur = FCKPanel_Window_OnBlur ; var _Original_FCK_StartEditor = FCK.StartEditor ; FCKPanel_Window_OnFocus = function( e, panel ) { // Call the original implementation. _Original_FCKPanel_Window_OnFocus.call( this, e, panel ) ; if ( panel._focusTimer ) clearTimeout( panel._focusTimer ) ; } FCKPanel_Window_OnBlur = function( e, panel ) { // Delay the execution of the original function. panel._focusTimer = FCKTools.SetTimeout( _Original_FCKPanel_Window_OnBlur, 100, this, [ e, panel ] ) ; } FCK.StartEditor = function() { // Force pointing to the CSS files instead of using the inline CSS cached styles. window.FCK_InternalCSS = FCKConfig.FullBasePath + 'css/fck_internal.css' ; window.FCK_ShowTableBordersCSS = FCKConfig.FullBasePath + 'css/fck_showtableborders_gecko.css' ; _Original_FCK_StartEditor.apply( this, arguments ) ; } })(); }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Contains the DTD mapping for XHTML 1.0 Strict. * This file was automatically generated from the file: xhtml10-strict.dtd */ FCK.DTD = (function() { var X = FCKTools.Merge ; var H,I,J,K,C,L,M,A,B,D,E,G,N,F ; A = {ins:1, del:1, script:1} ; B = {hr:1, ul:1, div:1, blockquote:1, noscript:1, table:1, address:1, pre:1, p:1, h5:1, dl:1, h4:1, ol:1, h6:1, h1:1, h3:1, h2:1} ; C = X({fieldset:1}, B) ; D = X({sub:1, bdo:1, 'var':1, sup:1, br:1, kbd:1, map:1, samp:1, b:1, acronym:1, '#':1, abbr:1, code:1, i:1, cite:1, tt:1, strong:1, q:1, em:1, big:1, small:1, span:1, dfn:1}, A) ; E = X({img:1, object:1}, D) ; F = {input:1, button:1, textarea:1, select:1, label:1} ; G = X({a:1}, F) ; H = {img:1, noscript:1, br:1, kbd:1, button:1, h5:1, h4:1, samp:1, h6:1, ol:1, h1:1, h3:1, h2:1, form:1, select:1, '#':1, ins:1, abbr:1, label:1, code:1, table:1, script:1, cite:1, input:1, strong:1, textarea:1, big:1, small:1, span:1, hr:1, sub:1, bdo:1, 'var':1, div:1, object:1, sup:1, map:1, dl:1, del:1, fieldset:1, ul:1, b:1, acronym:1, a:1, blockquote:1, i:1, address:1, tt:1, q:1, pre:1, p:1, em:1, dfn:1} ; I = X({form:1, fieldset:1}, B, E, G) ; J = {tr:1} ; K = {'#':1} ; L = X(E, G) ; M = {li:1} ; N = X({form:1}, A, C) ; return { col: {}, tr: {td:1, th:1}, img: {}, colgroup: {col:1}, noscript: N, td: I, br: {}, th: I, kbd: L, button: X(B, E), h5: L, h4: L, samp: L, h6: L, ol: M, h1: L, h3: L, option: K, h2: L, form: X(A, C), select: {optgroup:1, option:1}, ins: I, abbr: L, label: L, code: L, table: {thead:1, col:1, tbody:1, tr:1, colgroup:1, caption:1, tfoot:1}, script: K, tfoot: J, cite: L, li: I, input: {}, strong: L, textarea: K, big: L, small: L, span: L, dt: L, hr: {}, sub: L, optgroup: {option:1}, bdo: L, param: {}, 'var': L, div: I, object: X({param:1}, H), sup: L, dd: I, area: {}, map: X({form:1, area:1}, A, C), dl: {dt:1, dd:1}, del: I, fieldset: X({legend:1}, H), thead: J, ul: M, acronym: L, b: L, a: X({img:1, object:1}, D, F), blockquote: N, caption: L, i: L, tbody: J, address: L, tt: L, legend: L, q: L, pre: X({a:1}, D, F), p: L, em: L, dfn: L } ; })() ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Contains the DTD mapping for XHTML 1.0 Transitional. * This file was automatically generated from the file: xhtml10-transitional.dtd */ FCK.DTD = (function() { var X = FCKTools.Merge ; var A,L,J,M,N,O,D,H,P,K,Q,F,G,C,B,E,I ; A = {isindex:1, fieldset:1} ; B = {input:1, button:1, select:1, textarea:1, label:1} ; C = X({a:1}, B) ; D = X({iframe:1}, C) ; E = {hr:1, ul:1, menu:1, div:1, blockquote:1, noscript:1, table:1, center:1, address:1, dir:1, pre:1, h5:1, dl:1, h4:1, noframes:1, h6:1, ol:1, h1:1, h3:1, h2:1} ; F = {ins:1, del:1, script:1} ; G = X({b:1, acronym:1, bdo:1, 'var':1, '#':1, abbr:1, code:1, br:1, i:1, cite:1, kbd:1, u:1, strike:1, s:1, tt:1, strong:1, q:1, samp:1, em:1, dfn:1, span:1}, F) ; H = X({sub:1, img:1, object:1, sup:1, basefont:1, map:1, applet:1, font:1, big:1, small:1}, G) ; I = X({p:1}, H) ; J = X({iframe:1}, H, B) ; K = {img:1, noscript:1, br:1, kbd:1, center:1, button:1, basefont:1, h5:1, h4:1, samp:1, h6:1, ol:1, h1:1, h3:1, h2:1, form:1, font:1, '#':1, select:1, menu:1, ins:1, abbr:1, label:1, code:1, table:1, script:1, cite:1, input:1, iframe:1, strong:1, textarea:1, noframes:1, big:1, small:1, span:1, hr:1, sub:1, bdo:1, 'var':1, div:1, object:1, sup:1, strike:1, dir:1, map:1, dl:1, applet:1, del:1, isindex:1, fieldset:1, ul:1, b:1, acronym:1, a:1, blockquote:1, i:1, u:1, s:1, tt:1, address:1, q:1, pre:1, p:1, em:1, dfn:1} ; L = X({a:1}, J) ; M = {tr:1} ; N = {'#':1} ; O = X({param:1}, K) ; P = X({form:1}, A, D, E, I) ; Q = {li:1} ; return { col: {}, tr: {td:1, th:1}, img: {}, colgroup: {col:1}, noscript: P, td: P, br: {}, th: P, center: P, kbd: L, button: X(I, E), basefont: {}, h5: L, h4: L, samp: L, h6: L, ol: Q, h1: L, h3: L, option: N, h2: L, form: X(A, D, E, I), select: {optgroup:1, option:1}, font: J, // Changed from L to J (see (1)) ins: P, menu: Q, abbr: L, label: L, table: {thead:1, col:1, tbody:1, tr:1, colgroup:1, caption:1, tfoot:1}, code: L, script: N, tfoot: M, cite: L, li: P, input: {}, iframe: P, strong: J, // Changed from L to J (see (1)) textarea: N, noframes: P, big: J, // Changed from L to J (see (1)) small: J, // Changed from L to J (see (1)) span: J, // Changed from L to J (see (1)) hr: {}, dt: L, sub: J, // Changed from L to J (see (1)) optgroup: {option:1}, param: {}, bdo: L, 'var': J, // Changed from L to J (see (1)) div: P, object: O, sup: J, // Changed from L to J (see (1)) dd: P, strike: J, // Changed from L to J (see (1)) area: {}, dir: Q, map: X({area:1, form:1, p:1}, A, F, E), applet: O, dl: {dt:1, dd:1}, del: P, isindex: {}, fieldset: X({legend:1}, K), thead: M, ul: Q, acronym: L, b: J, // Changed from L to J (see (1)) a: J, blockquote: P, caption: L, i: J, // Changed from L to J (see (1)) u: J, // Changed from L to J (see (1)) tbody: M, s: L, address: X(D, I), tt: J, // Changed from L to J (see (1)) legend: L, q: L, pre: X(G, C), p: L, em: J, // Changed from L to J (see (1)) dfn: L } ; })() ; /* Notes: (1) According to the DTD, many elements, like <b> accept <a> elements inside of them. But, to produce better output results, we have manually changed the map to avoid breaking the links on pieces, having "<b>this is a </b><a><b>link</b> test</a>", instead of "<b>this is a <a>link</a></b><a> test</a>". */
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Chinese Simplified language file. */ var FCKLang = { // Language direction : "ltr" (left to right) or "rtl" (right to left). Dir : "ltr", ToolbarCollapse : "折叠工具栏", ToolbarExpand : "展开工具栏", // Toolbar Items and Context Menu Save : "保存", NewPage : "新建", Preview : "预览", Cut : "剪切", Copy : "复制", Paste : "粘贴", PasteText : "粘贴为无格式文本", PasteWord : "从 MS Word 粘贴", Print : "打印", SelectAll : "全选", RemoveFormat : "清除格式", InsertLinkLbl : "超链接", InsertLink : "插入/编辑超链接", RemoveLink : "取消超链接", Anchor : "插入/编辑锚点链接", AnchorDelete : "清除锚点链接", InsertImageLbl : "图象", InsertImage : "插入/编辑图象", InsertFlashLbl : "Flash", InsertFlash : "插入/编辑 Flash", InsertTableLbl : "表格", InsertTable : "插入/编辑表格", InsertLineLbl : "水平线", InsertLine : "插入水平线", InsertSpecialCharLbl: "特殊符号", InsertSpecialChar : "插入特殊符号", InsertSmileyLbl : "表情符", InsertSmiley : "插入表情图标", About : "关于 FCKeditor", Bold : "加粗", Italic : "倾斜", Underline : "下划线", StrikeThrough : "删除线", Subscript : "下标", Superscript : "上标", LeftJustify : "左对齐", CenterJustify : "居中对齐", RightJustify : "右对齐", BlockJustify : "两端对齐", DecreaseIndent : "减少缩进量", IncreaseIndent : "增加缩进量", Blockquote : "引用文字", Undo : "撤消", Redo : "重做", NumberedListLbl : "编号列表", NumberedList : "插入/删除编号列表", BulletedListLbl : "项目列表", BulletedList : "插入/删除项目列表", ShowTableBorders : "显示表格边框", ShowDetails : "显示详细资料", Style : "样式", FontFormat : "格式", Font : "字体", FontSize : "大小", TextColor : "文本颜色", BGColor : "背景颜色", Source : "源代码", Find : "查找", Replace : "替换", SpellCheck : "拼写检查", UniversalKeyboard : "软键盘", PageBreakLbl : "分页符", PageBreak : "插入分页符", Form : "表单", Checkbox : "复选框", RadioButton : "单选按钮", TextField : "单行文本", Textarea : "多行文本", HiddenField : "隐藏域", Button : "按钮", SelectionField : "列表/菜单", ImageButton : "图像域", FitWindow : "全屏编辑", ShowBlocks : "显示区块", // Context Menu EditLink : "编辑超链接", CellCM : "单元格", RowCM : "行", ColumnCM : "列", InsertRowAfter : "下插入行", InsertRowBefore : "上插入行", DeleteRows : "删除行", InsertColumnAfter : "右插入列", InsertColumnBefore : "左插入列", DeleteColumns : "删除列", InsertCellAfter : "右插入单元格", InsertCellBefore : "左插入单元格", DeleteCells : "删除单元格", MergeCells : "合并单元格", MergeRight : "右合并单元格", MergeDown : "下合并单元格", HorizontalSplitCell : "橫拆分单元格", VerticalSplitCell : "縱拆分单元格", TableDelete : "删除表格", CellProperties : "单元格属性", TableProperties : "表格属性", ImageProperties : "图象属性", FlashProperties : "Flash 属性", AnchorProp : "锚点链接属性", ButtonProp : "按钮属性", CheckboxProp : "复选框属性", HiddenFieldProp : "隐藏域属性", RadioButtonProp : "单选按钮属性", ImageButtonProp : "图像域属性", TextFieldProp : "单行文本属性", SelectionFieldProp : "菜单/列表属性", TextareaProp : "多行文本属性", FormProp : "表单属性", FontFormats : "普通;已编排格式;地址;标题 1;标题 2;标题 3;标题 4;标题 5;标题 6;段落(DIV)", // Alerts and Messages ProcessingXHTML : "正在处理 XHTML,请稍等...", Done : "完成", PasteWordConfirm : "您要粘贴的内容好像是来自 MS Word,是否要清除 MS Word 格式后再粘贴?", NotCompatiblePaste : "该命令需要 Internet Explorer 5.5 或更高版本的支持,是否按常规粘贴进行?", UnknownToolbarItem : "未知工具栏项目 \"%1\"", UnknownCommand : "未知命令名称 \"%1\"", NotImplemented : "命令无法执行", UnknownToolbarSet : "工具栏设置 \"%1\" 不存在", NoActiveX : "浏览器安全设置限制了本编辑器的某些功能。您必须启用安全设置中的“运行 ActiveX 控件和插件”,否则将出现某些错误并缺少功能。", BrowseServerBlocked : "无法打开资源浏览器,请确认是否启用了禁止弹出窗口。", DialogBlocked : "无法打开对话框窗口,请确认是否启用了禁止弹出窗口或网页对话框(IE)。", // Dialogs DlgBtnOK : "确定", DlgBtnCancel : "取消", DlgBtnClose : "关闭", DlgBtnBrowseServer : "浏览服务器", DlgAdvancedTag : "高级", DlgOpOther : "<其它>", DlgInfoTab : "信息", DlgAlertUrl : "请插入 URL", // General Dialogs Labels DlgGenNotSet : "<没有设置>", DlgGenId : "ID", DlgGenLangDir : "语言方向", DlgGenLangDirLtr : "从左到右 (LTR)", DlgGenLangDirRtl : "从右到左 (RTL)", DlgGenLangCode : "语言代码", DlgGenAccessKey : "访问键", DlgGenName : "名称", DlgGenTabIndex : "Tab 键次序", DlgGenLongDescr : "详细说明地址", DlgGenClass : "样式类名称", DlgGenTitle : "标题", DlgGenContType : "内容类型", DlgGenLinkCharset : "字符编码", DlgGenStyle : "行内样式", // Image Dialog DlgImgTitle : "图象属性", DlgImgInfoTab : "图象", DlgImgBtnUpload : "发送到服务器上", DlgImgURL : "源文件", DlgImgUpload : "上传", DlgImgAlt : "替换文本", DlgImgWidth : "宽度", DlgImgHeight : "高度", DlgImgLockRatio : "锁定比例", DlgBtnResetSize : "恢复尺寸", DlgImgBorder : "边框大小", DlgImgHSpace : "水平间距", DlgImgVSpace : "垂直间距", DlgImgAlign : "对齐方式", DlgImgAlignLeft : "左对齐", DlgImgAlignAbsBottom: "绝对底边", DlgImgAlignAbsMiddle: "绝对居中", DlgImgAlignBaseline : "基线", DlgImgAlignBottom : "底边", DlgImgAlignMiddle : "居中", DlgImgAlignRight : "右对齐", DlgImgAlignTextTop : "文本上方", DlgImgAlignTop : "顶端", DlgImgPreview : "预览", DlgImgAlertUrl : "请输入图象地址", DlgImgLinkTab : "链接", // Flash Dialog DlgFlashTitle : "Flash 属性", DlgFlashChkPlay : "自动播放", DlgFlashChkLoop : "循环", DlgFlashChkMenu : "启用 Flash 菜单", DlgFlashScale : "缩放", DlgFlashScaleAll : "全部显示", DlgFlashScaleNoBorder : "无边框", DlgFlashScaleFit : "严格匹配", // Link Dialog DlgLnkWindowTitle : "超链接", DlgLnkInfoTab : "超链接信息", DlgLnkTargetTab : "目标", DlgLnkType : "超链接类型", DlgLnkTypeURL : "超链接", DlgLnkTypeAnchor : "页内锚点链接", DlgLnkTypeEMail : "电子邮件", DlgLnkProto : "协议", DlgLnkProtoOther : "<其它>", DlgLnkURL : "地址", DlgLnkAnchorSel : "选择一个锚点", DlgLnkAnchorByName : "按锚点名称", DlgLnkAnchorById : "按锚点 ID", DlgLnkNoAnchors : "(此文档没有可用的锚点)", DlgLnkEMail : "地址", DlgLnkEMailSubject : "主题", DlgLnkEMailBody : "内容", DlgLnkUpload : "上传", DlgLnkBtnUpload : "发送到服务器上", DlgLnkTarget : "目标", DlgLnkTargetFrame : "<框架>", DlgLnkTargetPopup : "<弹出窗口>", DlgLnkTargetBlank : "新窗口 (_blank)", DlgLnkTargetParent : "父窗口 (_parent)", DlgLnkTargetSelf : "本窗口 (_self)", DlgLnkTargetTop : "整页 (_top)", DlgLnkTargetFrameName : "目标框架名称", DlgLnkPopWinName : "弹出窗口名称", DlgLnkPopWinFeat : "弹出窗口属性", DlgLnkPopResize : "调整大小", DlgLnkPopLocation : "地址栏", DlgLnkPopMenu : "菜单栏", DlgLnkPopScroll : "滚动条", DlgLnkPopStatus : "状态栏", DlgLnkPopToolbar : "工具栏", DlgLnkPopFullScrn : "全屏 (IE)", DlgLnkPopDependent : "依附 (NS)", DlgLnkPopWidth : "宽", DlgLnkPopHeight : "高", DlgLnkPopLeft : "左", DlgLnkPopTop : "右", DlnLnkMsgNoUrl : "请输入超链接地址", DlnLnkMsgNoEMail : "请输入电子邮件地址", DlnLnkMsgNoAnchor : "请选择一个锚点", DlnLnkMsgInvPopName : "弹出窗口名称必须以字母开头,并且不能含有空格。", // Color Dialog DlgColorTitle : "选择颜色", DlgColorBtnClear : "清除", DlgColorHighlight : "预览", DlgColorSelected : "选择", // Smiley Dialog DlgSmileyTitle : "插入表情图标", // Special Character Dialog DlgSpecialCharTitle : "选择特殊符号", // Table Dialog DlgTableTitle : "表格属性", DlgTableRows : "行数", DlgTableColumns : "列数", DlgTableBorder : "边框", DlgTableAlign : "对齐", DlgTableAlignNotSet : "<没有设置>", DlgTableAlignLeft : "左对齐", DlgTableAlignCenter : "居中", DlgTableAlignRight : "右对齐", DlgTableWidth : "宽度", DlgTableWidthPx : "像素", DlgTableWidthPc : "百分比", DlgTableHeight : "高度", DlgTableCellSpace : "间距", DlgTableCellPad : "边距", DlgTableCaption : "标题", DlgTableSummary : "摘要", // Table Cell Dialog DlgCellTitle : "单元格属性", DlgCellWidth : "宽度", DlgCellWidthPx : "像素", DlgCellWidthPc : "百分比", DlgCellHeight : "高度", DlgCellWordWrap : "自动换行", DlgCellWordWrapNotSet : "<没有设置>", DlgCellWordWrapYes : "是", DlgCellWordWrapNo : "否", DlgCellHorAlign : "水平对齐", DlgCellHorAlignNotSet : "<没有设置>", DlgCellHorAlignLeft : "左对齐", DlgCellHorAlignCenter : "居中", DlgCellHorAlignRight: "右对齐", DlgCellVerAlign : "垂直对齐", DlgCellVerAlignNotSet : "<没有设置>", DlgCellVerAlignTop : "顶端", DlgCellVerAlignMiddle : "居中", DlgCellVerAlignBottom : "底部", DlgCellVerAlignBaseline : "基线", DlgCellRowSpan : "纵跨行数", DlgCellCollSpan : "横跨列数", DlgCellBackColor : "背景颜色", DlgCellBorderColor : "边框颜色", DlgCellBtnSelect : "选择...", // Find and Replace Dialog DlgFindAndReplaceTitle : "查找和替换", // Find Dialog DlgFindTitle : "查找", DlgFindFindBtn : "查找", DlgFindNotFoundMsg : "指定文本没有找到。", // Replace Dialog DlgReplaceTitle : "替换", DlgReplaceFindLbl : "查找:", DlgReplaceReplaceLbl : "替换:", DlgReplaceCaseChk : "区分大小写", DlgReplaceReplaceBtn : "替换", DlgReplaceReplAllBtn : "全部替换", DlgReplaceWordChk : "全字匹配", // Paste Operations / Dialog PasteErrorCut : "您的浏览器安全设置不允许编辑器自动执行剪切操作,请使用键盘快捷键(Ctrl+X)来完成。", PasteErrorCopy : "您的浏览器安全设置不允许编辑器自动执行复制操作,请使用键盘快捷键(Ctrl+C)来完成。", PasteAsText : "粘贴为无格式文本", PasteFromWord : "从 MS Word 粘贴", DlgPasteMsg2 : "请使用键盘快捷键(<STRONG>Ctrl+V</STRONG>)把内容粘贴到下面的方框里,再按 <STRONG>确定</STRONG>。", DlgPasteSec : "因为你的浏览器的安全设置原因,本编辑器不能直接访问你的剪贴板内容,你需要在本窗口重新粘贴一次。", DlgPasteIgnoreFont : "忽略 Font 标签", DlgPasteRemoveStyles : "清理 CSS 样式", // Color Picker ColorAutomatic : "自动", ColorMoreColors : "其它颜色...", // Document Properties DocProps : "页面属性", // Anchor Dialog DlgAnchorTitle : "命名锚点", DlgAnchorName : "锚点名称", DlgAnchorErrorName : "请输入锚点名称", // Speller Pages Dialog DlgSpellNotInDic : "没有在字典里", DlgSpellChangeTo : "更改为", DlgSpellBtnIgnore : "忽略", DlgSpellBtnIgnoreAll : "全部忽略", DlgSpellBtnReplace : "替换", DlgSpellBtnReplaceAll : "全部替换", DlgSpellBtnUndo : "撤消", DlgSpellNoSuggestions : "- 没有建议 -", DlgSpellProgress : "正在进行拼写检查...", DlgSpellNoMispell : "拼写检查完成:没有发现拼写错误", DlgSpellNoChanges : "拼写检查完成:没有更改任何单词", DlgSpellOneChange : "拼写检查完成:更改了一个单词", DlgSpellManyChanges : "拼写检查完成:更改了 %1 个单词", IeSpellDownload : "拼写检查插件还没安装,你是否想现在就下载?", // Button Dialog DlgButtonText : "标签(值)", DlgButtonType : "类型", DlgButtonTypeBtn : "按钮", DlgButtonTypeSbm : "提交", DlgButtonTypeRst : "重设", // Checkbox and Radio Button Dialogs DlgCheckboxName : "名称", DlgCheckboxValue : "选定值", DlgCheckboxSelected : "已勾选", // Form Dialog DlgFormName : "名称", DlgFormAction : "动作", DlgFormMethod : "方法", // Select Field Dialog DlgSelectName : "名称", DlgSelectValue : "选定", DlgSelectSize : "高度", DlgSelectLines : "行", DlgSelectChkMulti : "允许多选", DlgSelectOpAvail : "列表值", DlgSelectOpText : "标签", DlgSelectOpValue : "值", DlgSelectBtnAdd : "新增", DlgSelectBtnModify : "修改", DlgSelectBtnUp : "上移", DlgSelectBtnDown : "下移", DlgSelectBtnSetValue : "设为初始化时选定", DlgSelectBtnDelete : "删除", // Textarea Dialog DlgTextareaName : "名称", DlgTextareaCols : "字符宽度", DlgTextareaRows : "行数", // Text Field Dialog DlgTextName : "名称", DlgTextValue : "初始值", DlgTextCharWidth : "字符宽度", DlgTextMaxChars : "最多字符数", DlgTextType : "类型", DlgTextTypeText : "文本", DlgTextTypePass : "密码", // Hidden Field Dialog DlgHiddenName : "名称", DlgHiddenValue : "初始值", // Bulleted List Dialog BulletedListProp : "项目列表属性", NumberedListProp : "编号列表属性", DlgLstStart : "开始序号", DlgLstType : "列表类型", DlgLstTypeCircle : "圆圈", DlgLstTypeDisc : "圆点", DlgLstTypeSquare : "方块", DlgLstTypeNumbers : "数字 (1, 2, 3)", DlgLstTypeLCase : "小写字母 (a, b, c)", DlgLstTypeUCase : "大写字母 (A, B, C)", DlgLstTypeSRoman : "小写罗马数字 (i, ii, iii)", DlgLstTypeLRoman : "大写罗马数字 (I, II, III)", // Document Properties Dialog DlgDocGeneralTab : "常规", DlgDocBackTab : "背景", DlgDocColorsTab : "颜色和边距", DlgDocMetaTab : "Meta 数据", DlgDocPageTitle : "页面标题", DlgDocLangDir : "语言方向", DlgDocLangDirLTR : "从左到右 (LTR)", DlgDocLangDirRTL : "从右到左 (RTL)", DlgDocLangCode : "语言代码", DlgDocCharSet : "字符编码", DlgDocCharSetCE : "中欧", DlgDocCharSetCT : "繁体中文 (Big5)", DlgDocCharSetCR : "西里尔文", DlgDocCharSetGR : "希腊文", DlgDocCharSetJP : "日文", DlgDocCharSetKR : "韩文", DlgDocCharSetTR : "土耳其文", DlgDocCharSetUN : "Unicode (UTF-8)", DlgDocCharSetWE : "西欧", DlgDocCharSetOther : "其它字符编码", DlgDocDocType : "文档类型", DlgDocDocTypeOther : "其它文档类型", DlgDocIncXHTML : "包含 XHTML 声明", DlgDocBgColor : "背景颜色", DlgDocBgImage : "背景图像", DlgDocBgNoScroll : "不滚动背景图像", DlgDocCText : "文本", DlgDocCLink : "超链接", DlgDocCVisited : "已访问的超链接", DlgDocCActive : "活动超链接", DlgDocMargins : "页面边距", DlgDocMaTop : "上", DlgDocMaLeft : "左", DlgDocMaRight : "右", DlgDocMaBottom : "下", DlgDocMeIndex : "页面索引关键字 (用半角逗号[,]分隔)", DlgDocMeDescr : "页面说明", DlgDocMeAuthor : "作者", DlgDocMeCopy : "版权", DlgDocPreview : "预览", // Templates Dialog Templates : "模板", DlgTemplatesTitle : "内容模板", DlgTemplatesSelMsg : "请选择编辑器内容模板<br>(当前内容将会被清除替换):", DlgTemplatesLoading : "正在加载模板列表,请稍等...", DlgTemplatesNoTpl : "(没有模板)", DlgTemplatesReplace : "替换当前内容", // About Dialog DlgAboutAboutTab : "关于", DlgAboutBrowserInfoTab : "浏览器信息", DlgAboutLicenseTab : "许可证", DlgAboutVersion : "版本", DlgAboutInfo : "要获得更多信息请访问 " };
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Chinese Traditional language file. */ var FCKLang = { // Language direction : "ltr" (left to right) or "rtl" (right to left). Dir : "ltr", ToolbarCollapse : "隱藏面板", ToolbarExpand : "顯示面板", // Toolbar Items and Context Menu Save : "儲存", NewPage : "開新檔案", Preview : "預覽", Cut : "剪下", Copy : "複製", Paste : "貼上", PasteText : "貼為純文字格式", PasteWord : "自 Word 貼上", Print : "列印", SelectAll : "全選", RemoveFormat : "清除格式", InsertLinkLbl : "超連結", InsertLink : "插入/編輯超連結", RemoveLink : "移除超連結", Anchor : "插入/編輯錨點", AnchorDelete : "移除錨點", InsertImageLbl : "影像", InsertImage : "插入/編輯影像", InsertFlashLbl : "Flash", InsertFlash : "插入/編輯 Flash", InsertTableLbl : "表格", InsertTable : "插入/編輯表格", InsertLineLbl : "水平線", InsertLine : "插入水平線", InsertSpecialCharLbl: "特殊符號", InsertSpecialChar : "插入特殊符號", InsertSmileyLbl : "表情符號", InsertSmiley : "插入表情符號", About : "關於 FCKeditor", Bold : "粗體", Italic : "斜體", Underline : "底線", StrikeThrough : "刪除線", Subscript : "下標", Superscript : "上標", LeftJustify : "靠左對齊", CenterJustify : "置中", RightJustify : "靠右對齊", BlockJustify : "左右對齊", DecreaseIndent : "減少縮排", IncreaseIndent : "增加縮排", Blockquote : "块引用", Undo : "復原", Redo : "重複", NumberedListLbl : "編號清單", NumberedList : "插入/移除編號清單", BulletedListLbl : "項目清單", BulletedList : "插入/移除項目清單", ShowTableBorders : "顯示表格邊框", ShowDetails : "顯示詳細資料", Style : "樣式", FontFormat : "格式", Font : "字體", FontSize : "大小", TextColor : "文字顏色", BGColor : "背景顏色", Source : "原始碼", Find : "尋找", Replace : "取代", SpellCheck : "拼字檢查", UniversalKeyboard : "萬國鍵盤", PageBreakLbl : "分頁符號", PageBreak : "插入分頁符號", Form : "表單", Checkbox : "核取方塊", RadioButton : "選項按鈕", TextField : "文字方塊", Textarea : "文字區域", HiddenField : "隱藏欄位", Button : "按鈕", SelectionField : "清單/選單", ImageButton : "影像按鈕", FitWindow : "編輯器最大化", ShowBlocks : "顯示區塊", // Context Menu EditLink : "編輯超連結", CellCM : "儲存格", RowCM : "列", ColumnCM : "欄", InsertRowAfter : "向下插入列", InsertRowBefore : "向上插入列", DeleteRows : "刪除列", InsertColumnAfter : "向右插入欄", InsertColumnBefore : "向左插入欄", DeleteColumns : "刪除欄", InsertCellAfter : "向右插入儲存格", InsertCellBefore : "向左插入儲存格", DeleteCells : "刪除儲存格", MergeCells : "合併儲存格", MergeRight : "向右合併儲存格", MergeDown : "向下合併儲存格", HorizontalSplitCell : "橫向分割儲存格", VerticalSplitCell : "縱向分割儲存格", TableDelete : "刪除表格", CellProperties : "儲存格屬性", TableProperties : "表格屬性", ImageProperties : "影像屬性", FlashProperties : "Flash 屬性", AnchorProp : "錨點屬性", ButtonProp : "按鈕屬性", CheckboxProp : "核取方塊屬性", HiddenFieldProp : "隱藏欄位屬性", RadioButtonProp : "選項按鈕屬性", ImageButtonProp : "影像按鈕屬性", TextFieldProp : "文字方塊屬性", SelectionFieldProp : "清單/選單屬性", TextareaProp : "文字區域屬性", FormProp : "表單屬性", FontFormats : "一般;已格式化;位址;標題 1;標題 2;標題 3;標題 4;標題 5;標題 6;一般 (DIV)", // Alerts and Messages ProcessingXHTML : "處理 XHTML 中,請稍候…", Done : "完成", PasteWordConfirm : "您想貼上的文字似乎是自 Word 複製而來,請問您是否要先清除 Word 的格式後再行貼上?", NotCompatiblePaste : "此指令僅在 Internet Explorer 5.5 或以上的版本有效。請問您是否同意不清除格式即貼上?", UnknownToolbarItem : "未知工具列項目 \"%1\"", UnknownCommand : "未知指令名稱 \"%1\"", NotImplemented : "尚未安裝此指令", UnknownToolbarSet : "工具列設定 \"%1\" 不存在", NoActiveX : "瀏覽器的安全性設定限制了本編輯器的某些功能。您必須啟用安全性設定中的「執行ActiveX控制項與外掛程式」項目,否則本編輯器將會出現錯誤並缺少某些功能", BrowseServerBlocked : "無法開啟資源瀏覽器,請確定所有快顯視窗封鎖程式是否關閉", DialogBlocked : "無法開啟對話視窗,請確定所有快顯視窗封鎖程式是否關閉", // Dialogs DlgBtnOK : "確定", DlgBtnCancel : "取消", DlgBtnClose : "關閉", DlgBtnBrowseServer : "瀏覽伺服器端", DlgAdvancedTag : "進階", DlgOpOther : "<其他>", DlgInfoTab : "資訊", DlgAlertUrl : "請插入 URL", // General Dialogs Labels DlgGenNotSet : "<尚未設定>", DlgGenId : "ID", DlgGenLangDir : "語言方向", DlgGenLangDirLtr : "由左而右 (LTR)", DlgGenLangDirRtl : "由右而左 (RTL)", DlgGenLangCode : "語言代碼", DlgGenAccessKey : "存取鍵", DlgGenName : "名稱", DlgGenTabIndex : "定位順序", DlgGenLongDescr : "詳細 URL", DlgGenClass : "樣式表類別", DlgGenTitle : "標題", DlgGenContType : "內容類型", DlgGenLinkCharset : "連結資源之編碼", DlgGenStyle : "樣式", // Image Dialog DlgImgTitle : "影像屬性", DlgImgInfoTab : "影像資訊", DlgImgBtnUpload : "上傳至伺服器", DlgImgURL : "URL", DlgImgUpload : "上傳", DlgImgAlt : "替代文字", DlgImgWidth : "寬度", DlgImgHeight : "高度", DlgImgLockRatio : "等比例", DlgBtnResetSize : "重設為原大小", DlgImgBorder : "邊框", DlgImgHSpace : "水平距離", DlgImgVSpace : "垂直距離", DlgImgAlign : "對齊", DlgImgAlignLeft : "靠左對齊", DlgImgAlignAbsBottom: "絕對下方", DlgImgAlignAbsMiddle: "絕對中間", DlgImgAlignBaseline : "基準線", DlgImgAlignBottom : "靠下對齊", DlgImgAlignMiddle : "置中對齊", DlgImgAlignRight : "靠右對齊", DlgImgAlignTextTop : "文字上方", DlgImgAlignTop : "靠上對齊", DlgImgPreview : "預覽", DlgImgAlertUrl : "請輸入影像 URL", DlgImgLinkTab : "超連結", // Flash Dialog DlgFlashTitle : "Flash 屬性", DlgFlashChkPlay : "自動播放", DlgFlashChkLoop : "重複", DlgFlashChkMenu : "開啟選單", DlgFlashScale : "縮放", DlgFlashScaleAll : "全部顯示", DlgFlashScaleNoBorder : "無邊框", DlgFlashScaleFit : "精確符合", // Link Dialog DlgLnkWindowTitle : "超連結", DlgLnkInfoTab : "超連結資訊", DlgLnkTargetTab : "目標", DlgLnkType : "超連接類型", DlgLnkTypeURL : "URL", DlgLnkTypeAnchor : "本頁錨點", DlgLnkTypeEMail : "電子郵件", DlgLnkProto : "通訊協定", DlgLnkProtoOther : "<其他>", DlgLnkURL : "URL", DlgLnkAnchorSel : "請選擇錨點", DlgLnkAnchorByName : "依錨點名稱", DlgLnkAnchorById : "依元件 ID", DlgLnkNoAnchors : "(本文件尚無可用之錨點)", DlgLnkEMail : "電子郵件", DlgLnkEMailSubject : "郵件主旨", DlgLnkEMailBody : "郵件內容", DlgLnkUpload : "上傳", DlgLnkBtnUpload : "傳送至伺服器", DlgLnkTarget : "目標", DlgLnkTargetFrame : "<框架>", DlgLnkTargetPopup : "<快顯視窗>", DlgLnkTargetBlank : "新視窗 (_blank)", DlgLnkTargetParent : "父視窗 (_parent)", DlgLnkTargetSelf : "本視窗 (_self)", DlgLnkTargetTop : "最上層視窗 (_top)", DlgLnkTargetFrameName : "目標框架名稱", DlgLnkPopWinName : "快顯視窗名稱", DlgLnkPopWinFeat : "快顯視窗屬性", DlgLnkPopResize : "可調整大小", DlgLnkPopLocation : "網址列", DlgLnkPopMenu : "選單列", DlgLnkPopScroll : "捲軸", DlgLnkPopStatus : "狀態列", DlgLnkPopToolbar : "工具列", DlgLnkPopFullScrn : "全螢幕 (IE)", DlgLnkPopDependent : "從屬 (NS)", DlgLnkPopWidth : "寬", DlgLnkPopHeight : "高", DlgLnkPopLeft : "左", DlgLnkPopTop : "右", DlnLnkMsgNoUrl : "請輸入欲連結的 URL", DlnLnkMsgNoEMail : "請輸入電子郵件位址", DlnLnkMsgNoAnchor : "請選擇錨點", DlnLnkMsgInvPopName : "快顯名稱必須以「英文字母」為開頭,且不得含有空白", // Color Dialog DlgColorTitle : "請選擇顏色", DlgColorBtnClear : "清除", DlgColorHighlight : "預覽", DlgColorSelected : "選擇", // Smiley Dialog DlgSmileyTitle : "插入表情符號", // Special Character Dialog DlgSpecialCharTitle : "請選擇特殊符號", // Table Dialog DlgTableTitle : "表格屬性", DlgTableRows : "列數", DlgTableColumns : "欄數", DlgTableBorder : "邊框", DlgTableAlign : "對齊", DlgTableAlignNotSet : "<未設定>", DlgTableAlignLeft : "靠左對齊", DlgTableAlignCenter : "置中", DlgTableAlignRight : "靠右對齊", DlgTableWidth : "寬度", DlgTableWidthPx : "像素", DlgTableWidthPc : "百分比", DlgTableHeight : "高度", DlgTableCellSpace : "間距", DlgTableCellPad : "內距", DlgTableCaption : "標題", DlgTableSummary : "摘要", // Table Cell Dialog DlgCellTitle : "儲存格屬性", DlgCellWidth : "寬度", DlgCellWidthPx : "像素", DlgCellWidthPc : "百分比", DlgCellHeight : "高度", DlgCellWordWrap : "自動換行", DlgCellWordWrapNotSet : "<尚未設定>", DlgCellWordWrapYes : "是", DlgCellWordWrapNo : "否", DlgCellHorAlign : "水平對齊", DlgCellHorAlignNotSet : "<尚未設定>", DlgCellHorAlignLeft : "靠左對齊", DlgCellHorAlignCenter : "置中", DlgCellHorAlignRight: "靠右對齊", DlgCellVerAlign : "垂直對齊", DlgCellVerAlignNotSet : "<尚未設定>", DlgCellVerAlignTop : "靠上對齊", DlgCellVerAlignMiddle : "置中", DlgCellVerAlignBottom : "靠下對齊", DlgCellVerAlignBaseline : "基準線", DlgCellRowSpan : "合併列數", DlgCellCollSpan : "合併欄数", DlgCellBackColor : "背景顏色", DlgCellBorderColor : "邊框顏色", DlgCellBtnSelect : "請選擇…", // Find and Replace Dialog DlgFindAndReplaceTitle : "尋找與取代", // Find Dialog DlgFindTitle : "尋找", DlgFindFindBtn : "尋找", DlgFindNotFoundMsg : "未找到指定的文字。", // Replace Dialog DlgReplaceTitle : "取代", DlgReplaceFindLbl : "尋找:", DlgReplaceReplaceLbl : "取代:", DlgReplaceCaseChk : "大小寫須相符", DlgReplaceReplaceBtn : "取代", DlgReplaceReplAllBtn : "全部取代", DlgReplaceWordChk : "全字相符", // Paste Operations / Dialog PasteErrorCut : "瀏覽器的安全性設定不允許編輯器自動執行剪下動作。請使用快捷鍵 (Ctrl+X) 剪下。", PasteErrorCopy : "瀏覽器的安全性設定不允許編輯器自動執行複製動作。請使用快捷鍵 (Ctrl+C) 複製。", PasteAsText : "貼為純文字格式", PasteFromWord : "自 Word 貼上", DlgPasteMsg2 : "請使用快捷鍵 (<strong>Ctrl+V</strong>) 貼到下方區域中並按下 <strong>確定</strong>", DlgPasteSec : "因為瀏覽器的安全性設定,本編輯器無法直接存取您的剪貼簿資料,請您自行在本視窗進行貼上動作。", DlgPasteIgnoreFont : "移除字型設定", DlgPasteRemoveStyles : "移除樣式設定", // Color Picker ColorAutomatic : "自動", ColorMoreColors : "更多顏色…", // Document Properties DocProps : "文件屬性", // Anchor Dialog DlgAnchorTitle : "命名錨點", DlgAnchorName : "錨點名稱", DlgAnchorErrorName : "請輸入錨點名稱", // Speller Pages Dialog DlgSpellNotInDic : "不在字典中", DlgSpellChangeTo : "更改為", DlgSpellBtnIgnore : "忽略", DlgSpellBtnIgnoreAll : "全部忽略", DlgSpellBtnReplace : "取代", DlgSpellBtnReplaceAll : "全部取代", DlgSpellBtnUndo : "復原", DlgSpellNoSuggestions : "- 無建議值 -", DlgSpellProgress : "進行拼字檢查中…", DlgSpellNoMispell : "拼字檢查完成:未發現拼字錯誤", DlgSpellNoChanges : "拼字檢查完成:未更改任何單字", DlgSpellOneChange : "拼字檢查完成:更改了 1 個單字", DlgSpellManyChanges : "拼字檢查完成:更改了 %1 個單字", IeSpellDownload : "尚未安裝拼字檢查元件。您是否想要現在下載?", // Button Dialog DlgButtonText : "顯示文字 (值)", DlgButtonType : "類型", DlgButtonTypeBtn : "按鈕 (Button)", DlgButtonTypeSbm : "送出 (Submit)", DlgButtonTypeRst : "重設 (Reset)", // Checkbox and Radio Button Dialogs DlgCheckboxName : "名稱", DlgCheckboxValue : "選取值", DlgCheckboxSelected : "已選取", // Form Dialog DlgFormName : "名稱", DlgFormAction : "動作", DlgFormMethod : "方法", // Select Field Dialog DlgSelectName : "名稱", DlgSelectValue : "選取值", DlgSelectSize : "大小", DlgSelectLines : "行", DlgSelectChkMulti : "可多選", DlgSelectOpAvail : "可用選項", DlgSelectOpText : "顯示文字", DlgSelectOpValue : "值", DlgSelectBtnAdd : "新增", DlgSelectBtnModify : "修改", DlgSelectBtnUp : "上移", DlgSelectBtnDown : "下移", DlgSelectBtnSetValue : "設為預設值", DlgSelectBtnDelete : "刪除", // Textarea Dialog DlgTextareaName : "名稱", DlgTextareaCols : "字元寬度", DlgTextareaRows : "列數", // Text Field Dialog DlgTextName : "名稱", DlgTextValue : "值", DlgTextCharWidth : "字元寬度", DlgTextMaxChars : "最多字元數", DlgTextType : "類型", DlgTextTypeText : "文字", DlgTextTypePass : "密碼", // Hidden Field Dialog DlgHiddenName : "名稱", DlgHiddenValue : "值", // Bulleted List Dialog BulletedListProp : "項目清單屬性", NumberedListProp : "編號清單屬性", DlgLstStart : "起始編號", DlgLstType : "清單類型", DlgLstTypeCircle : "圓圈", DlgLstTypeDisc : "圓點", DlgLstTypeSquare : "方塊", DlgLstTypeNumbers : "數字 (1, 2, 3)", DlgLstTypeLCase : "小寫字母 (a, b, c)", DlgLstTypeUCase : "大寫字母 (A, B, C)", DlgLstTypeSRoman : "小寫羅馬數字 (i, ii, iii)", DlgLstTypeLRoman : "大寫羅馬數字 (I, II, III)", // Document Properties Dialog DlgDocGeneralTab : "一般", DlgDocBackTab : "背景", DlgDocColorsTab : "顯色與邊界", DlgDocMetaTab : "Meta 資料", DlgDocPageTitle : "頁面標題", DlgDocLangDir : "語言方向", DlgDocLangDirLTR : "由左而右 (LTR)", DlgDocLangDirRTL : "由右而左 (RTL)", DlgDocLangCode : "語言代碼", DlgDocCharSet : "字元編碼", DlgDocCharSetCE : "中歐語系", DlgDocCharSetCT : "正體中文 (Big5)", DlgDocCharSetCR : "斯拉夫文", DlgDocCharSetGR : "希臘文", DlgDocCharSetJP : "日文", DlgDocCharSetKR : "韓文", DlgDocCharSetTR : "土耳其文", DlgDocCharSetUN : "Unicode (UTF-8)", DlgDocCharSetWE : "西歐語系", DlgDocCharSetOther : "其他字元編碼", DlgDocDocType : "文件類型", DlgDocDocTypeOther : "其他文件類型", DlgDocIncXHTML : "包含 XHTML 定義", DlgDocBgColor : "背景顏色", DlgDocBgImage : "背景影像", DlgDocBgNoScroll : "浮水印", DlgDocCText : "文字", DlgDocCLink : "超連結", DlgDocCVisited : "已瀏覽過的超連結", DlgDocCActive : "作用中的超連結", DlgDocMargins : "頁面邊界", DlgDocMaTop : "上", DlgDocMaLeft : "左", DlgDocMaRight : "右", DlgDocMaBottom : "下", DlgDocMeIndex : "文件索引關鍵字 (用半形逗號[,]分隔)", DlgDocMeDescr : "文件說明", DlgDocMeAuthor : "作者", DlgDocMeCopy : "版權所有", DlgDocPreview : "預覽", // Templates Dialog Templates : "樣版", DlgTemplatesTitle : "內容樣版", DlgTemplatesSelMsg : "請選擇欲開啟的樣版<br> (原有的內容將會被清除):", DlgTemplatesLoading : "讀取樣版清單中,請稍候…", DlgTemplatesNoTpl : "(無樣版)", DlgTemplatesReplace : "取代原有內容", // About Dialog DlgAboutAboutTab : "關於", DlgAboutBrowserInfoTab : "瀏覽器資訊", DlgAboutLicenseTab : "許可證", DlgAboutVersion : "版本", DlgAboutInfo : "想獲得更多資訊請至 " };
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts for the fck_select.html page. */ function Select( combo ) { var iIndex = combo.selectedIndex ; oListText.selectedIndex = iIndex ; oListValue.selectedIndex = iIndex ; var oTxtText = document.getElementById( "txtText" ) ; var oTxtValue = document.getElementById( "txtValue" ) ; oTxtText.value = oListText.value ; oTxtValue.value = oListValue.value ; } function Add() { var oTxtText = document.getElementById( "txtText" ) ; var oTxtValue = document.getElementById( "txtValue" ) ; AddComboOption( oListText, oTxtText.value, oTxtText.value ) ; AddComboOption( oListValue, oTxtValue.value, oTxtValue.value ) ; oListText.selectedIndex = oListText.options.length - 1 ; oListValue.selectedIndex = oListValue.options.length - 1 ; oTxtText.value = '' ; oTxtValue.value = '' ; oTxtText.focus() ; } function Modify() { var iIndex = oListText.selectedIndex ; if ( iIndex < 0 ) return ; var oTxtText = document.getElementById( "txtText" ) ; var oTxtValue = document.getElementById( "txtValue" ) ; oListText.options[ iIndex ].innerHTML = HTMLEncode( oTxtText.value ) ; oListText.options[ iIndex ].value = oTxtText.value ; oListValue.options[ iIndex ].innerHTML = HTMLEncode( oTxtValue.value ) ; oListValue.options[ iIndex ].value = oTxtValue.value ; oTxtText.value = '' ; oTxtValue.value = '' ; oTxtText.focus() ; } function Move( steps ) { ChangeOptionPosition( oListText, steps ) ; ChangeOptionPosition( oListValue, steps ) ; } function Delete() { RemoveSelectedOptions( oListText ) ; RemoveSelectedOptions( oListValue ) ; } function SetSelectedValue() { var iIndex = oListValue.selectedIndex ; if ( iIndex < 0 ) return ; var oTxtValue = document.getElementById( "txtSelValue" ) ; oTxtValue.value = oListValue.options[ iIndex ].value ; } // Moves the selected option by a number of steps (also negative) function ChangeOptionPosition( combo, steps ) { var iActualIndex = combo.selectedIndex ; if ( iActualIndex < 0 ) return ; var iFinalIndex = iActualIndex + steps ; if ( iFinalIndex < 0 ) iFinalIndex = 0 ; if ( iFinalIndex > ( combo.options.length - 1 ) ) iFinalIndex = combo.options.length - 1 ; if ( iActualIndex == iFinalIndex ) return ; var oOption = combo.options[ iActualIndex ] ; var sText = HTMLDecode( oOption.innerHTML ) ; var sValue = oOption.value ; combo.remove( iActualIndex ) ; oOption = AddComboOption( combo, sText, sValue, null, iFinalIndex ) ; oOption.selected = true ; } // Remove all selected options from a SELECT object function RemoveSelectedOptions(combo) { // Save the selected index var iSelectedIndex = combo.selectedIndex ; var oOptions = combo.options ; // Remove all selected options for ( var i = oOptions.length - 1 ; i >= 0 ; i-- ) { if (oOptions[i].selected) combo.remove(i) ; } // Reset the selection based on the original selected index if ( combo.options.length > 0 ) { if ( iSelectedIndex >= combo.options.length ) iSelectedIndex = combo.options.length - 1 ; combo.selectedIndex = iSelectedIndex ; } } // Add a new option to a SELECT object (combo or list) function AddComboOption( combo, optionText, optionValue, documentObject, index ) { var oOption ; if ( documentObject ) oOption = documentObject.createElement("OPTION") ; else oOption = document.createElement("OPTION") ; if ( index != null ) combo.options.add( oOption, index ) ; else combo.options.add( oOption ) ; oOption.innerHTML = optionText.length > 0 ? HTMLEncode( optionText ) : '&nbsp;' ; oOption.value = optionValue ; return oOption ; } function HTMLEncode( text ) { if ( !text ) return '' ; text = text.replace( /&/g, '&amp;' ) ; text = text.replace( /</g, '&lt;' ) ; text = text.replace( />/g, '&gt;' ) ; return text ; } function HTMLDecode( text ) { if ( !text ) return '' ; text = text.replace( /&gt;/g, '>' ) ; text = text.replace( /&lt;/g, '<' ) ; text = text.replace( /&amp;/g, '&' ) ; return text ; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts related to the Link dialog window (see fck_link.html). */ var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKRegexLib = oEditor.FCKRegexLib ; var FCKTools = oEditor.FCKTools ; //#### Dialog Tabs // Set the dialog tabs. dialog.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ; if ( !FCKConfig.LinkDlgHideTarget ) dialog.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ; if ( FCKConfig.LinkUpload ) dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ; if ( !FCKConfig.LinkDlgHideAdvanced ) dialog.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divTarget' , ( tabCode == 'Target' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAttribs' , ( tabCode == 'Advanced' ) ) ; dialog.SetAutoSize( true ) ; } //#### Regular Expressions library. var oRegex = new Object() ; oRegex.UriProtocol = /^(((http|https|ftp|news):\/\/)|mailto:)/gi ; oRegex.UrlOnChangeProtocol = /^(http|https|ftp|news):\/\/(?=.)/gi ; oRegex.UrlOnChangeTestOther = /^((javascript:)|[#\/\.])/gi ; oRegex.ReserveTarget = /^_(blank|self|top|parent)$/i ; oRegex.PopupUri = /^javascript:void\(\s*window.open\(\s*'([^']+)'\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*\)\s*$/ ; // Accessible popups oRegex.OnClickPopup = /^\s*on[cC]lick="\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*"$/ ; oRegex.PopupFeatures = /(?:^|,)([^=]+)=(\d+|yes|no)/gi ; //#### Parser Functions var oParser = new Object() ; oParser.ParseEMailUrl = function( emailUrl ) { // Initializes the EMailInfo object. var oEMailInfo = new Object() ; oEMailInfo.Address = '' ; oEMailInfo.Subject = '' ; oEMailInfo.Body = '' ; var oParts = emailUrl.match( /^([^\?]+)\??(.+)?/ ) ; if ( oParts ) { // Set the e-mail address. oEMailInfo.Address = oParts[1] ; // Look for the optional e-mail parameters. if ( oParts[2] ) { var oMatch = oParts[2].match( /(^|&)subject=([^&]+)/i ) ; if ( oMatch ) oEMailInfo.Subject = decodeURIComponent( oMatch[2] ) ; oMatch = oParts[2].match( /(^|&)body=([^&]+)/i ) ; if ( oMatch ) oEMailInfo.Body = decodeURIComponent( oMatch[2] ) ; } } return oEMailInfo ; } oParser.CreateEMailUri = function( address, subject, body ) { var sBaseUri = 'mailto:' + address ; var sParams = '' ; if ( subject.length > 0 ) sParams = '?subject=' + encodeURIComponent( subject ) ; if ( body.length > 0 ) { sParams += ( sParams.length == 0 ? '?' : '&' ) ; sParams += 'body=' + encodeURIComponent( body ) ; } return sBaseUri + sParams ; } //#### Initialization Code // oLink: The actual selected link in the editor. var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ; if ( oLink ) FCK.Selection.SelectNode( oLink ) ; window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; // Fill the Anchor Names and Ids combos. LoadAnchorNamesAndIds() ; // Load the selected link information (if any). LoadSelection() ; // Update the dialog box. SetLinkType( GetE('cmbLinkType').value ) ; // Show/Hide the "Browse Server" button. GetE('divBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; // Show the initial dialog content. GetE('divInfo').style.display = '' ; // Set the actual uploader URL. if ( FCKConfig.LinkUpload ) GetE('frmUpload').action = FCKConfig.LinkUploadURL ; // Set the default target (from configuration). SetDefaultTarget() ; // Activate the "OK" button. dialog.SetOkButton( true ) ; // Select the first field. switch( GetE('cmbLinkType').value ) { case 'url' : SelectField( 'txtUrl' ) ; break ; case 'email' : SelectField( 'txtEMailAddress' ) ; break ; case 'anchor' : if ( GetE('divSelAnchor').style.display != 'none' ) SelectField( 'cmbAnchorName' ) ; else SelectField( 'cmbLinkType' ) ; } } var bHasAnchors ; function LoadAnchorNamesAndIds() { // Since version 2.0, the anchors are replaced in the DOM by IMGs so the user see the icon // to edit them. So, we must look for that images now. var aAnchors = new Array() ; var i ; var oImages = oEditor.FCK.EditorDocument.getElementsByTagName( 'IMG' ) ; for( i = 0 ; i < oImages.length ; i++ ) { if ( oImages[i].getAttribute('_fckanchor') ) aAnchors[ aAnchors.length ] = oEditor.FCK.GetRealElement( oImages[i] ) ; } // Add also real anchors var oLinks = oEditor.FCK.EditorDocument.getElementsByTagName( 'A' ) ; for( i = 0 ; i < oLinks.length ; i++ ) { if ( oLinks[i].name && ( oLinks[i].name.length > 0 ) ) aAnchors[ aAnchors.length ] = oLinks[i] ; } var aIds = FCKTools.GetAllChildrenIds( oEditor.FCK.EditorDocument.body ) ; bHasAnchors = ( aAnchors.length > 0 || aIds.length > 0 ) ; for ( i = 0 ; i < aAnchors.length ; i++ ) { var sName = aAnchors[i].name ; if ( sName && sName.length > 0 ) FCKTools.AddSelectOption( GetE('cmbAnchorName'), sName, sName ) ; } for ( i = 0 ; i < aIds.length ; i++ ) { FCKTools.AddSelectOption( GetE('cmbAnchorId'), aIds[i], aIds[i] ) ; } ShowE( 'divSelAnchor' , bHasAnchors ) ; ShowE( 'divNoAnchor' , !bHasAnchors ) ; } function LoadSelection() { if ( !oLink ) return ; var sType = 'url' ; // Get the actual Link href. var sHRef = oLink.getAttribute( '_fcksavedurl' ) ; if ( sHRef == null ) sHRef = oLink.getAttribute( 'href' , 2 ) || '' ; // Look for a popup javascript link. var oPopupMatch = oRegex.PopupUri.exec( sHRef ) ; if( oPopupMatch ) { GetE('cmbTarget').value = 'popup' ; sHRef = oPopupMatch[1] ; FillPopupFields( oPopupMatch[2], oPopupMatch[3] ) ; SetTarget( 'popup' ) ; } // Accessible popups, the popup data is in the onclick attribute if ( !oPopupMatch ) { var onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ; if ( onclick ) { // Decode the protected string onclick = decodeURIComponent( onclick ) ; oPopupMatch = oRegex.OnClickPopup.exec( onclick ) ; if( oPopupMatch ) { GetE( 'cmbTarget' ).value = 'popup' ; FillPopupFields( oPopupMatch[1], oPopupMatch[2] ) ; SetTarget( 'popup' ) ; } } } // Search for the protocol. var sProtocol = oRegex.UriProtocol.exec( sHRef ) ; if ( sProtocol ) { sProtocol = sProtocol[0].toLowerCase() ; GetE('cmbLinkProtocol').value = sProtocol ; // Remove the protocol and get the remaining URL. var sUrl = sHRef.replace( oRegex.UriProtocol, '' ) ; if ( sProtocol == 'mailto:' ) // It is an e-mail link. { sType = 'email' ; var oEMailInfo = oParser.ParseEMailUrl( sUrl ) ; GetE('txtEMailAddress').value = oEMailInfo.Address ; GetE('txtEMailSubject').value = oEMailInfo.Subject ; GetE('txtEMailBody').value = oEMailInfo.Body ; } else // It is a normal link. { sType = 'url' ; GetE('txtUrl').value = sUrl ; } } else if ( sHRef.substr(0,1) == '#' && sHRef.length > 1 ) // It is an anchor link. { sType = 'anchor' ; GetE('cmbAnchorName').value = GetE('cmbAnchorId').value = sHRef.substr(1) ; } else // It is another type of link. { sType = 'url' ; GetE('cmbLinkProtocol').value = '' ; GetE('txtUrl').value = sHRef ; } if ( !oPopupMatch ) { // Get the target. var sTarget = oLink.target ; if ( sTarget && sTarget.length > 0 ) { if ( oRegex.ReserveTarget.test( sTarget ) ) { sTarget = sTarget.toLowerCase() ; GetE('cmbTarget').value = sTarget ; } else GetE('cmbTarget').value = 'frame' ; GetE('txtTargetFrame').value = sTarget ; } } // Get Advances Attributes GetE('txtAttId').value = oLink.id ; GetE('txtAttName').value = oLink.name ; GetE('cmbAttLangDir').value = oLink.dir ; GetE('txtAttLangCode').value = oLink.lang ; GetE('txtAttAccessKey').value = oLink.accessKey ; GetE('txtAttTabIndex').value = oLink.tabIndex <= 0 ? '' : oLink.tabIndex ; GetE('txtAttTitle').value = oLink.title ; GetE('txtAttContentType').value = oLink.type ; GetE('txtAttCharSet').value = oLink.charset ; var sClass ; if ( oEditor.FCKBrowserInfo.IsIE ) { sClass = oLink.getAttribute('className',2) || '' ; // Clean up temporary classes for internal use: sClass = sClass.replace( FCKRegexLib.FCK_Class, '' ) ; GetE('txtAttStyle').value = oLink.style.cssText ; } else { sClass = oLink.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oLink.getAttribute('style',2) || '' ; } GetE('txtAttClasses').value = sClass ; // Update the Link type combo. GetE('cmbLinkType').value = sType ; } //#### Link type selection. function SetLinkType( linkType ) { ShowE('divLinkTypeUrl' , (linkType == 'url') ) ; ShowE('divLinkTypeAnchor' , (linkType == 'anchor') ) ; ShowE('divLinkTypeEMail' , (linkType == 'email') ) ; if ( !FCKConfig.LinkDlgHideTarget ) dialog.SetTabVisibility( 'Target' , (linkType == 'url') ) ; if ( FCKConfig.LinkUpload ) dialog.SetTabVisibility( 'Upload' , (linkType == 'url') ) ; if ( !FCKConfig.LinkDlgHideAdvanced ) dialog.SetTabVisibility( 'Advanced' , (linkType != 'anchor' || bHasAnchors) ) ; if ( linkType == 'email' ) dialog.SetAutoSize( true ) ; } //#### Target type selection. function SetTarget( targetType ) { GetE('tdTargetFrame').style.display = ( targetType == 'popup' ? 'none' : '' ) ; GetE('tdPopupName').style.display = GetE('tablePopupFeatures').style.display = ( targetType == 'popup' ? '' : 'none' ) ; switch ( targetType ) { case "_blank" : case "_self" : case "_parent" : case "_top" : GetE('txtTargetFrame').value = targetType ; break ; case "" : GetE('txtTargetFrame').value = '' ; break ; } if ( targetType == 'popup' ) dialog.SetAutoSize( true ) ; } //#### Called while the user types the URL. function OnUrlChange() { var sUrl = GetE('txtUrl').value ; var sProtocol = oRegex.UrlOnChangeProtocol.exec( sUrl ) ; if ( sProtocol ) { sUrl = sUrl.substr( sProtocol[0].length ) ; GetE('txtUrl').value = sUrl ; GetE('cmbLinkProtocol').value = sProtocol[0].toLowerCase() ; } else if ( oRegex.UrlOnChangeTestOther.test( sUrl ) ) { GetE('cmbLinkProtocol').value = '' ; } } //#### Called while the user types the target name. function OnTargetNameChange() { var sFrame = GetE('txtTargetFrame').value ; if ( sFrame.length == 0 ) GetE('cmbTarget').value = '' ; else if ( oRegex.ReserveTarget.test( sFrame ) ) GetE('cmbTarget').value = sFrame.toLowerCase() ; else GetE('cmbTarget').value = 'frame' ; } // Accessible popups function BuildOnClickPopup() { var sWindowName = "'" + GetE('txtPopupName').value.replace(/\W/gi, "") + "'" ; var sFeatures = '' ; var aChkFeatures = document.getElementsByName( 'chkFeature' ) ; for ( var i = 0 ; i < aChkFeatures.length ; i++ ) { if ( i > 0 ) sFeatures += ',' ; sFeatures += aChkFeatures[i].value + '=' + ( aChkFeatures[i].checked ? 'yes' : 'no' ) ; } if ( GetE('txtPopupWidth').value.length > 0 ) sFeatures += ',width=' + GetE('txtPopupWidth').value ; if ( GetE('txtPopupHeight').value.length > 0 ) sFeatures += ',height=' + GetE('txtPopupHeight').value ; if ( GetE('txtPopupLeft').value.length > 0 ) sFeatures += ',left=' + GetE('txtPopupLeft').value ; if ( GetE('txtPopupTop').value.length > 0 ) sFeatures += ',top=' + GetE('txtPopupTop').value ; if ( sFeatures != '' ) sFeatures = sFeatures + ",status" ; return ( "window.open(this.href," + sWindowName + ",'" + sFeatures + "'); return false" ) ; } //#### Fills all Popup related fields. function FillPopupFields( windowName, features ) { if ( windowName ) GetE('txtPopupName').value = windowName ; var oFeatures = new Object() ; var oFeaturesMatch ; while( ( oFeaturesMatch = oRegex.PopupFeatures.exec( features ) ) != null ) { var sValue = oFeaturesMatch[2] ; if ( sValue == ( 'yes' || '1' ) ) oFeatures[ oFeaturesMatch[1] ] = true ; else if ( ! isNaN( sValue ) && sValue != 0 ) oFeatures[ oFeaturesMatch[1] ] = sValue ; } // Update all features check boxes. var aChkFeatures = document.getElementsByName('chkFeature') ; for ( var i = 0 ; i < aChkFeatures.length ; i++ ) { if ( oFeatures[ aChkFeatures[i].value ] ) aChkFeatures[i].checked = true ; } // Update position and size text boxes. if ( oFeatures['width'] ) GetE('txtPopupWidth').value = oFeatures['width'] ; if ( oFeatures['height'] ) GetE('txtPopupHeight').value = oFeatures['height'] ; if ( oFeatures['left'] ) GetE('txtPopupLeft').value = oFeatures['left'] ; if ( oFeatures['top'] ) GetE('txtPopupTop').value = oFeatures['top'] ; } //#### The OK button was hit. function Ok() { var sUri, sInnerHtml ; oEditor.FCKUndo.SaveUndoStep() ; switch ( GetE('cmbLinkType').value ) { case 'url' : sUri = GetE('txtUrl').value ; if ( sUri.length == 0 ) { alert( FCKLang.DlnLnkMsgNoUrl ) ; return false ; } sUri = GetE('cmbLinkProtocol').value + sUri ; break ; case 'email' : sUri = GetE('txtEMailAddress').value ; if ( sUri.length == 0 ) { alert( FCKLang.DlnLnkMsgNoEMail ) ; return false ; } sUri = oParser.CreateEMailUri( sUri, GetE('txtEMailSubject').value, GetE('txtEMailBody').value ) ; break ; case 'anchor' : var sAnchor = GetE('cmbAnchorName').value ; if ( sAnchor.length == 0 ) sAnchor = GetE('cmbAnchorId').value ; if ( sAnchor.length == 0 ) { alert( FCKLang.DlnLnkMsgNoAnchor ) ; return false ; } sUri = '#' + sAnchor ; break ; } // If no link is selected, create a new one (it may result in more than one link creation - #220). var aLinks = oLink ? [ oLink ] : oEditor.FCK.CreateLink( sUri, true ) ; // If no selection, no links are created, so use the uri as the link text (by dom, 2006-05-26) var aHasSelection = ( aLinks.length > 0 ) ; if ( !aHasSelection ) { sInnerHtml = sUri; // Built a better text for empty links. switch ( GetE('cmbLinkType').value ) { // anchor: use old behavior --> return true case 'anchor': sInnerHtml = sInnerHtml.replace( /^#/, '' ) ; break ; // url: try to get path case 'url': var oLinkPathRegEx = new RegExp("//?([^?\"']+)([?].*)?$") ; var asLinkPath = oLinkPathRegEx.exec( sUri ) ; if (asLinkPath != null) sInnerHtml = asLinkPath[1]; // use matched path break ; // mailto: try to get email address case 'email': sInnerHtml = GetE('txtEMailAddress').value ; break ; } // Create a new (empty) anchor. aLinks = [ oEditor.FCK.InsertElement( 'a' ) ] ; } for ( var i = 0 ; i < aLinks.length ; i++ ) { oLink = aLinks[i] ; if ( aHasSelection ) sInnerHtml = oLink.innerHTML ; // Save the innerHTML (IE changes it if it is like an URL). oLink.href = sUri ; SetAttribute( oLink, '_fcksavedurl', sUri ) ; var onclick; // Accessible popups if( GetE('cmbTarget').value == 'popup' ) { onclick = BuildOnClickPopup() ; // Encode the attribute onclick = encodeURIComponent( " onclick=\"" + onclick + "\"" ) ; SetAttribute( oLink, 'onclick_fckprotectedatt', onclick ) ; } else { // Check if the previous onclick was for a popup: // In that case remove the onclick handler. onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ; if ( onclick ) { // Decode the protected string onclick = decodeURIComponent( onclick ) ; if( oRegex.OnClickPopup.test( onclick ) ) SetAttribute( oLink, 'onclick_fckprotectedatt', '' ) ; } } oLink.innerHTML = sInnerHtml ; // Set (or restore) the innerHTML // Target if( GetE('cmbTarget').value != 'popup' ) SetAttribute( oLink, 'target', GetE('txtTargetFrame').value ) ; else SetAttribute( oLink, 'target', null ) ; // Let's set the "id" only for the first link to avoid duplication. if ( i == 0 ) SetAttribute( oLink, 'id', GetE('txtAttId').value ) ; // Advances Attributes SetAttribute( oLink, 'name' , GetE('txtAttName').value ) ; SetAttribute( oLink, 'dir' , GetE('cmbAttLangDir').value ) ; SetAttribute( oLink, 'lang' , GetE('txtAttLangCode').value ) ; SetAttribute( oLink, 'accesskey', GetE('txtAttAccessKey').value ) ; SetAttribute( oLink, 'tabindex' , ( GetE('txtAttTabIndex').value > 0 ? GetE('txtAttTabIndex').value : null ) ) ; SetAttribute( oLink, 'title' , GetE('txtAttTitle').value ) ; SetAttribute( oLink, 'type' , GetE('txtAttContentType').value ) ; SetAttribute( oLink, 'charset' , GetE('txtAttCharSet').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { var sClass = GetE('txtAttClasses').value ; // If it's also an anchor add an internal class if ( GetE('txtAttName').value.length != 0 ) sClass += ' FCK__AnchorC' ; SetAttribute( oLink, 'className', sClass ) ; oLink.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( oLink, 'class', GetE('txtAttClasses').value ) ; SetAttribute( oLink, 'style', GetE('txtAttStyle').value ) ; } } // Select the (first) link. oEditor.FCKSelection.SelectNode( aLinks[0] ); return true ; } function BrowseServer() { OpenFileBrowser( FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; } function SetUrl( url ) { document.getElementById('txtUrl').value = url ; OnUrlChange() ; dialog.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; case 500 : alert( 'The connector is disabled' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.LinkUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.LinkUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.LinkUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.LinkUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } return true ; } function SetDefaultTarget() { var target = FCKConfig.DefaultLinkTarget || '' ; if ( oLink || target.length == 0 ) return ; switch ( target ) { case '_blank' : case '_self' : case '_parent' : case '_top' : GetE('cmbTarget').value = target ; break ; default : GetE('cmbTarget').value = 'frame' ; break ; } GetE('txtTargetFrame').value = target ; }
JavaScript
//////////////////////////////////////////////////// // wordWindow object //////////////////////////////////////////////////// function wordWindow() { // private properties this._forms = []; // private methods this._getWordObject = _getWordObject; //this._getSpellerObject = _getSpellerObject; this._wordInputStr = _wordInputStr; this._adjustIndexes = _adjustIndexes; this._isWordChar = _isWordChar; this._lastPos = _lastPos; // public properties this.wordChar = /[a-zA-Z]/; this.windowType = "wordWindow"; this.originalSpellings = new Array(); this.suggestions = new Array(); this.checkWordBgColor = "pink"; this.normWordBgColor = "white"; this.text = ""; this.textInputs = new Array(); this.indexes = new Array(); //this.speller = this._getSpellerObject(); // public methods this.resetForm = resetForm; this.totalMisspellings = totalMisspellings; this.totalWords = totalWords; this.totalPreviousWords = totalPreviousWords; //this.getTextObjectArray = getTextObjectArray; this.getTextVal = getTextVal; this.setFocus = setFocus; this.removeFocus = removeFocus; this.setText = setText; //this.getTotalWords = getTotalWords; this.writeBody = writeBody; this.printForHtml = printForHtml; } function resetForm() { if( this._forms ) { for( var i = 0; i < this._forms.length; i++ ) { this._forms[i].reset(); } } return true; } function totalMisspellings() { var total_words = 0; for( var i = 0; i < this.textInputs.length; i++ ) { total_words += this.totalWords( i ); } return total_words; } function totalWords( textIndex ) { return this.originalSpellings[textIndex].length; } function totalPreviousWords( textIndex, wordIndex ) { var total_words = 0; for( var i = 0; i <= textIndex; i++ ) { for( var j = 0; j < this.totalWords( i ); j++ ) { if( i == textIndex && j == wordIndex ) { break; } else { total_words++; } } } return total_words; } //function getTextObjectArray() { // return this._form.elements; //} function getTextVal( textIndex, wordIndex ) { var word = this._getWordObject( textIndex, wordIndex ); if( word ) { return word.value; } } function setFocus( textIndex, wordIndex ) { var word = this._getWordObject( textIndex, wordIndex ); if( word ) { if( word.type == "text" ) { word.focus(); word.style.backgroundColor = this.checkWordBgColor; } } } function removeFocus( textIndex, wordIndex ) { var word = this._getWordObject( textIndex, wordIndex ); if( word ) { if( word.type == "text" ) { word.blur(); word.style.backgroundColor = this.normWordBgColor; } } } function setText( textIndex, wordIndex, newText ) { var word = this._getWordObject( textIndex, wordIndex ); var beginStr; var endStr; if( word ) { var pos = this.indexes[textIndex][wordIndex]; var oldText = word.value; // update the text given the index of the string beginStr = this.textInputs[textIndex].substring( 0, pos ); endStr = this.textInputs[textIndex].substring( pos + oldText.length, this.textInputs[textIndex].length ); this.textInputs[textIndex] = beginStr + newText + endStr; // adjust the indexes on the stack given the differences in // length between the new word and old word. var lengthDiff = newText.length - oldText.length; this._adjustIndexes( textIndex, wordIndex, lengthDiff ); word.size = newText.length; word.value = newText; this.removeFocus( textIndex, wordIndex ); } } function writeBody() { var d = window.document; var is_html = false; d.open(); // iterate through each text input. for( var txtid = 0; txtid < this.textInputs.length; txtid++ ) { var end_idx = 0; var begin_idx = 0; d.writeln( '<form name="textInput'+txtid+'">' ); var wordtxt = this.textInputs[txtid]; this.indexes[txtid] = []; if( wordtxt ) { var orig = this.originalSpellings[txtid]; if( !orig ) break; //!!! plain text, or HTML mode? d.writeln( '<div class="plainText">' ); // iterate through each occurrence of a misspelled word. for( var i = 0; i < orig.length; i++ ) { // find the position of the current misspelled word, // starting at the last misspelled word. // and keep looking if it's a substring of another word do { begin_idx = wordtxt.indexOf( orig[i], end_idx ); end_idx = begin_idx + orig[i].length; // word not found? messed up! if( begin_idx == -1 ) break; // look at the characters immediately before and after // the word. If they are word characters we'll keep looking. var before_char = wordtxt.charAt( begin_idx - 1 ); var after_char = wordtxt.charAt( end_idx ); } while ( this._isWordChar( before_char ) || this._isWordChar( after_char ) ); // keep track of its position in the original text. this.indexes[txtid][i] = begin_idx; // write out the characters before the current misspelled word for( var j = this._lastPos( txtid, i ); j < begin_idx; j++ ) { // !!! html mode? make it html compatible d.write( this.printForHtml( wordtxt.charAt( j ))); } // write out the misspelled word. d.write( this._wordInputStr( orig[i] )); // if it's the last word, write out the rest of the text if( i == orig.length-1 ){ d.write( printForHtml( wordtxt.substr( end_idx ))); } } d.writeln( '</div>' ); } d.writeln( '</form>' ); } //for ( var j = 0; j < d.forms.length; j++ ) { // alert( d.forms[j].name ); // for( var k = 0; k < d.forms[j].elements.length; k++ ) { // alert( d.forms[j].elements[k].name + ": " + d.forms[j].elements[k].value ); // } //} // set the _forms property this._forms = d.forms; d.close(); } // return the character index in the full text after the last word we evaluated function _lastPos( txtid, idx ) { if( idx > 0 ) return this.indexes[txtid][idx-1] + this.originalSpellings[txtid][idx-1].length; else return 0; } function printForHtml( n ) { return n ; // by FredCK /* var htmlstr = n; if( htmlstr.length == 1 ) { // do simple case statement if it's just one character switch ( n ) { case "\n": htmlstr = '<br/>'; break; case "<": htmlstr = '&lt;'; break; case ">": htmlstr = '&gt;'; break; } return htmlstr; } else { htmlstr = htmlstr.replace( /</g, '&lt' ); htmlstr = htmlstr.replace( />/g, '&gt' ); htmlstr = htmlstr.replace( /\n/g, '<br/>' ); return htmlstr; } */ } function _isWordChar( letter ) { if( letter.search( this.wordChar ) == -1 ) { return false; } else { return true; } } function _getWordObject( textIndex, wordIndex ) { if( this._forms[textIndex] ) { if( this._forms[textIndex].elements[wordIndex] ) { return this._forms[textIndex].elements[wordIndex]; } } return null; } function _wordInputStr( word ) { var str = '<input readonly '; str += 'class="blend" type="text" value="' + word + '" size="' + word.length + '">'; return str; } function _adjustIndexes( textIndex, wordIndex, lengthDiff ) { for( var i = wordIndex + 1; i < this.originalSpellings[textIndex].length; i++ ) { this.indexes[textIndex][i] = this.indexes[textIndex][i] + lengthDiff; } }
JavaScript
//////////////////////////////////////////////////// // controlWindow object //////////////////////////////////////////////////// function controlWindow( controlForm ) { // private properties this._form = controlForm; // public properties this.windowType = "controlWindow"; // this.noSuggestionSelection = "- No suggestions -"; // by FredCK this.noSuggestionSelection = FCKLang.DlgSpellNoSuggestions ; // set up the properties for elements of the given control form this.suggestionList = this._form.sugg; this.evaluatedText = this._form.misword; this.replacementText = this._form.txtsugg; this.undoButton = this._form.btnUndo; // public methods this.addSuggestion = addSuggestion; this.clearSuggestions = clearSuggestions; this.selectDefaultSuggestion = selectDefaultSuggestion; this.resetForm = resetForm; this.setSuggestedText = setSuggestedText; this.enableUndo = enableUndo; this.disableUndo = disableUndo; } function resetForm() { if( this._form ) { this._form.reset(); } } function setSuggestedText() { var slct = this.suggestionList; var txt = this.replacementText; var str = ""; if( (slct.options[0].text) && slct.options[0].text != this.noSuggestionSelection ) { str = slct.options[slct.selectedIndex].text; } txt.value = str; } function selectDefaultSuggestion() { var slct = this.suggestionList; var txt = this.replacementText; if( slct.options.length == 0 ) { this.addSuggestion( this.noSuggestionSelection ); } else { slct.options[0].selected = true; } this.setSuggestedText(); } function addSuggestion( sugg_text ) { var slct = this.suggestionList; if( sugg_text ) { var i = slct.options.length; var newOption = new Option( sugg_text, 'sugg_text'+i ); slct.options[i] = newOption; } } function clearSuggestions() { var slct = this.suggestionList; for( var j = slct.length - 1; j > -1; j-- ) { if( slct.options[j] ) { slct.options[j] = null; } } } function enableUndo() { if( this.undoButton ) { if( this.undoButton.disabled == true ) { this.undoButton.disabled = false; } } } function disableUndo() { if( this.undoButton ) { if( this.undoButton.disabled == false ) { this.undoButton.disabled = true; } } }
JavaScript
//////////////////////////////////////////////////// // spellChecker.js // // spellChecker object // // This file is sourced on web pages that have a textarea object to evaluate // for spelling. It includes the implementation for the spellCheckObject. // //////////////////////////////////////////////////// // constructor function spellChecker( textObject ) { // public properties - configurable // this.popUpUrl = '/speller/spellchecker.html'; // by FredCK this.popUpUrl = 'fck_spellerpages/spellerpages/spellchecker.html'; // by FredCK this.popUpName = 'spellchecker'; // this.popUpProps = "menu=no,width=440,height=350,top=70,left=120,resizable=yes,status=yes"; // by FredCK this.popUpProps = null ; // by FredCK // this.spellCheckScript = '/speller/server-scripts/spellchecker.php'; // by FredCK //this.spellCheckScript = '/cgi-bin/spellchecker.pl'; // values used to keep track of what happened to a word this.replWordFlag = "R"; // single replace this.ignrWordFlag = "I"; // single ignore this.replAllFlag = "RA"; // replace all occurances this.ignrAllFlag = "IA"; // ignore all occurances this.fromReplAll = "~RA"; // an occurance of a "replace all" word this.fromIgnrAll = "~IA"; // an occurance of a "ignore all" word // properties set at run time this.wordFlags = new Array(); this.currentTextIndex = 0; this.currentWordIndex = 0; this.spellCheckerWin = null; this.controlWin = null; this.wordWin = null; this.textArea = textObject; // deprecated this.textInputs = arguments; // private methods this._spellcheck = _spellcheck; this._getSuggestions = _getSuggestions; this._setAsIgnored = _setAsIgnored; this._getTotalReplaced = _getTotalReplaced; this._setWordText = _setWordText; this._getFormInputs = _getFormInputs; // public methods this.openChecker = openChecker; this.startCheck = startCheck; this.checkTextBoxes = checkTextBoxes; this.checkTextAreas = checkTextAreas; this.spellCheckAll = spellCheckAll; this.ignoreWord = ignoreWord; this.ignoreAll = ignoreAll; this.replaceWord = replaceWord; this.replaceAll = replaceAll; this.terminateSpell = terminateSpell; this.undo = undo; // set the current window's "speller" property to the instance of this class. // this object can now be referenced by child windows/frames. window.speller = this; } // call this method to check all text boxes (and only text boxes) in the HTML document function checkTextBoxes() { this.textInputs = this._getFormInputs( "^text$" ); this.openChecker(); } // call this method to check all textareas (and only textareas ) in the HTML document function checkTextAreas() { this.textInputs = this._getFormInputs( "^textarea$" ); this.openChecker(); } // call this method to check all text boxes and textareas in the HTML document function spellCheckAll() { this.textInputs = this._getFormInputs( "^text(area)?$" ); this.openChecker(); } // call this method to check text boxe(s) and/or textarea(s) that were passed in to the // object's constructor or to the textInputs property function openChecker() { this.spellCheckerWin = window.open( this.popUpUrl, this.popUpName, this.popUpProps ); if( !this.spellCheckerWin.opener ) { this.spellCheckerWin.opener = window; } } function startCheck( wordWindowObj, controlWindowObj ) { // set properties from args this.wordWin = wordWindowObj; this.controlWin = controlWindowObj; // reset properties this.wordWin.resetForm(); this.controlWin.resetForm(); this.currentTextIndex = 0; this.currentWordIndex = 0; // initialize the flags to an array - one element for each text input this.wordFlags = new Array( this.wordWin.textInputs.length ); // each element will be an array that keeps track of each word in the text for( var i=0; i<this.wordFlags.length; i++ ) { this.wordFlags[i] = []; } // start this._spellcheck(); return true; } function ignoreWord() { var wi = this.currentWordIndex; var ti = this.currentTextIndex; if( !this.wordWin ) { alert( 'Error: Word frame not available.' ); return false; } if( !this.wordWin.getTextVal( ti, wi )) { alert( 'Error: "Not in dictionary" text is missing.' ); return false; } // set as ignored if( this._setAsIgnored( ti, wi, this.ignrWordFlag )) { this.currentWordIndex++; this._spellcheck(); } return true; } function ignoreAll() { var wi = this.currentWordIndex; var ti = this.currentTextIndex; if( !this.wordWin ) { alert( 'Error: Word frame not available.' ); return false; } // get the word that is currently being evaluated. var s_word_to_repl = this.wordWin.getTextVal( ti, wi ); if( !s_word_to_repl ) { alert( 'Error: "Not in dictionary" text is missing' ); return false; } // set this word as an "ignore all" word. this._setAsIgnored( ti, wi, this.ignrAllFlag ); // loop through all the words after this word for( var i = ti; i < this.wordWin.textInputs.length; i++ ) { for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) { if(( i == ti && j > wi ) || i > ti ) { // future word: set as "from ignore all" if // 1) do not already have a flag and // 2) have the same value as current word if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl ) && ( !this.wordFlags[i][j] )) { this._setAsIgnored( i, j, this.fromIgnrAll ); } } } } // finally, move on this.currentWordIndex++; this._spellcheck(); return true; } function replaceWord() { var wi = this.currentWordIndex; var ti = this.currentTextIndex; if( !this.wordWin ) { alert( 'Error: Word frame not available.' ); return false; } if( !this.wordWin.getTextVal( ti, wi )) { alert( 'Error: "Not in dictionary" text is missing' ); return false; } if( !this.controlWin.replacementText ) { return false ; } var txt = this.controlWin.replacementText; if( txt.value ) { var newspell = new String( txt.value ); if( this._setWordText( ti, wi, newspell, this.replWordFlag )) { this.currentWordIndex++; this._spellcheck(); } } return true; } function replaceAll() { var ti = this.currentTextIndex; var wi = this.currentWordIndex; if( !this.wordWin ) { alert( 'Error: Word frame not available.' ); return false; } var s_word_to_repl = this.wordWin.getTextVal( ti, wi ); if( !s_word_to_repl ) { alert( 'Error: "Not in dictionary" text is missing' ); return false; } var txt = this.controlWin.replacementText; if( !txt.value ) return false; var newspell = new String( txt.value ); // set this word as a "replace all" word. this._setWordText( ti, wi, newspell, this.replAllFlag ); // loop through all the words after this word for( var i = ti; i < this.wordWin.textInputs.length; i++ ) { for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) { if(( i == ti && j > wi ) || i > ti ) { // future word: set word text to s_word_to_repl if // 1) do not already have a flag and // 2) have the same value as s_word_to_repl if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl ) && ( !this.wordFlags[i][j] )) { this._setWordText( i, j, newspell, this.fromReplAll ); } } } } // finally, move on this.currentWordIndex++; this._spellcheck(); return true; } function terminateSpell() { // called when we have reached the end of the spell checking. var msg = ""; // by FredCK var numrepl = this._getTotalReplaced(); if( numrepl == 0 ) { // see if there were no misspellings to begin with if( !this.wordWin ) { msg = ""; } else { if( this.wordWin.totalMisspellings() ) { // msg += "No words changed."; // by FredCK msg += FCKLang.DlgSpellNoChanges ; // by FredCK } else { // msg += "No misspellings found."; // by FredCK msg += FCKLang.DlgSpellNoMispell ; // by FredCK } } } else if( numrepl == 1 ) { // msg += "One word changed."; // by FredCK msg += FCKLang.DlgSpellOneChange ; // by FredCK } else { // msg += numrepl + " words changed."; // by FredCK msg += FCKLang.DlgSpellManyChanges.replace( /%1/g, numrepl ) ; } if( msg ) { // msg += "\n"; // by FredCK alert( msg ); } if( numrepl > 0 ) { // update the text field(s) on the opener window for( var i = 0; i < this.textInputs.length; i++ ) { // this.textArea.value = this.wordWin.text; if( this.wordWin ) { if( this.wordWin.textInputs[i] ) { this.textInputs[i].value = this.wordWin.textInputs[i]; } } } } // return back to the calling window // this.spellCheckerWin.close(); // by FredCK if ( typeof( this.OnFinished ) == 'function' ) // by FredCK this.OnFinished(numrepl) ; // by FredCK return true; } function undo() { // skip if this is the first word! var ti = this.currentTextIndex; var wi = this.currentWordIndex; if( this.wordWin.totalPreviousWords( ti, wi ) > 0 ) { this.wordWin.removeFocus( ti, wi ); // go back to the last word index that was acted upon do { // if the current word index is zero then reset the seed if( this.currentWordIndex == 0 && this.currentTextIndex > 0 ) { this.currentTextIndex--; this.currentWordIndex = this.wordWin.totalWords( this.currentTextIndex )-1; if( this.currentWordIndex < 0 ) this.currentWordIndex = 0; } else { if( this.currentWordIndex > 0 ) { this.currentWordIndex--; } } } while ( this.wordWin.totalWords( this.currentTextIndex ) == 0 || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromIgnrAll || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromReplAll ); var text_idx = this.currentTextIndex; var idx = this.currentWordIndex; var preReplSpell = this.wordWin.originalSpellings[text_idx][idx]; // if we got back to the first word then set the Undo button back to disabled if( this.wordWin.totalPreviousWords( text_idx, idx ) == 0 ) { this.controlWin.disableUndo(); } var i, j, origSpell ; // examine what happened to this current word. switch( this.wordFlags[text_idx][idx] ) { // replace all: go through this and all the future occurances of the word // and revert them all to the original spelling and clear their flags case this.replAllFlag : for( i = text_idx; i < this.wordWin.textInputs.length; i++ ) { for( j = 0; j < this.wordWin.totalWords( i ); j++ ) { if(( i == text_idx && j >= idx ) || i > text_idx ) { origSpell = this.wordWin.originalSpellings[i][j]; if( origSpell == preReplSpell ) { this._setWordText ( i, j, origSpell, undefined ); } } } } break; // ignore all: go through all the future occurances of the word // and clear their flags case this.ignrAllFlag : for( i = text_idx; i < this.wordWin.textInputs.length; i++ ) { for( j = 0; j < this.wordWin.totalWords( i ); j++ ) { if(( i == text_idx && j >= idx ) || i > text_idx ) { origSpell = this.wordWin.originalSpellings[i][j]; if( origSpell == preReplSpell ) { this.wordFlags[i][j] = undefined; } } } } break; // replace: revert the word to its original spelling case this.replWordFlag : this._setWordText ( text_idx, idx, preReplSpell, undefined ); break; } // For all four cases, clear the wordFlag of this word. re-start the process this.wordFlags[text_idx][idx] = undefined; this._spellcheck(); } } function _spellcheck() { var ww = this.wordWin; // check if this is the last word in the current text element if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) { this.currentTextIndex++; this.currentWordIndex = 0; // keep going if we're not yet past the last text element if( this.currentTextIndex < this.wordWin.textInputs.length ) { this._spellcheck(); return; } else { this.terminateSpell(); return; } } // if this is after the first one make sure the Undo button is enabled if( this.currentWordIndex > 0 ) { this.controlWin.enableUndo(); } // skip the current word if it has already been worked on if( this.wordFlags[this.currentTextIndex][this.currentWordIndex] ) { // increment the global current word index and move on. this.currentWordIndex++; this._spellcheck(); } else { var evalText = ww.getTextVal( this.currentTextIndex, this.currentWordIndex ); if( evalText ) { this.controlWin.evaluatedText.value = evalText; ww.setFocus( this.currentTextIndex, this.currentWordIndex ); this._getSuggestions( this.currentTextIndex, this.currentWordIndex ); } } } function _getSuggestions( text_num, word_num ) { this.controlWin.clearSuggestions(); // add suggestion in list for each suggested word. // get the array of suggested words out of the // three-dimensional array containing all suggestions. var a_suggests = this.wordWin.suggestions[text_num][word_num]; if( a_suggests ) { // got an array of suggestions. for( var ii = 0; ii < a_suggests.length; ii++ ) { this.controlWin.addSuggestion( a_suggests[ii] ); } } this.controlWin.selectDefaultSuggestion(); } function _setAsIgnored( text_num, word_num, flag ) { // set the UI this.wordWin.removeFocus( text_num, word_num ); // do the bookkeeping this.wordFlags[text_num][word_num] = flag; return true; } function _getTotalReplaced() { var i_replaced = 0; for( var i = 0; i < this.wordFlags.length; i++ ) { for( var j = 0; j < this.wordFlags[i].length; j++ ) { if(( this.wordFlags[i][j] == this.replWordFlag ) || ( this.wordFlags[i][j] == this.replAllFlag ) || ( this.wordFlags[i][j] == this.fromReplAll )) { i_replaced++; } } } return i_replaced; } function _setWordText( text_num, word_num, newText, flag ) { // set the UI and form inputs this.wordWin.setText( text_num, word_num, newText ); // keep track of what happened to this word: this.wordFlags[text_num][word_num] = flag; return true; } function _getFormInputs( inputPattern ) { var inputs = new Array(); for( var i = 0; i < document.forms.length; i++ ) { for( var j = 0; j < document.forms[i].elements.length; j++ ) { if( document.forms[i].elements[j].type.match( inputPattern )) { inputs[inputs.length] = document.forms[i].elements[j]; } } } return inputs; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Useful functions used by almost all dialog window pages. * Dialogs should link to this file as the very first script on the page. */ // Automatically detect the correct document.domain (#123). (function() { var d = document.domain ; while ( true ) { // Test if we can access a parent property. try { var test = window.parent.document.domain ; break ; } catch( e ) {} // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... d = d.replace( /.*?(?:\.|$)/, '' ) ; if ( d.length == 0 ) break ; // It was not able to detect the domain. try { document.domain = d ; } catch (e) { break ; } } })() ; // Attention: FCKConfig must be available in the page. function GetCommonDialogCss( prefix ) { // CSS minified by http://iceyboard.no-ip.org/projects/css_compressor return FCKConfig.BasePath + 'dialog/common/' + '|.ImagePreviewArea{border:#000 1px solid;overflow:auto;width:100%;height:170px;background-color:#fff}.FlashPreviewArea{border:#000 1px solid;padding:5px;overflow:auto;width:100%;height:170px;background-color:#fff}.BtnReset{float:left;background-position:center center;background-image:url(images/reset.gif);width:16px;height:16px;background-repeat:no-repeat;border:1px none;font-size:1px}.BtnLocked,.BtnUnlocked{float:left;background-position:center center;background-image:url(images/locked.gif);width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px}.BtnUnlocked{background-image:url(images/unlocked.gif)}.BtnOver{border:outset 1px;cursor:pointer;cursor:hand}' ; } // Gets a element by its Id. Used for shorter coding. function GetE( elementId ) { return document.getElementById( elementId ) ; } function ShowE( element, isVisible ) { if ( typeof( element ) == 'string' ) element = GetE( element ) ; element.style.display = isVisible ? '' : 'none' ; } function SetAttribute( element, attName, attValue ) { if ( attValue == null || attValue.length == 0 ) element.removeAttribute( attName, 0 ) ; // 0 : Case Insensitive else element.setAttribute( attName, attValue, 0 ) ; // 0 : Case Insensitive } function GetAttribute( element, attName, valueIfNull ) { var oAtt = element.attributes[attName] ; if ( oAtt == null || !oAtt.specified ) return valueIfNull ? valueIfNull : '' ; var oValue = element.getAttribute( attName, 2 ) ; if ( oValue == null ) oValue = oAtt.nodeValue ; return ( oValue == null ? valueIfNull : oValue ) ; } function SelectField( elementId ) { var element = GetE( elementId ) ; element.focus() ; // element.select may not be available for some fields (like <select>). if ( element.select ) element.select() ; } // Functions used by text fields to accept numbers only. var IsDigit = ( function() { var KeyIdentifierMap = { End : 35, Home : 36, Left : 37, Right : 39, 'U+00007F' : 46 // Delete } ; return function ( e ) { if ( !e ) e = event ; var iCode = ( e.keyCode || e.charCode ) ; if ( !iCode && e.keyIdentifier && ( e.keyIdentifier in KeyIdentifierMap ) ) iCode = KeyIdentifierMap[ e.keyIdentifier ] ; return ( ( iCode >= 48 && iCode <= 57 ) // Numbers || (iCode >= 35 && iCode <= 40) // Arrows, Home, End || iCode == 8 // Backspace || iCode == 46 // Delete || iCode == 9 // Tab ) ; } } )() ; String.prototype.Trim = function() { return this.replace( /(^\s*)|(\s*$)/g, '' ) ; } String.prototype.StartsWith = function( value ) { return ( this.substr( 0, value.length ) == value ) ; } String.prototype.Remove = function( start, length ) { var s = '' ; if ( start > 0 ) s = this.substring( 0, start ) ; if ( start + length < this.length ) s += this.substring( start + length , this.length ) ; return s ; } String.prototype.ReplaceAll = function( searchArray, replaceArray ) { var replaced = this ; for ( var i = 0 ; i < searchArray.length ; i++ ) { replaced = replaced.replace( searchArray[i], replaceArray[i] ) ; } return replaced ; } function OpenFileBrowser( url, width, height ) { // oEditor must be defined. var iLeft = ( oEditor.FCKConfig.ScreenWidth - width ) / 2 ; var iTop = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ; var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ; sOptions += ",width=" + width ; sOptions += ",height=" + height ; sOptions += ",left=" + iLeft ; sOptions += ",top=" + iTop ; // The "PreserveSessionOnFileBrowser" because the above code could be // blocked by popup blockers. if ( oEditor.FCKConfig.PreserveSessionOnFileBrowser && oEditor.FCKBrowserInfo.IsIE ) { // The following change has been made otherwise IE will open the file // browser on a different server session (on some cases): // http://support.microsoft.com/default.aspx?scid=kb;en-us;831678 // by Simone Chiaretta. var oWindow = oEditor.window.open( url, 'FCKBrowseWindow', sOptions ) ; if ( oWindow ) { // Detect Yahoo popup blocker. try { var sTest = oWindow.name ; // Yahoo returns "something", but we can't access it, so detect that and avoid strange errors for the user. oWindow.opener = window ; } catch(e) { alert( oEditor.FCKLang.BrowseServerBlocked ) ; } } else alert( oEditor.FCKLang.BrowseServerBlocked ) ; } else window.open( url, 'FCKBrowseWindow', sOptions ) ; } /** Utility function to create/update an element with a name attribute in IE, so it behaves properly when moved around It also allows to change the name or other special attributes in an existing node oEditor : instance of FCKeditor where the element will be created oOriginal : current element being edited or null if it has to be created nodeName : string with the name of the element to create oAttributes : Hash object with the attributes that must be set at creation time in IE Those attributes will be set also after the element has been created for any other browser to avoid redudant code */ function CreateNamedElement( oEditor, oOriginal, nodeName, oAttributes ) { var oNewNode ; // IE doesn't allow easily to change properties of an existing object, // so remove the old and force the creation of a new one. var oldNode = null ; if ( oOriginal && oEditor.FCKBrowserInfo.IsIE ) { // Force the creation only if some of the special attributes have changed: var bChanged = false; for( var attName in oAttributes ) bChanged |= ( oOriginal.getAttribute( attName, 2) != oAttributes[attName] ) ; if ( bChanged ) { oldNode = oOriginal ; oOriginal = null ; } } // If the node existed (and it's not IE), then we just have to update its attributes if ( oOriginal ) { oNewNode = oOriginal ; } else { // #676, IE doesn't play nice with the name or type attribute if ( oEditor.FCKBrowserInfo.IsIE ) { var sbHTML = [] ; sbHTML.push( '<' + nodeName ) ; for( var prop in oAttributes ) { sbHTML.push( ' ' + prop + '="' + oAttributes[prop] + '"' ) ; } sbHTML.push( '>' ) ; if ( !oEditor.FCKListsLib.EmptyElements[nodeName.toLowerCase()] ) sbHTML.push( '</' + nodeName + '>' ) ; oNewNode = oEditor.FCK.EditorDocument.createElement( sbHTML.join('') ) ; // Check if we are just changing the properties of an existing node: copy its properties if ( oldNode ) { CopyAttributes( oldNode, oNewNode, oAttributes ) ; oEditor.FCKDomTools.MoveChildren( oldNode, oNewNode ) ; oldNode.parentNode.removeChild( oldNode ) ; oldNode = null ; if ( oEditor.FCK.Selection.SelectionData ) { // Trick to refresh the selection object and avoid error in // fckdialog.html Selection.EnsureSelection var oSel = oEditor.FCK.EditorDocument.selection ; oEditor.FCK.Selection.SelectionData = oSel.createRange() ; // Now oSel.type will be 'None' reflecting the real situation } } oNewNode = oEditor.FCK.InsertElement( oNewNode ) ; // FCK.Selection.SelectionData is broken by now since we've // deleted the previously selected element. So we need to reassign it. if ( oEditor.FCK.Selection.SelectionData ) { var range = oEditor.FCK.EditorDocument.body.createControlRange() ; range.add( oNewNode ) ; oEditor.FCK.Selection.SelectionData = range ; } } else { oNewNode = oEditor.FCK.InsertElement( nodeName ) ; } } // Set the basic attributes for( var attName in oAttributes ) oNewNode.setAttribute( attName, oAttributes[attName], 0 ) ; // 0 : Case Insensitive return oNewNode ; } // Copy all the attributes from one node to the other, kinda like a clone // But oSkipAttributes is an object with the attributes that must NOT be copied function CopyAttributes( oSource, oDest, oSkipAttributes ) { var aAttributes = oSource.attributes ; for ( var n = 0 ; n < aAttributes.length ; n++ ) { var oAttribute = aAttributes[n] ; if ( oAttribute.specified ) { var sAttName = oAttribute.nodeName ; // We can set the type only once, so do it with the proper value, not copying it. if ( sAttName in oSkipAttributes ) continue ; var sAttValue = oSource.getAttribute( sAttName, 2 ) ; if ( sAttValue == null ) sAttValue = oAttribute.nodeValue ; oDest.setAttribute( sAttName, sAttValue, 0 ) ; // 0 : Case Insensitive } } // The style: oDest.style.cssText = oSource.style.cssText ; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts related to the Image dialog window (see fck_image.html). */ var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKDebug = oEditor.FCKDebug ; var FCKTools = oEditor.FCKTools ; var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ; //#### Dialog Tabs // Set the dialog tabs. dialog.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ; if ( !bImageButton && !FCKConfig.ImageDlgHideLink ) dialog.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ; if ( FCKConfig.ImageUpload ) dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; if ( !FCKConfig.ImageDlgHideAdvanced ) dialog.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divLink' , ( tabCode == 'Link' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; } // Get the selected image (if available). var oImage = dialog.Selection.GetSelectedElement() ; if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) ) oImage = null ; // Get the active link. var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ; var oImageOriginal ; function UpdateOriginal( resetSize ) { if ( !eImgPreview ) return ; if ( GetE('txtUrl').value.length == 0 ) { oImageOriginal = null ; return ; } oImageOriginal = document.createElement( 'IMG' ) ; // new Image() ; if ( resetSize ) { oImageOriginal.onload = function() { this.onload = null ; ResetSizes() ; } } oImageOriginal.src = eImgPreview.src ; } var bPreviewInitialized ; window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; GetE('btnLockSizes').title = FCKLang.DlgImgLockRatio ; GetE('btnResetSize').title = FCKLang.DlgBtnResetSize ; // Load the selected element information (if any). LoadSelection() ; // Show/Hide the "Browse Server" button. GetE('tdBrowse').style.display = FCKConfig.ImageBrowser ? '' : 'none' ; GetE('divLnkBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; UpdateOriginal() ; // Set the actual uploader URL. if ( FCKConfig.ImageUpload ) GetE('frmUpload').action = FCKConfig.ImageUploadURL ; dialog.SetAutoSize( true ) ; // Activate the "OK" button. dialog.SetOkButton( true ) ; SelectField( 'txtUrl' ) ; } function LoadSelection() { if ( ! oImage ) return ; var sUrl = oImage.getAttribute( '_fcksavedurl' ) ; if ( sUrl == null ) sUrl = GetAttribute( oImage, 'src', '' ) ; GetE('txtUrl').value = sUrl ; GetE('txtAlt').value = GetAttribute( oImage, 'alt', '' ) ; GetE('txtVSpace').value = GetAttribute( oImage, 'vspace', '' ) ; GetE('txtHSpace').value = GetAttribute( oImage, 'hspace', '' ) ; GetE('txtBorder').value = GetAttribute( oImage, 'border', '' ) ; GetE('cmbAlign').value = GetAttribute( oImage, 'align', '' ) ; var iWidth, iHeight ; var regexSize = /^\s*(\d+)px\s*$/i ; if ( oImage.style.width ) { var aMatchW = oImage.style.width.match( regexSize ) ; if ( aMatchW ) { iWidth = aMatchW[1] ; oImage.style.width = '' ; SetAttribute( oImage, 'width' , iWidth ) ; } } if ( oImage.style.height ) { var aMatchH = oImage.style.height.match( regexSize ) ; if ( aMatchH ) { iHeight = aMatchH[1] ; oImage.style.height = '' ; SetAttribute( oImage, 'height', iHeight ) ; } } GetE('txtWidth').value = iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ; GetE('txtHeight').value = iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ; // Get Advances Attributes GetE('txtAttId').value = oImage.id ; GetE('cmbAttLangDir').value = oImage.dir ; GetE('txtAttLangCode').value = oImage.lang ; GetE('txtAttTitle').value = oImage.title ; GetE('txtLongDesc').value = oImage.longDesc ; if ( oEditor.FCKBrowserInfo.IsIE ) { GetE('txtAttClasses').value = oImage.className || '' ; GetE('txtAttStyle').value = oImage.style.cssText ; } else { GetE('txtAttClasses').value = oImage.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oImage.getAttribute('style',2) ; } if ( oLink ) { var sLinkUrl = oLink.getAttribute( '_fcksavedurl' ) ; if ( sLinkUrl == null ) sLinkUrl = oLink.getAttribute('href',2) ; GetE('txtLnkUrl').value = sLinkUrl ; GetE('cmbLnkTarget').value = oLink.target ; } UpdatePreview() ; } //#### The OK button was hit. function Ok() { if ( GetE('txtUrl').value.length == 0 ) { dialog.SetSelectedTab( 'Info' ) ; GetE('txtUrl').focus() ; alert( FCKLang.DlgImgAlertUrl ) ; return false ; } var bHasImage = ( oImage != null ) ; if ( bHasImage && bImageButton && oImage.tagName == 'IMG' ) { if ( confirm( 'Do you want to transform the selected image on a image button?' ) ) oImage = null ; } else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' ) { if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) ) oImage = null ; } oEditor.FCKUndo.SaveUndoStep() ; if ( !bHasImage ) { if ( bImageButton ) { oImage = FCK.EditorDocument.createElement( 'input' ) ; oImage.type = 'image' ; oImage = FCK.InsertElement( oImage ) ; } else oImage = FCK.InsertElement( 'img' ) ; } UpdateImage( oImage ) ; var sLnkUrl = GetE('txtLnkUrl').value.Trim() ; if ( sLnkUrl.length == 0 ) { if ( oLink ) FCK.ExecuteNamedCommand( 'Unlink' ) ; } else { if ( oLink ) // Modifying an existent link. oLink.href = sLnkUrl ; else // Creating a new link. { if ( !bHasImage ) oEditor.FCKSelection.SelectNode( oImage ) ; oLink = oEditor.FCK.CreateLink( sLnkUrl )[0] ; if ( !bHasImage ) { oEditor.FCKSelection.SelectNode( oLink ) ; oEditor.FCKSelection.Collapse( false ) ; } } SetAttribute( oLink, '_fcksavedurl', sLnkUrl ) ; SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ; } return true ; } function UpdateImage( e, skipId ) { e.src = GetE('txtUrl').value ; SetAttribute( e, "_fcksavedurl", GetE('txtUrl').value ) ; SetAttribute( e, "alt" , GetE('txtAlt').value ) ; SetAttribute( e, "width" , GetE('txtWidth').value ) ; SetAttribute( e, "height", GetE('txtHeight').value ) ; SetAttribute( e, "vspace", GetE('txtVSpace').value ) ; SetAttribute( e, "hspace", GetE('txtHSpace').value ) ; SetAttribute( e, "border", GetE('txtBorder').value ) ; SetAttribute( e, "align" , GetE('cmbAlign').value ) ; // Advances Attributes if ( ! skipId ) SetAttribute( e, 'id', GetE('txtAttId').value ) ; SetAttribute( e, 'dir' , GetE('cmbAttLangDir').value ) ; SetAttribute( e, 'lang' , GetE('txtAttLangCode').value ) ; SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; SetAttribute( e, 'longDesc' , GetE('txtLongDesc').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { e.className = GetE('txtAttClasses').value ; e.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( e, 'class' , GetE('txtAttClasses').value ) ; SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; } } var eImgPreview ; var eImgPreviewLink ; function SetPreviewElements( imageElement, linkElement ) { eImgPreview = imageElement ; eImgPreviewLink = linkElement ; UpdatePreview() ; UpdateOriginal() ; bPreviewInitialized = true ; } function UpdatePreview() { if ( !eImgPreview || !eImgPreviewLink ) return ; if ( GetE('txtUrl').value.length == 0 ) eImgPreviewLink.style.display = 'none' ; else { UpdateImage( eImgPreview, true ) ; if ( GetE('txtLnkUrl').value.Trim().length > 0 ) eImgPreviewLink.href = 'javascript:void(null);' ; else SetAttribute( eImgPreviewLink, 'href', '' ) ; eImgPreviewLink.style.display = '' ; } } var bLockRatio = true ; function SwitchLock( lockButton ) { bLockRatio = !bLockRatio ; lockButton.className = bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ; lockButton.title = bLockRatio ? 'Lock sizes' : 'Unlock sizes' ; if ( bLockRatio ) { if ( GetE('txtWidth').value.length > 0 ) OnSizeChanged( 'Width', GetE('txtWidth').value ) ; else OnSizeChanged( 'Height', GetE('txtHeight').value ) ; } } // Fired when the width or height input texts change function OnSizeChanged( dimension, value ) { // Verifies if the aspect ration has to be maintained if ( oImageOriginal && bLockRatio ) { var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ; if ( value.length == 0 || isNaN( value ) ) { e.value = '' ; return ; } if ( dimension == 'Width' ) value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value / oImageOriginal.width ) ) ; else value = value == 0 ? 0 : Math.round( oImageOriginal.width * ( value / oImageOriginal.height ) ) ; if ( !isNaN( value ) ) e.value = value ; } UpdatePreview() ; } // Fired when the Reset Size button is clicked function ResetSizes() { if ( ! oImageOriginal ) return ; if ( oEditor.FCKBrowserInfo.IsGecko && !oImageOriginal.complete ) { setTimeout( ResetSizes, 50 ) ; return ; } GetE('txtWidth').value = oImageOriginal.width ; GetE('txtHeight').value = oImageOriginal.height ; UpdatePreview() ; } function BrowseServer() { OpenServerBrowser( 'Image', FCKConfig.ImageBrowserURL, FCKConfig.ImageBrowserWindowWidth, FCKConfig.ImageBrowserWindowHeight ) ; } function LnkBrowseServer() { OpenServerBrowser( 'Link', FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; } function OpenServerBrowser( type, url, width, height ) { sActualBrowser = type ; OpenFileBrowser( url, width, height ) ; } var sActualBrowser ; function SetUrl( url, width, height, alt ) { if ( sActualBrowser == 'Link' ) { GetE('txtLnkUrl').value = url ; UpdatePreview() ; } else { GetE('txtUrl').value = url ; GetE('txtWidth').value = width ? width : '' ; GetE('txtHeight').value = height ? height : '' ; if ( alt ) GetE('txtAlt').value = alt; UpdatePreview() ; UpdateOriginal( true ) ; } dialog.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; case 500 : alert( 'The connector is disabled' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } sActualBrowser = '' ; SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.ImageUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.ImageUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.ImageUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.ImageUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } return true ; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts related to the Flash dialog window (see fck_flash.html). */ var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKTools = oEditor.FCKTools ; //#### Dialog Tabs // Set the dialog tabs. dialog.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ; if ( FCKConfig.FlashUpload ) dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; if ( !FCKConfig.FlashDlgHideAdvanced ) dialog.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; } // Get the selected flash embed (if available). var oFakeImage = dialog.Selection.GetSelectedElement() ; var oEmbed ; if ( oFakeImage ) { if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckflash') ) oEmbed = FCK.GetRealElement( oFakeImage ) ; else oFakeImage = null ; } window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; // Load the selected element information (if any). LoadSelection() ; // Show/Hide the "Browse Server" button. GetE('tdBrowse').style.display = FCKConfig.FlashBrowser ? '' : 'none' ; // Set the actual uploader URL. if ( FCKConfig.FlashUpload ) GetE('frmUpload').action = FCKConfig.FlashUploadURL ; dialog.SetAutoSize( true ) ; // Activate the "OK" button. dialog.SetOkButton( true ) ; SelectField( 'txtUrl' ) ; } function LoadSelection() { if ( ! oEmbed ) return ; GetE('txtUrl').value = GetAttribute( oEmbed, 'src', '' ) ; GetE('txtWidth').value = GetAttribute( oEmbed, 'width', '' ) ; GetE('txtHeight').value = GetAttribute( oEmbed, 'height', '' ) ; // Get Advances Attributes GetE('txtAttId').value = oEmbed.id ; GetE('chkAutoPlay').checked = GetAttribute( oEmbed, 'play', 'true' ) == 'true' ; GetE('chkLoop').checked = GetAttribute( oEmbed, 'loop', 'true' ) == 'true' ; GetE('chkMenu').checked = GetAttribute( oEmbed, 'menu', 'true' ) == 'true' ; GetE('cmbScale').value = GetAttribute( oEmbed, 'scale', '' ).toLowerCase() ; GetE('txtAttTitle').value = oEmbed.title ; if ( oEditor.FCKBrowserInfo.IsIE ) { GetE('txtAttClasses').value = oEmbed.getAttribute('className') || '' ; GetE('txtAttStyle').value = oEmbed.style.cssText ; } else { GetE('txtAttClasses').value = oEmbed.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) || '' ; } UpdatePreview() ; } //#### The OK button was hit. function Ok() { if ( GetE('txtUrl').value.length == 0 ) { dialog.SetSelectedTab( 'Info' ) ; GetE('txtUrl').focus() ; alert( oEditor.FCKLang.DlgAlertUrl ) ; return false ; } oEditor.FCKUndo.SaveUndoStep() ; if ( !oEmbed ) { oEmbed = FCK.EditorDocument.createElement( 'EMBED' ) ; oFakeImage = null ; } UpdateEmbed( oEmbed ) ; if ( !oFakeImage ) { oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ; oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ; oFakeImage = FCK.InsertElement( oFakeImage ) ; } oEditor.FCKEmbedAndObjectProcessor.RefreshView( oFakeImage, oEmbed ) ; return true ; } function UpdateEmbed( e ) { SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ; SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ; SetAttribute( e, 'src', GetE('txtUrl').value ) ; SetAttribute( e, "width" , GetE('txtWidth').value ) ; SetAttribute( e, "height", GetE('txtHeight').value ) ; // Advances Attributes SetAttribute( e, 'id' , GetE('txtAttId').value ) ; SetAttribute( e, 'scale', GetE('cmbScale').value ) ; SetAttribute( e, 'play', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ; SetAttribute( e, 'loop', GetE('chkLoop').checked ? 'true' : 'false' ) ; SetAttribute( e, 'menu', GetE('chkMenu').checked ? 'true' : 'false' ) ; SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { SetAttribute( e, 'className', GetE('txtAttClasses').value ) ; e.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( e, 'class', GetE('txtAttClasses').value ) ; SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; } } var ePreview ; function SetPreviewElement( previewEl ) { ePreview = previewEl ; if ( GetE('txtUrl').value.length > 0 ) UpdatePreview() ; } function UpdatePreview() { if ( !ePreview ) return ; while ( ePreview.firstChild ) ePreview.removeChild( ePreview.firstChild ) ; if ( GetE('txtUrl').value.length == 0 ) ePreview.innerHTML = '&nbsp;' ; else { var oDoc = ePreview.ownerDocument || ePreview.document ; var e = oDoc.createElement( 'EMBED' ) ; SetAttribute( e, 'src', GetE('txtUrl').value ) ; SetAttribute( e, 'type', 'application/x-shockwave-flash' ) ; SetAttribute( e, 'width', '100%' ) ; SetAttribute( e, 'height', '100%' ) ; ePreview.appendChild( e ) ; } } // <embed id="ePreview" src="fck_flash/claims.swf" width="100%" height="100%" style="visibility:hidden" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> function BrowseServer() { OpenFileBrowser( FCKConfig.FlashBrowserURL, FCKConfig.FlashBrowserWindowWidth, FCKConfig.FlashBrowserWindowHeight ) ; } function SetUrl( url, width, height ) { GetE('txtUrl').value = url ; if ( width ) GetE('txtWidth').value = width ; if ( height ) GetE('txtHeight').value = height ; UpdatePreview() ; dialog.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; case 500 : alert( 'The connector is disabled' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.FlashUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.FlashUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.FlashUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.FlashUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } return true ; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Plugin to insert "Placeholders" in the editor. */ // Register the related command. FCKCommands.RegisterCommand( 'Placeholder', new FCKDialogCommand( 'Placeholder', FCKLang.PlaceholderDlgTitle, FCKPlugins.Items['placeholder'].Path + 'fck_placeholder.html', 340, 160 ) ) ; // Create the "Plaholder" toolbar button. var oPlaceholderItem = new FCKToolbarButton( 'Placeholder', FCKLang.PlaceholderBtn ) ; oPlaceholderItem.IconPath = FCKPlugins.Items['placeholder'].Path + 'placeholder.gif' ; FCKToolbarItems.RegisterItem( 'Placeholder', oPlaceholderItem ) ; // The object used for all Placeholder operations. var FCKPlaceholders = new Object() ; // Add a new placeholder at the actual selection. FCKPlaceholders.Add = function( name ) { var oSpan = FCK.InsertElement( 'span' ) ; this.SetupSpan( oSpan, name ) ; } FCKPlaceholders.SetupSpan = function( span, name ) { span.innerHTML = '[[ ' + name + ' ]]' ; span.style.backgroundColor = '#ffff00' ; span.style.color = '#000000' ; if ( FCKBrowserInfo.IsGecko ) span.style.cursor = 'default' ; span._fckplaceholder = name ; span.contentEditable = false ; // To avoid it to be resized. span.onresizestart = function() { FCK.EditorWindow.event.returnValue = false ; return false ; } } // On Gecko we must do this trick so the user select all the SPAN when clicking on it. FCKPlaceholders._SetupClickListener = function() { FCKPlaceholders._ClickListener = function( e ) { if ( e.target.tagName == 'SPAN' && e.target._fckplaceholder ) FCKSelection.SelectNode( e.target ) ; } FCK.EditorDocument.addEventListener( 'click', FCKPlaceholders._ClickListener, true ) ; } // Open the Placeholder dialog on double click. FCKPlaceholders.OnDoubleClick = function( span ) { if ( span.tagName == 'SPAN' && span._fckplaceholder ) FCKCommands.GetCommand( 'Placeholder' ).Execute() ; } FCK.RegisterDoubleClickHandler( FCKPlaceholders.OnDoubleClick, 'SPAN' ) ; // Check if a Placholder name is already in use. FCKPlaceholders.Exist = function( name ) { var aSpans = FCK.EditorDocument.getElementsByTagName( 'SPAN' ) ; for ( var i = 0 ; i < aSpans.length ; i++ ) { if ( aSpans[i]._fckplaceholder == name ) return true ; } return false ; } if ( FCKBrowserInfo.IsIE ) { FCKPlaceholders.Redraw = function() { if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) return ; var aPlaholders = FCK.EditorDocument.body.innerText.match( /\[\[[^\[\]]+\]\]/g ) ; if ( !aPlaholders ) return ; var oRange = FCK.EditorDocument.body.createTextRange() ; for ( var i = 0 ; i < aPlaholders.length ; i++ ) { if ( oRange.findText( aPlaholders[i] ) ) { var sName = aPlaholders[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ; oRange.pasteHTML( '<span style="color: #000000; background-color: #ffff00" contenteditable="false" _fckplaceholder="' + sName + '">' + aPlaholders[i] + '</span>' ) ; } } } } else { FCKPlaceholders.Redraw = function() { if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) return ; var oInteractor = FCK.EditorDocument.createTreeWalker( FCK.EditorDocument.body, NodeFilter.SHOW_TEXT, FCKPlaceholders._AcceptNode, true ) ; var aNodes = new Array() ; while ( ( oNode = oInteractor.nextNode() ) ) { aNodes[ aNodes.length ] = oNode ; } for ( var n = 0 ; n < aNodes.length ; n++ ) { var aPieces = aNodes[n].nodeValue.split( /(\[\[[^\[\]]+\]\])/g ) ; for ( var i = 0 ; i < aPieces.length ; i++ ) { if ( aPieces[i].length > 0 ) { if ( aPieces[i].indexOf( '[[' ) == 0 ) { var sName = aPieces[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ; var oSpan = FCK.EditorDocument.createElement( 'span' ) ; FCKPlaceholders.SetupSpan( oSpan, sName ) ; aNodes[n].parentNode.insertBefore( oSpan, aNodes[n] ) ; } else aNodes[n].parentNode.insertBefore( FCK.EditorDocument.createTextNode( aPieces[i] ) , aNodes[n] ) ; } } aNodes[n].parentNode.removeChild( aNodes[n] ) ; } FCKPlaceholders._SetupClickListener() ; } FCKPlaceholders._AcceptNode = function( node ) { if ( /\[\[[^\[\]]+\]\]/.test( node.nodeValue ) ) return NodeFilter.FILTER_ACCEPT ; else return NodeFilter.FILTER_SKIP ; } } FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKPlaceholders.Redraw ) ; // We must process the SPAN tags to replace then with the real resulting value of the placeholder. FCKXHtml.TagProcessors['span'] = function( node, htmlNode ) { if ( htmlNode._fckplaceholder ) node = FCKXHtml.XML.createTextNode( '[[' + htmlNode._fckplaceholder + ']]' ) ; else FCKXHtml._AppendChildNodes( node, htmlNode, false ) ; return node ; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Placholder Italian language file. */ FCKLang.PlaceholderBtn = 'Aggiungi/Modifica Placeholder' ; FCKLang.PlaceholderDlgTitle = 'Proprietà del Placeholder' ; FCKLang.PlaceholderDlgName = 'Nome del Placeholder' ; FCKLang.PlaceholderErrNoName = 'Digitare il nome del placeholder' ; FCKLang.PlaceholderErrNameInUse = 'Il nome inserito è già in uso' ;
JavaScript