From 6d35c64eb12c65914a9a2245b4b1764673a97538 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 17 Sep 2011 19:40:15 +0200 Subject: [PATCH] fix event handlers --- static/js/pandora.api.js | 4 +- static/js/pandora.embed.js | 2 +- static/js/pandora.local.js | 9 +- static/js/pandora/pandora.js | 4 +- static/js/pandora/ui/Ox.FilesView.js | 2 +- static/js/pandora/ui/account.js | 8 +- static/js/pandora/ui/backButton.js | 2 +- static/js/pandora/ui/browser.js | 16 +- static/js/pandora/ui/editor.js | 6 +- static/js/pandora/ui/findElement.js | 6 +- static/js/pandora/ui/folderBrowserList.js | 482 +--------------------- static/js/pandora/ui/folders.js | 24 +- static/js/pandora/ui/foldersList.js | 16 +- static/js/pandora/ui/group.js | 6 +- static/js/pandora/ui/homePage.js | 3 +- static/js/pandora/ui/item.js | 19 +- static/js/pandora/ui/leftPanel.js | 18 +- static/js/pandora/ui/list.js | 10 +- static/js/pandora/ui/menu.js | 8 +- static/js/pandora/ui/rightPanel.js | 8 +- static/js/pandora/ui/sectionButtons.js | 2 +- static/js/pandora/ui/sortSelect.js | 2 +- static/js/pandora/ui/viewSelect.js | 2 +- 23 files changed, 92 insertions(+), 567 deletions(-) diff --git a/static/js/pandora.api.js b/static/js/pandora.api.js index f16cca35..0e8d6e57 100755 --- a/static/js/pandora.api.js +++ b/static/js/pandora.api.js @@ -10,7 +10,7 @@ Ox.load('UI', { var app = new Ox.App({ apiURL: '/api/', init: 'init', -}).bindEvent('load', function(event, data) { +}).bindEvent('load', function(data) { app.site = data.site; app.user = data.user; app.site.default_info = '

Pan.do/ra API Overview

use this api in the browser with Ox.app or use pandora_client it in python. Further description of the api can be found on the wiki
'; @@ -116,7 +116,7 @@ function constructList() { } ] }).bindEvent({ - select: function(event, data) { + select: function(data) { var info = $('
').addClass('OxSelectable'), hash = '#'; if(data.ids.length) diff --git a/static/js/pandora.embed.js b/static/js/pandora.embed.js index 7cadb1b9..5b0f53ab 100755 --- a/static/js/pandora.embed.js +++ b/static/js/pandora.embed.js @@ -82,7 +82,7 @@ window.pandora = new Ox.App({url: '/api/'}).bindEvent({ }, flipbook: function(item) { var that = Ox.Flipbook({ - }).bindEvent('click', function(event, data) { + }).bindEvent('click', function(data) { var item_url = document.location.origin + '/' + item; window.top.location.href = item_url + '/timeline#t=' + data.position; }); diff --git a/static/js/pandora.local.js b/static/js/pandora.local.js index 367ed5a0..66d97b2b 100644 --- a/static/js/pandora.local.js +++ b/static/js/pandora.local.js @@ -92,6 +92,7 @@ pandora.afterLaunch.push(function() { }); pandora.$ui.sections.push($section); + // fixme: cleanup pandora.local.volumes(function(data) { Ox.print("got volumes", data); var volumes = 0; @@ -123,14 +124,14 @@ pandora.afterLaunch.push(function() { id: 'add_volume', title: 'add', width: 32 - }).bindEvent('click', function(event, data) { + }).bindEvent('click', function(data) { if(_this.api.setLocation("Volume "+(volumes+1))) _this.loadVolumes(); }); var update_button = new Ox.Button({ id: 'update_archive', title: 'update', width: 48 - }).bindEvent('click', function(event, data) { + }).bindEvent('click', function(data) { update_button.options({disabled: true}); _this.api.update(function() { update_button.options({disabled: false}); @@ -277,13 +278,13 @@ pandora.afterLaunch.push(function() { id: 'upload_' + oshash, title: 'Upload', width: 48 - }).bindEvent('click', function(fid) { return function(event, data) { + }).bindEvent('click', function(fid) { return function(data) { Ox.print(videos[fid]); $($('#'+fid).find('.OxCell')[1]).html(function(fid) { var button = new Ox.Button({ title: 'Cancel', width: 48 - }).bindEvent('click', function(event, data) { + }).bindEvent('click', function(data) { $.each(videos[fid], function(i, oshash) { _this.cancel(oshash); }); diff --git a/static/js/pandora/pandora.js b/static/js/pandora/pandora.js index 07c84ee1..6a25b57f 100644 --- a/static/js/pandora/pandora.js +++ b/static/js/pandora/pandora.js @@ -437,7 +437,7 @@ pandora.reloadList = function() { $group.reloadList(); }); pandora.$ui.list.bindEvent({ - init: function(event, data) { + init: function(data) { // fixme: this will not work for lists in the favorites folder // (but then it's also unlikely they'll have to be reloaded) var folder = listData.status != 'featured' ? 'personal' : 'featured'; @@ -445,7 +445,7 @@ pandora.reloadList = function() { } }) .bindEventOnce({ - load: function(event, data) { + load: function(data) { pandora.$ui.list.gainFocus(); if (data) pandora.$ui.list.options({selected: [data.items]}); } diff --git a/static/js/pandora/ui/Ox.FilesView.js b/static/js/pandora/ui/Ox.FilesView.js index 6dece408..b4107240 100644 --- a/static/js/pandora/ui/Ox.FilesView.js +++ b/static/js/pandora/ui/Ox.FilesView.js @@ -351,7 +351,7 @@ Ox.FilesView = function(options, self) { orientation: 'horizontal' }); - function openFiles(event, data) { + function openFiles(data) { Ox.print('........', JSON.stringify(self.$filesList.value(data.ids[0], 'instances'))) } diff --git a/static/js/pandora/ui/account.js b/static/js/pandora/ui/account.js index 0304026f..4f4464bf 100644 --- a/static/js/pandora/ui/account.js +++ b/static/js/pandora/ui/account.js @@ -8,7 +8,7 @@ pandora.ui.accountDialog = function(action) { width: 432 }, pandora.ui.accountDialogOptions(action))) .bindEvent({ - resize: function(event, data) { + resize: function(data) { var width = data.width - 32; pandora.$ui.accountForm.items.forEach(function(item) { item.options({width: width}); @@ -171,10 +171,10 @@ pandora.ui.accountForm = function(action, value) { } } }).bindEvent({ - submit: function(event, data) { + submit: function(data) { }, - validate: function(event, data) { + validate: function(data) { //Ox.print('FORM VALIDATE', data) pandora.$ui.accountDialog[ (data.valid ? 'enable' : 'disable') + 'Button' @@ -278,7 +278,7 @@ pandora.ui.accountForm = function(action, value) { width: 128 }) .bindEvent({ - change: function(event, data) { + change: function(data) { var selected = data.selected[0].id; pandora.$ui.usernameOrEmailInput.options({ autovalidate: selected == 'username' ? pandora.autovalidateUsername : autovalidateEmail, diff --git a/static/js/pandora/ui/backButton.js b/static/js/pandora/ui/backButton.js index 41482d1c..a2210e2f 100644 --- a/static/js/pandora/ui/backButton.js +++ b/static/js/pandora/ui/backButton.js @@ -8,7 +8,7 @@ pandora.ui.backButton = function() { margin: '4px' }) .bindEvent({ - click: function(event, data) { + click: function() { pandora.URL.set(pandora.Query.toString()); } }); diff --git a/static/js/pandora/ui/browser.js b/static/js/pandora/ui/browser.js index e3e2ae94..7699ada8 100644 --- a/static/js/pandora/ui/browser.js +++ b/static/js/pandora/ui/browser.js @@ -22,16 +22,16 @@ pandora.ui.browser = function() { orientation: 'horizontal' }) .bindEvent({ - resize: function(event, data) { - pandora.user.ui.groupsSize = data; + resize: function(data) { + pandora.user.ui.groupsSize = data.size; pandora.$ui.groups.forEach(function(list) { list.size(); }); }, - resizeend: function(event, data){ - pandora.UI.set({groupsSize: data}); + resizeend: function(data) { + pandora.UI.set({groupsSize: data.size}); }, - toggle: function(event, data) { + toggle: function(data) { pandora.UI.set({showGroups: !data.collapsed}); data.collapsed && pandora.$ui.list.gainFocus(); } @@ -73,14 +73,14 @@ pandora.ui.browser = function() { unique: 'id' }) .bindEvent({ - open: function(event, data) { + open: function() { that.scrollToSelection(); }, - select: function(event, data) { + select: function(data) { pandora.UI.set('lists|' + pandora.user.ui.list + '|selected', data.ids); pandora.URL.set(data.ids[0]); }, - toggle: function(event, data) { + toggle: function(data) { pandora.UI.set({showMovies: !data.collapsed}); if (data.collapsed) { if (pandora.user.ui.itemView == 'timeline') { diff --git a/static/js/pandora/ui/editor.js b/static/js/pandora/ui/editor.js index 28b05e34..6642a2b9 100644 --- a/static/js/pandora/ui/editor.js +++ b/static/js/pandora/ui/editor.js @@ -8,14 +8,12 @@ pandora.ui.annotations = function() { }) .bindEvent({ resize: function(data) { - pandora.user.ui.annotationsSize = data; + pandora.user.ui.annotationsSize = data.size; }, resizeend: function(data) { - //alert('resizeend', JSON.stringify(data)) - pandora.UI.set({annotationsSize: data}); + pandora.UI.set({annotationsSize: data.size}); }, toggle: function(data) { - //alert('toggle', JSON.stringify(data)) pandora.UI.set({showAnnotations: !data.collapsed}); } }), diff --git a/static/js/pandora/ui/findElement.js b/static/js/pandora/ui/findElement.js index 59c9750c..23a8bfa8 100644 --- a/static/js/pandora/ui/findElement.js +++ b/static/js/pandora/ui/findElement.js @@ -4,7 +4,7 @@ pandora.ui.findElement = function() { findKey = pandora.user.ui.find.key, findValue = pandora.user.ui.find.value; var that = Ox.FormElementGroup({ - elements: $.merge(pandora.user.ui.list ? [ + elements: Ox.merge(pandora.user.ui.list ? [ pandora.$ui.findListSelect = Ox.Select({ items: [ {id: 'all', title: 'Find: All ' + pandora.site.itemName.plural}, @@ -14,7 +14,7 @@ pandora.ui.findElement = function() { type: 'image' }) .bindEvent({ - change: function(event, data) { + change: function(data) { var key = data.selected[0].id; pandora.$ui.findInput.options({ autocomplete: autocompleteFunction() @@ -42,7 +42,7 @@ pandora.ui.findElement = function() { width: 112 }) .bindEvent({ - change: function(event, data) { + change: function(data) { var key = data.selected[0].id; if (key == 'advanced') { pandora.$ui.filterDialog = pandora.ui.filterDialog().open(); diff --git a/static/js/pandora/ui/folderBrowserList.js b/static/js/pandora/ui/folderBrowserList.js index e92b8fbb..69f0fe59 100644 --- a/static/js/pandora/ui/folderBrowserList.js +++ b/static/js/pandora/ui/folderBrowserList.js @@ -136,7 +136,7 @@ pandora.ui.folderBrowserList = function(id) { ] }) .bindEvent({ - click: function(event, data) { + click: function(data) { if (data.key == 'type') { alert('...'); } else if (data.key == 'subscribed') { @@ -162,7 +162,7 @@ pandora.ui.folderBrowserList = function(id) { }); } }, - init: function(event, data) { + init: function(data) { pandora.site.sectionFolders[pandora.user.ui.section][i].items = data.items; pandora.$ui.folder[i].$content.css({ height: 40 + data.items * 16 + 'px' @@ -172,10 +172,10 @@ pandora.ui.folderBrowserList = function(id) { }); pandora.resizeFolders(); }, - paste: function(event, data) { + paste: function(data) { pandora.$ui.list.triggerEvent('paste', data); }, - select: function(event, data) { + select: function(data) { // fixme: duplicated if (data.ids.length) { $.each(pandora.$ui.folderList, function(id_, $list) { @@ -190,476 +190,4 @@ pandora.ui.folderBrowserList = function(id) { } }); return that; -}; - -/* -pandora.ui.folderList = function(id) { - var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id), - that; - if (pandora.user.ui.section == 'site') { - that = Ox.TextList({ - columns: [ - { - format: function() { - return $('') - .attr({ - src: Ox.UI.PATH + 'png/icon16.png' - }) - }, - id: 'id', - operator: '+', - unique: true, - visible: true, - width: 16 - }, - { - id: 'title', - operator: '+', - visible: true, - width: pandora.user.ui.sidebarSize - 16 - } - ], - items: function(data, callback) { - var result = {data: {}}; - if (!data.range) { - result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items.length; - } else { - result.data.items = Ox.getObjectById(pandora.site.sectionFolders.site, id).items; - } - callback(result); - }, - max: 1, - min: 1, - sort: [{key: '', operator: ''}] - }) - .bindEvent({ - select: function(event, data) { - // fixme: duplicated - $.each(pandora.$ui.folderList, function(id_, $list) { - id != id_ && $list.options('selected', []); - }) - pandora.URL.set((id == 'admin' ? 'admin/' : '' ) + data.ids[0]); - }, - }); - } else if (pandora.user.ui.section == 'items') { - that = Ox.TextList({ - columns: [ - { - format: function() { - return $('').attr({ - src: Ox.UI.PATH + 'png/icon16.png' - }); - }, - id: 'user', - operator: '+', - visible: true, - width: 16 - }, - { - format: function(value) { - return value.split('/').join(': '); - }, - id: 'id', - operator: '+', - unique: true, - visible: id == 'favorite', - width: pandora.user.ui.sidebarWidth - 88 - }, - { - editable: function(data) { - return data.user == pandora.user.username; - }, - id: 'name', - input: { - autovalidate: pandora.ui.autovalidateListname - }, - operator: '+', - visible: id != 'favorite', - width: pandora.user.ui.sidebarWidth - 88 - }, - { - align: 'right', - id: 'items', - operator: '-', - visible: true, - width: 40 - }, - { - clickable: function(data) { - return data.type == 'smart'; - }, - format: function(value) { - return $('') - .attr({ - src: Ox.UI.getImageURL('symbolFind') - }) - .css({ - width: '10px', - height: '10px', - padding: '3px 2px 1px 2px', - opacity: value == 'static' ? 0.1 : 1 - }); - }, - id: 'type', - operator: '+', - visible: true, - width: 16 - }, - { - clickable: id == 'personal', - format: function(value) { - //var symbols = {private: 'Publish', public: 'Publish', featured: 'Star'}; - return $('') - .attr({ - src: Ox.UI.getImageURL( - 'symbol' + (value == 'featured' ? 'Star' : 'Publish') - ) - }) - .css({ - width: '10px', - height: '10px', - padding: '3px 2px 1px 2px', - opacity: value == 'private' ? 0.1 : 1 - }) - }, - id: 'status', - operator: '+', - visible: true, - width: 16 - } - ], - items: function(data, callback) { - var query; - if (id == 'personal') { - query = {conditions: [ - {key: 'user', value: pandora.user.username, operator: '='}, - {key: 'status', value: 'featured', operator: '!'} - ], operator: '&'}; - } else if (id == 'favorite') { - query = {conditions: [ - {key: 'subscribed', value: true, operator: '='}, - {key: 'status', value: 'featured', operator: '!'}, - ], operator: '&'}; - } else if (id == 'featured') { - query = {conditions: [{key: 'status', value: 'featured', operator: '='}], operator: '&'}; - } - return pandora.api.findLists($.extend(data, { - query: query - }), callback); - }, - max: 1, - min: 0, - pageLength: 1000, - sort: [ - {key: 'position', operator: '+'} - ], - sortable: id == 'personal' || id == 'favorite' || pandora.user.level == 'admin' - }) - .css({ - left: 0, - top: 0, - width: pandora.user.ui.sidebarWidth + 'px', - }) - .bind({ - dragenter: function(e) { - //Ox.print('DRAGENTER', e) - } - }) - .bindEvent({ - click: function(event, data) { - var $list = pandora.$ui.folderList[id]; - if (data.key == 'type') { - pandora.$ui.filterDialog = pandora.ui.filterDialog().open(); - } else if (data.key == 'status') { - pandora.api.editList({ - id: data.id, - status: $list.value(data.id, data.key) == 'private' ? 'public' : 'private' - }, function(result) { - $list.value(result.data.id, 'status', result.data.status); - }); - } - }, - 'delete': function(event, data) { - var $list = pandora.$ui.folderList[id]; - pandora.user.ui.listQuery.conditions = []; - pandora.URL.set(pandora.Query.toString()); - $list.options({selected: []}); - if (id == 'personal') { - pandora.api.removeList({ - id: data.ids[0] - }, function(result) { - // fixme: is this the best way to delete a ui preference? - delete pandora.user.ui.lists[data.ids[0]]; - pandora.UI.set({lists: pandora.user.ui.lists}); - Ox.Request.clearCache(); // fixme: remove - $list.reloadList(); - }); - } else if (id == 'favorite') { - pandora.api.unsubscribeFromList({ - id: data.ids[0] - }, function(result) { - Ox.Request.clearCache(); // fixme: remove - $list.reloadList(); - }); - } else if (id == 'featured' && pandora.user.level == 'admin') { - pandora.api.editList({ - id: data.ids[0], - status: 'public' - }, function(result) { - // fixme: duplicated - if (result.data.user == pandora.user.username || result.data.subscribed) { - Ox.Request.clearCache(); // fixme: remove - pandora.$ui.folderList[ - result.data.user == pandora.user.username ? 'personal' : 'favorite' - ].reloadList(); - } - $list.reloadList(); - }); - } - }, - init: function(event, data) { - pandora.site.sectionFolders[pandora.user.ui.section][i].items = data.items; - pandora.$ui.folder[i].$content.css({ - height: data.items * 16 + 'px' - }); - pandora.$ui.folderList[id].css({ - height: data.items * 16 + 'px' - }); - pandora.resizeFolders(); - }, - move: function(event, data) { - data.ids.forEach(function(id, pos) { - pandora.user.ui.lists[id].position = pos; - }); - pandora.api.sortLists({ - section: id, - ids: data.ids - }); - }, - paste: function(event, data) { - pandora.$ui.list.triggerEvent('paste', data); - }, - select: function(event, data) { - if (data.ids.length) { - $.each(pandora.$ui.folderList, function(id_, $list) { - id != id_ && $list.options('selected', []); - }); - pandora.URL.set('?find=list:' + data.ids[0]); - } else { - pandora.URL.set('?find='); - } - }, - submit: function(event, data) { - data_ = {id: data.id}; - data_[data.key] = data.value; - pandora.api.editList(data_, function(result) { - if (result.data.id != data.id) { - pandora.$ui.folderList[id].value(data.id, 'name', result.data.name); - pandora.$ui.folderList[id].value(data.id, 'id', result.data.id); - pandora.URL.set('?find=list:' + result.data.id); - } - }); - } - }); - } - return that; -}; - -pandora.ui.folders = function() { - var that = Ox.Element() - .css({overflowX: 'hidden', overflowY: 'auto'}) - .bindEvent({ - resize: function(event, data) { - pandora.resizeFolders(); - } - }); - var counter = 0; - //var $sections = []; - pandora.$ui.folder = []; - pandora.$ui.folderBrowser = {}; - pandora.$ui.folderList = {}; - if (pandora.user.ui.section == 'site') { - $.each(pandora.site.sectionFolders.site, function(i, folder) { - var height = (Ox.getObjectById(pandora.site.sectionFolders.site, folder.id).items.length * 16); - pandora.$ui.folder[i] = Ox.CollapsePanel({ - id: folder.id, - collapsed: !pandora.user.ui.showFolder.site[folder.id], - size: 16, - title: folder.title - }) - .bindEvent({ - toggle: function(event, data) { - - } - }); - //alert(JSON.stringify(Ox.getObjectById(pandora.site.sectionFolders.site, folder.id))) - pandora.$ui.folder[i].$content.css({ - height: height + 'px' - }) - //.appendTo(that); - pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id) - .css({ - height: height + 'px' - }) - .appendTo(pandora.$ui.folder[i].$content); - pandora.$ui.folder.forEach(function($folder) { - that.append($folder); - }); - }); - //pandora.resizeFolders(); - } else if (pandora.user.ui.section == 'items') { - $.each(pandora.site.sectionFolders.items, function(i, folder) { - var extras = []; - if (folder.id == 'personal' && pandora.user.level != 'guest') { - extras = [Ox.Select({ - items: [ - { id: 'new', title: 'New List...' }, - { id: 'newfromselection', title: 'New List from Current Selection...', disabled: true }, - { id: 'newsmart', title: 'New Smart List...' }, - { id: 'newfromresults', title: 'New Smart List from Current Results...', disabled: true }, - {}, - { id: 'addselection', title: 'Add Selection to List...' } - ], - max: 0, - min: 0, - selectable: false, - type: 'image' - }) - .bindEvent({ - click: function(event, data) { - var $list = pandora.$ui.folderList[folder.id], - id; - if (data.id == 'new' || data.id == 'newsmart') { - pandora.api.addList({ - name: 'Untitled', - status: 'private', - type: data.id == 'new' ? 'static' : 'smart' - }, function(result) { - id = result.data.id; - pandora.UI.set(['lists', id].join('|'), pandora.site.user.ui.lists['']); // fixme: necessary? - pandora.URL.set('?find=list:' + id) - Ox.Request.clearCache(); // fixme: remove - $list.reloadList().bindEventOnce({ - load: function(event, data) { - $list.gainFocus() - .options({selected: [id]}) - .editCell(id, 'name'); - } - }); - }); - } - } - })]; - } else if (folder.id == 'favorite' && pandora.user.level != 'guest') { - extras = [Ox.Button({ - selectable: true, - style: 'symbol', - title: 'Edit', - tooltip: 'Manage Favorite Lists', - type: 'image' - }) - .bindEvent({ - change: function(event, data) { - Ox.Request.clearCache(); // fixme: remove - pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser; - if (pandora.site.sectionFolders.items[i].showBrowser) { - pandora.$ui.folderList.favorite.replaceWith( - pandora.$ui.folderBrowser.favorite = pandora.ui.folderBrowser('favorite') - ); - } else { - pandora.$ui.folderBrowser.favorite.replaceWith( - pandora.$ui.folderList.favorite = pandora.ui.folderList('favorite') - ); - } - pandora.resizeFolders(); - } - })]; - } else if (folder.id == 'featured' && pandora.user.level == 'admin') { - extras = [Ox.Button({ - selectable: true, - style: 'symbol', - title: 'Edit', - tooltip: 'Manage Featured Lists', - type: 'image' - }) - .bindEvent({ - change: function(event, data) { - Ox.Request.clearCache(); // fixme: remove - pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser; - if (pandora.site.sectionFolders.items[i].showBrowser) { - pandora.$ui.folderList.featured.replaceWith( - pandora.$ui.folderBrowser.featured = pandora.ui.folderBrowser('featured')); - } else { - pandora.$ui.folderBrowser.featured.replaceWith( - pandora.$ui.folderList.featured = pandora.ui.folderList('featured') - ); - } - pandora.resizeFolders(); - } - })]; - } - pandora.$ui.folder[i] = Ox.CollapsePanel({ - id: folder.id, - collapsed: !pandora.user.ui.showFolder.items[folder.id], - extras: extras, - size: 16, - title: folder.title - }) - .bindEvent({ - // fixme: duplicated - click: function(event, data) { - var $list = pandora.$ui.folderList[i], - hasFocus, id; - if (data.id == 'new' || data.id == 'newsmart') { - pandora.api.addList({ - name: 'Untitled', - status: 'private', - type: data.id == 'new' ? 'static' : 'smart' - }, function(result) { - id = result.data.id; - pandora.URL.set('?find=list:' + id) - Ox.Request.clearCache(); // fixme: remove - $list.reloadList().bindEventOnce({ - load: function(event, data) { - $list.gainFocus() - .options({selected: [id]}) - .editCell(id, 'name'); - } - }); - }); - } else if (data.id == 'browse') { - alert('??') - //pandora.$ui.sectionList[1].replaceWith(pandora.$ui.publicLists = pandora.ui.publicLists()); - //pandora.site.showAllPublicLists = true; - } - }, - toggle: function(event, data) { - data.collapsed && pandora.$ui.folderList[folder.id].loseFocus(); - pandora.UI.set('showFolder|items|' + folder.id, !data.collapsed); - pandora.resizeFolders(); - } - }); - //$sections.push(pandora.$ui.section[i]); - pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id) - .bindEventOnce({ - init: function(event, data) { - Ox.print('init', i, counter) - if (++counter == 3) { - pandora.$ui.folder.forEach(function($folder) { - that.append($folder); - }); - pandora.resizeFolders(); - pandora.selectList(); //fixme: doesn't work - } - } - }) - .appendTo(pandora.$ui.folder[i].$content); - }); - } - that.toggle = function() { - - } - return that; -}; -*/ - +}; \ No newline at end of file diff --git a/static/js/pandora/ui/folders.js b/static/js/pandora/ui/folders.js index 55d10c6b..1fc0bcee 100644 --- a/static/js/pandora/ui/folders.js +++ b/static/js/pandora/ui/folders.js @@ -3,9 +3,7 @@ pandora.ui.folders = function() { var that = Ox.Element() .css({overflowX: 'hidden', overflowY: 'auto'}) .bindEvent({ - resize: function(event, data) { - pandora.resizeFolders(); - } + resize: pandora.resizeFolders }); var counter = 0; //var $sections = []; @@ -41,7 +39,7 @@ pandora.ui.folders = function() { type: 'image' }) .bindEvent({ - click: function(event, data) { + click: function(data) { var $list = pandora.$ui.folderList[folder.id]; // fixme: duplicated if (data.id == 'new' || data.id == 'newsmart') { @@ -55,7 +53,7 @@ pandora.ui.folders = function() { pandora.URL.set('?find=list:' + id) Ox.Request.clearCache(); // fixme: remove $list.reloadList().bindEventOnce({ - load: function(event, data) { + load: function(data) { $list.gainFocus() .options({selected: [id]}) .editCell(id, 'name'); @@ -78,7 +76,7 @@ pandora.ui.folders = function() { type: 'image' }) .bindEvent({ - change: function(event, data) { + change: function(data) { Ox.Request.clearCache(); // fixme: remove pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser; if (pandora.site.sectionFolders.items[i].showBrowser) { @@ -98,7 +96,7 @@ pandora.ui.folders = function() { pandora.$ui.folderList.featured.options({selected: [listData.id]}); } else { // and nowhere else - pandora.URL.set('?find='); + pandora.URL.set(''); } } pandora.$ui.folderBrowser.favorite.replaceWith( @@ -121,7 +119,7 @@ pandora.ui.folders = function() { type: 'image' }) .bindEvent({ - change: function(event, data) { + change: function(data) { var listData; Ox.Request.clearCache(); // fixme: remove pandora.site.sectionFolders.items[i].showBrowser = !pandora.site.sectionFolders.items[i].showBrowser; @@ -149,7 +147,7 @@ pandora.ui.folders = function() { pandora.$ui.folderList.favorite.options({selected: [listData.id]}); } else { // and nowhere else - pandora.URL.set('?find='); + pandora.URL.set(''); } } pandora.$ui.folderBrowser.featured.replaceWith( @@ -192,7 +190,7 @@ pandora.ui.folders = function() { }) .bindEvent({ // fixme: duplicated - click: function(event, data) { + click: function(data) { var $list = pandora.$ui.folderList[i], hasFocus, id; if (data.id == 'new' || data.id == 'newsmart') { @@ -205,7 +203,7 @@ pandora.ui.folders = function() { pandora.URL.set('?find=list:' + id) Ox.Request.clearCache(); // fixme: remove $list.reloadList().bindEventOnce({ - load: function(event, data) { + load: function(data) { $list.gainFocus() .options({selected: [id]}) .editCell(id, 'name'); @@ -220,7 +218,7 @@ pandora.ui.folders = function() { */ } }, - toggle: function(event, data) { + toggle: function(data) { data.collapsed && pandora.$ui.folderList[folder.id].loseFocus(); pandora.UI.set('showFolder|items|' + folder.id, !data.collapsed); pandora.resizeFolders(); @@ -229,7 +227,7 @@ pandora.ui.folders = function() { //$sections.push(pandora.$ui.section[i]); pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id) .bindEventOnce({ - init: function(event, data) { + init: function(data) { Ox.print('init', i, counter) if (++counter == 4) { pandora.$ui.folder.forEach(function($folder) { diff --git a/static/js/pandora/ui/foldersList.js b/static/js/pandora/ui/foldersList.js index 32ddad7c..d3b7c137 100644 --- a/static/js/pandora/ui/foldersList.js +++ b/static/js/pandora/ui/foldersList.js @@ -255,7 +255,7 @@ pandora.ui.folderList = function(id) { pandora.URL.set('?find=list:' + id) Ox.Request.clearCache(); // fixme: remove that.reloadList().bindEventOnce({ - load: function(event, data) { + load: function(data) { that.gainFocus() .options({selected: [id]}) .editCell(id, 'name'); @@ -278,7 +278,7 @@ pandora.ui.folderList = function(id) { */ } }, - click: function(event, data) { + click: function(data) { var $list = pandora.$ui.folderList[id]; if (data.key == 'type') { pandora.$ui.filterDialog = pandora.ui.filterDialog().open(); @@ -295,7 +295,7 @@ pandora.ui.folderList = function(id) { alert(JSON.stringify(data)); } }, - 'delete': function(event, data) { + 'delete': function(data) { // fixme: add a confirmation dialog var $list = pandora.$ui.folderList[id]; pandora.URL.set('?find='); @@ -331,7 +331,7 @@ pandora.ui.folderList = function(id) { }); } }, - init: function(event, data) { + init: function(data) { pandora.site.sectionFolders[pandora.user.ui.section][i].items = data.items; pandora.$ui.folder[i].$content.css({ height: data.items * 16 + 'px' @@ -341,7 +341,7 @@ pandora.ui.folderList = function(id) { }); pandora.resizeFolders(); }, - move: function(event, data) { + move: function(data) { /* data.ids.forEach(function(id, pos) { pandora.user.ui.lists[id].position = pos; @@ -352,10 +352,10 @@ pandora.ui.folderList = function(id) { ids: data.ids }); }, - paste: function(event, data) { + paste: function(data) { pandora.$ui.list.triggerEvent('paste', data); }, - select: function(event, data) { + select: function(data) { if (data.ids.length) { Ox.forEach(pandora.$ui.folderList, function($list, id_) { id != id_ && $list.options('selected', []); @@ -366,7 +366,7 @@ pandora.ui.folderList = function(id) { pandora.URL.set(''); } }, - submit: function(event, data) { + submit: function(data) { data_ = {id: data.id}; data_[data.key] = data.value; pandora.api.editList(data_, function(result) { diff --git a/static/js/pandora/ui/group.js b/static/js/pandora/ui/group.js index bd90bd0d..3ccf8b7b 100644 --- a/static/js/pandora/ui/group.js +++ b/static/js/pandora/ui/group.js @@ -74,10 +74,10 @@ pandora.ui.group = function(id) { }] }) .bindEvent({ - paste: function(event, data) { + paste: function(data) { pandora.$ui.list.triggerEvent('paste', data); }, - select: function(event, data) { + select: function(data) { var conditions = data.ids.map(function(value) { return { key: id, @@ -138,7 +138,7 @@ pandora.ui.group = function(id) { min: 1, type: 'image' }) - .bindEvent('change', function(event, data) { + .bindEvent('change', function(data) { var id_ = data.selected[0].id, i_ = pandora.user.ui.groups.indexOf(id_); if (i_ == -1) { diff --git a/static/js/pandora/ui/homePage.js b/static/js/pandora/ui/homePage.js index 8def2c50..5d17fc7e 100644 --- a/static/js/pandora/ui/homePage.js +++ b/static/js/pandora/ui/homePage.js @@ -35,8 +35,7 @@ pandora.ui.homePage = function() { // fixme: duplicated $select = Ox.Select({ id: 'select', - items: $.merge($.map(pandora.site.findKeys, - function(key, i) { + items: Ox.merge(pandora.site.findKeys.map(function(key) { return { id: key.id, title: 'Find: ' + key.title diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index fb641932..38dfdc13 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -118,7 +118,7 @@ pandora.ui.item = function() { sort: pandora.user.ui.lists[pandora.user.ui.list].sort, unique: 'id' }).bindEvent({ - open: function(event, data) { + open: function(data) { var id = data.ids[0], item = pandora.user.ui.item, points = { @@ -156,7 +156,8 @@ pandora.ui.item = function() { title: 'Save', type: 'text' }).bindEvent({ - click: function(event, data) { + click: function(data) { + // fixme: cleanup var values = $form.value(); var changed = {}; Ox.map(pandora.site.itemKeys, function(key, i) { @@ -259,7 +260,7 @@ pandora.ui.item = function() { sort: pandora.user.ui.lists[pandora.user.ui.list].sort, unique: 'id' }).bindEvent({ - open: function(event, data) { + open: function(data) { var id = data.ids[0], item = pandora.user.ui.item, points = { @@ -405,13 +406,13 @@ pandora.ui.item = function() { position: function(data) { pandora.UI.set('videoPoints|' + pandora.user.ui.item + '|position', data.position); }, - resize: function(event, data) { + resize: function(data) { pandora.$ui.editor.options({ - height: data + height: data.size }); }, resizeend: function(data) { - pandora.UI.set({annotationsSize: data}); + pandora.UI.set({annotationsSize: data.size}); }, togglesize: function(data) { pandora.UI.set({videoSize: data.size}); @@ -441,14 +442,14 @@ pandora.ui.item = function() { }); } })); - that.bindEvent('resize', function(event, data) { + that.bindEvent('resize', function(data) { //Ox.print('resize item', data) pandora.$ui.editor.options({ - height: data + height: data.size }); }); /* - pandora.$ui.rightPanel.bindEvent('resize', function(event, data) { + pandora.$ui.rightPanel.bindEvent('resize', function(data) { Ox.print('... rightPanel resize', data, pandora.$ui.timelinePanel.size(1)) pandora.$ui.editor.options({ width: data - pandora.$ui.timelinePanel.size(1) - 1 diff --git a/static/js/pandora/ui/leftPanel.js b/static/js/pandora/ui/leftPanel.js index 01d03780..b13741b8 100644 --- a/static/js/pandora/ui/leftPanel.js +++ b/static/js/pandora/ui/leftPanel.js @@ -21,15 +21,15 @@ pandora.ui.leftPanel = function() { orientation: 'vertical' }) .bindEvent({ - resize: function(event, data) { + resize: function(data) { Ox.print('LEFT PANEL RESIZE') - var infoSize = Math.round(data / pandora.user.infoRatio); - pandora.UI.set('sidebarSize', data); - if (data < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) { + var infoSize = Math.round(data.size / pandora.user.infoRatio); + pandora.UI.set('sidebarSize', data.size); + if (data.size < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) { pandora.$ui.sectionButtons.removeElement(); delete pandora.$ui.sectionButtons; pandora.$ui.sectionbar.append(pandora.$ui.sectionSelect = pandora.ui.sectionSelect()); - } else if (data >= pandora.site.sectionButtonsWidth && pandora.$ui.sectionSelect) { + } else if (data.size >= pandora.site.sectionButtonsWidth && pandora.$ui.sectionSelect) { pandora.$ui.sectionSelect.removeElement(); delete pandora.$ui.sectionSelect; pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons()); @@ -38,14 +38,14 @@ pandora.ui.leftPanel = function() { pandora.$ui.leftPanel.size(2, infoSize); pandora.$ui.videoPreview && pandora.$ui.videoPreview.options({ frameHeight: infoSize - 16, - frameWidth: data + frameWidth: data.size }); pandora.resizeFolders(); }, - resizeend: function(event, data) { - pandora.UI.set({sidebarSize: data}); + resizeend: function(data) { + pandora.UI.set({sidebarSize: data.size}); }, - toggle: function(event, data) { + toggle: function(data) { pandora.UI.set({showSidebar: !data.collapsed}); if (data.collapsed) { $.each(pandora.$ui.folderList, function(k, $list) { diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index 59504c24..a3cc0760 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -7,7 +7,7 @@ pandora.ui.list = function() { // fixme: remove view argument //Ox.print('constructList', view); if (view == 'list') { /* - keys = Ox.unique($.merge( + keys = Ox.unique(Ox.merge( $.map(pandora.user.ui.lists[pandora.user.ui.list].columns, function(id) { return Ox.getObjectById(pandora.site.sortKeys, id); }), @@ -514,7 +514,7 @@ pandora.ui.list = function() { // fixme: remove view argument ], orientation: 'horizontal' }) - .bindEvent('resize', function() { + .bindEvent('resize', function(data) { }); } else { @@ -611,10 +611,10 @@ pandora.ui.list = function() { // fixme: remove view argument that.closePreview(); preview = false; }, - resize: function(event) { + resize: function(data) { pandora.$ui.previewImage.css({ - width: event.width + 'px', - height: event.height + 'px' + width: data.width + 'px', + height: data.height + 'px' }); } }) diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js index 54ca5f6b..3e93bcf0 100644 --- a/static/js/pandora/ui/menu.js +++ b/static/js/pandora/ui/menu.js @@ -167,7 +167,7 @@ pandora.ui.mainMenu = function() { ] }) .bindEvent({ - change: function(event, data) { + change: function(data) { var value = data.checked[0].id; if (data.id == 'find') { pandora.$ui.findSelect.options({value: value}); @@ -224,7 +224,7 @@ pandora.ui.mainMenu = function() { //pandora.URL.set('/' + value + '/' + document.location.search); } }, - click: function(event, data) { + click: function(data) { if (data.id == 'home') { pandora.$ui.home = pandora.ui.home().fadeInScreen(); pandora.URL.push('home'); @@ -274,7 +274,7 @@ pandora.ui.mainMenu = function() { type: 'image' }) .bindEvent({ - change: function(event, data) { + change: function(data) { pandora.$ui.findPlacesSelect.loseFocus(); pandora.$ui.findPlacesInput.options({ placeholder: data.selected[0].title @@ -364,7 +364,7 @@ pandora.ui.mainMenu = function() { margin: '4px' }) .bindEvent({ - submit: function(event, data) { + submit: function(data) { pandora.$ui.map.find(data.value, function(location) { pandora.$ui.placeNameInput.options({ diff --git a/static/js/pandora/ui/rightPanel.js b/static/js/pandora/ui/rightPanel.js index 8d102602..3374def8 100644 --- a/static/js/pandora/ui/rightPanel.js +++ b/static/js/pandora/ui/rightPanel.js @@ -35,13 +35,13 @@ pandora.ui.rightPanel = function() { orientation: 'vertical' }) .bindEvent({ - resize: function(event, data) { + resize: function(data) { if (!pandora.user.ui.item) { pandora.resizeGroups(); pandora.$ui.list.size(); if (pandora.user.ui.lists[pandora.user.ui.list].listView == 'timelines') { pandora.$ui.list.options({ - width: data + width: data.size }); } else if (pandora.user.ui.lists[pandora.user.ui.list].listView == 'map') { pandora.$ui.map.resizeMap(); @@ -49,10 +49,10 @@ pandora.ui.rightPanel = function() { } else { pandora.$ui.browser.scrollToSelection(); pandora.user.ui.itemView == 'player' && pandora.$ui.player.options({ - width: data + width: data.size }); pandora.user.ui.itemView == 'timeline' && pandora.$ui.editor.options({ - width: data + width: data.size }); } } diff --git a/static/js/pandora/ui/sectionButtons.js b/static/js/pandora/ui/sectionButtons.js index be5ff8f2..dd1b0a9d 100644 --- a/static/js/pandora/ui/sectionButtons.js +++ b/static/js/pandora/ui/sectionButtons.js @@ -13,7 +13,7 @@ pandora.ui.sectionButtons = function() { margin: '4px' }) .bindEvent({ - change: function(event, data) { + change: function(data) { var section = data.selected[0]; if (section == 'items') { pandora.URL.set(pandora.Query.toString()); diff --git a/static/js/pandora/ui/sortSelect.js b/static/js/pandora/ui/sortSelect.js index e0ec5294..86db3363 100644 --- a/static/js/pandora/ui/sortSelect.js +++ b/static/js/pandora/ui/sortSelect.js @@ -16,7 +16,7 @@ pandora.ui.sortSelect = function() { margin: '4px 0 0 4px' }) .bindEvent({ - change: function(event, data) { + change: function(data) { var key = data.selected[0].id, operator = pandora.getSortOperator(key); pandora.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + key); diff --git a/static/js/pandora/ui/viewSelect.js b/static/js/pandora/ui/viewSelect.js index 5016057f..e150bfec 100644 --- a/static/js/pandora/ui/viewSelect.js +++ b/static/js/pandora/ui/viewSelect.js @@ -27,7 +27,7 @@ pandora.ui.viewSelect = function() { pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.list = pandora.ui.list()); pandora.URL.push('/' + view + '/' + document.location.search); // pandora.URL.set('/' + view + '/' + document.location.search); - } : function(event, data) { + } : function(data) { var view = data.selected[0].id; //pandora.UI.set({itemView: id}); pandora.URL.set(pandora.user.ui.item + '/' + view);