易栈网-膘叔

发文热力图 2025-12-07 ~ 2026-12-06
少 多 近 365 天共 27 篇
浏览模式: 标准 | 列表 | 图文
推荐一个Jquery插件:autoComplete

推荐一个Jquery插件:autoComplete

我就不翻译了……

这些东西也不复杂。

Copy网站开始……黑黑

Dependencies

Known issues:

  • When completing multiple values, only the last value can be edited with the autocomplete help
  • mustMatch option is broken (mostly fixed in latest revision)
  • default browser autocomplete displays a long list of values scrollable, that isn’t supported yet

Recent changes

Documentation

Autocompletition of input elements is a very helpful tool to guide users in entering the right value. That value can come from a (big) list of possible values or it may consist of values the user has entered before. This plugin makes it easy for a developer to setup autocomplete for text inputs and textareas.

Setup
First step in setting up autocomplete is to decide what kind of data is provided. To autocomplete a few dozen possible values, it is a good idea to provide local data. The data is loaded only once and then cached, providing a very responsive interface.
If the data can consist of hundreds, thousands or even millions of rows, the searching and filtering must be done where performance won’t suffer, in most cases a relational database (eg. MySQL). The plugin will request the rows for the entered value, displaying only a subset of all possible values.
For local autocomplete, just pass the data as an array to the autocomplete plugin. For remote autocomplete, specify an URL pointing to the resource providing the data. The plugin then requests data with a “q” parameter containing the current search value.

API

  • autocomplete( String|Array urlOrData, Map options ) returns jQuery
    Provide autocomplete for text-inputs or textareas.

    Depends on dimensions plugin’s offset method for correct positioning of the select box and bgiframe plugin
    to fix IE’s problem with selects.

    Options

    • inputClass (String): This class will be added to the input box. Default: “ac_input”
    • resultsClass (String): The class for the UL that will contain the result items (result items are LI elements). Default: “ac_results”
    • loadingClass (String): The class for the input box while results are being fetched from the server. Default: “ac_loading”
    • minChars (Number): The minimum number of characters a user has to type before the autocompleter activates. Default: 1
    • delay (Number): The delay in milliseconds the autocompleter waits after a keystroke to activate itself. Default: 400 for remote, 10 for local
    • cacheLength (Number): The number of backend query results to store in cache. If set to 1 (the current result), no caching will happen. Do not set below 1. Default: 10
    • matchSubset (Boolean): Whether or not the autocompleter can use a cache for more specific queries. This means that all matches of “foot” are a subset of all matches for “foo”. Usually this is true, and using this options decreases server load and increases performance. Only useful with cacheLength settings bigger then one, like 10. Default: true
    • matchCase (Boolean): Whether or not the comparison is case sensitive. Only important only if you use caching. Default: false
    • matchContains (Boolean): Whether or not the comparison looks inside (i.e. does “ba” match “foo bar”) the search results. Only important if you use caching. Don’t mix with autofill. Default: false
    • mustMatch (Booolean): If set to true, the autocompleter will only allow results that are presented by the backend. Note that illegal values result in an empty input box. Default: false
    • extraParams (Object): Extra parameters for the backend. If you were to specify { bar:4 }, the autocompleter would call my_autocomplete_backend.php?q=foo&bar=4 (assuming the input box contains “foo”). Default: {}
    • selectFirst (Boolean): If this is set to true, the first autocomplete value will be automatically selected on tab/return, even if it has not been handpicked by keyboard or mouse action. If there is a handpicked (highlighted) result, that result will take precedence. Default: true
    • formatItem (Function): Provides advanced markup for an item. For each row of results, this function will be called. The returned value will be displayed inside an LI element in the results list. Autocompleter will provide 3 parameters: the results row, the position of the row in the list of results (starting at 1), and the number of items in the list of results. Default: none, assumes that a single row contains a single value.
    • formatResult (Function): Similar to formatResult, but provides the formatting for the value to be put into the input field. Again three arguments: Data, position (starting with one) and total number of data. Default: none, assumes either plain data to use as result or uses the same value as provided by formatItem.
    • multiple (Boolean): Whether to allow more then one autocomplted-value to enter. Default: false
    • multipleSeparator (String): Seperator to put between values when using multiple option. Default: “, “
    • width (Number): Specify a custom width for the select box. Default: width of the input element
    • autoFill (Boolean): Fill the textinput while still selecting a value, replacing the value if more is type or something else is selected. Default: false
    • max (Number): Limit the number of items in the select box. Is also send as a “limit” parameter with a remote request. Default: 10

    Example:

    Autocomplete a text-input with remote data. For small to giant datasets.

    When the user starts typing, a request is send to the specified backend (”my_autocomplete_backend.php”),
    with a GET parameter named q that contains the current value of the input box and a paremeter “limit” with
    the value specified for the max option.

    A value of “foo” would result in this request url: my_autocomplete_backend.php?q=foo&limit=10

    The result must return with one value on each line. The result is presented in the order
    the backend sends it.

    $("#input_box").autocomplete("my_autocomplete_backend.php");

    HTML:

    <input id="input_box" />

    Example:

    Autcomplete a text-input with local data. For small datasets.

    $("#input_box").autocomplete(["Cologne", "Berlin", "Munich"]);

    HTML:

    <input id="input_box" />

    Example:

    Autcomplete a text-input with data received via AJAX. For small to medium sized datasets.

    $.getJSON("my_backend.php", function(data) {
      $("#input_box").autocomplete(data);
    });

    HTML:

    <input id="input_box" />

    Example:

    Autcomplete a textarea with local data (for small datasets). Once the user chooses one
    value, a separator is appended (by default a comma, see multipleSeparator option) and more values
    are autocompleted.

    $("#mytextarea").autocomplete(["Cologne", "Berlin", "Munich"], {
     multiple: true
    });

    HTML:

    <textarea id="mytextarea" />
  • result( Function handler ) returns jQuery
    Handle the result of a search event. Is executed when the user selects a value or a
    programmatic search event is triggered (see search()).

    You can add and remove (using unbind(”result”)) this event at any time.

    Example:

    Bind a handler to the result event to display the selected value in a #result element.
    The first argument is a generic event object, in this case with type “result”.
    The second argument refers to the selected data, which can be a plain string value or an array or object.
    The third argument is the formatted value that is inserted into the input field.

    jQuery('input#suggest').result(function(event, data, formatted) {
      jQuery("#result").html( !data ? "No match!" : "Selected: " + formatted);
    });
  • search( ) returns jQuery
    Trigger a search event. See result(Function) for binding to that event.

    A search event mimics the same behaviour as when the user selects a value from
    the list of autocomplete items. You can use it to execute anything that does something
    with the selected value, beyond simply putting the value into the input and submitting it.

    Example:

    Triggers a search event.

    jQuery('input#suggest').search();

jQuery一些插件的链接[转]

文件上传(File upload)JQuery_001

Ajax File Upload.
jQUploader.
Multiple File Upload plugin.
jQuery File Style.
Styling an input type file.
Progress Bar Plugin.

表单验证(Form Validation)

jQuery Validation.
Auto Help.
Simple jQuery form validation.
jQuery XAV - form validations.
jQuery AlphaNumeric.
Masked Input.
TypeWatch Plugin.
Text limiter for form fields.
Ajax Username Check with jQuery.

表单-选取框(Form - Select Box stuff)

jQuery Combobox.
jQuery controlled dependent (or Cascadign) Select List.
Multiple Selects.
Select box manipulation.
Select Combo Plugin.
jQuery - LinkedSelect
Auto-populate multiple select boxes.
Choose Plugin (Select Replacement).

表单基本、输入框、选择框等(Form Basics, Input Fields, Checkboxes etc.)

jQuery Form Plugin.
jQuery-Form.
jLook Nice Forms.
jNice.
Ping Plugin.
Toggle Form Text.
ToggleVal.
jQuery Field Plugin.
jQuery Form’n Field plugin.
jQuery Checkbox manipulation.
jTagging.
jQuery labelcheck.
Overlabel.
3 state radio buttons.
ShiftCheckbox jQuery Plugin.
Watermark Input.
jQuery Checkbox (checkboxes with imags).
jQuery SpinButton Control.
jQuery Ajax Form Builder.
jQuery Focus Fields.
jQuery Time Entry.

时间、日期和颜色选取(Time, Date and Color Picker)

jQuery UI Datepicker.
jQuery date picker plugin.
jQuery Time Picker.
Time Picker.
ClickPick.
TimePicker.
Farbtastic jQuery Color Picker Plugin.
Color Picker by intelliance.fr.

投票插件(Rating Plugins)

jQuery Star Rating Plugin.
jQuery Star Rater.
Content rater with asp.net, ajax and jQuery.
Half-Star Rating Plugin.

搜索插件(Search Plugins)

jQuery Suggest.
jQuery Autocomplete.
jQuery Autocomplete Mod.
jQuery Autocomplete by AjaxDaddy.
jQuery Autocomplete Plugin with HTML formatting.
jQuery Autocompleter.
AutoCompleter (Tutorial with PHP&MySQL).
quick Search jQuery Plugin.

编辑器(Inline Edit & Editors)JQuery_002

jTagEditor.
WYMeditor.
jQuery jFrame.
Jeditable - edit in place plugin for jQuery.
jQuery editable.
jQuery Disable Text Select Plugin.
Edit in Place with Ajax using jQuery.
jQuery Plugin - Another In-Place Editor.
TableEditor.
tEditable - in place table editing for jQuery.

多媒体、视频、Flash等(Audio, Video, Flash, SVG, etc)

jMedia - accessible multi-media embedding.
JBEdit - Ajax online Video Editor.
jQuery MP3 Plugin.
jQuery Media Plugin.
jQuery Flash Plugin.
Embed QuickTime.
SVG Integration.

图片(Photos/Images/Galleries)

ThickBox.
jQuery lightBox plugin.
jQuery Image Strip.
jQuery slideViewer.
jQuery jqGalScroll 2.0.
jQuery - jqGalViewII.
jQuery - jqGalViewIII.
jQuery Photo Slider.
jQuery Thumbs - easily create thumbnails.
jQuery jQIR Image Replacement.
jCarousel Lite.
jQPanView.
jCarousel.
Interface Imagebox.
Image Gallery using jQuery, Interface & Reflactions.
simple jQuery Gallery.
jQuery Gallery Module.
EO Gallery.
jQuery ScrollShow.
jQuery Cycle Plugin.
jQuery Flickr.
jQuery Lazy Load Images Plugin.
Zoomi - Zoomable Thumbnails.
jQuery Crop - crop any image on the fly.
Image Reflection.

Google地图(Google Map)

jQuery Plugin googlemaps.
jMaps jQuery Maps Framework.
jQmaps.
jQuery & Google Maps.
jQuery Maps Interface forr Google and Yahoo maps.
jQuery J Maps - by Tane Piper.

游戏(Games)

Tetris with jQuery.
jQuery Chess.
Mad Libs Word Game.
jQuery Puzzle.
jQuery Solar System (not a game but awesome jQuery Stuff).

表格等(Tables, Grids etc.)

UI/Tablesorter.JQuery_003
jQuery ingrid.
jQuery Grid Plugin.
Table Filter - awesome!.
TableEditor.
jQuery Tree Tables.
Expandable “Detail” Table Rows.
Sortable Table ColdFusion Costum Tag with jQuery UI.
jQuery Bubble.
TableSorter.
Scrollable HTML Table.
jQuery column Manager Plugin.
jQuery tableHover Plugin.
jQuery columnHover Plugin.
jQuery Grid.
TableSorter plugin for jQuery.
tEditable - in place table editing for jQuery.
jQuery charToTable Plugin.
jQuery Grid Column Sizing.
jQuery Grid Row Sizing.

统计图(Charts, Presentation etc.)

jQuery Wizard Plugin .
jQuery Chart Plugin.
Bar Chart.

边框、圆角、背景(Border, Corners, Background)

jQuery Corner.
jQuery Curvy Corner.
Nifty jQuery Corner.
Transparent Corners.
jQuery Corner Gallery.
Gradient Plugin.

文字和超链接(Text and Links)

jQuery Spoiler plugin.
Text Highlighting.
Disable Text Select Plugin.
jQuery Newsticker.
Auto line-height Plugin.
Textgrad - a text gradient plugin.
LinkLook - a link thumbnail preview.
pager jQuery Plugin.
shortKeys jQuery Plugin.
jQuery Biggerlink.
jQuery Ajax Link Checker.

鼠标提示(Tooltips)

jQuery Plugin - Tooltip.
jTip - The jQuery Tool Tip.
clueTip.
BetterTip.
Flash Tooltips using jQuery.
ToolTip.

菜单和导航(Menus, Navigations)

jQuery Tabs Plugin - awesome! . [demo nested tabs.]
another jQuery nested Tab Set example (based on jQuery Tabs Plugin).
jQuery idTabs.
jdMenu - Hierarchical Menu Plugin for jQuery.
jQuery SuckerFish Style.
jQuery Plugin Treeview.
treeView Basic.
FastFind Menu.
Sliding Menu.
Lava Lamp jQuery Menu.
jQuery iconDock.
jVariations Control Panel.
ContextMenu plugin.
clickMenu.
CSS Dock Menu.
jQuery Pop-up Menu Tutorial.
Sliding Menu.

http://stilbuero.de/jquery/tabs_3/

幻灯、翻转等(Accordions, Slide and Toggle stuff)

jQuery Plugin Accordion.
jQuery Accordion Plugin Horizontal Way.
haccordion - a simple horizontal accordion plugin for jQuery.
Horizontal Accordion by portalzine.de.
HoverAccordion.
Accordion Example from fmarcia.info.
jQuery Accordion Example.
jQuery Demo - Expandable Sidebar Menu.
Sliding Panels for jQuery.
jQuery ToggleElements.
Coda Slider.
jCarousel.
Accesible News Slider Plugin.
Showing and Hiding code Examples.
jQuery Easing Plugin.
jQuery Portlets.
AutoScroll.
Innerfade.

拖放插件(Drag and Drop)

UI/Draggables.
EasyDrag jQuery Plugin.
jQuery Portlets.
jqDnR - drag, drop resize.
Drag Demos.

XML XSL JSON Feeds

XSLT Plugin.
jQuery Ajax call and result XML parsing.
xmlObjectifier - Converts XML DOM to JSON.
jQuery XSL Transform.
jQuery Taconite - multiple Dom updates.
RSS/ATOM Feed Parser Plugin.
jQuery Google Feed Plugin.

浏览器(Browserstuff)

Wresize - IE Resize event Fix Plugin.
jQuery ifixpng.
jQuery pngFix.
Link Scrubber - removes the dotted line onfocus from links.
jQuery Perciformes - the entire suckerfish familly under one roof.
Background Iframe.
QinIE - for proper display of Q tags in IE.
jQuery Accessibility Plugin.
jQuery MouseWheel Plugin.

对话框、确认窗口(Alert, Prompt, Confirm Windows)

jQuery Impromptu.
jQuery Confirm Plugin.
jqModal.
SimpleModal.

CSS

jQuery Style Switcher.
JSS - Javascript StyleSheets.
jQuery Rule - creation/manipulation of CSS Rules.
jPrintArea.

DOM、AJAX和其它JQuery插件(DOM, Ajax and other jQuery plugins)

FlyDOM.
jQuery Dimenion Plugin.
jQuery Loggin.
Metadata - extract metadata from classes, attributes, elements.
Super-tiny Client-Side Include Javascript jQuery Plugin.
Undo Made Easy with Ajax.
JHeartbeat - periodically poll the server.
Lazy Load Plugin.
Live Query.
jQuery Timers.
jQuery Share it - display social bookmarking icons.
jQuery serverCookieJar.
jQuery autoSave.
jQuery Puffer.
jQuery iFrame Plugin.
Cookie Plugin for jQuery.
jQuery Spy - awesome plugin.
Effect Delay Trick.
jQuick - a quick tag creator for jQuery.
Metaobjects
.
elementReady.

回顾NeatStudio历程

刚才把域名往alexa里面输入了一下,发现neatcn.com还是在全球没有排名,只是下面关联的网站里,却有好多以往的东西。

717dd8fd4594366b7d44c42318928492

翻开以前的htdocs目录,找到了neatstudio目录,感慨一下。现在再看看以前的代码,还有值得可取的地方,当然……我写了不少的垃圾代码。怀念一下walker,hihiyou,totododo,老戴等团队成员。(他们写的代码比我优秀啊……顺便在网上邀请一下,等满月的时候,丫一个个给我过来送红包。NND,结婚的时候,怕你们太远,没让你们过来……满月你们还敢再逃?)

109fb084c399b53337a28b3c8a5cea6a

d05fcd00ebba35b294dc48143b6ce1c3

JpGraph中文乱码完美解决方案[转]

JpGraph中文乱码完美解决方案[转]

原文地址:http://lizi.blogbus.com/logs/12601515.html

很多人使用JpGraph会出现乱码问题,但是网上有好多并无效果的解决方式,经过反复试验及在网上看了其它人的经验,总结出在2.3版下最终较完美解决方案
1、把simsun.ttc字体拷到服务器/usr/X11R6/lib/X11/fonts/truetype下,当然这个目录可以自定义
2、不需要更改$aFF === FF_SIMSUN或$aFF === FF_CHINESE ,直接用以下代码即可
$title = "JpGraph中文测试";
$title = iconv("UTF-8", "gb2312", $title);
$graph->title->Set($title);
就可以完美的解决中文问题了
3、还有一个问题,就是右上方的中文显示问题,就是SetLegend函数,解决方式如下
打开jpgraph.php文件,找到
private $font_family=FF_FONT1,$font_style=FS_NORMAL,$font_size=12;
用
private $font_family=FF_SIMSUN,$font_style=FS_NORMAL,$font_size=8;
替换就OK了^_^

后记:本来都忘了这个了,正好有朋友问起类似的问题,于是又GOOGLE了一下,找到了这个,记录一下,也为GOOGLE的收录作点贡献,这样以后再有人遇到类似问题,更容易被搜索到。

简化TM的签名

简化TM的签名

一些网页上图片操作的技巧
http://blog.rexsong.com/?p=746

公开的SVN网站
http://www.coollittlethings.com/

Marquee 的JS实现
http://www.popub.net/script/MSClass.html

流程图制作软件下载
http://www.3ddown.com/go.asp?=22721

一个链接
http://www.btv.org/btvweb/images

开源的FLASH CHART网址
http://teethgrinder.co.uk/open-flash-chart/

我的博客的另外一个域名
http://www.52cd.net

朋友的网站
http://www.hooo.com.cn

临时记录,一个商城的网址
http://www.enjoytown.com.cn/

待出售的域名:
www.fans123.com www.fans123.net www.gmking.net 等

三八节,陪老婆买了点婴儿用品

妇女节,天气阴有小雨,陪媳妇到港汇兜了一圈。买了一点婴儿用品。

虽然baby还没有出来,但媳妇却挺当成一回事,买了点衣服和奶瓶,用我的话来说,是放在橱里长灰了,可是,不能打消她的积极性啊。最后拿上了300W的数码相机,用着并不娴熟的技术拍了几张照片,放到网上以贻大方。

c91997701c9142840f73e2550e5b6ef2

41752ad833b48f276406ffe1e319b8c6

614963395ae71426cab718aeda2a5486

利用array_diff函数更新tag

利用array_diff函数更新tag

先介绍一下array_diff函数

array_diff -- 计算数组的差集
说明
array array_diff ( array array1, array array2 [, array ...] )


array_diff() 返回一个数组,该数组包括了所有在 array1 中但是不在任何其它参数数组中的值。注意键名保留不变。

注意: 两个单元仅在 (string) $elem1 === (string) $elem2 时被认为是相同的。也就是说,当字符串的表达是一样的时候。

注意: 注意本函数只检查了多维数组中的一维。当然可以用 array_diff($array1[0], $array2[0]); 检查更深的维度。

::::::本函数在 PHP 4.0.4 中是坏的! :::::

在网站的实际应用中,我们可能会用到TAG(标签),对标签的更新可能也会经常遇到,当然添加了之后不修改另作别论。

比如,我们为一条新闻添加了如下标签:新闻,CGX,艳照门 (开个玩笑,呵呵),存入数据库后,应该是在tag表里存入类似于这样的数据

id newsid tagname
1 1 新闻
2 1 CGX
3 1 艳照门

其中id是自增字段,newsid是新闻的ID,tagname是刚刚存入的标签(存的时候以逗号分隔)。

然而现实总是残酷的,XXX总局规定我们不得把“艳照门”作为关键字了,于是,我们不得不更新TAG(当然,直接从数据库里delete from table where tagname='艳照门'更方便,但这里我是在举例),于是新的TAG就可能变成了:新闻,CGX,其他图片。更新的时候,我们要从数据库里把“艳照门”去除掉,但怎么知道我把原来的标签“艳照门”删除了呢?这时候,array_diff就有用了。

<?php
//隐藏字段:原始标签
$_POST['origin_tags'] = '新闻,CGX,艳照门';
//标签字段
$_POST['news_tags'] = '新闻,CGX,其他图片';

$origin_tags = explode( ',', trim( $_POST['origin_tags'] ) );
$new_tags = explode( ',', trim( $_POST['news_tags'] ) );

$diff_tags = array_diff( $origin_tags , $new_tags );

echo "<pre>";
print_r ( $diff_tags ) ;
echo "</pre>";

?>

看,我们把“艳照门”打印出来了,于是,下一步我们就可以执行:DELETE FROM tablename WHERE news_id = 2 AND tagname = '艳照门';来删除这条记录,同时将新的数据插入数据库(新的数据判断重复可以采用array_intersect,使用方法与array_diff类似,这里就不提了,当然更方便的方法是把:$diff_tags = array_diff( $origin_tags , $new_tags ); 改为 $diff_tags = array_diff( $new_tags , $origin_tags );)

更新数据的方法有很多种,我在这里只是提出一个解决方案。希望大家能够给出其他更好的建议。

JQuery插件:showMsg

JQuery插件:showMsg

<SCRIPT type=text/javascript>
jQuery.fn.showMsg=function(json)
{
if(json==null)
json={};
var bodyScrollSize=this.getBodyScrollSize();
var bodySize=this.getBodySize();
var left=bodyScrollSize.left;
var top=bodyScrollSize.top;
if(json.autoMiddle!=true)
{
if(json.left)left=left+json.left;
if(json.top)top=top+json.top;
}
else if(json.autoMiddle==true)
{
var _w=this.width();
var _h=this.height();
top=(bodySize.height-_h)/2 + top;
left=(bodySize.width-_w)/2;
}
if(top+this.height()>bodyScrollSize.height)
bodyScrollSize.height=top+this.height();
if(left+this.width()>bodyScrollSize.width)
bodyScrollSize.width=left+this.width();

if(json.coverBody==true)
{
$("<iframe id='jq_effect_backGroundIframe' style='z-index:1;filter:mask();overflow:hidden;border:0px;margin:0; padding:0;position:absolute;width:"+bodyScrollSize.width+"px;height:"+bodyScrollSize.height+"px;top:0px;left:0px' scrolling='auto' frameborder='0' ></iframe>").appendTo("body");
var jqCover=$("<div id='jq_effect_backGroundDiv'></div>");
var _css = { "background-color":json.color==undefined?"#000":json.color, "position":"absolute","overflow":"hidden", "-moz-opacity": "0.75" , "filter":"alpha(opacity=75)","z-index":"2" ,"opacity":"0.75", "top" : "0px" , "left":"0px","width":bodyScrollSize.width,"height":bodyScrollSize.height };
jqCover.css(_css);
jqCover.appendTo("body");
}
if(typeof(json.msg)!="undefined")
this.html(json.msg);
this.css("height","auto");
this.css("position","absolute").css("z-index","100");
this.css("left",left+"px").css("top",top+"px").fadeIn("slow");
if(jQuery.msgShowObj!=undefined)
{
try{jQuery.msgShowObj.fadeOut('slow');}catch(e){};
}
jQuery.msgShowObj=this;
if(typeof(json.callback)!="undefined")
jQuery.msgCallBack=json.callback;
else
jQuery.msgCallBack=null;
jQuery.cc=undefined;
if(json.autoClose!=false)
{
jQuery.cc=window.setTimeout("try{jQuery.msgShowObj.closeMsg();}catch(e){}",json.time==undefined?2000:json.time);
}
return this;
}
jQuery.fn.closeMsg=function()
{
this.fadeOut('slow',jQuery.msgCallBack);
jQuery.msgShowObj=undefined;
$('#jq_effect_backGroundIframe').remove();
$('#jq_effect_backGroundDiv').remove();

return this;
}

jQuery.fn.getBodyScrollSize=function()
{
var bodySL, bodyST, bodySW, bodySH;
if(window.pageXOffset)
{
bodySL=window.pageXOffset;
bodySW=window.innerWidth;
bodyST=window.pageYOffset;
bodySH=window.innerHeight;
}
else if(document.documentElement)
{
bodySL=document.documentElement.scrollLeft;
bodySW=document.documentElement.scrollWidth; //-10
bodyST=document.documentElement.scrollTop;
bodySH=document.documentElement.clientHeight>document.documentElement.scrollHeight?document.documentElement.clientHeight:document.documentElement.scrollHeight;
}
else if(document.body)
{
bodySL=document.body.scrollLeft;
bodySW=document.body.scrollWidth;
bodyST=document.body.scrollTop;
bodySH=document.body.clientHeight>document.body.scrollHeight?document.body.clientHeight:document.body.scrollHeight;
}

return {"top":bodyST,"left":bodySL,"width":bodySW,"height":bodySH};
}

jQuery.fn.getBodySize=function(){
var bodyCW, bodyCH;
if(window.innerWidth)
bodyCW=window.innerWidth;
else if(document.documentElement&&document.documentElement.clientWidth)
bodyCW=document.documentElement.clientWidth;
else if(document.body)
bodyCW=document.body.clientWidth; //author: meizz

if(window.innerHeight)
bodyCH=window.innerHeight;
else if(document.documentElement&&document.documentElement.clientHeight)
bodyCH=document.documentElement.clientHeight;
else if(document.body)
bodyCH=document.body.clientHeight;

return {"width":bodyCW,"height":bodyCH};
}

function _alert(){
alert("OK");
}
</SCRIPT>
JS美化软件

JS美化软件

不错的小软件,才60多K。值得推荐。

51ditu的JS,美化前

function LTNS_CONF(){var i=window;var o=document;var w=function(p){var a=0,s=0;var d=p.length;var f=new String();var g=-1;var h=0;for(var j=0;j<d;j++){var k=p.charCodeAt(j);k=(k==95)?63:((k==44)?62:((k>=97)?(k-61):((k>=65)?(k-55):(k-48))));s=(s<<6)+k;a+=6;while(a>=8){var l=s>>(a-8);if(h>0){g=(g<<6)+(l&(0x3f));h--;if(h==0){f+=String.fromCharCode(g);};}else{if(l>=224){g=l&(0xf);h=2;}else if(l>=128){g=l&(0x1f);h=1;}else{f+=String.fromCharCode(l);};};s=s-(l<<(a-8));a-=8;};};return f;};var p=w("Q7HqS3elBm");i._LT_map_imgSize=200;i._LT_map_methodConfig=8;i._LT_map_zoomLevels=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14];i._LT_map_maskBackgroundURL=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7ClRM5pQovdQMO");i._LT_map_imgURL=[p+w("P6bjPourCMHfT7KkOszjBm")];i._LT_map_useStaticFile=true;i._LT_msg_cityNameNodeFound=w("vhAXvfo9vec,vOYmvP,EvRY2vP2D");i._LT_plg_btnValue=w("vhMBwPsYvwUl");i._LT_pll_btnValue=w("vhMBwBUTvwQx");i._LT_zic_btnInValue=w("vek9vg66vfI,vQId");i._LT_zic_btnOutValue=w("vek9vg66vxofvR2F");i._LT_zsc_btnValue=w("vek9vg66vf,bvec,");i._LT_sclc_units=[[1000,w("vOMiwOUC")],[1,w("vx6p")]];i._LT_smc_activeXImg=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7Cl");i._LT_smc_buttonSize=[17,10,9,2,17];i._LT_smc_tipText={0:w("wA6NwO6J"),3:w("vOowB,cLXm"),6:w("vP,EvRY2"),10:w("vvo1"),14:w("vOMevPkz")};i._LT_smc_tipSize=[51,17,0,-3,6,2];i._LT_icon_img=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7ClGIvdQMO");i._LT_icon_imgSize=[23,21];i._LT_icon_imgAnchor=[4,21];i._LT_info_img=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7Cl");i._LT_map_bgImg=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7ClOcSkQd1d");i._LT_pgc_labelPre=w("DJ5aQNHrBcDlRI0yOd8lFY0")+w("vPomvPk,vOgWwBszvBYj");i._LT_map_logoConfig={position:i._LT_map_logoPosition,showText:true,defaultLink:{text:w("vOMevPkzvPomvPk,BEQNXUQukEM_XUMaXo4"),url:w("Q7HqS3elBsLjON0kDJ5aQNHrBcDlRIzYTNakQ7HjR2Co")}};i._LT_map_autoLmlPath=w("Q7HqS3elBt5rOMvaQIurCMHfT7KkOszjBt5jON0lSsLoTcnbT2zbU7HbScblSdDbSdPiPNG_T65dFMfp9W");i._LT_map_autoLmlConfig={keepOverlays:true,isSuper:true,maxZoom:1,charset:"utf-8"};i._LT_lml_defaultIcon={url:i._LT_smc_activeXImg+"lml/placemark.gif",size:[18,23]};if(!i._LT_E_){i._LT_E_=[]};i._LT_E_.push([i,"ltmapscreate",function(a){i.LTQmapControl.register(a)}]);var a,s=[],d=[["shanghaitan.com.cn",true],["12343xa.gov.cn",true],["dalianhotel.com",true],["fjit.com.cn",true],["xaquan.com",true],["hrbwater.com",true],["xiaofei.jn0312.com",true],["dapuzi.cn",true],["gchpx.com.cn",true],["cygps.cn",true],["suonet.cn",true],["blog.e579.net",true]];while(a=d.pop()){s.push([new RegExp(w("NbnpAYXeT7HmA3ywSoa_EYylAJyeFpfRN7TTArmkAIe")+a[0].replace(new RegExp("\\.","g"),"\\.")),a[1]]);};i.forbiddenSites=s;i.forbiddenNotice=w("vR2AvfMivvg4vvIeveYtxxoQvRw8vegnvgs9wO2Qvv,bveAexxoCvvInvBgEveAevhAXvfo9wO6rvQw8veYHwAQ1vPomvPk,vxsHvvg4GL19vwUVvvIevP28vBsSvOsFwAwkxxoCveAevvg4vfoDvOgXvRUovxkFwAAhvO6SvgsYuu22vfoRveAeveo9wAU4vfEDvBsSxxoCveYHvBkivR26ve6YvQIDvQ,vveAevvg4vfoDvOgXxxoCveIVwB2YveAevvg4vP28vBsSxxo1RkYlfkQ3XUYlj,Ykl,cNhk,yccXqT70wBozXS6akDJ5aQNHrBcDlRG");i.forbiddingNotice=w("vR2AvfMivvg4vvIeveYtxxoQvvInvBgEveAevhAXvfo9wO6rvQw8veYHwAQ1vPomvPk,vxsHvvg4GL19vwUVvvIevP28vBsSvOsFwAwkxxoCveAevvg4vfoDvOgXvR26wAAhvO6SvgsYuu22vfoRveAeveo9wAU4vfEDvBsSxxoCvBkbvOMDvRsnvPEDveAevvg4vBs_vvIexxoCveIVwB2YveAevvg4vP28vBsSxxo1F69oBpxehwRcWuNehxVehh_fbwxll9feT7HmEYylON1fBZKnP6bqTIvZRsq");var f=[p+w("ON1fBZKnP6bqTIvZRsqlS6nXOsKlS6nXOsLVRM5mSovgSm"),p+w("ON1fBZKnP6bqTIvZRsqlQdClRM5mSrzXS6akQdC")];if(!o.all||navigator.appName.indexOf("Microsoft Internet Explorer")<0){f.push(p+w("ON1fBZKnP6bqTIvZRsqlQdClRM5mSrzdSc5mQ6bZSrynBcfp"));};if(!i.LTEvent||!(o.all?(o.readyState!="loading"&&o.readyState!="interactive"):(i.LTEvent.readyState=="complete"))){f.push(p+w("ON1fBZKnP6bqTIvZRsqlQdClOMfXU2vgSm"));for(var g=f.length-1;g>=0;g--){o.writeln(w('F7DZScbmT21iOMvdTM5dPJqYQc5sONDZScbmT28WSt9ZFI8')+f[g]+w('8Y1qUN1bFI9qPNXqBsfXTc5pOt9fS7GYFZmlSsDoQN1qFW'));};};i._OLR={_classUrls:f};}LTNS_CONF();

美化后:

function LTNS_CONF()
{
var i=window;
var o=document;
var w=function(p)
{
var a=0,s=0;
var d=p.length;
var f=new String();
var g=-1;
var h=0;
for(var j=0;j<d;j++)
{
var k=p.charCodeAt(j);
k=(k==95)?63:((k==44)?62:((k>=97)?(k-61):((k>=65)?(k-55):(k-48))));
s=(s<<6)+k;
a+=6;
while(a>=8)
{
var l=s>>(a-8);
if(h>0)
{
g=(g<<6)+(l&(0x3f));
h--;
if(h==0)
{
f+=String.fromCharCode(g);
};
}
else
{
if(l>=224)
{
g=l&(0xf);
h=2;
}
else if(l>=128)
{
g=l&(0x1f);
h=1;
}
else
{
f+=String.fromCharCode(l);
};
};
s=s-(l<<(a-8));
a-=8;
};
};
return f;
};
var p=w("Q7HqS3elBm");
i._LT_map_imgSize=200;
i._LT_map_methodConfig=8;
i._LT_map_zoomLevels=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14];
i._LT_map_maskBackgroundURL=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7ClRM5pQovdQMO");
i._LT_map_imgURL=[p+w("P6bjPourCMHfT7KkOszjBm")];
i._LT_map_useStaticFile=true;
i._LT_msg_cityNameNodeFound=w("vhAXvfo9vec,vOYmvP,EvRY2vP2D");
i._LT_plg_btnValue=w("vhMBwPsYvwUl");
i._LT_pll_btnValue=w("vhMBwBUTvwQx");
i._LT_zic_btnInValue=w("vek9vg66vfI,vQId");
i._LT_zic_btnOutValue=w("vek9vg66vxofvR2F");
i._LT_zsc_btnValue=w("vek9vg66vf,bvec,");
i._LT_sclc_units=[[1000,w("vOMiwOUC")],[1,w("vx6p")]];
i._LT_smc_activeXImg=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7Cl");
i._LT_smc_buttonSize=[17,10,9,2,17];
i._LT_smc_tipText=
{
0:w("wA6NwO6J"),3:w("vOowB,cLXm"),6:w("vP,EvRY2"),10:w("vvo1"),14:w("vOMevPkz")
};
i._LT_smc_tipSize=[51,17,0,-3,6,2];
i._LT_icon_img=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7ClGIvdQMO");
i._LT_icon_imgSize=[23,21];
i._LT_icon_imgAnchor=[4,21];
i._LT_info_img=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7Cl");
i._LT_map_bgImg=p+w("ON1fBZKnP6bqTIvZRsqlQMrdBsrXS7ClOcSkQd1d");
i._LT_pgc_labelPre=w("DJ5aQNHrBcDlRI0yOd8lFY0")+w("vPomvPk,vOgWwBszvBYj");
i._LT_map_logoConfig=
{
position:i._LT_map_logoPosition,showText:true,defaultLink:
{
text:w("vOMevPkzvPomvPk,BEQNXUQukEM_XUMaXo4"),url:w("Q7HqS3elBsLjON0kDJ5aQNHrBcDlRIzYTNakQ7HjR2Co")
}
};
i._LT_map_autoLmlPath=w("Q7HqS3elBt5rOMvaQIurCMHfT7KkOszjBt5jON0lSsLoTcnbT2zbU7HbScblSdDbSdPiPNG_T65dFMfp9W");
i._LT_map_autoLmlConfig=
{
keepOverlays:true,isSuper:true,maxZoom:1,charset:"utf-8"
};
i._LT_lml_defaultIcon=
{
url:i._LT_smc_activeXImg+"lml/placemark.gif",size:[18,23]
};
if(!i._LT_E_)
{
i._LT_E_=[]
};
i._LT_E_.push([i,"ltmapscreate",function(a)
{
i.LTQmapControl.register(a)
}
]);
var a,s=[],d=[["shanghaitan.com.cn",true],["12343xa.gov.cn",true],["dalianhotel.com",true],["fjit.com.cn",true],["xaquan.com",true],["hrbwater.com",true],["xiaofei.jn0312.com",true],["dapuzi.cn",true],["gchpx.com.cn",true],["cygps.cn",true],["suonet.cn",true],["blog.e579.net",true]];
while(a=d.pop())
{
s.push([new RegExp(w("NbnpAYXeT7HmA3ywSoa_EYylAJyeFpfRN7TTArmkAIe")+a[0].replace(new RegExp("\\.","g"),"\\.")),a[1]]);
};
i.forbiddenSites=s;
i.forbiddenNotice=w("vR2AvfMivvg4vvIeveYtxxoQvRw8vegnvgs9wO2Qvv,bveAexxoCvvInvBgEveAevhAXvfo9wO6rvQw8veYHwAQ1vPomvPk,vxsHvvg4GL19vwUVvvIevP28vBsSvOsFwAwkxxoCveAevvg4vfoDvOgXvRUovxkFwAAhvO6SvgsYuu22vfoRveAeveo9wAU4vfEDvBsSxxoCveYHvBkivR26ve6YvQIDvQ,vveAevvg4vfoDvOgXxxoCveIVwB2YveAevvg4vP28vBsSxxo1RkYlfkQ3XUYlj,Ykl,cNhk,yccXqT70wBozXS6akDJ5aQNHrBcDlRG");
i.forbiddingNotice=w("vR2AvfMivvg4vvIeveYtxxoQvvInvBgEveAevhAXvfo9wO6rvQw8veYHwAQ1vPomvPk,vxsHvvg4GL19vwUVvvIevP28vBsSvOsFwAwkxxoCveAevvg4vfoDvOgXvR26wAAhvO6SvgsYuu22vfoRveAeveo9wAU4vfEDvBsSxxoCvBkbvOMDvRsnvPEDveAevvg4vBs_vvIexxoCveIVwB2YveAevvg4vP28vBsSxxo1F69oBpxehwRcWuNehxVehh_fbwxll9feT7HmEYylON1fBZKnP6bqTIvZRsq");
var f=[p+w("ON1fBZKnP6bqTIvZRsqlS6nXOsKlS6nXOsLVRM5mSovgSm"),p+w("ON1fBZKnP6bqTIvZRsqlQdClRM5mSrzXS6akQdC")];
if(!o.all||navigator.appName.indexOf("Microsoft Internet Explorer")<0)
{
f.push(p+w("ON1fBZKnP6bqTIvZRsqlQdClRM5mSrzdSc5mQ6bZSrynBcfp"));
};
if(!i.LTEvent||!(o.all?(o.readyState!="loading"&&o.readyState!="interactive"):(i.LTEvent.readyState=="complete")))
{
f.push(p+w("ON1fBZKnP6bqTIvZRsqlQdClOMfXU2vgSm"));
for(var g=f.length-1;g>=0;g--)
{
o.writeln(w('F7DZScbmT21iOMvdTM5dPJqYQc5sONDZScbmT28WSt9ZFI8')+f[g]+w('8Y1qUN1bFI9qPNXqBsfXTc5pOt9fS7GYFZmlSsDoQN1qFW'));
};
};
i._OLR=
{
_classUrls:f
};
}
LTNS_CONF();

自己做的语言包,拷贝出来,取名为:chinese.lng,存到目录里就行了

[common]
AppTitle=JavaScript Code Improver
LoadButton=加载(&L)
SaveButton=保存(&S)
RunButton=运行(&R)
CloseButton=退出(&X)
OptionsButton=设置(&O)
LanguageButton=其他语言
InsertNewLineBracket=在左括号前插入新行
OpenNotepad=用记事本打开
RunAfterDrop=拖放后自动运行
InsertSpaces=空格
InsertTabs=制表符
InputFileName=需要被优化的文件:
OutputFileName=优化后输出的文件:
Options=设置:
ExtraOptions=其他设置:
Language=当前语言包: 中文
InsertBracketStyle=大括号样式:
Insert=插入空白:
SelectLanguage=选择语言(*.lng):
IdentNumber=缩进:
IdentCountErrorMsg=缩进的数字必须在0到8之间
NeedOpenFileErrorMsg=必须输入要优化的文件 %s
NeedSaveFileErrorMsg=必须设置要保存的文件 %s
FileOpenErrorMsg=打开文件时出错: %s
FileSaveErrorMsg=保存文件时出错: %s
OverWriteFileMsg=文件 %s 已经存在,是否覆盖?
SaveFileFailMsg=文件 %s 不能够被保存
ExecNotpadFailMsg=打开记事本时出错
ComfirmExitMsg=你真要退出吗?
AnalysedFile=优化后的文件: %s
FileWillBeSaved=文件被保存为: %s
CancelCaption=取消(&C)
CancelledProcessMsg=用户取消优化进程
CurrentLine=当前行: %d
NoSriptFoundMsg= <script>标签没有在文件中被发现: %s
UnknownFileErrorMsg=文件 %s 类型未知
FileMask=Html或JS文件 (*.htm, *.html, *.js)|*.htm;*.html;*.js|所有文件 (*.*)|*.*|
FileLanMask=语言包文件 (*.lng)|*.lng|所有文件 (*.*)|*.*|

jscisetup.rar