{"id":668,"date":"2013-07-28T00:42:41","date_gmt":"2013-07-27T16:42:41","guid":{"rendered":"http:\/\/www.clonefactor.com\/wordpress\/?p=668"},"modified":"2013-08-17T23:17:01","modified_gmt":"2013-08-17T15:17:01","slug":"%e5%9f%ba%e6%96%bc-jquery-%e5%af%ab%e7%9a%84%e4%b8%80%e5%80%8b-debug-window-%e7%b4%94%e7%82%ba%e5%a5%bd%e7%8e%a9","status":"publish","type":"post","link":"https:\/\/www.clonefactor.com\/wordpress\/program\/668\/","title":{"rendered":"\u57fa\u65bc JQuery \u5beb\u7684\u4e00\u500b Debug window. \u7d14\u70ba\u597d\u73a9."},"content":{"rendered":"<p>\u82b1\u4e86\u534a\u5929\u6642\u9593, \u628a\u820a\u6709\u7684\u500b\u4eba\u7528 debug window, \u6574\u4fee\u70ba\u53ef\u4ee5\u7531\u5176\u4ed6 js \u589e\u52a0\u529f\u80fd\u7684 debug window.<\/p>\n<p>\u7528\u9019\u500b\u53ef\u80fd\u6703\u5c0e\u81f4\u7db2\u7ad9\u88ab hack \u7684\u98a8\u96aa\u5462.<\/p>\n<p>\u9700\u8981\u88dd\u7684\u5eab\u70ba jquery.js \u958b\u767c\u6642\u7248\u672c\u70ba 1.9.1\/2.0.2 \u4ee5\u5f8c\u6703\u4e0d\u6703\u7dad\u8b77\u5c31\u4e0d\u77e5\u9053\u4e86 ( \u6beb\u7121\u8cac\u4efb\u611f \ud83d\ude1b )<\/p>\n<div class=\"aio-button\"><div class=\"aio-pulse\"><a target=\"_blank\" href=\"http:\/\/jsfiddle.net\/canis\/tfgh4\/3\/\" class=\"aio-green-medium\" title=\"Demo\">Demo<\/a><\/div><\/div>\n<div class=\"aio-button\"><div class=\"aio-bounce\"><a target=\"_blank\" href=\"https:\/\/gist.github.com\/canistk\/6095700\" class=\"aio-gray-medium\" title=\"Download Now\"><i class=\"glyphicons glyphicons-download x2\"><\/i>Download Now<\/a><\/div><\/div>\n<p>[CodePen height=500 show=js href=BHwos user=canis ]<\/p>\n<p>debugScreen.css \u662f\u8ca0\u8cac\u9032\u884c debug window \u7684\u756b\u9762\u914d\u7f6e, \u7d14\u7cb9\u70ba\u4e86\u7f8e\u89c0&#8230;\u55ef..\u672c\u4eba\u6c92\u751a\u9ebc\u7f8e\u611f\u5c31\u662f.<\/p>\n<p>\u96a8\u4fbf\u5587~~~<\/p>\n<p>\u53e6\u5916\u5c31\u8981\u914d\u4e0a js \u6a94.<\/p>\n<p>jquery.cf.debug.js\u00a0<span style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;\">\u653e\u4e0a\u53bb\u4e4b\u5f8c\u751a\u9ebc\u90fd\u6c92\u6709\u51fa\u73fe\u90a3\u5c31\u606d\u559c\u4f60\u54af XD<\/span><\/p>\n<p>\u56e0\u70ba\u9084\u6c92\u6709\u555f\u7528 debug, \u800c\u4e14 css \u4e5f\u6b63\u78ba\u7684\u904b\u884c\u4e86.<br \/>\n\u8981\u78ba\u5be6\u5730\u904b\u4f5c\u9700\u65bc onload \u6642\u9032\u884c\u4e0b\u5217\u52d5\u4f5c<\/p>\n<p>[js]<br \/>\n$(document).ready(function(){<br \/>\n \/\/ \u6240\u6709 script \u5b8c\u6210\u5f8c\u904b\u884c.<br \/>\n \/\/ \u555f\u7528 Debug window<br \/>\n $.debug.init();<br \/>\n \/\/ \u52a0\u5165\u81ea\u8a02 Command<br \/>\n $.debug.addCmd({<br \/>\n tag : &quot;hello&quot;, \/\/ \u9019\u662f\u547d\u4ee4\u7684\u8a9e\u6cd5 (\u5c31\u4e00\u500b\u55ae\u5b57 XD )<br \/>\n info : &quot;Just to say hi&quot;, \/\/ \u9019\u662f\u7d66\u4eba\u985e\u770b\u7684\u547d\u4ee4\u7c21\u4ecb.<br \/>\n fn : function(){ $.debug.log(&quot;Oh. hi there.&quot;); } \/\/ \u9019\u7576\u7136\u662f\u529f\u80fd\u554a!!!<br \/>\n });<br \/>\n});<\/p>\n<p>$.debug.show(); \/\/ \u986f\u793a debug window.<br \/>\n[\/js]<\/p>\n<p>\u4ee5\u4e0a, \u5c31\u662f\u7c21\u55ae\u7528\u6cd5.<\/p>\n<p>\u4ee5\u4e0b, \u662f\u529f\u80fd\/\u7528\u6cd5<\/p>\n<ol>\n<li>$.debug.init();<br \/>\ninit debug window.<\/li>\n<li>$.debug.show();<br \/>\ndisplay debug window<\/li>\n<li>$.debug.hide();<br \/>\nhidden debug window<\/li>\n<li>$.debug.log(string);<br \/>\nprint text(string) on debug console. do what ever you want.<\/li>\n<li>$.debug.addCmd(cmdClass,cmdClass,cmdClass);<br \/>\nassign a command function to debug window.<br \/>\ncmdClass must contain following object.<br \/>\ncmdClass.tag = &#8220;string&#8221;; \/\/ your command<br \/>\ncmdClass.info = &#8220;string&#8221;; \/\/ description for your command<br \/>\ncmdClass.fn = function(){}; \/\/ the function call you want to link to this command<\/li>\n<li>$.debug.run(string)<br \/>\nthis will tried to search the command you setup. and do the job.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u82b1\u4e86\u534a\u5929\u6642\u9593, \u628a\u820a\u6709\u7684\u500b\u4eba\u7528 debug window, \u6574\u4fee\u70ba\u53ef\u4ee5\u7531\u5176\u4ed6 js \u589e\u52a0\u529f\u80fd\u7684 de &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,4],"tags":[27],"class_list":["post-668","post","type-post","status-publish","format-standard","hentry","category-javascript-webdevelop","category-program","tag-javascript"],"_links":{"self":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/comments?post=668"}],"version-history":[{"count":0,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/668\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/media?parent=668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/categories?post=668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/tags?post=668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}