mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 03:09:45 +02:00
global settting
This commit is contained in:
23
src/packages/CoreServices/Calendar.coffee
Normal file
23
src/packages/CoreServices/Calendar.coffee
Normal file
@ -0,0 +1,23 @@
|
||||
class Calendar extends this.OS.GUI.BaseService
|
||||
constructor: (args) ->
|
||||
super "Calendar", args
|
||||
#@iconclass = "fa fa-commenting"
|
||||
@text = ""
|
||||
@iconclass = "fa fa-calendar"
|
||||
init: ->
|
||||
#update time each second
|
||||
me = @
|
||||
@watch 1000, () ->
|
||||
now = new Date
|
||||
me.text = "#{now.getDate()}/#{(now.getMonth()+1)}/#{now.getFullYear()} " +
|
||||
"#{now.getHours()}:#{now.getMinutes()}:#{now.getSeconds()}"
|
||||
me.update()
|
||||
|
||||
awake: (e) ->
|
||||
@.openDialog "CalendarDialog", (d) -> console.log d
|
||||
# do nothing
|
||||
cleanup: (evt) ->
|
||||
console.log "cleanup for quit"
|
||||
# do nothing
|
||||
|
||||
this.OS.register "Calendar",Calendar
|
11
src/packages/CoreServices/Makefile
Normal file
11
src/packages/CoreServices/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
coffee_files = Calendar.coffee PushNotification.coffee Spotlight.coffee
|
||||
|
||||
jsfiles =
|
||||
|
||||
cssfiles =
|
||||
|
||||
copyfiles = package.json
|
||||
|
||||
|
||||
PKG_NAME=CoreServices
|
||||
include ../pkg.mk
|
93
src/packages/CoreServices/PushNotification.coffee
Normal file
93
src/packages/CoreServices/PushNotification.coffee
Normal file
@ -0,0 +1,93 @@
|
||||
class PushNotification extends this.OS.GUI.BaseService
|
||||
constructor: (args) ->
|
||||
super "PushNotification", args
|
||||
@iconclass = "fa fa-bars"
|
||||
@onmenuselect = (e) -> console.log e
|
||||
@cb = undefined
|
||||
@pending = []
|
||||
init: ->
|
||||
@view = false
|
||||
path = "resources/schemes/notifications.html"
|
||||
@render path
|
||||
|
||||
spin: (b) ->
|
||||
if b and @iconclass is "fa fa-bars"
|
||||
@iconclass = "fa fa-spinner fa-spin"
|
||||
@color = "#f90e00"
|
||||
@update()
|
||||
else if not b and @iconclass is "fa fa-spinner fa-spin"
|
||||
@iconclass = "fa fa-bars"
|
||||
@color = "#414339"
|
||||
@update()
|
||||
|
||||
main: ->
|
||||
me = @
|
||||
@mlist = @find "notifylist"
|
||||
@mfeed = @find "notifeed"
|
||||
@nzone = @find "notifyzone"
|
||||
@fzone = @find "feedzone"
|
||||
(@find "btclear").set "onbtclick", (e) -> me.mlist.set "items", []
|
||||
#mlist.set "onlistselect", (e) -> console.log e
|
||||
@subscribe "notification", (o) -> me.pushout 'INFO', o
|
||||
@subscribe "fail", (o) -> me.pushout 'FAIL', o
|
||||
@subscribe "error", (o) -> me.pushout 'ERROR', o
|
||||
|
||||
@subscribe "loading", (o) ->
|
||||
me.pending.push o.id
|
||||
me.spin true
|
||||
|
||||
@subscribe "loaded", (o) ->
|
||||
i = me.pending.indexOf o.id
|
||||
me.pending.splice i, 1 if i >= 0
|
||||
me.spin false if me.pending.length is 0
|
||||
|
||||
($ @nzone).css "right", 0
|
||||
.css "top", "-3px"
|
||||
.css "height", ""
|
||||
.css "bottom", "0"
|
||||
.css "z-index", 1000000
|
||||
.hide()
|
||||
($ @fzone)
|
||||
#.css("z-index", 99999)
|
||||
.css("bottom", "0")
|
||||
.css("height", "")
|
||||
.hide()
|
||||
|
||||
pushout: (s, o, mfeed) ->
|
||||
d = {
|
||||
text: "[#{s}] #{o.name} (#{o.id}): #{o.data.m}",
|
||||
icon: o.data.icon,
|
||||
iconclass: o.data.iconclass,
|
||||
closable: true }
|
||||
@mlist.unshift d, true
|
||||
@notifeed d
|
||||
|
||||
notifeed: (d) ->
|
||||
me = @
|
||||
@mfeed.unshift d, true
|
||||
($ @fzone).show()
|
||||
timer = setTimeout () ->
|
||||
me.mfeed.remove d, true
|
||||
clearTimeout timer
|
||||
, 3000
|
||||
|
||||
awake: (e) ->
|
||||
if @view then ($ @nzone).hide() else ($ @nzone).show()
|
||||
@view = not @view
|
||||
me = @
|
||||
if not @cb
|
||||
@cb = (e) ->
|
||||
return if e.originalEvent.item and e.originalEvent.item.i isnt undefined
|
||||
if not ($ e.target).closest($ me.nzone).length and not ($ e.target).closest($ me.holder.root).length
|
||||
($ me.nzone).hide()
|
||||
$(document).unbind "click", me.cb
|
||||
me.view = not me.view
|
||||
if @view
|
||||
$(document).on "click", @cb
|
||||
else
|
||||
$(document).unbind "click", @cb
|
||||
|
||||
cleanup: (evt) ->
|
||||
# do nothing
|
||||
|
||||
this.OS.register "PushNotification",PushNotification
|
20
src/packages/CoreServices/Spotlight.coffee
Normal file
20
src/packages/CoreServices/Spotlight.coffee
Normal file
@ -0,0 +1,20 @@
|
||||
class Spotlight extends this.OS.GUI.BaseService
|
||||
constructor: (args) ->
|
||||
super "Spotlight", args
|
||||
@iconclass = "fa fa-search"
|
||||
init: ->
|
||||
@child = [
|
||||
{
|
||||
text: "#{@.name} (#{@.pid}): dummy notif",
|
||||
child: [ { text: "submenu" } ]
|
||||
}
|
||||
]
|
||||
# do nothing
|
||||
main: ->
|
||||
|
||||
awake: (e) ->
|
||||
console.log @name ,@pid
|
||||
cleanup: (evt) ->
|
||||
# do nothing
|
||||
|
||||
this.OS.register "Spotlight",Spotlight
|
14
src/packages/CoreServices/package.json
Normal file
14
src/packages/CoreServices/package.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"app":"CoreServices",
|
||||
"name":"CoreServices",
|
||||
"description":"This is the core services",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com",
|
||||
"credit": "dedicated to some one here",
|
||||
"licences": "MIT"
|
||||
},
|
||||
"version":"0.1a",
|
||||
"category":"System",
|
||||
"mimes":["*"]
|
||||
}
|
Reference in New Issue
Block a user