Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function map_refresh(map) {
- if (map_plugin.alread_done) return true;
- awPlus.API('map', 'GET', null, function(data) {
- data.data.sids = [];
- for (var sid in data.data.sys) {
- data.data.sys[sid].id = parseInt(data.data.sys[sid].id);
- data.data.sids.push(data.data.sys[sid]);
- }
- var store = new Ext.data.Store({
- model: 'Map',
- sorters: 'id',
- getGroupString: function(record) {
- return record.get('name')[0];
- },
- data: data.data.sids,
- });
- map.setStore(store);
- map_plugin.alread_done = true;
- });
- }
- var map_plugin = {
- name: 'map',
- weight: 1,
- alread_done: false,
- onReady: function() {
- Ext.regModel('Map', {fields: ['name', 'x', 'y', 'id', 'level']});
- var map = new Ext.List({
- tpl: ['<tpl for="."><div class="awsystem">{id} - {name} ({x}/{y})</div></tpl>'],
- emptyText: '<p style="padding: 10px">Loading maps...</p>',
- itemSelector: 'div.awsystem',
- layout: 'card',
- title: 'map',
- iconCls: 'favorites',
- tbTitle: 'Map',
- singleSelect: true,
- grouped: false,
- indexBar: false,
- store: new Ext.data.Store({
- model: 'Map',
- sorters: 'name',
- data: [],
- }),
- });
- map.on('activate', map_refresh);
- awPlus.addTabPanelItem(map);
- }
- }
- awPlus.registerPlugin(map_plugin);
Add Comment
Please, Sign In to add comment