Inspector.Controller:
Ext.define('AM.controller.Inspector',{
extend: 'Ext.app.Controller',
views: ['inspector'],
init: function(options){
this.control({
'inspector button[action=goto]':{click: this.gotoPage, delegate: this},
'inspector button[action=inspect]':{click: this.inspect},
'inspector': {id: options.id, destroy: this.closeWin, move: this.saveWin}
})
},
//открыть страницу
gotoPage: function(event){
var url = Ext.getCmp('url').getValue();
if(!/^http:\/\//.test(url)){
url = 'http://'+url;
//url = 'http://interface/index.php?controller=content&action=getHttp&addres s='+aurl;
}
var iframe = Ext.get('.container');
iframe.dom.src = url;
Ext.getCmp('url').setValue(url);
this.win.setTitle(url);
}
...
Inspector.view:
Ext.define('AM.view.inspector', {
extend: 'Ext.window.Window',
alias: 'widget.inspector',
initComponent: function(options){
var toolbar = new Ext.Toolbar({
defaults:{
iconAlign: 'top'
},
items: [
{text:'Назад',iconCls:'back', action: 'back'},
{text:'Вперед',iconCls:'forward'},
{text:'Обновить',iconCls:'reload'},
{text:'Остановить',iconCls:'stop'},
{text:'Домой',iconCls:'home', action: 'goHome'},
'-',
{
xtype: 'buttongroup',
items:[
{xtype:'textfield',id:'url',width:250,enableKeyEve nts:true},
{iconCls:'goto', action: 'goto'}
]
},
{text: 'Инспектировать', action: 'inspect'},
'->',
{text:'Закладки',iconCls:'book'}
]
});
if(this.idl) this.id = this.idl;
var url = this.url == null ? '' : this.url;
//this.height= 400;
//this.width= 600;
//this.x= 450;
//this.y= 250;
this.title= 'Инспектор';
this.tbar = toolbar;
this.closable= true;
this.maximizable= true;
this.maskDisabled= true;
this.plain= true;
this.layout= 'fit';
this.bodyStyle= 'background-color:#fff';
//this.html= '<iframe id="container" src="" style="width:100%;height:100%;border:none"></iframe>';
this.items=[{
xtype : "component",
autoEl : {
tag : "iframe",
src : url,
cls: 'container'
},
listeners: {
afterrender: function () {
this.getEl().on('load', function () {
//console.log('loaded');
});
}
}
}];
this.callParent(arguments);
}
})
|