diff --git a/static/js/pandora/account.js b/static/js/pandora/account.js index ebcab75a..b4453149 100644 --- a/static/js/pandora/account.js +++ b/static/js/pandora/account.js @@ -284,11 +284,10 @@ pandora.ui.accountForm = function(action, value) { }) .bindEvent({ change: function(data) { - var selected = data.selected[0].id; pandora.$ui.usernameOrEmailInput.options({ - autovalidate: selected == 'username' + autovalidate: data.value == 'username' ? pandora.autovalidateUsername : pandora.autovalidateEmail, - validate: pandora.validateUser(selected, true), + validate: pandora.validateUser(data.value, true), value: '' }).focusInput(true); that.$element.find('.OxFormMessage:visible').html('').hide(); diff --git a/static/js/pandora/contactForm.js b/static/js/pandora/contactForm.js index 410a4763..fdb35eb4 100644 --- a/static/js/pandora/contactForm.js +++ b/static/js/pandora/contactForm.js @@ -83,7 +83,7 @@ pandora.ui.contactForm = function() { .bindEvent({ change: function(data) { $receiptCheckbox.options({ - title: data.checked + title: data.value ? 'Send a receipt to ' + pandora.user.email : 'Don\'t send me a receipt' }); diff --git a/static/js/pandora/filesView.js b/static/js/pandora/filesView.js index 57372d57..5bfa7cad 100644 --- a/static/js/pandora/filesView.js +++ b/static/js/pandora/filesView.js @@ -271,7 +271,7 @@ pandora.ui.filesView = function(options, self) { conditions = [{key: 'id', value: data.value, operator: '=='}] } else { conditions = Ox.map(['title', 'director', 'year'], function(key) { - var value = self['$' + key + 'Input'].options('value') + var value = self['$' + key + 'Input'].value() return value.length ? {key: key, value: value, operator: '='} : null; }); } @@ -286,7 +286,7 @@ pandora.ui.filesView = function(options, self) { */ conditions = {}; Ox.map(['id', 'title', 'director', 'year'], function(key) { - var value = self['$' + key + 'Input'].options('value'); + var value = self['$' + key + 'Input'].value(); if(value.length) { conditions[key] = key == 'director' ? value.split(', ') : value; } @@ -295,18 +295,18 @@ pandora.ui.filesView = function(options, self) { var length = result.data.items.length; if (length == 0) { if (key != 'id') { - self.$idInput.options({value: ''}); + self.$idInput.value(''); } } else if (result.data.items.length == 1) { ['title', 'director', 'year', 'id'].forEach(function(key) { - self['$' + key + 'Input'].options({ - value: key == 'director' + self['$' + key + 'Input'].value( + key == 'director' ? result.data.items[0][key].join(', ') : result.data.items[0][key] - }); + ); }); } else { - self.$idInput.options({value: ''}); + self.$idInput.value(''); } }); } @@ -343,7 +343,7 @@ pandora.ui.filesView = function(options, self) { .bindEvent({ click: function() { ['title', 'director', 'year', 'id'].forEach(function(key) { - self['$' + key + 'Input'].options({value: ''}) + self['$' + key + 'Input'].value(''); }); } }); @@ -421,11 +421,11 @@ pandora.ui.filesView = function(options, self) { }, function(result) { ['title', 'director', 'year'].forEach(function(key) { if (result.data[key]) { - self['$' + key + 'Input'].options({ - value: key == 'director' + self['$' + key + 'Input'].value( + key == 'director' ? result.data[key].join(', ') : result.data[key] - }); + ); } }); updateForm(); diff --git a/static/js/pandora/filter.js b/static/js/pandora/filter.js index 58637a84..ec93abd7 100644 --- a/static/js/pandora/filter.js +++ b/static/js/pandora/filter.js @@ -171,7 +171,7 @@ pandora.ui.filter = function(id) { .bindEvent('change', function(data) { var filters = Ox.clone(pandora.user.ui.filters), find, - id_ = data.selected[0].id, + id_ = data.value, i_ = Ox.getPositionById(pandora.user.ui.filters, id_); if (i_ == -1) { // new filter was not part of old filter set diff --git a/static/js/pandora/findElement.js b/static/js/pandora/findElement.js index 0b3fbdc4..7beb2b16 100644 --- a/static/js/pandora/findElement.js +++ b/static/js/pandora/findElement.js @@ -16,7 +16,6 @@ pandora.ui.findElement = function() { }) .bindEvent({ change: function(data) { - var key = data.selected[0].id; pandora.$ui.findInput.options({ autocomplete: autocompleteFunction() }).focusInput(true); @@ -46,8 +45,7 @@ pandora.ui.findElement = function() { }) .bindEvent({ change: function(data) { - var key = data.selected[0].id; - if (key == 'advanced') { + if (data.value == 'advanced') { that.update(); pandora.$ui.filterDialog = pandora.ui.filterDialog().open(); } else { diff --git a/static/js/pandora/folderBrowserBar.js b/static/js/pandora/folderBrowserBar.js index 7b5e8c3c..d5302933 100644 --- a/static/js/pandora/folderBrowserBar.js +++ b/static/js/pandora/folderBrowserBar.js @@ -7,36 +7,36 @@ pandora.ui.folderBrowserBar = function(id) { pandora.$ui.findListElement[id] = Ox.FormElementGroup({ elements: [ pandora.$ui.findListSelect[id] = Ox.Select({ - items: [ - {id: 'user', title: 'Find: User', checked: true}, - {id: 'list', title: 'Find: List'} - ], - overlap: 'right', - type: 'image' - }) - .bindEvent({ - change: function(data) { - var key = data.selected[0].id == 'user' ? 'user' : 'name', - value = pandora.$ui.findListInput[id].value(); - value && updateList(key, value); - pandora.$ui.findListInput[id].options({ - placeholder: data.selected[0].title - }); - } - }), + items: [ + {id: 'user', title: 'Find: User', checked: true}, + {id: 'list', title: 'Find: List'} + ], + overlap: 'right', + type: 'image' + }) + .bindEvent({ + change: function(data) { + var key = data.value == 'user' ? 'user' : 'name', + value = pandora.$ui.findListInput[id].value(); + value && updateList(key, value); + pandora.$ui.findListInput[id].options({ + placeholder: data.title + }); + } + }), pandora.$ui.findListInput[id] = Ox.Input({ - changeOnKeypress: true, - clear: true, - placeholder: 'Find: User', - width: pandora.getFoldersWidth() - 24 - }) - .bindEvent({ - change: function(data) { - var key = pandora.$ui.findListSelect[id].value() == 'user' ? 'user' : 'name', - value = data.value; - updateList(key, value); - } - }) + changeOnKeypress: true, + clear: true, + placeholder: 'Find: User', + width: pandora.getFoldersWidth() - 24 + }) + .bindEvent({ + change: function(data) { + var key = pandora.$ui.findListSelect[id].value() == 'user' ? 'user' : 'name', + value = data.value; + updateList(key, value); + } + }) ], }) .css({ diff --git a/static/js/pandora/home.js b/static/js/pandora/home.js index cdf98cc9..32bec4f3 100644 --- a/static/js/pandora/home.js +++ b/static/js/pandora/home.js @@ -107,8 +107,8 @@ pandora.ui.home = function() { var folder = pandora.getListData().folder, value = $findInput.value(); folder && pandora.$ui.folderList[folder].options({selected: []}); - pandora.$ui.findSelect.options({value: '*'}); - pandora.$ui.findInput.options({value: value}); + pandora.$ui.findSelect.value('*'); + pandora.$ui.findInput.value(value); that.fadeOutScreen(); pandora.UI.set('find', { conditions: value === '' diff --git a/static/js/pandora/listDialog.js b/static/js/pandora/listDialog.js index ee1a2e86..fc89f2e6 100644 --- a/static/js/pandora/listDialog.js +++ b/static/js/pandora/listDialog.js @@ -55,7 +55,7 @@ pandora.ui.listDialog = function(section) { .bindEvent({ change: function(data) { pandora.$ui.findIconItemInput.options({ - placeholder: data.selected[0].title + placeholder: data.title }); // fixme: this is a bit weird setTimeout(function() { @@ -247,13 +247,13 @@ pandora.ui.listGeneralPanel = function(listData) { } } function editStatus(data) { - var status = data.selected[0].id; + var status = data.value; $statusSelect.value(status == 'private' ? 'public' : 'private'); pandora.changeListStatus(listData.id, status, function(result) { listData.status = result.data.status; if (result.data.status == 'private') { subscribers = 0; - $subscribersInput.options({value: 0}); + $subscribersInput.value(0); } $statusSelect.value(result.data.status); $subscribersInput[getSubscribersAction()](); diff --git a/static/js/pandora/logsDialog.js b/static/js/pandora/logsDialog.js index 7ac9c5f0..9fd25f61 100644 --- a/static/js/pandora/logsDialog.js +++ b/static/js/pandora/logsDialog.js @@ -19,11 +19,11 @@ pandora.ui.logsDialog = function() { }) .bindEvent({ change: function(data) { - var key = data.selected[0].id, + var key = data.value, value = $findInput.value(); value && updateList(key, value); $findInput.options({ - placeholder: data.selected[0].title + placeholder: data.title }); } }), diff --git a/static/js/pandora/menu.js b/static/js/pandora/menu.js index 8a23498f..f7506dfa 100644 --- a/static/js/pandora/menu.js +++ b/static/js/pandora/menu.js @@ -162,7 +162,7 @@ pandora.ui.mainMenu = function() { that.checkItem('allitems'); } } else if (data.id == 'find') { - pandora.$ui.findSelect.options({value: value}); + pandora.$ui.findSelect.value(value); } else if (data.id == 'itemview') { pandora.UI.set({itemView: value}); } else if (Ox.startsWith(data.id, 'orderfilter')) { diff --git a/static/js/pandora/preferencesDialog.js b/static/js/pandora/preferencesDialog.js index befd2dc5..2f8a037e 100644 --- a/static/js/pandora/preferencesDialog.js +++ b/static/js/pandora/preferencesDialog.js @@ -97,7 +97,7 @@ pandora.ui.preferencesDialog = function() { this.options({ title: this.options('title') == 'Subscribed' ? 'Unsubscribed' : 'Subscribed' }); - pandora.user.newsletter = data.checked; + pandora.user.newsletter = data.value; pandora.api.editPreferences({ newsletter: pandora.user.newsletter }); diff --git a/static/js/pandora/sectionButtons.js b/static/js/pandora/sectionButtons.js index 7cf2f040..d705642f 100644 --- a/static/js/pandora/sectionButtons.js +++ b/static/js/pandora/sectionButtons.js @@ -15,7 +15,7 @@ pandora.ui.sectionButtons = function() { }) .bindEvent({ change: function(data) { - var section = data.selected[0]; + var section = data.value; if (section == 'items') { pandora.URL.set(pandora.Query.toString()); } else if (section == 'clips') { diff --git a/static/js/pandora/sortSelect.js b/static/js/pandora/sortSelect.js index 36a31066..f8628db1 100644 --- a/static/js/pandora/sortSelect.js +++ b/static/js/pandora/sortSelect.js @@ -28,29 +28,29 @@ pandora.ui.sortSelect = function(isNavigationView) { })); } that = Ox.Select({ - id: 'sortSelect', - items: items, - width: isNavigationView ? 128 : 144 - }) - .css({ - float: isNavigationView ? 'right' : 'left', - margin: isNavigationView ? '4px 4px 0 0' : '4px 0 0 4px' - }) - .bindEvent({ - change: function(data) { - var key = data.selected[0].id; - pandora.UI.set(sortKey, [{ - key: key, - operator: pandora.getSortOperator(key) - }]); - }, - pandora_listsort: function(data) { - that.selectItem(data.value[0].key); - }, - pandora_itemsort: function(data) { - that.selectItem(data.value[0].key); - } - }); + id: 'sortSelect', + items: items, + width: isNavigationView ? 128 : 144 + }) + .css({ + float: isNavigationView ? 'right' : 'left', + margin: isNavigationView ? '4px 4px 0 0' : '4px 0 0 4px' + }) + .bindEvent({ + change: function(data) { + var key = data.value; + pandora.UI.set(sortKey, [{ + key: key, + operator: pandora.getSortOperator(key) + }]); + }, + pandora_listsort: function(data) { + that.selectItem(data.value[0].key); + }, + pandora_itemsort: function(data) { + that.selectItem(data.value[0].key); + } + }); return that; }; diff --git a/static/js/pandora/usersDialog.js b/static/js/pandora/usersDialog.js index c7db8121..97126543 100644 --- a/static/js/pandora/usersDialog.js +++ b/static/js/pandora/usersDialog.js @@ -31,7 +31,7 @@ pandora.ui.usersDialog = function() { change: function(data) { $findInput.value() && updateList(); $findInput.options({ - placeholder: data.selected[0].title + placeholder: data.title }); } }), @@ -537,11 +537,11 @@ pandora.ui.usersDialog = function() { change: function(event) { var data = {id: user.id}, key, value; if (event.id == 'status') { - data.disabled = !event.data.checked; + data.disabled = !event.data.value; } else if (event.id == 'level') { - data.level = event.data.selected[0].id; + data.level = event.data.value; } else if (event.id == 'newsletter') { - data.newsletter = event.data.checked; + data.newsletter = event.data.value; } else { data[event.id] = event.data.value; } @@ -622,12 +622,12 @@ pandora.ui.usersDialog = function() { click: function(data) { var $input = getFormItemById('message'), textarea = $input.find('textarea')[0], - value = $input.options('value'); - $input.options({ - value: value.substr(0, textarea.selectionStart) - + '{' + data.id + '}' - + value.substr(textarea.selectionEnd) - }) + value = $input.value(); + $input.value( + value.substr(0, textarea.selectionStart) + + '{' + data.id + '}' + + value.substr(textarea.selectionEnd) + ) .focusInput(textarea.selectionStart + data.id.length + 2); } }), @@ -654,7 +654,7 @@ pandora.ui.usersDialog = function() { function selectForm(data) { var selected; - if (data.selected[0] == 'edit') { + if (data.value == 'edit') { $mailForm.detach(); selected = $list.options('selected'); if (selected.length == 1 && selected[0].level != 'guest') { @@ -690,8 +690,8 @@ pandora.ui.usersDialog = function() { function sendMail() { pandora.api.mail({ to: getTo(), - subject: getFormItemById('subject').options('value'), - message: getFormItemById('message').options('value'), + subject: getFormItemById('subject').value(), + message: getFormItemById('message').value(), receipt: getFormItemById('receipt').value() }, function(result) { var title = result.status.code == 200 @@ -734,7 +734,7 @@ pandora.ui.usersDialog = function() { } function setHeight(data) { - var form = $formButton.options('value'), + var form = $formButton.value(), $item = getFormItemById(form == 'edit' ? 'notes' : 'message'); Ox.print('$ITEM', $item) dialogHeight = data.height; @@ -759,9 +759,9 @@ pandora.ui.usersDialog = function() { function setSend() { getFormItemById('send').options({ - disabled: getFormItemById('to').options('value') == 'No recipients' - || getFormItemById('subject').options('value') === '' - || getFormItemById('message').options('value') === '' + disabled: getFormItemById('to').value() == 'No recipients' + || getFormItemById('subject').value() === '' + || getFormItemById('message').value() === '' }); } diff --git a/static/js/pandora/viewSelect.js b/static/js/pandora/viewSelect.js index dd96a81e..55088cc9 100644 --- a/static/js/pandora/viewSelect.js +++ b/static/js/pandora/viewSelect.js @@ -7,34 +7,34 @@ pandora.ui.viewSelect = function() { sortKey = !ui.item ? 'listSort' : 'itemSort', viewKey = !ui.item ? 'listView' : 'itemView', that = Ox.Select({ - id: 'viewSelect', - items: Ox.map(pandora.site[viewKey + 's'], function(view) { - return viewKey == 'listView' - || ['data', 'files'].indexOf(view.id) == -1 - || pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level] - ? Ox.extend(Ox.clone(view), { - checked: view.id == ui[viewKey], - title: 'View ' + view.title - }) - : null; - }), - width: !ui.item ? 144 : 128 - }) - .css({ - float: 'left', - margin: '4px 0 0 4px' - }) - .bindEvent({ - change: function(data) { - pandora.UI.set(viewKey, data.selected[0].id); - }, - pandora_listview: function(data) { - that.selectItem(data.value); - }, - pandora_itemview: function(data) { - that.selectItem(data.value); - } - }); + id: 'viewSelect', + items: Ox.map(pandora.site[viewKey + 's'], function(view) { + return viewKey == 'listView' + || ['data', 'files'].indexOf(view.id) == -1 + || pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level] + ? Ox.extend(Ox.clone(view), { + checked: view.id == ui[viewKey], + title: 'View ' + view.title + }) + : null; + }), + width: !ui.item ? 144 : 128 + }) + .css({ + float: 'left', + margin: '4px 0 0 4px' + }) + .bindEvent({ + change: function(data) { + pandora.UI.set(viewKey, data.value); + }, + pandora_listview: function(data) { + that.selectItem(data.value); + }, + pandora_itemview: function(data) { + that.selectItem(data.value); + } + }); return that; };