rev357, Coffeescript compiler autodetect on linux, Fix loading screen hide on 0 sized sites

This commit is contained in:
HelloZeroNet 2015-08-26 02:51:32 +02:00
parent b83d6ba2ff
commit dd2bb8b3fb
5 changed files with 25 additions and 12 deletions

View File

@ -8,7 +8,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.3.2"
self.rev = 351
self.rev = 357
self.argv = argv
self.action = None
self.createParser()

View File

@ -17,6 +17,20 @@ def findfiles(path, find_ext):
yield file_path.replace("\\", "/")
# Try to find coffeescript compiler in path
def findCoffeescriptCompiler():
coffeescript_compiler = None
try:
import distutils.spawn
coffeescript_compiler = distutils.spawn.find_executable("coffee") + " --no-header -p"
except:
pass
if coffeescript_compiler:
return coffeescript_compiler
else:
return False
# Generates: all.js: merge *.js, compile coffeescript, all.css: merge *.css, vendor prefix features
def merge(merged_path):
merge_dir = os.path.dirname(merged_path)
@ -53,10 +67,15 @@ def merge(merged_path):
parts.append("\n\n/* ---- %s ---- */\n\n" % file_path)
if file_path.endswith(".coffee"): # Compile coffee script
if file_path in changed or file_path not in old_parts: # Only recompile if changed or its not compiled before
if config.coffeescript_compiler is None:
config.coffeescript_compiler = findCoffeescriptCompiler()
if not config.coffeescript_compiler:
logging.error("No coffeescript compiler definied, skipping compiling %s" % merged_path)
return False # No coffeescript compiler, skip this file
command = config.coffeescript_compiler % os.path.join(*file_path.split("/")) # Fix os path separator
if "%s" in config.coffeescript_compiler: # Replace %s with coffeescript file
command = config.coffeescript_compiler % os.path.join(*file_path.split("/"))
else: # Put coffeescript file to end
command = config.coffeescript_compiler + " " + os.path.join(*file_path.split("/"))
s = time.time()
compiler = subprocess.Popen(command, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
out = compiler.stdout.read().decode("utf8")

View File

@ -13,6 +13,7 @@ class Notifications
add: (id, type, body, timeout=0) ->
id = id.replace /[^A-Za-z0-9]/g, ""
# Close notifications with same id
for elem in $(".notification-#{id}")
@close $(elem)

View File

@ -31,9 +31,6 @@ class Wrapper
src = $("#inner-iframe").attr("src").replace(/#.*/, "")+window.location.hash
$("#inner-iframe").attr("src", src)
###setInterval (->
console.log document.hasFocus()
), 1000###
$("#inner-iframe").focus()
@
@ -303,7 +300,7 @@ class Wrapper
@notifications.add("size_limit", "done", res, 5000)
return false
if @loading.screen_visible and @inner_loaded and site_info.settings.size < site_info.size_limit*1024*1024 # Loading screen still visible, but inner loaded
if @loading.screen_visible and @inner_loaded and site_info.settings.size < site_info.size_limit*1024*1024 and site_info.settings.size > 0 # Loading screen still visible, but inner loaded
@loading.hideScreen()
if site_info.tasks > 0 and site_info.started_task_num > 0

View File

@ -666,6 +666,7 @@ jQuery.extend( jQuery.easing,
if (timeout == null) {
timeout = 0;
}
id = id.replace(/[^A-Za-z0-9]/g, "");
_ref = $(".notification-" + id);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
elem = _ref[_i];
@ -801,11 +802,6 @@ jQuery.extend( jQuery.easing,
}
};
})(this));
/*setInterval (->
console.log document.hasFocus()
), 1000
*/
$("#inner-iframe").focus();
this;
}
@ -1160,7 +1156,7 @@ jQuery.extend( jQuery.easing,
})(this));
}
}
if (this.loading.screen_visible && this.inner_loaded && site_info.settings.size < site_info.size_limit * 1024 * 1024) {
if (this.loading.screen_visible && this.inner_loaded && site_info.settings.size < site_info.size_limit * 1024 * 1024 && site_info.settings.size > 0) {
this.loading.hideScreen();
}
if (site_info.tasks > 0 && site_info.started_task_num > 0) {