document.title += ' ' + art.dialog.fn.version; // 运行代码 $.fn.runCode = function () { var getText = function(elems) { var ret = "", elem; for ( var i = 0; elems[i]; i++ ) { elem = elems[i]; if ( elem.nodeType === 3 || elem.nodeType === 4 ) { ret += elem.nodeValue; } else if ( elem.nodeType !== 8 ) { ret += getText( elem.childNodes ); }; }; return ret; }; var code = getText(this); new Function(code).call(window); return this; }; $(function(){ // 按钮触发代码运行 $(document).bind('click', function(event){ var target = event.target, $target = $(target); if ($target.hasClass('runCode')) { $('#' + target.name).runCode(); }; }); // 跳转到头部 var $footer = $('#footer'); if (!$footer[0]) return; $footer.bind('click', function () { window.scrollTo(0, 0); return false; }).css('cursor', 'pointer')[0].title = '回到页头'; }); // 皮肤选择 window._demoSkin = function () { art.dialog({ id: 'demoSkin', padding: '15px', title: 'artDialog皮肤展示', content: _demoSkin.tmpl }); }; _demoSkin.tmpl = function (data) { var html = ['
'); html.push(data[i].name); html.push(' | '); html.push(data[i].about); html.push(' |
---|