mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-23 09:19:47 +02:00
alpha version of Blogger
This commit is contained in:
@ -285,7 +285,15 @@ class FileDiaLog extends BaseDialog
|
||||
($ filename).val f.filename if f.type is "file"
|
||||
(@find "bt-ok").set "onbtclick", (e) ->
|
||||
f = fileview.get "selectedFile"
|
||||
return unless f
|
||||
return me.notify "Please select a file" unless f
|
||||
if me.data and me.data.mimes
|
||||
#verify the mime
|
||||
m = false
|
||||
for v in me.data.mimes
|
||||
if f.mime.match (new RegExp v, "g")
|
||||
m = true
|
||||
break
|
||||
return me.notify "Only #{me.data.mimes.join(",")} could be selected" unless m
|
||||
d = f.path
|
||||
d = f.path.asFileHandler().parent() if f.type is "file"
|
||||
me.handler d, ($ filename).val() if me.handler
|
||||
|
@ -1,3 +1,43 @@
|
||||
String.prototype.hash = () ->
|
||||
hash = 5381
|
||||
i = this.length
|
||||
hash = (hash * 33) ^ this.charCodeAt(--i) while i
|
||||
hash >>> 0
|
||||
|
||||
String.prototype.asBase64 = () ->
|
||||
tmp = encodeURIComponent this
|
||||
return btoa ( tmp.replace /%([0-9A-F]{2})/g, (match, p1) ->
|
||||
return String.fromCharCode (parseInt p1, 16)
|
||||
)
|
||||
String.prototype.unescape = () ->
|
||||
d = @
|
||||
d = d.replace /\\\\/g, "\\"
|
||||
d = d.replace /\\"/g, '"'
|
||||
d = d.replace /\\n/g, "\n"
|
||||
d = d.replace /\\t/g, "\t"
|
||||
d = d.replace /\\b/g, "\b"
|
||||
d = d.replace /\\f/g, "\f"
|
||||
d = d.replace /\\r/g, "\r"
|
||||
d
|
||||
|
||||
Date.prototype.toString = () ->
|
||||
dd = @getDate()
|
||||
mm = @getMonth() + 1
|
||||
yyyy = @getFullYear()
|
||||
hh = @getHours()
|
||||
mi = @getMinutes()
|
||||
se = @getSeconds()
|
||||
|
||||
dd = "0#{dd}" if dd < 10
|
||||
mm = "0#{mm}" if mm < 10
|
||||
hh = "0#{hh}" if hh < 10
|
||||
mi = "0#{mi}" if mi < 10
|
||||
se = "0#{se}" if se < 10
|
||||
return "#{dd}/#{mm}/#{yyyy} #{hh}:#{mi}:#{se}"
|
||||
|
||||
Date.prototype.timestamp = () ->
|
||||
return @getTime() / 1000 | 0
|
||||
|
||||
self.OS.API =
|
||||
# the handler object could be a any remote or local handle to
|
||||
# fetch user data, used by the API to make requests
|
||||
|
@ -1,15 +1,3 @@
|
||||
String.prototype.hash = () ->
|
||||
hash = 5381
|
||||
i = this.length
|
||||
hash = (hash * 33) ^ this.charCodeAt(--i) while i
|
||||
hash >>> 0
|
||||
|
||||
String.prototype.asBase64 = () ->
|
||||
tmp = encodeURIComponent this
|
||||
return btoa ( tmp.replace /%([0-9A-F]{2})/g, (match, p1) ->
|
||||
return String.fromCharCode (parseInt p1, 16)
|
||||
)
|
||||
|
||||
String.prototype.asFileHandler = () ->
|
||||
list = @split ":///"
|
||||
handlers = _API.VFS.findHandlers list[0]
|
||||
|
Reference in New Issue
Block a user