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 = ['']; for (var i = 0, length = data.length; i < length; i ++) { html.push(''); }; html.push('
'); html.push(data[i].name); html.push(''); html.push(data[i].about); html.push('
'); return html.join(''); }([ {name: 'default', about: 'artDialog默认皮肤,简洁,纯CSS设计,无图片,采用css3渐进增强'}, {name: 'aero', about: 'artDialog 2+标志性的皮肤,windows7毛玻璃风格。提供PSD源文件 下载'}, {name: 'chrome', about: 'chrome浏览器(xp)风格'}, {name: 'opera', about: 'opera 11浏览器内置对话框风格'}, {name: 'simple', about: '简单风格,无图片,不显示标题'}, {name: 'idialog', about: '苹果风格,iPad Safari或Mac Safari关闭按钮将在左边显示'}, {name: 'twitter', about: 'twitter风格,无图片'}, {name: 'blue', about: '蓝色风格'}, {name: 'black', about: '黑色风格'}, {name: 'green', about: '绿色风格'} ]); $(function () { var $skin = $('#nav-skin'); if (!$skin[0]) return; $skin.bind('click', function () { _demoSkin(); return false; }); // 点亮导航 var links = $('#nav')[0].getElementsByTagName("a"), URL = document.URL.split('#')[0], last = URL.charAt(URL.length - 1); if (last === '/') { links[0].className += ' select'; } else { for (var i=0; i