Make clientside ordered
This commit is contained in:
@@ -130,7 +130,9 @@ class ClientScript(Plugin):
|
|||||||
data_combined = ''
|
data_combined = ''
|
||||||
|
|
||||||
raw = []
|
raw = []
|
||||||
for file_path in paths:
|
new_paths = []
|
||||||
|
for x in paths:
|
||||||
|
file_path, urls = x
|
||||||
|
|
||||||
f = open(file_path, 'r').read()
|
f = open(file_path, 'r').read()
|
||||||
|
|
||||||
@@ -145,13 +147,14 @@ class ClientScript(Plugin):
|
|||||||
if Env.get('dev'):
|
if Env.get('dev'):
|
||||||
self.watcher.watch(file_path, self.compile)
|
self.watcher.watch(file_path, self.compile)
|
||||||
|
|
||||||
url_path = paths[file_path].get('original_url')
|
url_path = urls.get('original_url')
|
||||||
compiled_file_name = position + '_%s.css' % url_path.replace('/', '_').split('.scss')[0]
|
compiled_file_name = position + '_%s.css' % url_path.replace('/', '_').split('.scss')[0]
|
||||||
compiled_file_path = os.path.join(minified_dir, compiled_file_name)
|
compiled_file_path = os.path.join(minified_dir, compiled_file_name)
|
||||||
self.createFile(compiled_file_path, f.strip())
|
self.createFile(compiled_file_path, f.strip())
|
||||||
|
|
||||||
# Remove scss path
|
# Remove scss path
|
||||||
paths[file_path]['url'] = 'minified/%s?%s' % (compiled_file_name, tryInt(time.time()))
|
urls['url'] = 'minified/%s?%s' % (compiled_file_name, tryInt(time.time()))
|
||||||
|
new_paths.append((file_path, urls))
|
||||||
|
|
||||||
if not Env.get('dev'):
|
if not Env.get('dev'):
|
||||||
|
|
||||||
@@ -165,16 +168,19 @@ class ClientScript(Plugin):
|
|||||||
|
|
||||||
data_combined += self.comment.get(file_type) % (ss(file_path), int(os.path.getmtime(file_path)))
|
data_combined += self.comment.get(file_type) % (ss(file_path), int(os.path.getmtime(file_path)))
|
||||||
data_combined += data + '\n\n'
|
data_combined += data + '\n\n'
|
||||||
|
else:
|
||||||
del paths[file_path]
|
new_paths.append(x)
|
||||||
|
|
||||||
# Combine all files together with some comments
|
# Combine all files together with some comments
|
||||||
if not Env.get('dev'):
|
if not Env.get('dev'):
|
||||||
|
|
||||||
self.createFile(os.path.join(minified_dir, out_name), data_combined.strip())
|
out_path = os.path.join(minified_dir, out_name)
|
||||||
|
self.createFile(out_path, data_combined.strip())
|
||||||
|
|
||||||
minified_url = 'minified/%s?%s' % (out_name, tryInt(os.path.getmtime(out)))
|
minified_url = 'minified/%s?%s' % (out_name, tryInt(os.path.getmtime(out)))
|
||||||
self.minified[file_type][position].append(minified_url)
|
new_paths.append((out_path, {'url': minified_url}))
|
||||||
|
|
||||||
|
self.paths[file_type][position] = new_paths
|
||||||
|
|
||||||
def getStyles(self, *args, **kwargs):
|
def getStyles(self, *args, **kwargs):
|
||||||
return self.get('style', *args, **kwargs)
|
return self.get('style', *args, **kwargs)
|
||||||
@@ -184,7 +190,7 @@ class ClientScript(Plugin):
|
|||||||
|
|
||||||
def get(self, type, location = 'head'):
|
def get(self, type, location = 'head'):
|
||||||
paths = self.paths[type][location]
|
paths = self.paths[type][location]
|
||||||
return [paths[x].get('url', paths[x].get('original_url')) for x in paths]
|
return [x[1].get('url', x[1].get('original_url')) for x in paths]
|
||||||
|
|
||||||
def registerStyle(self, api_path, file_path, position = 'head'):
|
def registerStyle(self, api_path, file_path, position = 'head'):
|
||||||
self.register(api_path, file_path, 'style', position)
|
self.register(api_path, file_path, 'style', position)
|
||||||
@@ -197,8 +203,8 @@ class ClientScript(Plugin):
|
|||||||
api_path = '%s?%s' % (api_path, tryInt(os.path.getmtime(file_path)))
|
api_path = '%s?%s' % (api_path, tryInt(os.path.getmtime(file_path)))
|
||||||
|
|
||||||
if not self.paths[type].get(location):
|
if not self.paths[type].get(location):
|
||||||
self.paths[type][location] = {}
|
self.paths[type][location] = []
|
||||||
self.paths[type][location][file_path] = {'original_url': api_path}
|
self.paths[type][location].append((file_path, {'original_url': api_path}))
|
||||||
|
|
||||||
prefix_properties = ['border-radius', 'transform', 'transition', 'box-shadow']
|
prefix_properties = ['border-radius', 'transform', 'transition', 'box-shadow']
|
||||||
prefix_tags = ['ms', 'moz', 'webkit']
|
prefix_tags = ['ms', 'moz', 'webkit']
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Block.Search = new Class({
|
var BlockSearch = new Class({
|
||||||
|
|
||||||
Extends: BlockBase,
|
Extends: BlockBase,
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ Block.Search = new Class({
|
|||||||
if(typeOf(media) == 'array'){
|
if(typeOf(media) == 'array'){
|
||||||
Object.each(media, function(m){
|
Object.each(media, function(m){
|
||||||
|
|
||||||
var m = new Block.Search[m.type.capitalize() + 'Item'](m);
|
var m = new BlockSearch[m.type.capitalize() + 'Item'](m);
|
||||||
$(m).inject(self.results);
|
$(m).inject(self.results);
|
||||||
self.media[m.imdb || 'r-'+Math.floor(Math.random()*10000)] = m;
|
self.media[m.imdb || 'r-'+Math.floor(Math.random()*10000)] = m;
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ var MovieList = new Class({
|
|||||||
),
|
),
|
||||||
new Element('div.menus').adopt(
|
new Element('div.menus').adopt(
|
||||||
self.navigation_counter = new Element('span.counter[title=Total]'),
|
self.navigation_counter = new Element('span.counter[title=Total]'),
|
||||||
self.filter_menu = new Block.Menu(self, {
|
self.filter_menu = new BlockMenu(self, {
|
||||||
'class': 'filter'
|
'class': 'filter'
|
||||||
}),
|
}),
|
||||||
self.navigation_actions = new Element('ul.actions', {
|
self.navigation_actions = new Element('ul.actions', {
|
||||||
@@ -249,7 +249,7 @@ var MovieList = new Class({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
self.navigation_menu = new Block.Menu(self, {
|
self.navigation_menu = new BlockMenu(self, {
|
||||||
'class': 'extra'
|
'class': 'extra'
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Block.Search.MovieItem = new Class({
|
var BlockSearchMovieItem = new Class({
|
||||||
|
|
||||||
Implements: [Options, Events],
|
Implements: [Options, Events],
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ var Charts = new Class({
|
|||||||
|
|
||||||
Object.each(chart.list, function(movie){
|
Object.each(chart.list, function(movie){
|
||||||
|
|
||||||
var m = new Block.Search.MovieItem(movie, {
|
var m = new BlockSearchMovieItem(movie, {
|
||||||
'onAdded': function(){
|
'onAdded': function(){
|
||||||
self.afterAdded(m, movie)
|
self.afterAdded(m, movie)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ var SuggestList = new Class({
|
|||||||
|
|
||||||
Object.each(json.suggestions, function(movie){
|
Object.each(json.suggestions, function(movie){
|
||||||
|
|
||||||
var m = new Block.Search.MovieItem(movie, {
|
var m = new BlockSearchMovieItem(movie, {
|
||||||
'onAdded': function(){
|
'onAdded': function(){
|
||||||
self.afterAdded(m, movie)
|
self.afterAdded(m, movie)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ var NotificationBase = new Class({
|
|||||||
self.notifications = [];
|
self.notifications = [];
|
||||||
App.addEvent('load', function(){
|
App.addEvent('load', function(){
|
||||||
|
|
||||||
App.block.notification = new Block.Menu(self, {
|
App.block.notification = new BlockMenu(self, {
|
||||||
'button_class': 'icon2.eye-open',
|
'button_class': 'icon2.eye-open',
|
||||||
'class': 'notification_menu',
|
'class': 'notification_menu',
|
||||||
'onOpen': self.markAsRead.bind(self)
|
'onOpen': self.markAsRead.bind(self)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Page.Userscript = new Class({
|
|||||||
if(json.error)
|
if(json.error)
|
||||||
self.frame.set('html', json.error);
|
self.frame.set('html', json.error);
|
||||||
else {
|
else {
|
||||||
var item = new Block.Search.MovieItem(json.movie);
|
var item = new BlockSearchMovieItem(json.movie);
|
||||||
self.frame.adopt(item);
|
self.frame.adopt(item);
|
||||||
item.showOptions();
|
item.showOptions();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,5 +35,3 @@ var BlockBase = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var Block = BlockBase;
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
Block.Footer = new Class({
|
var BlockFooter = new Class({
|
||||||
|
|
||||||
Extends: BlockBase,
|
Extends: BlockBase,
|
||||||
|
|
||||||
@@ -8,4 +8,4 @@ Block.Footer = new Class({
|
|||||||
self.el = new Element('div.footer');
|
self.el = new Element('div.footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Block.Menu = new Class({
|
var BlockMenu = new Class({
|
||||||
|
|
||||||
Extends: BlockBase,
|
Extends: BlockBase,
|
||||||
|
|
||||||
@@ -52,4 +52,4 @@ Block.Menu = new Class({
|
|||||||
return new Element('li').adopt(tab).inject(self.more_option_ul, position || 'bottom');
|
return new Element('li').adopt(tab).inject(self.more_option_ul, position || 'bottom');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Block.Navigation = new Class({
|
var BlockNavigation = new Class({
|
||||||
|
|
||||||
Extends: BlockBase,
|
Extends: BlockBase,
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ Block.Navigation = new Class({
|
|||||||
self.backtotop.fade('in')
|
self.backtotop.fade('in')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.nav.addEvents({
|
self.nav.addEvents({
|
||||||
'click:relay(a)': function(){
|
'click:relay(a)': function(){
|
||||||
if($(document.body).getParent().hasClass('menu_shown'))
|
if($(document.body).getParent().hasClass('menu_shown'))
|
||||||
@@ -70,7 +70,7 @@ Block.Navigation = new Class({
|
|||||||
if(nr <= 2) return;
|
if(nr <= 2) return;
|
||||||
if(el.get('tag') == 'a')
|
if(el.get('tag') == 'a')
|
||||||
self.nav.grab(new Element('li').grab(el.clone().cloneEvents(el)));
|
self.nav.grab(new Element('li').grab(el.clone().cloneEvents(el)));
|
||||||
else
|
else
|
||||||
self.nav.grab(new Element('li.separator'));
|
self.nav.grab(new Element('li.separator'));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -89,4 +89,4 @@ Block.Navigation = new Class({
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -69,18 +69,18 @@
|
|||||||
createLayout: function(){
|
createLayout: function(){
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.block.header = new Block();
|
self.block.header = new BlockBase();
|
||||||
|
|
||||||
self.c.adopt(
|
self.c.adopt(
|
||||||
$(self.block.header).addClass('header').adopt(
|
$(self.block.header).addClass('header').adopt(
|
||||||
new Element('div').adopt(
|
new Element('div').adopt(
|
||||||
self.block.navigation = new Block.Navigation(self, {}),
|
self.block.navigation = new BlockNavigation(self, {}),
|
||||||
self.block.search = new Block.Search(self, {}),
|
self.block.search = new BlockSearch(self, {}),
|
||||||
self.block.more = new Block.Menu(self, {'button_class': 'icon2.cog'})
|
self.block.more = new BlockMenu(self, {'button_class': 'icon2.cog'})
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
self.content = new Element('div.content'),
|
self.content = new Element('div.content'),
|
||||||
self.block.footer = new Block.Footer(self, {})
|
self.block.footer = new BlockFooter(self, {})
|
||||||
);
|
);
|
||||||
|
|
||||||
var setting_links = [
|
var setting_links = [
|
||||||
|
|||||||
Reference in New Issue
Block a user