From d215c0fad0e8d4a07eb30a87d15b6f6d2ede538a Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 10 May 2013 14:18:14 +0000 Subject: [PATCH] remove clearIconCache and clearListIconCache, append modified to more icon/poster urls, localize more strings --- static/js/pandora/account.js | 2 +- static/js/pandora/apiDialog.js | 8 ++++---- static/js/pandora/folderList.js | 4 ++-- static/js/pandora/info.js | 10 +++++----- static/js/pandora/infoView.0xdb.js | 1 - static/js/pandora/infoView.indiancinema.js | 1 - static/js/pandora/siteDialog.js | 13 +++++++------ static/js/pandora/statisticsDialog.js | 14 +++++++------- static/js/pandora/utils.js | 20 -------------------- 9 files changed, 26 insertions(+), 47 deletions(-) diff --git a/static/js/pandora/account.js b/static/js/pandora/account.js index 946b7ff7..6e501807 100644 --- a/static/js/pandora/account.js +++ b/static/js/pandora/account.js @@ -344,7 +344,7 @@ pandora.ui.accountSignoutDialog = function() { .append( $('
') .css({position: 'absolute', left: '96px', top: '16px', width: '192px'}) - .html('Are you sure you want to sign out?') + .html(Ox._('Are you sure you want to sign out?')) ), fixedSize: true, height: 128, diff --git a/static/js/pandora/apiDialog.js b/static/js/pandora/apiDialog.js index 3ed62ddf..b0dbd729 100644 --- a/static/js/pandora/apiDialog.js +++ b/static/js/pandora/apiDialog.js @@ -113,15 +113,15 @@ pandora.ui.apiDialog = function() { function getIndex() { var $index = Ox.Element() - .html( + .html(Ox._( '

API Documentation

\n' - + '

' + pandora.site.site.name + ' uses a JSON API' + + '

{0} uses a JSON API' + ' to communicate between the browser and the server.' + ' This API is 100% public, which means that there is' + ' virtually no limit to what you can do with the site,' + ' or build on top of it — from writing simple scripts' + ' to read or write specific information to including' - + ' data from ' + pandora.site.site.name + '' + + ' data from {0}' + ' (not just videos, but also metadata, annotations, lists,' + ' or a custom search interface) in your own website.

\n' + '

If you are using the API in JavaScript, you may want to' @@ -137,7 +137,7 @@ pandora.ui.apiDialog = function() { + ' start with "X" (sorted by duration, then title, both' + ' in ascending order), it will return their duration,' + ' id and title properties.' - ) + [pandora.site.site.name])) .append( Ox.SyntaxHighlighter({ source: "pandora.api.find({\n" diff --git a/static/js/pandora/folderList.js b/static/js/pandora/folderList.js index 8a52effa..559e2e96 100644 --- a/static/js/pandora/folderList.js +++ b/static/js/pandora/folderList.js @@ -17,7 +17,7 @@ pandora.ui.folderList = function(id) { }, format: function(value, data) { return $('').attr({ - src: '/' + folderItem.toLowerCase() + '/' + data.id + '/icon.jpg' + src: '/' + folderItem.toLowerCase() + '/' + data.id + '/icon.jpg?' + data.modified }).css({ width: '14px', height: '14px', @@ -253,7 +253,7 @@ pandora.ui.folderList = function(id) { that = Ox.TableList({ columns: columns, items: items, - keys: ui.section == 'items' ? ['query'] : ['rightslevel'], + keys: ['modified'].concat(ui.section == 'items' ? ['query'] : ['rightslevel']), max: 1, min: 0, pageLength: 1000, diff --git a/static/js/pandora/info.js b/static/js/pandora/info.js index 592ee49c..e2633f47 100644 --- a/static/js/pandora/info.js +++ b/static/js/pandora/info.js @@ -76,7 +76,7 @@ pandora.ui.info = function() { that.append(pandora.$ui.listInfo = pandora.ui.listInfo()); previousView == 'video' && resizeInfo(); } else if (view == 'poster') { - pandora.api.get({id: id, keys: ['director', 'posterRatio', 'title']}, function(result) { + pandora.api.get({id: id, keys: ['director', 'modified', 'posterRatio', 'title']}, function(result) { var ratio = result.data.posterRatio, height = pandora.getInfoHeight(true); emptyInfo(); @@ -299,7 +299,7 @@ pandora.ui.listInfo = function() { that.append( $('

') .css({paddingTop: '16px'}) - .html(folderItem + ' not found') + .html(Ox._('{0} not found', [Ox._(folderItem)])) ); } }); @@ -308,8 +308,8 @@ pandora.ui.listInfo = function() { $('
') .css({fontWeight: 'bold'}) .html(ui.section == 'items' - ? 'All ' + pandora.site.itemName.plural - : pandora.site.site.name + ' ' + folderItems + ? Ox._('All {0}', [Ox._(pandora.site.itemName.plural)]) + : Ox._('{} ' + folderItems, [pandora.site.site.name]) ) ); } @@ -351,7 +351,7 @@ pandora.ui.listInfo = function() { pandora.ui.posterInfo = function(data) { var $poster = $('') - .attr({src: '/' + data.id + '/poster512.jpg'}) + .attr({src: '/' + data.id + '/poster512.jpg' + data.modified}) .css(getPosterCSS()), $text = $('
') .css({ diff --git a/static/js/pandora/infoView.0xdb.js b/static/js/pandora/infoView.0xdb.js index 3c615025..5bd178c3 100644 --- a/static/js/pandora/infoView.0xdb.js +++ b/static/js/pandora/infoView.0xdb.js @@ -863,7 +863,6 @@ pandora.ui.infoView = function(data) { position: selectedImage.index }), function() { var src; - pandora.clearIconCache(data.id); Ox.Request.clearCache(); if (ui.icons == 'frames') { src = '/' + data.id + '/icon512.jpg?' + Ox.uid(); diff --git a/static/js/pandora/infoView.indiancinema.js b/static/js/pandora/infoView.indiancinema.js index cf280cd8..35d48411 100644 --- a/static/js/pandora/infoView.indiancinema.js +++ b/static/js/pandora/infoView.indiancinema.js @@ -487,7 +487,6 @@ pandora.ui.infoView = function(data) { pandora.updateItemContext(); pandora.$ui.browser.value(result.data.id, key, result.data[key]); if (Ox.contains(['title', 'director', 'year'], key)) { - pandora.clearIconCache(data.id); if (ui.icons == 'posters') { pandora.$ui.browser.find('img[src*="/' + data.id + '/"]').each(function() { $(this).attr({ diff --git a/static/js/pandora/siteDialog.js b/static/js/pandora/siteDialog.js index aceca945..c9418849 100644 --- a/static/js/pandora/siteDialog.js +++ b/static/js/pandora/siteDialog.js @@ -23,10 +23,10 @@ pandora.ui.siteDialog = function(section) { pandora.$ui.news = pandora.ui.news(dialogWidth, dialogHeight).appendTo($content); } else if (id == 'software') { Ox.Element() - .html( + .html(Ox._( '

pan.do/ra

' + 'open media archive' - + '

' + pandora.site.site.name + ' is based on pan.do/ra, ' + + '

{0} is based on pan.do/ra, ' + 'a free, open source platform for media archives.

' + 'pan.do/ra includes OxJS, ' + 'a new JavaScript library for web applications.

' @@ -35,12 +35,13 @@ pandora.ui.siteDialog = function(section) { + 'and oxjs.org.

' + ( canSeeVersion - ? '' + pandora.site.site.name + ? '{0}' + ' is running pan.do/ra revision ' - + pandora.site.site.version + '.' + + '{1}.' : '' - ) - ) + ), + [pandora.site.site.name, pandora.site.site.version] + )) .appendTo($content); pandora.createLinks($content); } else { diff --git a/static/js/pandora/statisticsDialog.js b/static/js/pandora/statisticsDialog.js index cce7a736..59dc88c9 100644 --- a/static/js/pandora/statisticsDialog.js +++ b/static/js/pandora/statisticsDialog.js @@ -318,9 +318,9 @@ pandora.ui.statisticsDialog = function() { key: key == 'topdays' ? 'value' : 'key', operator: isDate || isDay ? '-' : '+' }, - title: key == 'lastdays' ? 'Last 30 Days' - : key == 'topdays' ? 'Top 30 Days' - : Ox.toTitleCase(key) + 's', + title: key == 'lastdays' ? Ox._('Last 30 Days') + : key == 'topdays' ? Ox._('Top 30 Days') + : Ox._(Ox.toTitleCase(key) + 's'), width: chartWidth }) .css({ @@ -480,9 +480,9 @@ pandora.ui.statisticsDialog = function() { sort: version == '' ? {key: 'value', operator: '-'} : {key: 'key', operator: '+'}, - title: key == 'system' + title: Ox._(key == 'system' ? (version == '' ? 'Platforms' : 'Platform Versions') - : (version == '' ? 'Browsers' : 'Browser Versions'), + : (version == '' ? 'Browsers' : 'Browser Versions')), width: chartWidth }) .css({ @@ -557,8 +557,8 @@ pandora.ui.statisticsDialog = function() { ? {key: 'value', operator: '-'} : {key: 'key', operator: '+'}, title: version == '' - ? 'Platforms & Browsers' - : 'Platform & Browser Versions', + ? Ox._('Platforms & Browsers') + : Ox._('Platform & Browser Versions'), width: chartWidth }) .css({ diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index f2e53bab..8ba1e480 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -222,26 +222,6 @@ pandora.changeFolderItemStatus = function(id, status, callback) { } }; -pandora.clearIconCache = function(item) { - ['poster', 'icon'].forEach(function(icon) { - ['', 64, 128, 512].forEach(function(size) { - var url = '/' + item + '/' + icon + size + '.jpg', - xhr = new XMLHttpRequest(); - xhr.open('POST', url); - xhr.send(); - }); - }); -}; - -pandora.clearListIconCache = function(list) { - ['', 256].forEach(function(size) { - var url = '/list/' + list + '/icon' + size + '.jpg', - xhr = new XMLHttpRequest(); - xhr.open('POST', url); - xhr.send(); - }); -}; - pandora.clickLink = function(e) { var match = e.target.id.match(/^embed(\d+)$/) if (match) {