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(){ initialize: function(){
var self = this; var self = this;
App.addEvent('load', self.info.bind(self, 1000)) App.addEvent('load', self.info.bind(self, 2000))
App.addEvent('unload', function(){ App.addEvent('unload', function(){
if(self.timer) if(self.timer)
clearTimeout(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'); $(App.block.notification).inject(App.getBlock('search'), 'after');
self.badge = new Element('div.badge').inject(App.block.notification, 'top').hide(); 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(){ 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 // Get available chars and highlight
Api.request('movie.available_chars', { if(self.navigation.isDisplayed() || self.navigation.isVisible())
'data': Object.merge({ Api.request('movie.available_chars', {
'status': self.options.status 'data': Object.merge({
}, self.filter), 'status': self.options.status
'onSuccess': function(json){ }, self.filter),
'onSuccess': function(json){
json.chars.split('').each(function(c){
self.letters[c.capitalize()].addClass('available') json.chars.split('').each(function(c){
}) self.letters[c.capitalize()].addClass('available')
})
}
}); }
});
// Add menu or hide // Add menu or hide
if (self.options.menu.length > 0) if (self.options.menu.length > 0)
@ -274,17 +275,7 @@ var MovieList = new Class({
self.navigation_menu.addLink(menu_item); self.navigation_menu.addLink(menu_item);
}) })
else else
self.navigation_menu.hide() self.navigation_menu.hide();
self.nav_scrollspy = new ScrollSpy({
min: 10,
onEnter: function(){
self.navigation.addClass('float')
},
onLeave: function(){
self.navigation.removeClass('float')
}
});
}, },

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

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

11
couchpotato/templates/index.html

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

Loading…
Cancel
Save