⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 samplescripts.debug.js

📁 经典编程900例(C语言),主要是C基础知识
💻 JS
📖 第 1 页 / 共 5 页
字号:
                pbar2.updateText('Done.');
            }));
        }));
        var pbar3 = new Ext.ProgressBar(new Ext.ProgressBarConfig().id('pbar3').width(300).renderTo('p3').toDictionary());
        pbar3.on('update', Delegate.create(this, function() {
            ExtClass.fly('p3text').dom.innerHTML += '.';
        }));
        var btn3 = ExtClass.get('btn3');
        btn3.on('click', Delegate.create(this, function() {
            ExtClass.fly('p3text').update('Working');
            btn3.dom.disabled = true;
            pbar3.wait({ interval: 200, duration: 5000, increment: 15, fn: Delegate.create(this, function() {
                btn3.dom.disabled = false;
                ExtClass.fly('p3text').update('Done');
            }) });
        }));
        var pbar4 = new Ext.ProgressBar(new Ext.ProgressBarConfig().custom('text', 'Waiting on you...').id('pbar4').custom('textEl', 'p4text').cls('custom').renderTo('p4').toDictionary());
        var btn4 = ExtClass.get('btn4');
        btn4.on('click', Delegate.create(this, function() {
            SampleScripts.simple_widgets._runner.run(pbar4, btn4, 19, Delegate.create(this, function() {
                pbar4.updateText('All finished!');
            }));
        }));
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.simple_widgets._runner

SampleScripts.simple_widgets._runner = function SampleScripts_simple_widgets__runner() {
}
SampleScripts.simple_widgets._runner._f = function SampleScripts_simple_widgets__runner$_f(v, pbar, btn, count, onComplete) {
    return Delegate.create(null, function() {
        if (v > count) {
            btn.dom.disabled = false;
            onComplete.invoke();
        }
        else {
            var i = v / count;
            if (pbar.id === 'pbar4') {
                pbar.updateProgress(i, Math.round(100 * i) + '% completed...');
            }
            else {
                pbar.updateProgress(i, String.format('Loading item {0} of {1}...', v, count));
            }
        }
    });
}
SampleScripts.simple_widgets._runner.run = function SampleScripts_simple_widgets__runner$run(pbar, btn, count, onComplete) {
    btn.dom.disabled = true;
    var ms = 5000 / count;
    for (var i = 1; i < (count + 2); i++) {
        window.setTimeout(SampleScripts.simple_widgets._runner._f(i, pbar, btn, count, onComplete), i * ms);
    }
}


Type.createNamespace('SampleScripts.tabs');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.tabs.TabScript

SampleScripts.tabs.TabScript = function SampleScripts_tabs_TabScript() {
}
SampleScripts.tabs.TabScript.main = function SampleScripts_tabs_TabScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.tabs.TabScript().init();
    }));
}
SampleScripts.tabs.TabScript._handleActivate = function SampleScripts_tabs_TabScript$_handleActivate(tab) {
    Ext.MessageBox.alert('Alert', tab.title + ' was activated.');
}
SampleScripts.tabs.TabScript.prototype = {
    
    init: function SampleScripts_tabs_TabScript$init() {
        new Ext.TabPanel(new Ext.TabPanelConfig().renderTo('tabs1').width(450).custom('activeTab', 0).frame(true).defaults({ autoHeight: true }).items([ { contentEl: 'script', title: 'Short Text' }, { contentEl: 'markup', title: 'Long Text' } ]).toDictionary());
        new Ext.TabPanel(new Ext.TabPanelConfig().renderTo(document.body).custom('activeTab', 0).width(600).height(250).custom('plain', true).defaults({ autoScroll: true }).items([ { title: 'Normal Tab', html: 'My content was added during construction.' }, { title: 'Ajax Tab 1', autoLoad: 'ajax1.htm' }, { title: 'Ajax Tab 2', autoLoad: { url: 'ajax2.aspx', params: 'foo=bar&wtf=1' } }, { title: 'Event Tab', listeners: { activate: Delegate.create(null, SampleScripts.tabs.TabScript._handleActivate) }, html: 'I am tab4\'s content. I also have an event listener attached.' }, { title: 'Disabled Tax', disabled: true, html: 'Can\'t see me cause I\'m disabled' } ]).toDictionary());
    }
}


Type.createNamespace('SampleScripts.view');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.view.Photo

SampleScripts.view.Photo = function SampleScripts_view_Photo() {
}
SampleScripts.view.Photo.prototype = {
    name: null,
    size: null,
    shortName: null,
    sizeString: null,
    dateString: null,
    lastmod: null
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.view.DataViewScript

SampleScripts.view.DataViewScript = function SampleScripts_view_DataViewScript() {
}
SampleScripts.view.DataViewScript.main = function SampleScripts_view_DataViewScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.view.DataViewScript().init();
    }));
}
SampleScripts.view.DataViewScript.prototype = {
    
    init: function SampleScripts_view_DataViewScript$init() {
        var store = new Ext.data.JsonStore(new Ext.data.JsonStoreConfig().url('get-images.ashx/Get').custom('root', 'images').fields([ { name: 'url' }, { name: 'size', type: 'float' }, { name: 'lastmod', type: 'date', dateFormat: 'timestamp' } ]).toDictionary());
        store.load();
        var tpl = new Ext.XTemplate('<tpl for=\".\">\r\n\t\t\t\t\t<div class=\"thumb-wrap\" id=\"{name}\">\r\n\t\t\t\t\t<div class=\"thumb\"><img src=\"{url}\" title=\"{name}\"></div>\r\n\t\t\t\t\t<span class=\"x-editable\">{shortName}</span></div>\r\n\t\t\t\t</tpl>\r\n\t\t\t\t<div class=\"x-clear\"></div>');
        var panel = new Ext.Panel(new Ext.PanelConfig().id('images-view').frame(true).width(535).autoHeight(true).collapsible(true).layout('fit').title('Simple DataView with editable labels, multi and drag selection').items(new Ext.DataView(new Ext.DataViewConfig().store(store).tpl(tpl).autoHeight(true).multiSelect(true).overClass('x-view-over').itemSelector('div.thumb-wrap').emptyText('No images to display').custom('prepareData', Delegate.create(this, function(data) {
            data.shortName = Ext.util.Format.ellipsis(data.name, 15);
            data.sizeString = Ext.util.Format.fileSize(data.size);
            data.dateString = data.lastmod.toString();
            return data;
        })).toDictionary())).toDictionary());
        panel.render(document.body);
    }
}


Type.createNamespace('SampleScripts.window');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.window.HelloScript

SampleScripts.window.HelloScript = function SampleScripts_window_HelloScript() {
}
SampleScripts.window.HelloScript.main = function SampleScripts_window_HelloScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.window.HelloScript().init();
    }));
}
SampleScripts.window.HelloScript.prototype = {
    _win: null,
    
    init: function SampleScripts_window_HelloScript$init() {
        var button = ExtClass.get('show-btn');
        button.on('click', Delegate.create(this, this._showWindow));
    },
    
    _showWindow: function SampleScripts_window_HelloScript$_showWindow(button, evt) {
        if (!this._win) {
            this._win = new Ext.WindowClass(new Ext.WindowConfig().custom('el', 'hello-win').layout('fit').width(500).height(300).closeAction('hide').plain(true).items(new Ext.TabPanel(new Ext.TabPanelConfig().custom('el', 'hello-tabs').custom('autoTabs', true).custom('activeTab', 0).custom('deferredRender', false).border(false).toDictionary())).buttons([ new Ext.ButtonConfig().text('Submit').disabled(true).toDictionary(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -