').css({position:'绝对',顶部:“0px”,左:“0px”,宽度:'1px',高度:$('body').css('height')}).appendTo(“正文”);};/***解冻车身高度。*/Drupal.unfreezeHeight=函数(){$(“#冻结高度”).remove();};/***对Drupal路径进行编码,以便在URL中使用。**出于美学原因,斜线是不可避免的。*/Drupal.encodePath=函数(item,uri){uri=uri||location.href;return encodeURIComponent(item).replace(/%2F/g,'/');};/***获取文本区域中的文本选择。*/Drupal.getSelection=函数(元素){if(元素类型.selectionStart!=“数字”&&document.selection){//当前选择。var range1=document.selection.createRange();var range2=range1.duplicate();//选择所有文本。range2.moveToElementText(元素);//现在将“虚拟”端点移动到原始范围的端点。range2.设置端点('EndToEnd',range1);//现在我们可以计算起点和终点了。var开始=范围2.text.length-范围1.text.lenth;var结束=开始+范围1.text.length;return{“start”:开始,“end”:结束};}return{“开始”:element.selectionStart,“结束”:element.selectionEnd};};/***从Ajax响应构建错误消息。*/Drupal.ajaxError=函数(xmlhttp,uri){var statusCode、statusText、pathText、responseText、readyStateText、message;if(xmlhttp.status){statusCode=“\n”+Drupal.t(“发生AJAX HTTP错误。”)+“\n”+Drupal.t(“HTTP结果代码:!status”,{'!status':xmlhttp.status});}其他{statusCode=“\n”+Drupal.t(“AJAX HTTP请求异常终止。”);}statusCode+=“\n”+Drupal.t(“调试信息如下。”);pathText=“\n”+Drupal.t(“路径:!uri”,{'!uri':uri});statusText=“”;//在某些情况下,当statusCode==0时,可能不会定义xmlhttp.statusText。//不幸的是,用typeof等进行测试似乎并没有抓住这一点//测试会导致异常。所以我们需要在这里捕获异常。尝试{statusText=“\n”+Drupal.t(“statusText:!statusText”,{'!statusText':$.trim(xmlhttp.statusText)});}捕获(e){}responseText=“”;//同样,我们无法确定是否访问//xmlhttp.responseText将引发异常。所以我们会抓住它。尝试{responseText=“\n”+Drupal.t(“响应文本:!response文本”,{'!respondseText':$.trim(xmlhttp.response文本)});}捕获(e){}//通过剥离HTML标记和换行符,使responseText更具可读性。responseText=response Text.replace(/<(“[^”]*“|'[^']*'|[^'“>])*>/gi,”“);responseText=response Text.replace(/[\n]+\s+/g,“\n”);//除了status==0之外,我们不需要readyState。readyStateText=xmlhttp.status==0?(“\n”+Drupal.t(“ReadyState:!ReadyState”,{'!ReadyState':xmlhttp.ReadyState}):“”;消息=statusCode+pathText+statusText+responseText+readyStateText;返回消息;};//指示启用JS的类;用于造型目的。$('html).addClass('js');//“启用js”cookie。document.cookie=‘has_js=1;路径=/';/***添加到jQuery.support。*/$(函数(){/***布尔值,指示是否支持位置:fixed。*/if(jQuery.support.positionFixed===未定义){var el=$('').appendTo(document.body);jQuery.support.positionFixed=el[0].offsetTop===10;el.remove();}});//附加所有行为。$(函数(){Drupal.attachBehaviors(文档、Drupal.settings);});/***默认主题。*/Drupal.theme.prototype={/***设置文本格式,以便在句子内的占位符中强调显示。**@param字符串*要格式化的文本(纯文本)。*@返回*格式化文本(html)。*/占位符:函数(str){返回''+Drupal.checkPlain(str)+'';}};})(jQuery);