Browse Source

Optimize initial requests

pull/1680/head
Ruud 12 years ago
parent
commit
2f5cb81029
  1. 2
      couchpotato/core/_base/updater/static/updater.js
  2. 6
      couchpotato/core/notifications/core/static/notification.js
  3. 37
      couchpotato/core/plugins/movie/static/list.js
  4. 2
      couchpotato/static/scripts/page/wanted.js
  5. 11
      couchpotato/templates/index.html

2
couchpotato/core/_base/updater/static/updater.js

@ -5,7 +5,7 @@ var UpdaterBase = new Class({
initialize: function(){
var self = this;
App.addEvent('load', self.info.bind(self, 1000))
App.addEvent('load', self.info.bind(self, 2000))
App.addEvent('unload', function(){
if(self.timer)
clearTimeout(self.timer);

6
couchpotato/core/notifications/core/static/notification.js

@ -28,14 +28,10 @@ var NotificationBase = new Class({
$(App.block.notification).inject(App.getBlock('search'), 'after');
self.badge = new Element('div.badge').inject(App.block.notification, 'top').hide();
/* App.getBlock('notification').addLink(new Element('a.more', {
'href': App.createUrl('notifications'),
'text': 'Show older notifications'
})); */
});
window.addEvent('load', function(){
self.startInterval.delay(Browser.safari ? 100 : 0, self)
self.startInterval.delay(2000, self)
});
},

37
couchpotato/core/plugins/movie/static/list.js

@ -255,18 +255,19 @@ var MovieList = new Class({
});
// Get available chars and highlight
Api.request('movie.available_chars', {
'data': Object.merge({
'status': self.options.status
}, self.filter),
'onSuccess': function(json){
json.chars.split('').each(function(c){
self.letters[c.capitalize()].addClass('available')
})
}
});
if(self.navigation.isDisplayed() || self.navigation.isVisible())
Api.request('movie.available_chars', {
'data': Object.merge({
'status': self.options.status
}, self.filter),
'onSuccess': function(json){
json.chars.split('').each(function(c){
self.letters[c.capitalize()].addClass('available')
})
}
});
// Add menu or hide
if (self.options.menu.length > 0)
@ -274,17 +275,7 @@ var MovieList = new Class({
self.navigation_menu.addLink(menu_item);
})
else
self.navigation_menu.hide()
self.nav_scrollspy = new ScrollSpy({
min: 10,
onEnter: function(){
self.navigation.addClass('float')
},
onLeave: function(){
self.navigation.removeClass('float')
}
});
self.navigation_menu.hide();
},

2
couchpotato/static/scripts/page/wanted.js

@ -30,7 +30,7 @@ Page.Wanted = new Class({
$(self.wanted).inject(self.el);
// Check if search is in progress
self.startProgressInterval();
self.startProgressInterval.delay(4000, self);
}
},

11
couchpotato/templates/index.html

@ -3,7 +3,7 @@
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
<meta name="apple-mobile-web-app-capable" content="yes">
{% for url in fireEvent('clientscript.get_styles', as_html = True, location = 'front', single = True) %}
<link rel="stylesheet" href="{{ url_for('web.index') }}{{ url }}" type="text/css">{% endfor %}
{% for url in fireEvent('clientscript.get_scripts', as_html = True, location = 'front', single = True) %}
@ -20,6 +20,15 @@
<script type="text/javascript" src="https://www.youtube.com/player_api" defer="defer"></script>
<script type="text/javascript">
window.addEvent('load', function() {
setTimeout(function(){
window.scrollTo(0, 1);
window.scrollTo(0, 0);
}, 100);
});
window.addEvent('domready', function() {
new Uniform();

Loading…
Cancel
Save