├── .gitignore
├── README.md
├── beewatch.go
├── beewatch.json
├── beewatch_test.go
├── http.go
├── monitor.go
├── static
├── css
│ ├── furatto.css
│ └── normalize.css
├── fonts
│ ├── fontawesome
│ │ ├── FontAwesome.otf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.svg
│ │ ├── fontawesome-webfont.ttf
│ │ └── fontawesome-webfont.woff
│ ├── meteocons-webfont.eot
│ ├── meteocons-webfont.svg
│ ├── meteocons-webfont.ttf
│ └── meteocons-webfont.woff
├── img
│ ├── icheck
│ │ ├── aero.png
│ │ ├── aero@2x.png
│ │ ├── blue.png
│ │ ├── blue@2x.png
│ │ ├── flat.png
│ │ ├── flat@2x.png
│ │ ├── green.png
│ │ ├── green@2x.png
│ │ ├── grey.png
│ │ ├── grey@2x.png
│ │ ├── orange.png
│ │ ├── orange@2x.png
│ │ ├── pink.png
│ │ ├── pink@2x.png
│ │ ├── purple.png
│ │ ├── purple@2x.png
│ │ ├── red.png
│ │ ├── red@2x.png
│ │ ├── yellow.png
│ │ └── yellow@2x.png
│ ├── icons
│ │ ├── customize-icon150.png
│ │ ├── flexible-icon.png
│ │ ├── github-128-black.png
│ │ ├── iphone-icon150.png
│ │ ├── lock-icon128.png
│ │ ├── rocket-icon128.png
│ │ ├── rocket-icon150.png
│ │ ├── screen-icon.png
│ │ ├── screens-icon.png
│ │ └── screens2-icon.png
│ ├── next.png
│ ├── previous.png
│ ├── themes.gif
│ └── toggle.png
└── js
│ ├── beewatch.js
│ ├── furatto.min.js
│ └── jquery-1.10.2.min.js
├── tests
├── demo
│ ├── beewatch.go
│ └── beewatch.json
└── images
│ └── demo_beewatch.png
├── utils.go
├── views
└── home.html
└── watchpoint.go
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 | .idea/
10 |
11 | # Architecture specific extensions/prefixes
12 | *.[568vq]
13 | [568vq].out
14 |
15 | *.cgo1.go
16 | *.cgo2.c
17 | _cgo_defun.c
18 | _cgo_gotypes.go
19 | _cgo_export.*
20 |
21 | _testmain.go
22 |
23 | *.exe
24 | .DS_Store
25 | beebbs
26 | bee
27 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Bee Watch
2 | ========
3 |
4 | [](https://drone.io/github.com/beego/beewatch/latest)
5 |
6 | Bee Watch is an interactive debugger for the Go programming language.
7 |
8 | ## Features
9 |
10 | - Use `Critical`, `Info` and `Trace` three levels to change debugger behavior.
11 | - `Display()` variable values or `Printf()` with customized format.
12 | - User-friendly Web UI for **WebSocket** mode or easy-control **command-line** mode.
13 | - Call `AddWatchVars()` to monitor variables and show their information when the program calls `Break()`.
14 | - Configuration file with your customized settings(`beewatch.json`).
15 |
16 | ## Installation
17 |
18 | Bee Watch is a "go get" able Go project, you can execute the following command to auto-install:
19 |
20 | go get github.com/beego/beewatch
21 |
22 | **Attention** This project can only be installed by source code now.
23 |
24 | ## Quick start
25 |
26 | [beego.me/docs/Reference_BeeWatch](http://beego.me/docs/Reference_BeeWatch)
27 |
28 | ## Credits
29 |
30 | - [emicklei/hopwatch](https://github.com/emicklei/hopwatch)
31 | - [realint/dbgutil](https://github.com/realint/dbgutil)
32 |
33 | ## Examples and API documentation
34 |
35 | [Go Walker](http://gowalker.org/github.com/beego/beewatch)
36 |
37 |
38 | ## License
39 |
40 | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
--------------------------------------------------------------------------------
/beewatch.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Unknown
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | // Bee Watch is an interactive debugger for the Go programming language.
16 | package beewatch
17 |
18 | import (
19 | "encoding/json"
20 | "os"
21 | )
22 |
23 | const (
24 | APP_VER = "0.5.2.0830"
25 | )
26 |
27 | type debugLevel int
28 |
29 | const (
30 | LevelTrace debugLevel = iota
31 | LevelInfo
32 | LevelCritical
33 | )
34 |
35 | var (
36 | watchLevel debugLevel
37 | isStarted bool
38 | )
39 |
40 | var App struct {
41 | Name string `json:"app_name"`
42 | HttpPort int `json:"http_port"`
43 | WatchEnabled bool `json:"watch_enabled"`
44 | CmdMode bool `json:"cmd_mode"`
45 | SkipSuspend bool `json:"skip_suspend"`
46 | PrintStack bool `json:"print_stack"`
47 | PrintSource bool `json:"print_source"`
48 | }
49 |
50 | func loadJSON() {
51 | wd, err := os.Getwd()
52 | if err != nil {
53 | colorLog("[ERRO] BW: Fail to get work directory[ %s ]\n", err)
54 | return
55 | }
56 |
57 | f, err := os.Open(wd + "/beewatch.json")
58 | if err != nil {
59 | colorLog("[WARN] BW: Fail to load beewatch.json[ %s ]\n", err)
60 | return
61 | }
62 | defer f.Close()
63 |
64 | d := json.NewDecoder(f)
65 | err = d.Decode(&App)
66 | if err != nil {
67 | colorLog("[WARN] BW: Fail to parse beewatch.json[ %s ]\n", err)
68 | os.Exit(2)
69 | }
70 | }
71 |
72 | // Start initialize debugger data.
73 | func Start(wl ...debugLevel) {
74 | if isStarted {
75 | colorLog("[ERRO] Fail to start Bee Watch[ %s ]",
76 | "cannot start Bee Watch twice")
77 | return
78 | }
79 |
80 | isStarted = true
81 | colorLog("[INIT] BW: Bee Watch v%s.\n", APP_VER)
82 |
83 | watchLevel = LevelTrace
84 | if len(wl) > 0 {
85 | watchLevel = wl[0]
86 | }
87 |
88 | App.Name = "Bee Watch"
89 | App.HttpPort = 23456
90 | App.WatchEnabled = true
91 | App.PrintStack = true
92 | App.PrintSource = true
93 |
94 | loadJSON()
95 |
96 | if App.WatchEnabled {
97 | if App.CmdMode {
98 |
99 | } else {
100 | initHTTP()
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/beewatch.json:
--------------------------------------------------------------------------------
1 | {
2 | "app_name": "Bee Watch Demo",
3 | "http_port": 23456,
4 | "watch_enabled": true,
5 | "cmd_mode": false,
6 | "skip_suspend": false,
7 | "print_stack": true,
8 | "print_source": true
9 | }
10 |
--------------------------------------------------------------------------------
/beewatch_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Unknown
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package beewatch
16 |
17 | import (
18 | "testing"
19 | )
20 |
21 | func Test_BeeWatch(t *testing.T) {
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/http.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Unknown
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package beewatch
16 |
17 | import (
18 | "fmt"
19 | "html/template"
20 | "io"
21 | "net/http"
22 | "os"
23 | "strings"
24 |
25 | "code.google.com/p/go.net/websocket"
26 | )
27 |
28 | var (
29 | viewPath string
30 | data map[interface{}]interface{}
31 | )
32 |
33 | func initHTTP() {
34 | // Static path.
35 | sp, err := getStaticPath()
36 | if err != nil {
37 | colorLog("[ERRO] BW: Fail to get static path[ %s ]\n", err)
38 | os.Exit(2)
39 | }
40 |
41 | http.Handle("/static/", http.StripPrefix("/static/",
42 | http.FileServer(http.Dir(sp))))
43 | colorLog("[INIT] BW: File server( %s )\n",
44 | sp[:strings.LastIndex(sp, "/")])
45 |
46 | // View path.
47 | viewPath = strings.Replace(sp, "static", "views", 1)
48 |
49 | http.HandleFunc("/", mainPage)
50 | http.HandleFunc("/gosource", gosource)
51 | http.Handle("/beewatch", websocket.Handler(connectHandler))
52 |
53 | data = make(map[interface{}]interface{})
54 | data["AppVer"] = "v" + APP_VER
55 | data["AppName"] = App.Name
56 |
57 | go sendLoop()
58 | go listen()
59 | }
60 |
61 | func listen() {
62 | err := http.ListenAndServe(":"+fmt.Sprintf("%d", App.HttpPort), nil)
63 | if err != nil {
64 | colorLog("[ERRO] BW: Server crashed[ %s ]\n", err)
65 | os.Exit(2)
66 | }
67 | }
68 |
69 | // Close sends disconnect signal to the browser.
70 | func Close() {
71 | if App.WatchEnabled && !App.CmdMode {
72 | channelExchangeCommands(LevelCritical, command{Action: "DONE"})
73 | }
74 | }
75 |
76 | func mainPage(w http.ResponseWriter, r *http.Request) {
77 | b, err := loadFile(viewPath + "/home.html")
78 | if err != nil {
79 | colorLog("[ERRO] BW: Fail to load template[ %s ]\n", err)
80 | os.Exit(2)
81 | }
82 | t := template.New("home.html")
83 | t.Parse(string(b))
84 | t.Execute(w, data)
85 | }
86 |
87 | // serve a (source) file for displaying in the debugger
88 | func gosource(w http.ResponseWriter, r *http.Request) {
89 | if App.PrintSource {
90 | fileName := r.FormValue("file")
91 | // should check for permission?
92 | w.Header().Set("Cache-control", "no-store, no-cache, must-revalidate")
93 | http.ServeFile(w, r, fileName)
94 | } else {
95 | io.WriteString(w, "'print_source' disenabled.")
96 | }
97 | }
98 |
99 | var (
100 | currentWebsocket *websocket.Conn
101 | connectChannel = make(chan command)
102 | toBrowserChannel = make(chan command)
103 | fromBrowserChannel = make(chan command)
104 | )
105 |
106 | // command is used to transport message to and from the debugger.
107 | type command struct {
108 | Action string
109 | Level string
110 | Parameters map[string]string
111 | WatchVars map[string]*watchVar
112 | }
113 |
114 | // addParam adds a key,value string pair to the command ; no check on overwrites.
115 | func (c *command) addParam(key, value string) {
116 | if c.Parameters == nil {
117 | c.Parameters = map[string]string{}
118 | }
119 | c.Parameters[key] = value
120 | }
121 |
122 | func connectHandler(ws *websocket.Conn) {
123 | if currentWebsocket != nil {
124 | colorLog("[INFO] BW: Connection has already been established, ignore.\n")
125 | return
126 | }
127 |
128 | var cmd command
129 | if err := websocket.JSON.Receive(ws, &cmd); err != nil {
130 | colorLog("[ERRO] BW: Fail to establish connection[ %s ]\n", err)
131 | } else {
132 | currentWebsocket = ws
133 | connectChannel <- cmd
134 | App.WatchEnabled = true
135 | colorLog("[SUCC] BW: Connected to browser, ready to watch.\n")
136 | receiveLoop()
137 | }
138 | }
139 |
140 | // receiveLoop reads commands from the websocket and puts them onto a channel.
141 | func receiveLoop() {
142 | for {
143 | var cmd command
144 | if err := websocket.JSON.Receive(currentWebsocket, &cmd); err != nil {
145 | colorLog("[ERRO] BW: connectHandler.JSON.Receive failed[ %s ]\n", err)
146 | cmd = command{Action: "QUIT"}
147 | }
148 |
149 | colorLog("[SUCC] BW: Received %v.\n", cmd)
150 | if "QUIT" == cmd.Action {
151 | App.WatchEnabled = false
152 | colorLog("[INFO] BW: Browser requests disconnect.\n")
153 | currentWebsocket.Close()
154 | currentWebsocket = nil
155 | //toBrowserChannel <- cmd
156 | if cmd.Parameters["PASSIVE"] == "1" {
157 | fromBrowserChannel <- cmd
158 | }
159 | close(toBrowserChannel)
160 | close(fromBrowserChannel)
161 | App.WatchEnabled = false
162 | colorLog("[WARN] BW: Disconnected.\n")
163 | break
164 | } else {
165 | fromBrowserChannel <- cmd
166 | }
167 | }
168 |
169 | colorLog("[WARN] BW: Exit receive loop.\n")
170 | //go sendLoop()
171 | }
172 |
173 | // sendLoop takes commands from a channel to send to the browser (debugger).
174 | // If no connection is available then wait for it.
175 | // If the command action is quit then abort the loop.
176 | func sendLoop() {
177 | if currentWebsocket == nil {
178 | colorLog("[INFO] BW: No connection, wait for it.\n")
179 | cmd := <-connectChannel
180 | if "QUIT" == cmd.Action {
181 | return
182 | }
183 | }
184 |
185 | for {
186 | next, ok := <-toBrowserChannel
187 | if !ok {
188 | colorLog("[WARN] BW: Send channel was closed.\n")
189 | break
190 | }
191 |
192 | if "QUIT" == next.Action {
193 | break
194 | }
195 |
196 | if currentWebsocket == nil {
197 | colorLog("[INFO] BW: No connection, wait for it.\n")
198 | cmd := <-connectChannel
199 | if "QUIT" == cmd.Action {
200 | break
201 | }
202 | }
203 | websocket.JSON.Send(currentWebsocket, &next)
204 | colorLog("[SUCC] BW: Sent %v.\n", next)
205 | }
206 |
207 | colorLog("[WARN] BW: Exit send loop.\n")
208 | }
209 |
--------------------------------------------------------------------------------
/monitor.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Unknown
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package beewatch
16 |
17 | import (
18 | //"bytes"
19 | "fmt"
20 | "reflect"
21 | "sync"
22 | )
23 |
24 | type watchValue struct {
25 | Value reflect.Value
26 | Note string
27 | }
28 |
29 | var (
30 | watchLock *sync.RWMutex
31 | watchMap map[string]*watchValue
32 | )
33 |
34 | // AddWatchVars adds variables to be watched,
35 | // so that when the program calls 'Break()'
36 | // these variables' infomation will be showed on monitor panel.
37 | // The parameter 'nameValuePairs' must be even sized.
38 | // Note that you have to pass pointers in order to have correct results.
39 | func AddWatchVars(nameValuePairs ...interface{}) {
40 | // if !App.WatchEnabled {
41 | // return
42 | // }
43 |
44 | if watchLock == nil {
45 | watchLock = new(sync.RWMutex)
46 | }
47 | watchLock.Lock()
48 | defer watchLock.Unlock()
49 |
50 | if watchMap == nil {
51 | watchMap = make(map[string]*watchValue)
52 | }
53 |
54 | l := len(nameValuePairs)
55 | if l%2 != 0 {
56 | colorLog("[ERRO] cannot add watch variables without even sized.\n")
57 | return
58 | }
59 |
60 | for i := 0; i < l; i += 2 {
61 | k := nameValuePairs[i]
62 | v := nameValuePairs[i+1]
63 | rv := reflect.ValueOf(v)
64 |
65 | if rv.Kind() != reflect.Ptr {
66 | colorLog("[WARN] cannot watch variable( %s ) because [ %s ]\n",
67 | k, "it's not passed by pointer")
68 | continue
69 | }
70 |
71 | watchMap[fmt.Sprint(k)] = &watchValue{
72 | Value: rv,
73 | Note: "",
74 | }
75 | }
76 | }
77 |
78 | // func pirntWatchValues() {
79 | // buf := new(bytes.Buffer)
80 | // for k, v := range watchMap {
81 | // printWatchValue(buf, k, "", v)
82 | // }
83 | // fmt.Print(buf.String())
84 | // }
85 |
86 | // func printWatchValue(buf *bytes.Buffer, name, prefix string, wv *watchValue) {
87 | // switch wv.Type {
88 | // case reflect.String:
89 | // fmt.Fprintf(buf, "%s:string:%s\"%v\"\n", name, prefix, wv.Value)
90 | // case reflect.Ptr:
91 | // if wv.Value.IsNil() {
92 | // fmt.Fprintf(buf, "%s:pointer:null\n", name)
93 | // return
94 | // }
95 |
96 | // printWatchValue(buf, name, "&", &watchValue{
97 | // Type: wv.Value.Elem().Kind(),
98 | // Value: wv.Value.Elem(),
99 | // })
100 | // }
101 | // }
102 |
103 | type watchVar struct {
104 | Kind, Value, Note string
105 | }
106 |
107 | func formatWatchVars() map[string]*watchVar {
108 | if watchLock == nil {
109 | return nil
110 | }
111 |
112 | watchLock.RLock()
113 | defer watchLock.RUnlock()
114 |
115 | watchVars := make(map[string]*watchVar)
116 | for k, v := range watchMap {
117 | watchVars[k] = &watchVar{
118 | Kind: fmt.Sprint(v.Value.Elem().Kind()),
119 | Value: reflectToStr(v.Value.Elem()),
120 | Note: v.Note,
121 | }
122 | }
123 | return watchVars
124 | }
125 |
126 | func reflectToStr(rv reflect.Value) string {
127 | k := rv.Kind()
128 | switch k {
129 | case reflect.Bool:
130 | return fmt.Sprintf("%v", rv.Bool())
131 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
132 | return fmt.Sprintf("%v", rv.Int())
133 | case reflect.Uint8, reflect.Uint16, reflect.Uint, reflect.Uint32, reflect.Uint64:
134 | return fmt.Sprintf("%v", rv.Uint())
135 | case reflect.Float32, reflect.Float64:
136 | return fmt.Sprintf("%v", rv.Float())
137 | case reflect.Complex64, reflect.Complex128:
138 | return fmt.Sprintf("%v", rv.Complex())
139 | case reflect.String:
140 | return fmt.Sprintf("\"%s\"", rv.String())
141 | case reflect.Invalid:
142 | return "Invalid"
143 | default:
144 | return "Unknown"
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/static/css/normalize.css:
--------------------------------------------------------------------------------
1 | /* normalize.css v2.1.1 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{background:#fff;color:#000;font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:0.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace, serif;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}
2 |
3 | .version {
4 | font-size: 50%;
5 | color: rgb(204, 154, 204);
6 | }
7 |
8 | .mono {
9 | font-family: "Lucida Console", Monaco, monospace;
10 | font-size: 13px;
11 | }
12 |
13 | .break {
14 | background-color: #375EAB;
15 | color: #FFF;
16 | }
17 |
18 | #gosource {
19 | background: #FFD;
20 | white-space: pre;
21 | }
22 |
--------------------------------------------------------------------------------
/static/fonts/fontawesome/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/fonts/fontawesome/FontAwesome.otf
--------------------------------------------------------------------------------
/static/fonts/fontawesome/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/fonts/fontawesome/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/static/fonts/fontawesome/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/fonts/fontawesome/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/static/fonts/fontawesome/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/fonts/fontawesome/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/static/fonts/meteocons-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/fonts/meteocons-webfont.eot
--------------------------------------------------------------------------------
/static/fonts/meteocons-webfont.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/static/fonts/meteocons-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/fonts/meteocons-webfont.ttf
--------------------------------------------------------------------------------
/static/fonts/meteocons-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/fonts/meteocons-webfont.woff
--------------------------------------------------------------------------------
/static/img/icheck/aero.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/aero.png
--------------------------------------------------------------------------------
/static/img/icheck/aero@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/aero@2x.png
--------------------------------------------------------------------------------
/static/img/icheck/blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/blue.png
--------------------------------------------------------------------------------
/static/img/icheck/blue@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/blue@2x.png
--------------------------------------------------------------------------------
/static/img/icheck/flat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/flat.png
--------------------------------------------------------------------------------
/static/img/icheck/flat@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/flat@2x.png
--------------------------------------------------------------------------------
/static/img/icheck/green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/green.png
--------------------------------------------------------------------------------
/static/img/icheck/green@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/green@2x.png
--------------------------------------------------------------------------------
/static/img/icheck/grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/grey.png
--------------------------------------------------------------------------------
/static/img/icheck/grey@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/grey@2x.png
--------------------------------------------------------------------------------
/static/img/icheck/orange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/orange.png
--------------------------------------------------------------------------------
/static/img/icheck/orange@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/orange@2x.png
--------------------------------------------------------------------------------
/static/img/icheck/pink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/pink.png
--------------------------------------------------------------------------------
/static/img/icheck/pink@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/pink@2x.png
--------------------------------------------------------------------------------
/static/img/icheck/purple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/purple.png
--------------------------------------------------------------------------------
/static/img/icheck/purple@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/purple@2x.png
--------------------------------------------------------------------------------
/static/img/icheck/red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/red.png
--------------------------------------------------------------------------------
/static/img/icheck/red@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/red@2x.png
--------------------------------------------------------------------------------
/static/img/icheck/yellow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/yellow.png
--------------------------------------------------------------------------------
/static/img/icheck/yellow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icheck/yellow@2x.png
--------------------------------------------------------------------------------
/static/img/icons/customize-icon150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/customize-icon150.png
--------------------------------------------------------------------------------
/static/img/icons/flexible-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/flexible-icon.png
--------------------------------------------------------------------------------
/static/img/icons/github-128-black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/github-128-black.png
--------------------------------------------------------------------------------
/static/img/icons/iphone-icon150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/iphone-icon150.png
--------------------------------------------------------------------------------
/static/img/icons/lock-icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/lock-icon128.png
--------------------------------------------------------------------------------
/static/img/icons/rocket-icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/rocket-icon128.png
--------------------------------------------------------------------------------
/static/img/icons/rocket-icon150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/rocket-icon150.png
--------------------------------------------------------------------------------
/static/img/icons/screen-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/screen-icon.png
--------------------------------------------------------------------------------
/static/img/icons/screens-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/screens-icon.png
--------------------------------------------------------------------------------
/static/img/icons/screens2-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/icons/screens2-icon.png
--------------------------------------------------------------------------------
/static/img/next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/next.png
--------------------------------------------------------------------------------
/static/img/previous.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/previous.png
--------------------------------------------------------------------------------
/static/img/themes.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/themes.gif
--------------------------------------------------------------------------------
/static/img/toggle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/static/img/toggle.png
--------------------------------------------------------------------------------
/static/js/beewatch.js:
--------------------------------------------------------------------------------
1 | var wsUri = "ws://" + window.location.hostname + ":" + window.location.port + "/beewatch";
2 | var output;
3 | var ctrlPanel;
4 | var varMonitor;
5 | var varTable;
6 | var connected = false;
7 | var suspended = false;
8 | var websocket = new WebSocket(wsUri);
9 |
10 | function init() {
11 | output = document.getElementById("output");
12 | ctrlPanel = document.getElementById("control_panel");
13 | ctrlPanel.style.width = (document.body.clientWidth - 820) + "px";
14 | varMonitor = document.getElementById("variable_monitor");
15 | output.style.minHeight = (window.innerHeight - 200) + "px";
16 | varMonitor.style.height = (window.innerHeight - 220) + "px";
17 | varTable = document.getElementById("var_table");
18 |
19 | setupWebSocket();
20 | }
21 |
22 | function setupWebSocket() {
23 | websocket.onopen = function (evt) {
24 | onOpen(evt)
25 | };
26 | websocket.onclose = function (evt) {
27 | onClose(evt)
28 | };
29 | websocket.onmessage = function (evt) {
30 | onMessage(evt)
31 | };
32 | websocket.onerror = function (evt) {
33 | onError(evt)
34 | };
35 | }
36 |
37 | function onOpen(evt) {
38 | connected = true;
39 | //document.getElementById("disconnect").className = "buttonEnabled";
40 | writeToScreen("Connection has established.", "label label-funky", "INFO", "");
41 | sendConnected();
42 | }
43 |
44 | function onClose(evt) {
45 | //handleDisconnected();
46 | }
47 |
48 | function handleDisconnected() {
49 | //connected = false;
50 | //document.getElementById("resume").className = "buttonDisabled";
51 | //document.getElementById("disconnect").className = "buttonDisabled";
52 | //writeToScreen("Disconnected.", "label label-funky", "INFO", "");
53 | }
54 |
55 | function onMessage(evt) {
56 | try {
57 | var cmd = JSON.parse(evt.data);
58 | } catch (e) {
59 | writeToScreen("Failed to read valid JSON", "label label-funky", "ERRO", e.message.data);
60 | return;
61 | }
62 |
63 | switch (cmd.Action) {
64 | case "PRINT":
65 | case "DISPLAY":
66 | writeToScreen(getTitle(cmd), getLevelCls(cmd.Level), cmd.Level, watchParametersToHtml(cmd.Parameters));
67 | sendResume();
68 | return;
69 | case "DONE":
70 | actionDisconnect(true);
71 | return;
72 | case "BREAK":
73 | var title;
74 | if (cmd.Parameters["go.SKIP_SUSPEND"] == "true") {
75 | title = "program suspend skiped <->";
76 | } else {
77 | suspended = true;
78 | title = "program suspended -->";
79 | }
80 | var logdiv = writeToScreen(title, getLevelCls(cmd.Level), cmd.Level, "");
81 |
82 | addStack(logdiv, cmd);
83 | handleSourceUpdate(logdiv, cmd);
84 | updateVarInfo(cmd);
85 | return;
86 | }
87 | }
88 |
89 | function getTitle(cmd) {
90 | var filePath = cmd.Parameters["go.file"];
91 | var i = filePath.lastIndexOf("/") + 1;
92 | return filePath.substring(i, filePath.length) + ":" + cmd.Parameters["go.line"];
93 | }
94 |
95 | function onError(evt) {
96 | writeToScreen("WebScoket error", "label label-funky", "ERRO", evt.data);
97 | }
98 |
99 | function writeToScreen(title, cls, level, msg) {
100 | var logdiv = document.createElement("div");
101 | addTime(logdiv, cls, level);
102 | addTitle(logdiv, title);
103 | addMessage(logdiv, msg, level);
104 | output.appendChild(logdiv);
105 | logdiv.scrollIntoView();
106 | return logdiv;
107 | }
108 |
109 | function addTime(logdiv, cls, level) {
110 | var stamp = document.createElement("span");
111 | stamp.innerHTML = timeHHMMSS() + " " + level;
112 | stamp.className = cls;
113 | logdiv.appendChild(stamp);
114 | }
115 |
116 | function timeHHMMSS() {
117 | return new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
118 | }
119 |
120 | function addTitle(logdiv, title) {
121 | var name = document.createElement("span");
122 | name.innerHTML = " " + title;
123 | logdiv.appendChild(name);
124 | }
125 |
126 | function addMessage(logdiv, msg, level) {
127 | var txt = document.createElement("span");
128 |
129 | if (msg.substr(0, 1) == "[") {
130 | // Debugger messages.
131 | txt.className = getMsgClass(msg.substr(1, 4));
132 | } else {
133 | // App messages.
134 | txt.className = getMsgClass(level);
135 | }
136 |
137 | txt.innerHTML = " " + msg;
138 | logdiv.appendChild(txt);
139 | }
140 |
141 | function addStack(logdiv, cmd) {
142 | var stack;
143 | if (cmd.Parameters["go.PRINT_STACK"] != "true") {
144 | stack = "'print_stack' disenabled.";
145 | } else {
146 | stack = cmd.Parameters["go.stack"];
147 | }
148 | if (stack != null && stack.length > 0) {
149 | addNonEmptyStackTo(stack, logdiv);
150 | }
151 | }
152 |
153 | function addNonEmptyStackTo(stack, logdiv) {
154 | var toggle = document.createElement("a");
155 | toggle.className = "label label-primary";
156 | toggle.onclick = function () {
157 | toggleStack(toggle);
158 | };
159 | toggle.innerHTML = "Stack & Source ▶";
160 | logdiv.appendChild(toggle);
161 |
162 | var panel = document.createElement("div");
163 | panel.style.display = "none";
164 | panel.id = "panel";
165 | var stk = document.createElement("div");
166 | var lines = document.createElement("pre");
167 | lines.innerHTML = stack;
168 | stk.appendChild(lines);
169 | panel.appendChild(stk);
170 | logdiv.appendChild(panel);
171 | }
172 |
173 | function toggleStack(link) {
174 | var stack = link.nextSibling;
175 | if (stack.style.display == "none") {
176 | link.innerHTML = "Stack & Source ▼";
177 | stack.style.display = "block";
178 | } else {
179 | link.innerHTML = "Stack & Source ▶";
180 | stack.style.display = "none";
181 | }
182 | }
183 |
184 | function getMsgClass(level) {
185 | switch (level) {
186 | case "INIT", "INFO":
187 | return "text-success";
188 | }
189 | }
190 |
191 | function getLevelCls(level) {
192 | switch (level) {
193 | case "TRACE":
194 | return "label";
195 | case "INFO":
196 | return "label label-info";
197 | case "CRITICAL":
198 | return "label label-danger";
199 | default:
200 | return "lable";
201 | }
202 | }
203 |
204 | function watchParametersToHtml(parameters) {
205 | var line = "";
206 | var multiline = false;
207 | for (var prop in parameters) {
208 | if (prop.slice(0, 3) != "go.") {
209 | if (multiline) {
210 | line = line + ", ";
211 | }
212 | line = line + prop + " => " + parameters[prop];
213 | multiline = true;
214 | }
215 | }
216 | return line
217 | }
218 |
219 | function handleSourceUpdate(logdiv, cmd) {
220 | loadSource(logdiv, cmd.Parameters["go.file"], cmd.Parameters["go.line"]);
221 | }
222 |
223 | function loadSource(logdiv, fileName, nr) {
224 | $("#gofile").html(shortenFileName(fileName));
225 | $("#source_panel").show();
226 | $.ajax({
227 | url:"/gosource?file=" + fileName
228 | }
229 | ).
230 | done(
231 | function (responseText, status, xhr) {
232 | handleSourceLoaded(logdiv, fileName, responseText, parseInt(nr));
233 | }
234 | );
235 | }
236 |
237 | function handleSourceLoaded(logdiv, fileName, responseText, line) {
238 | var srcPanel = document.createElement("div");
239 | var gosrc = document.createElement("div")
240 | gosrc.className = "mono";
241 | gosrc.id = "gosource";
242 |
243 | if (responseText.indexOf("\n") > -1) {
244 | var breakElm;
245 |
246 | var elm = document.createElement("div");
247 | elm.innerHTML = shortenFileName(fileName);
248 | gosrc.appendChild(elm);
249 |
250 | // Insert line numbers
251 | var arr = responseText.split('\n');
252 | for (var i = 0; i < arr.length; i++) {
253 | if ((i + 1 <= line - 10)) {
254 | continue;
255 | } else if (i + 1 >= line + 10) {
256 | break;
257 | }
258 |
259 | var nr = i + 1
260 | var buf = space_padded(nr) + arr[i];
261 | var elm = document.createElement("div");
262 | elm.innerHTML = buf;
263 | if (line == nr) {
264 | elm.className = "break";
265 | breakElm = elm
266 | }
267 | gosrc.appendChild(elm);
268 | }
269 | } else {
270 | var elm = document.createElement("div");
271 | elm.innerHTML = responseText;
272 | gosrc.appendChild(elm);
273 | }
274 |
275 | srcPanel.appendChild(gosrc);
276 | logdiv.childNodes[4].appendChild(srcPanel);
277 | }
278 |
279 | function space_padded(i) {
280 | var buf = "" + i
281 | if (i < 1000) {
282 | buf += " "
283 | }
284 | if (i < 100) {
285 | buf += " "
286 | }
287 | if (i < 10) {
288 | buf += " "
289 | }
290 | return buf
291 | }
292 |
293 | function shortenFileName(fileName) {
294 | return fileName.length > 60 ? "..." + fileName.substring(fileName.length - 60) : fileName;
295 | }
296 |
297 | function updateVarInfo(cmd) {
298 | for (var wv in cmd.WatchVars) {
299 | var tr = findWatchVar(wv);
300 | if (tr == null) {
301 | tr = document.createElement("tr");
302 | var td = document.createElement("td");
303 | td.innerHTML = wv;
304 | tr.appendChild(td);
305 |
306 | td = document.createElement("td");
307 | td.innerHTML = cmd.WatchVars[wv].Kind;
308 | tr.appendChild(td);
309 |
310 | td = document.createElement("td");
311 | td.innerHTML = cmd.WatchVars[wv].Value;
312 | tr.appendChild(td);
313 |
314 | varTable.appendChild(tr);
315 | } else {
316 | var v = cmd.WatchVars[wv].Value;
317 | if (v != tr.childNodes[2].innerHTML) {
318 | tr.childNodes[2].innerHTML = v;
319 | tr.className="text-error";
320 | }
321 | }
322 | }
323 | }
324 |
325 | function findWatchVar(name) {
326 | var trs = varTable.childNodes;
327 | for (var i = 0; i < trs.length; i++) {
328 | if (name == trs[i].childNodes[0].innerHTML) {
329 | return trs[i];
330 | }
331 | }
332 | return null;
333 | }
334 |
335 | function actionResume() {
336 | if (!connected) return;
337 | if (!suspended) return;
338 | suspended = false;
339 | //document.getElementById("resume").className = "buttonDisabled";
340 | writeToScreen("<-- resume program.", "label label-info", "INFO", "");
341 | sendResume();
342 | }
343 |
344 | function actionDisconnect(passive) {
345 | if (!connected) return;
346 | connected = false;
347 | //document.getElementById("disconnect").className = "buttonDisabled";
348 | sendQuit(passive);
349 | writeToScreen("Disconnected.", "label label-funky", "INFO", "");
350 | websocket.close(); // seems not to trigger close on Go-side ; so handleDisconnected cannot be used here.
351 | }
352 |
353 | function sendConnected() {
354 | doSend('{"Action":"CONNECTED"}');
355 | }
356 |
357 | function sendResume() {
358 | doSend('{"Action":"RESUME"}');
359 | }
360 |
361 | function sendQuit(passive) {
362 | if (passive) {
363 | doSend('{"Action":"QUIT","Parameters":{"PASSIVE":"1"}}');
364 | } else {
365 | doSend('{"Action":"QUIT","Parameters":{"PASSIVE":"0"}}');
366 | }
367 | }
368 |
369 | function doSend(message) {
370 | // console.log("[hopwatch] send: " + message);
371 | websocket.send(message);
372 | }
373 |
374 | function handleKeyDown(event) {
375 | switch (event.keyCode) {
376 | case 119: // F8.
377 | actionResume();
378 | case 120: // F9.
379 | }
380 | }
381 |
382 | function resizeWindow() {
383 | output.style.minHeight = (window.innerHeight - 200) + "px";
384 | varMonitor.style.height = (window.innerHeight - 220) + "px";
385 | }
386 |
387 | window.addEventListener("load", init, false);
388 | window.addEventListener("keydown", handleKeyDown, true);
389 | window.addEventListener("resize", resizeWindow, false)
--------------------------------------------------------------------------------
/static/js/furatto.min.js:
--------------------------------------------------------------------------------
1 | !function(e){"use strict";function r(){e(".dropdown-backdrop").remove(),e(t).each(function(){i(e(this)).removeClass("open")})}function i(t){var n=t.attr("data-target"),r;n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),r=n&&e(n);if(!r||!r.length)r=t.parent();return r}var t="[data-toggle=dropdown]",n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),s,o;if(n.is(".disabled, :disabled"))return;return s=i(n),o=s.hasClass("open"),r(),o||("ontouchstart"in document.documentElement&&e('
').insertBefore(e(this)).on("click",r),s.toggleClass("open")),n.focus(),!1},keydown:function(n){var r,s,o,u,a,f;if(!/(38|40|27)/.test(n.keyCode))return;r=e(this),n.preventDefault(),n.stopPropagation();if(r.is(".disabled, :disabled"))return;u=i(r),a=u.hasClass("open");if(!a||a&&n.keyCode==27)return n.which==27&&u.find(t).focus(),r.click();s=e("[role=menu] li:not(.divider):visible a",u);if(!s.length)return;f=s.index(s.filter(":focus")),n.keyCode==38&&f>0&&f--,n.keyCode==40&&f *").each(function(){e(this).css("position")=="fixed"&&e(this).css(n.options.direction)=="auto"&&n.fixedChildren.push(this)});if(n.fixedChildren.length>0){var r={position:"relative"};r[n.options.direction]="1px",n.setPanelStyle(r),parseInt(e(n.fixedChildren[0]).offset().left)==0&&(n.settings.shiftFixedChildren=!0)}n.setPanelStyle(t)},setjPanelMenuStyles:function(){var t="#fff",r=e("html").css("background-color"),i=e("body").css("background-color");i!="transparent"&&i!="rgba(0, 0, 0, 0)"?t=i:r!="transparent"&&r!="rgba(0, 0, 0, 0)"?t=r:t="#fff",e("#jPanelMenu-style-master").length==0&&e("body").append('")},setMenuState:function(t){var n=t?"open":"closed";e("body").attr("data-menu-position",n)},getMenuState:function(){return e("body").attr("data-menu-position")},menuIsOpen:function(){return n.getMenuState()=="open"?!0:!1},setMenuStyle:function(t){e(n.menu).css(t)},setPanelStyle:function(t){e(n.panel).css(t)},showMenu:function(){n.setMenuStyle({display:"block"}),n.setMenuStyle({"z-index":"1"})},hideMenu:function(){n.setMenuStyle({"z-index":"-1"}),n.setMenuStyle({display:"none"})},enableTransitions:function(t,r){var i=t/1e3,s=n.getCSSEasingFunction(r);n.disableTransitions(),e("body").append('")},disableTransitions:function(){e("#jPanelMenu-style-transitions").remove()},enableFixedTransitions:function(t,r,i,s){var o=i/1e3,u=n.getCSSEasingFunction(s);n.disableFixedTransitions(r),e("body").append('")},disableFixedTransitions:function(t){e("#jPanelMenu-style-fixed-"+t).remove()},getCSSEasingFunction:function(e){switch(e){case"linear":return e;case"ease":return e;case"ease-in":return e;case"ease-out":return e;case"ease-in-out":return e;default:return"ease-in-out"}},getJSEasingFunction:function(e){switch(e){case"linear":return e;default:return"swing"}},openMenu:function(t){if(typeof t=="undefined"||t==null)t=n.options.animated;n.clearTimeouts(),n.options.before(),n.options.beforeOpen(),n.setMenuState(!0),n.setPanelStyle({position:"relative"}),n.showMenu();var r={none:t?!1:!0,transitions:t&&n.settings.transitionsSupported?!0:!1};if(r.transitions||r.none){r.none&&n.disableTransitions(),r.transitions&&n.enableTransitions(n.options.openDuration,n.options.openEasing);var i={};i[n.options.direction]=n.options.openPosition,n.setPanelStyle(i),n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t=e(this).prop("tagName").toLowerCase()+" "+e(this).attr("class"),i=t.replace(" ","."),t=t.replace(" ","-");r.none&&n.disableFixedTransitions(t),r.transitions&&n.enableFixedTransitions(i,t,n.options.openDuration,n.options.openEasing);var s={};s[n.options.direction]=n.options.openPosition,e(this).css(s)}),n.timeouts.afterOpen=setTimeout(function(){n.disableTransitions(),n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t=e(this).prop("tagName").toLowerCase()+" "+e(this).attr("class"),t=t.replace(" ","-");n.disableFixedTransitions(t)}),n.options.after(),n.options.afterOpen(),n.initiateContentClickListeners()},n.options.openDuration)}else{var s=n.getJSEasingFunction(n.options.openEasing),o={};o[n.options.direction]=n.options.openPosition,e(n.panel).stop().animate(o,n.options.openDuration,s,function(){n.options.after(),n.options.afterOpen(),n.initiateContentClickListeners()}),n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t={};t[n.options.direction]=n.options.openPosition,e(this).stop().animate(t,n.options.openDuration,s)})}},closeMenu:function(t){if(typeof t=="undefined"||t==null)t=n.options.animated;n.clearTimeouts(),n.options.before(),n.options.beforeClose(),n.setMenuState(!1);var r={none:t?!1:!0,transitions:t&&n.settings.transitionsSupported?!0:!1};if(r.transitions||r.none){r.none&&n.disableTransitions(),r.transitions&&n.enableTransitions(n.options.closeDuration,n.options.closeEasing);var i={};i[n.options.direction]=0+n.settings.positionUnits,n.setPanelStyle(i),n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t=e(this).prop("tagName").toLowerCase()+" "+e(this).attr("class"),i=t.replace(" ","."),t=t.replace(" ","-");r.none&&n.disableFixedTransitions(t),r.transitions&&n.enableFixedTransitions(i,t,n.options.closeDuration,n.options.closeEasing);var s={};s[n.options.direction]=0+n.settings.positionUnits,e(this).css(s)}),n.timeouts.afterClose=setTimeout(function(){n.setPanelStyle({position:n.settings.panelPosition}),n.disableTransitions(),n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t=e(this).prop("tagName").toLowerCase()+" "+e(this).attr("class"),t=t.replace(" ","-");n.disableFixedTransitions(t)}),n.hideMenu(),n.options.after(),n.options.afterClose(),n.destroyContentClickListeners()},n.options.closeDuration)}else{var s=n.getJSEasingFunction(n.options.closeEasing),o={};o[n.options.direction]=0+n.settings.positionUnits,e(n.panel).stop().animate(o,n.options.closeDuration,s,function(){n.setPanelStyle({position:n.settings.panelPosition}),n.hideMenu(),n.options.after(),n.options.afterClose(),n.destroyContentClickListeners()}),n.settings.shiftFixedChildren&&e(n.fixedChildren).each(function(){var t={};t[n.options.direction]=0+n.settings.positionUnits,e(this).stop().animate(t,n.options.closeDuration,s)})}},triggerMenu:function(e){n.menuIsOpen()?n.closeMenu(e):n.openMenu(e)},initiateClickListeners:function(){e(document).on("click",n.options.trigger,function(){return n.triggerMenu(n.options.animated),!1})},destroyClickListeners:function(){e(document).off("click",n.options.trigger,null)},initiateContentClickListeners:function(){if(!n.options.closeOnContentClick)return!1;e(document).on("click",n.panel,function(e){n.menuIsOpen()&&n.closeMenu(n.options.animated)}),e(document).on("touchend",n.panel,function(e){n.menuIsOpen()&&n.closeMenu(n.options.animated)})},destroyContentClickListeners:function(){if(!n.options.closeOnContentClick)return!1;e(document).off("click",n.panel,null),e(document).off("touchend",n.panel,null)},initiateKeyboardListeners:function(){var t=["input","textarea"];e(document).on("keydown",function(r){var i=e(r.target),s=!1;e.each(t,function(){i.is(this.toString())&&(s=!0)});if(s)return!0;for(mapping in n.options.keyboardShortcuts)if(r.which==n.options.keyboardShortcuts[mapping].code){var o=n.options.keyboardShortcuts[mapping];return o.open&&o.close?n.triggerMenu(n.options.animated):o.open&&!o.close&&!n.menuIsOpen()?n.openMenu(n.options.animated):!o.open&&o.close&&n.menuIsOpen()&&n.closeMenu(n.options.animated),!1}})},destroyKeyboardListeners:function(){e(document).off("keydown",null)},setupMarkup:function(){e("html").addClass("jPanelMenu"),e("body > *").not(n.menu+", "+n.options.excludedPanelContent).wrapAll(''),e(n.options.menu).clone().attr("id",n.menu.replace("#","")).insertAfter("body > "+n.panel)},resetMarkup:function(){e("html").removeClass("jPanelMenu"),e("body > "+n.panel+" > *").unwrap(),e(n.menu).remove()},init:function(){n.options.beforeOn(),n.initiateClickListeners(),Object.prototype.toString.call(n.options.keyboardShortcuts)==="[object Array]"&&n.initiateKeyboardListeners(),n.setjPanelMenuStyles(),n.setMenuState(!1),n.setupMarkup(),n.setMenuStyle({width:n.options.openPosition}),n.checkFixedChildren(),n.setPositionUnits(),n.closeMenu(!1),n.options.afterOn()},destroy:function(){n.options.beforeOff(),n.closeMenu(),n.destroyClickListeners(),Object.prototype.toString.call(n.options.keyboardShortcuts)==="[object Array]"&&n.destroyKeyboardListeners(),n.resetMarkup();var t={};t[n.options.direction]="auto",e(n.fixedChildren).each(function(){e(this).css(t)}),n.fixedChildren=[],n.options.afterOff()}};return{on:n.init,off:n.destroy,trigger:n.triggerMenu,open:n.openMenu,close:n.closeMenu,isOpen:n.menuIsOpen,menu:n.menu,getMenu:function(){return e(n.menu)},panel:n.panel,getPanel:function(){return e(n.panel)}}}}(jQuery),function(e){e.fn.avgrund=function(t){var n={width:380,height:280,showClose:!1,showCloseText:"",closeByEscape:!0,closeByDocument:!0,holderClass:"",overlayClass:"",enableStackAnimation:!1,onBlurContainer:"",openOnEvent:!0,setEvent:"click",onLoad:!1,onUnload:!1,template:"This is test popin content!
"};return t=e.extend(n,t),this.each(function(){function u(e){t.closeByEscape&&e.keyCode===27&&l()}function a(n){t.closeByDocument?e(n.target).is(".avgrund-overlay, .avgrund-close")&&(n.preventDefault(),l()):e(n.target).is(".avgrund-close")&&(n.preventDefault(),l())}function f(){typeof t.onLoad=="function"&&t.onLoad(n),setTimeout(function(){r.addClass("avgrund-active")},100),r.append(''+o+"
"),e(".avgrund-popin").css({width:i+"px",height:s+"px","margin-left":"-"+(i/2+10)+"px","margin-top":"-"+(s/2+10)+"px"}),t.showClose&&e(".avgrund-popin").append(''+t.showCloseText+""),t.enableStackAnimation&&e(".avgrund-popin").addClass("stack"),r.bind("keyup",u),r.bind("click",a)}function l(){r.unbind("keyup",u),r.unbind("click",a),r.removeClass("avgrund-active"),setTimeout(function(){e(".avgrund-popin").remove()},500),typeof t.onUnload=="function"&&t.onUnload(n)}var n=e(this),r=e("body"),i=t.width>640?640:t.width,s=t.height>350?350:t.height,o=typeof t.template=="function"?t.template(n):t.template;r.addClass("avgrund-ready"),r.append(''),t.onBlurContainer!==""&&e(t.onBlurContainer).addClass("avgrund-blur"),t.openOnEvent?n.bind(t.setEvent,function(t){t.stopPropagation(),e(t.target).is("a")&&t.preventDefault(),f()}):f()})}}(jQuery),function(e,t,n){function l(e,t){var n=e.keyCode,r=t.data("dropkick"),i=t.find(".dk_options"),o=t.hasClass("dk_open"),u=t.find(".dk_option_current"),a=i.find("li").first(),f=i.find("li").last(),l,p;switch(n){case s.enter:o?(c(u.find("a"),t),d(t)):v(t),e.preventDefault();break;case s.up:p=u.prev("li"),o?p.length?h(p,t):h(f,t):v(t),e.preventDefault();break;case s.down:o?(l=u.next("li").first(),l.length?h(l,t):h(a,t)):v(t),e.preventDefault();break;default:}}function c(e,t,n){var r,i,s;r=e.attr("data-dk-dropdown-value"),i=e.text(),s=t.data("dropkick"),$select=s.$select,$select.val(r),t.find(".dk_label").text(i),n=n||!1,s.settings.change&&!n&&s.settings.change.call($select,r,i)}function h(e,t){t.find(".dk_option_current").removeClass("dk_option_current"),e.addClass("dk_option_current"),p(t,e)}function p(e,t){var n=t.prevAll("li").outerHeight()*t.prevAll("li").length;e.find(".dk_options_inner").animate({scrollTop:n+"px"},0)}function d(e){e.removeClass("dk_open")}function v(e){var t=e.data("dropkick");e.find(".dk_options").css({top:e.find(".dk_toggle").outerHeight()-1}),e.toggleClass("dk_open")}function m(t,n){var r=t,i=[],s;r=r.replace("{{ id }}",n.id),r=r.replace("{{ label }}",n.label),r=r.replace("{{ tabindex }}",n.tabindex),r=r.replace("{{ classname }}",n.classname);if(n.options&&n.options.length)for(var o=0,a=n.options.length;o0?t:!1}n.documentElement.className=n.documentElement.className+" dk_fouc";var r={},i=[],s={left:37,up:38,right:39,down:40,enter:13},o=['"].join(""),u='{{ text }}',a={startSpeed:100,theme:!1,change:!1},f=!1;r.init=function(t){return t=e.extend({},a,t),this.each(function(){var n=e(this),r=n.find(":selected").first(),s=n.find("option"),u=n.data("dropkick")||{},a=n.attr("id")||n.attr("name"),f=t.width||n.outerWidth(),l=n.attr("tabindex")?n.attr("tabindex"):"",c=n.attr("class")?n.attr("class"):"",h=!1,p;if(u.id)return n;u.settings=t,u.tabindex=l,u.classname=c,u.id=a,u.$original=r,u.$select=n,u.value=g(n.val())||g(r.attr("value")),u.label=r.text(),u.options=s,h=m(o,u),h.find(".dk_toggle").css({}),n.before(h),h=e("#dk_container_"+a).addClass("dk_shown"),p=t.theme?t.theme:"default",h.addClass("dk_theme_"+p),u.theme=p,u.$dk=h,n.data("dropkick",u),h.data("dropkick",u),i[i.length]=n,h.bind("focus.dropkick",function(e){h.addClass("dk_focus")}).bind("blur.dropkick",function(e){h.removeClass("dk_open dk_focus")}),setTimeout(function(){n.hide()},0)})},r.theme=function(t){var n=e(this),r=n.data("dropkick"),i=r.$dk,s="dk_theme_"+r.theme;i.removeClass(s).addClass("dk_theme_"+t),r.theme=t},r.reset=function(){for(var e=0,t=i.length;e')[m]("ifCreated").parent().append(C.insert),j=e('').css(N).appendTo(B);o.data(t,{o:C,s:o.attr("style")}).css(k),!!C.inheritClass&&B[d](a.className),!!C.inheritID&&f&&B.attr("id",t+"-"+f),B.css("position")=="static"&&B.css("position","relative"),w(o,!0,l),H.length&&H.on(h+".i mouseenter.i mouseleave.i "+p,function(t){var n=t[c],r=e(this);if(!a[u]){n==h?w(o,!1,!0):M&&(/ve|nd/.test(n)?(B[v](L),r[v](_)):(B[d](L),r[d](_)));if(!b)return!1;t.stopPropagation()}}),o.on(h+".i focus.i blur.i keyup.i keydown.i keypress.i",function(e){var t=e[c],n=e.keyCode;if(t==h)return!1;if(t=="keydown"&&n==32){if(a[c]!=i||!a[s])a[s]?S(o,s):E(o,s);return!1}t=="keyup"&&a[c]==i?!a[s]&&E(o,s):/us|ur/.test(t)&&B[t=="blur"?v:d](A)}),j.on(h+" mousedown mouseup mouseover mouseout "+p,function(e){var t=e[c],n=/wn|up/.test(t)?O:L;if(!a[u]){t==h?w(o,!1,!0):(/wn|er|in/.test(t)?B[d](n):B[v](n+" "+O),H.length&&M&&n==L&&H[/ut|nd/.test(t)?v:d](_));if(!b)return!1;e.stopPropagation()}})})}return this}}(jQuery),function(e){var t=new Array,n=new Array;e.fn.doAutosize=function(t){var n=e(this).data("minwidth"),r=e(this).data("maxwidth"),i="",s=e(this),o=e("#"+e(this).data("tester_id"));if(i===(i=s.val()))return;var u=i.replace(/&/g,"&").replace(/\s/g," ").replace(//g,">");o.html(u);var a=o.width(),f=a+t.comfortZone>=n?a+t.comfortZone:n,l=s.width(),c=f=n||f>n&&f").css({position:"absolute",top:-9999,left:-9999,width:"auto",fontSize:s.css("fontSize"),fontFamily:s.css("fontFamily"),fontWeight:s.css("fontWeight"),letterSpacing:s.css("letterSpacing"),whiteSpace:"nowrap"}),u=e(this).attr("id")+"_autosize_tester";!e("#"+u).length>0&&(o.attr("id",u),o.appendTo("body")),s.data("minwidth",n),s.data("maxwidth",r),s.data("tester_id",u),s.css("width",n)},e.fn.addTag=function(r,i){return i=jQuery.extend({focus:!1,callback:!0},i),this.each(function(){var s=e(this).attr("id"),o=e(this).val().split(t[s]);o[0]==""&&(o=new Array),r=jQuery.trim(r);if(i.unique){var u=e(this).tagExist(r);u==1&&e("#"+s+"_tag").addClass("not_valid")}else var u=!1;if(r!=""&&u!=1){e("").addClass("tag").append(e("").text(r).append(" "),e('',{href:"#",title:"Remove tag",text:""}).click(function(){return e("#"+s).removeTag(escape(r))})).insertBefore("#"+s+"_addTag"),o.push(r),e("#"+s+"_tag").val(""),i.focus?e("#"+s+"_tag").focus():e("#"+s+"_tag").blur(),e.fn.tagsInput.updateTagsField(this,o);if(i.callback&&n[s]&&n[s].onAddTag){var a=n[s].onAddTag;a.call(this,r)}if(n[s]&&n[s].onChange){var f=o.length,a=n[s].onChange;a.call(this,e(this),o[f-1])}}}),!1},e.fn.removeTag=function(r){return r=unescape(r),this.each(function(){var s=e(this).attr("id"),o=e(this).val().split(t[s]);e("#"+s+"_tagsinput .tag").remove(),str="";for(i=0;i=0},e.fn.importTags=function(t){id=e(this).attr("id"),e("#"+id+"_tagsinput .tag").remove(),e.fn.tagsInput.importTags(this,t)},e.fn.tagsInput=function(r){var i=jQuery.extend({interactive:!0,defaultText:"",minChars:0,width:"",height:"",autocomplete:{selectFirst:!1},hide:!0,delimiter:",",unique:!0,removeWithBackspace:!0,placeholderColor:"#666666",autosize:!0,comfortZone:20,inputPadding:12},r);return this.each(function(){i.hide&&e(this).hide();var r=e(this).attr("id");if(!r||t[e(this).attr("id")])r=e(this).attr("id","tags"+(new Date).getTime()).attr("id");var s=jQuery.extend({pid:r,real_input:"#"+r,holder:"#"+r+"_tagsinput",input_wrapper:"#"+r+"_addTag",fake_input:"#"+r+"_tag"},i);t[r]=s.delimiter;if(i.onAddTag||i.onRemoveTag||i.onChange)n[r]=new Array,n[r].onAddTag=i.onAddTag,n[r].onRemoveTag=i.onRemoveTag,n[r].onChange=i.onChange;var o='",e(o).insertAfter(this),e(s.holder).css("width",i.width),e(s.holder).css("min-height",i.height),e(s.holder).css("height","100%"),e(s.real_input).val()!=""&&e.fn.tagsInput.importTags(e(s.real_input),e(s.real_input).val());if(i.interactive){e(s.fake_input).val(e(s.fake_input).attr("data-default")),e(s.fake_input).css("color",i.placeholderColor),e(s.fake_input).resetAutosize(i),e(s.holder).bind("click",s,function(t){e(t.data.fake_input).focus()}),e(s.fake_input).bind("focus",s,function(t){e(t.data.fake_input).val()==e(t.data.fake_input).attr("data-default")&&e(t.data.fake_input).val(""),e(t.data.fake_input).css("color","#000000")});if(i.autocomplete_url!=undefined){autocomplete_options={source:i.autocomplete_url};for(attrname in i.autocomplete)autocomplete_options[attrname]=i.autocomplete[attrname];jQuery.Autocompleter!==undefined?(e(s.fake_input).autocomplete(i.autocomplete_url,i.autocomplete),e(s.fake_input).bind("result",s,function(t,n,s){n&&e("#"+r).addTag(n[0]+"",{focus:!0,unique:i.unique})})):jQuery.ui.autocomplete!==undefined&&(e(s.fake_input).autocomplete(autocomplete_options),e(s.fake_input).bind("autocompleteselect",s,function(t,n){return e(t.data.real_input).addTag(n.item.value,{focus:!0,unique:i.unique}),!1}))}else e(s.fake_input).bind("blur",s,function(t){var n=e(this).attr("data-default");return e(t.data.fake_input).val()!=""&&e(t.data.fake_input).val()!=n?t.data.minChars<=e(t.data.fake_input).val().length&&(!t.data.maxChars||t.data.maxChars>=e(t.data.fake_input).val().length)&&e(t.data.real_input).addTag(e(t.data.fake_input).val(),{focus:!0,unique:i.unique}):(e(t.data.fake_input).val(e(t.data.fake_input).attr("data-default")),e(t.data.fake_input).css("color",i.placeholderColor)),!1});e(s.fake_input).bind("keypress",s,function(t){if(t.which==t.data.delimiter.charCodeAt(0)||t.which==13)return t.preventDefault(),t.data.minChars<=e(t.data.fake_input).val().length&&(!t.data.maxChars||t.data.maxChars>=e(t.data.fake_input).val().length)&&e(t.data.real_input).addTag(e(t.data.fake_input).val(),{focus:!0,unique:i.unique}),e(t.data.fake_input).resetAutosize(i),!1;t.data.autosize&&e(t.data.fake_input).doAutosize(i)}),s.removeWithBackspace&&e(s.fake_input).bind("keydown",function(t){if(t.keyCode==8&&e(this).val()==""){t.preventDefault();var n=e(this).closest(".tagsinput").find(".tag:last").text(),r=e(this).attr("id").replace(/_tag$/,"");n=n.replace(/[\s\u00a0]+x$/,""),e("#"+r).removeTag(escape(n)),e(this).trigger("focus")}}),e(s.fake_input).blur(),s.unique&&e(s.fake_input).keydown(function(t){(t.keyCode==8||String.fromCharCode(t.which).match(/\w+|[áéíóúÁÉÍÓÚñÑ,/]+/))&&e(this).removeClass("not_valid")})}}),this},e.fn.tagsInput.updateTagsField=function(n,r){var i=e(n).attr("id");e(n).val(r.join(t[i]))},e.fn.tagsInput.importTags=function(r,s){e(r).val("");var o=e(r).attr("id"),u=s.split(t[o]);for(i=0;i').addClass("tool-"+r.options.position).addClass("tool-rounded").append('').append('').appendTo("body").css("opacity",0).hide(),r.toolbar_arrow=r.toolbar.find(".arrow"),r.initializeToolbar()},initializeToolbar:function(){var e=this;e.populateContent(),e.setTrigger(),e.toolbarWidth=e.toolbar.width()},setTrigger:function(){var n=this;n.$elem.on("click",function(e){e.preventDefault(),n.$elem.hasClass("pressed")?n.hide():n.show()}),n.options.hideOnClick&&e("html").on("click.toolbar",function(e){e.target!=n.elem&&n.$elem.has(e.target).length===0&&n.toolbar.has(e.target).length===0&&n.toolbar.is(":visible")&&n.hide()}),e(t).resize(function(e){e.stopPropagation(),n.toolbar.is(":visible")&&(n.toolbarCss=n.getCoordinates(n.options.position,20),n.collisionDetection(),n.toolbar.css(n.toolbarCss),n.toolbar_arrow.css(n.arrowCss))})},populateContent:function(){var t=this,n=t.toolbar.find(".tool-items"),r=e(t.options.content).clone(!0).find("a").addClass("tool-item gradient");n.html(r),n.find(".tool-item").on("click",function(e){e.preventDefault(),t.$elem.trigger("toolbarItemClick",this)})},calculatePosition:function(){var e=this;e.arrowCss={},e.toolbarCss=e.getCoordinates(e.options.position,0),e.toolbarCss.position="absolute",e.toolbarCss.zIndex=e.options.zIndex,e.collisionDetection(),e.toolbar.css(e.toolbarCss),e.toolbar_arrow.css(e.arrowCss)},getCoordinates:function(e,t){var n=this;n.coordinates=n.$elem.offset(),n.options.adjustment&&n.options.adjustment[n.options.position]&&(t=n.options.adjustment[n.options.position]);switch(n.options.position){case"top":return{left:n.coordinates.left-n.toolbar.width()/2+n.$elem.outerWidth()/2,top:n.coordinates.top-n.$elem.height()-t,right:"auto"};case"left":return{left:n.coordinates.left-n.toolbar.width()/2-n.$elem.width()/2-t,top:n.coordinates.top-n.toolbar.height()/2+n.$elem.outerHeight()/2,right:"auto"};case"right":return{left:n.coordinates.left+n.toolbar.width()/2+n.$elem.width()/3+t,top:n.coordinates.top-n.toolbar.height()/2+n.$elem.outerHeight()/2,right:"auto"};case"bottom":return{left:n.coordinates.left-n.toolbar.width()/2+n.$elem.outerWidth()/2,top:n.coordinates.top+n.$elem.height()+t,right:"auto"}}},collisionDetection:function(){var n=this,r=20;if(n.options.position=="top"||n.options.position=="bottom")n.arrowCss={left:"50%",right:"50%"},n.toolbarCss.left>>0;if(typeof e!="function")throw new TypeError;var r=[],i=arguments[1];for(var s=0;s>>0;if(n===0)return-1;var r=0;arguments.length>1&&(r=Number(arguments[1]),r!=r?r=0:r!==0&&r!=Infinity&&r!=-Infinity&&(r=(r>0||-1)*Math.floor(Math.abs(r))));if(r>=n)return-1;var i=r>=0?r:Math.max(n-Math.abs(r),0);for(;i>>0:t>>>0;while(u=e.exec(n)){a=u.index+u[0].length;if(a>s){r.push(n.slice(s,u.index)),!compliantExecNpcg&&u.length>1&&u[0].replace(o,function(){for(var e=1;e1&&u.index=t)break}e.lastIndex===u.index&&e.lastIndex++}return s===n.length?(f||!e.test(""))&&r.push(""):r.push(n.slice(s)),r.length>t?r.slice(0,t):r},window.Picker=function(e,t,n){function r(i,s,o,u){function d(){return r._.node("div",r._.node("div",r._.node("div",r._.node("div",p.component.nodes(a.open),l.box),l.wrap),l.frame),l.holder)}function v(e){e.stopPropagation(),e.type=="focus"&&p.$root.addClass(l.focused),p.open()}if(!i)return r;var a={id:Math.abs(~~(Math.random()*1e9))},f=o?e.extend(!0,{},o.defaults,u):u||{},l=e.extend({},r.klasses(),f.klass),c=e(i),h=function(){return this.start()},p=h.prototype={constructor:h,$node:c,start:function(){return a&&a.start?p:(a.methods={},a.start=!0,a.open=!1,a.type=i.type,i.autofocus=i==document.activeElement,i.type="text",i.readOnly=!0,p.component=new o(p,f),p.$root=e(r._.node("div",d(),l.picker)).on({focusin:function(e){p.$root.removeClass(l.focused),e.stopPropagation()},mousedown:function(e){e.target!=p.$root.children()[0]&&e.stopPropagation()},click:function(t){var n=t.target,s=n.attributes.length?e(n):e(n).closest("[data-pick]"),o=s.data();n!=p.$root.children()[0]&&(t.stopPropagation(),p.$root.find(document.activeElement).length||i.focus(),o.nav&&!s.hasClass(l.navDisabled)?p.set("highlight",p.component.item.highlight,{nav:o.nav}):r._.isInteger(o.pick)&&!s.hasClass(l.disabled)?p.set("select",o.pick).close(!0):o.clear&&p.clear().close(!0))}}),p._hidden=f.formatSubmit?e("")[0]:n,c.addClass(l.input).on("focus.P"+a.id+" click.P"+a.id,v).on("change.P"+a.id,function(){p._hidden&&(p._hidden.value=i.value?r._.trigger(p.component.formats.toString,p.component,[f.formatSubmit,p.component.item.select]):"")}).on("keydown.P"+a.id,function(e){var t=e.keyCode,n=/^(8|46)$/.test(t);if(t==27)return p.close(),!1;if(t==32||n||!a.open&&p.component.key[t])e.preventDefault(),e.stopPropagation(),n?p.clear().close():p.open()}).val(c.data("value")?r._.trigger(p.component.formats.toString,p.component,[f.format,p.component.item.select]):i.value).after(p.$root,p._hidden).data(s,p),p.on({start:p.component.onStart,render:p.component.onRender,stop:p.component.onStop,open:p.component.onOpen,close:p.component.onClose,set:p.component.onSet}).on({start:f.onStart,render:f.onRender,stop:f.onStop,open:f.onOpen,close:f.onClose,set:f.onSet}),i.autofocus&&p.open(),p.trigger("start").trigger("render"))},render:function(){return p.$root.html(d()),p.trigger("render")},stop:function(){return a.start?(p.close(),p._hidden&&p._hidden.parentNode.removeChild(p._hidden),p.$root.remove(),c.removeClass(l.input).off(".P"+a.id).removeData(s),i.type=a.type,i.readOnly=!1,p.trigger("stop"),a.methods={},a.start=!1,p):p},open:function(e){return a.open?p:(c.addClass(l.active),p.$root.addClass(l.opened),e!==!1&&(a.open=!0,c.focus(),t.on("click.P"+a.id+" focusin.P"+a.id,function(e){e.target!=i&&e.target!=document&&p.close()}).on("keydown.P"+a.id,function(e){var t=e.keyCode,n=p.component.key[t],s=e.target;t==27?p.close(!0):s!=i||!n&&t!=13?p.$root.find(s).length&&t==13&&(e.preventDefault(),s.click()):(e.preventDefault(),n?r._.trigger(p.component.key.go,p,[n]):p.$root.find("."+l.highlighted).hasClass(l.disabled)||p.set("select",p.component.item.highlight).close())})),p.trigger("open"))},close:function(e){return e&&(c.off("focus.P"+a.id).focus(),setTimeout(function(){c.on("focus.P"+a.id,v)},0)),c.removeClass(l.active),p.$root.removeClass(l.opened+" "+l.focused),a.open&&(a.open=!1,t.off(".P"+a.id)),p.trigger("close")},clear:function(){return p.set("clear")},set:function(e,t,n){var i,s,o=r._.isObject(e),u=o?e:{};if(e){o||(u[e]=t);for(i in u)s=u[i],p.component.item[i]&&p.component.set(i,s,n||{}),(i=="select"||i=="clear")&&c.val(i=="clear"?"":r._.trigger(p.component.formats.toString,p.component,[f.format,p.component.get(i)])).trigger("change");p.render()}return p.trigger("set",u)},get:function(e,t){e=e||"value";if(a[e]!=null)return a[e];if(e=="value")return i.value;if(p.component.item[e])return typeof t=="string"?r._.trigger(p.component.formats.toString,p.component,[t,p.component.get(e)]):p.component.get(e)},on:function(e,t){var n,i,s=r._.isObject(e),o=s?e:{};if(e){s||(o[e]=t);for(n in o)i=o[n],a.methods[n]=a.methods[n]||[],a.methods[n].push(i)}return p},trigger:function(e,t){var n=a.methods[e];return n&&n.map(function(e){r._.trigger(e,p,[t])}),p}};return new h}return r.klasses=function(e){return e=e||"picker",{picker:e,opened:e+"--opened",focused:e+"--focused",input:e+"__input",active:e+"__input--active",holder:e+"__holder",frame:e+"__frame",wrap:e+"__wrap",box:e+"__box"}},r._={group:function(e){var t,n="",i=r._.trigger(e.min,e);for(;i<=r._.trigger(e.max,e,[i]);i+=e.i)t=r._.trigger(e.item,e,[i]),n+=r._.node(e.node,t[0],t[1],t[2]);return n},node:function(e,t,n,r){return t?(t=Array.isArray(t)?t.join(""):t,n=n?' class="'+n+'"':"",r=r?" "+r:"","<"+e+n+r+">"+t+""+e+">"):""},lead:function(e){return(e<10?"0":"")+e},trigger:function(e,t,n){return typeof e=="function"?e.apply(t,n||[]):e},digits:function(e){return/\d/.test(e[1])?2:1},isObject:function(e){return{}.toString.call(e).indexOf("Object")>-1},isDate:function(e){return{}.toString.call(e).indexOf("Date")>-1&&this.isInteger(e.getDate())},isInteger:function(e){return{}.toString.call(e).indexOf("Number")>-1&&e%1===0}},r.extend=function(t,n){e.fn[t]=function(i,s){var o=this.data(t);return i=="picker"?o:o&&typeof i=="string"?(r._.trigger(o[i],o,[s]),this):this.each(function(){var s=e(this);s.data(t)||new r(this,t,n,i)})},e.fn[t].defaults=n.defaults},r}(jQuery,jQuery(document)),function(){function n(e,t){var n=this,r=e.$node[0].value,i=e.$node.data("value"),s=i||r,o=i?t.formatSubmit:t.format;n.settings=t,n.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"navigate create validate",view:"create validate viewset",disable:"flipItem",enable:"flipItem"},n.item={},n.item.disable=(t.disable||[]).slice(0),n.item.enable=-function(e){return e[0]===!0?e.shift():-1}(n.item.disable),n.set("min",t.min).set("max",t.max).set("now").set("select",s||n.item.now,{format:o,data:function(e){return s&&(e.indexOf("mm")>-1||e.indexOf("m")>-1)}(n.formats.toArray(o))}),n.key={40:7,38:-7,39:1,37:-1,go:function(e){n.set("highlight",[n.item.highlight.year,n.item.highlight.month,n.item.highlight.date+e],{interval:e}),this.render()}},e.on("render",function(){e.$root.find("."+t.klass.selectMonth).on("change",function(){e.set("highlight",[e.get("view").year,this.value,e.get("highlight").date]),e.$root.find("."+t.klass.selectMonth).focus()}),e.$root.find("."+t.klass.selectYear).on("change",function(){e.set("highlight",[this.value,e.get("view").month,e.get("highlight").date]),e.$root.find("."+t.klass.selectYear).focus()})}).on("open",function(){e.$root.find("button, select").attr("disabled",!1)}).on("close",function(){e.$root.find("button, select").attr("disabled",!0)})}var e=7,t=6;n.prototype.set=function(e,t,n){var r=this;return r.item[e=="enable"?"disable":e=="flip"?"enable":e]=r.queue[e].split(" ").map(function(i){return t=r[i](e,t,n)}).pop(),e=="select"?r.set("highlight",r.item.select,n):e=="highlight"?r.set("view",r.item.highlight,n):(e=="flip"||e=="min"||e=="max"||e=="disable"||e=="enable")&&r.item.select&&r.item.highlight&&r.set("select",r.item.select,n).set("highlight",r.item.highlight,n),r},n.prototype.get=function(e){return this.item[e]},n.prototype.create=function(e,t,n){var r,i=this;return t=t===undefined?e:t,t==-Infinity||t==Infinity?r=t:Picker._.isObject(t)&&Picker._.isInteger(t.pick)?t=t.obj:Array.isArray(t)?(t=new Date(t[0],t[1],t[2]),t=Picker._.isDate(t)?t:i.create().obj):Picker._.isInteger(t)||Picker._.isDate(t)?t=i.normalize(new Date(t),n):t=i.now(e,t,n),{year:r||t.getFullYear(),month:r||t.getMonth(),date:r||t.getDate(),day:r||t.getDay(),obj:r||t,pick:r||t.getTime()}},n.prototype.now=function(e,t,n){return t=new Date,n&&n.rel&&t.setDate(t.getDate()+n.rel),this.normalize(t,n)},n.prototype.navigate=function(e,t,n){if(Picker._.isObject(t)){var r=new Date(t.year,t.month+(n&&n.nav?n.nav:0),1),i=r.getFullYear(),s=r.getMonth(),o=t.date;while(Picker._.isDate(r)&&(new Date(i,s,o)).getMonth()!==s)o-=1;t=[i,s,o]}return t},n.prototype.normalize=function(e){return e.setHours(0,0,0,0),e},n.prototype.measure=function(e,t){var n=this;return t?Picker._.isInteger(t)&&(t=n.now(e,t,{rel:t})):t=e=="min"?-Infinity:Infinity,t},n.prototype.viewset=function(e,t){return this.create([t.year,t.month,1])},n.prototype.validate=function(e,t,n){var r=this,i=t,s=n&&n.interval?n.interval:1,o=r.item.enable===-1,u,a,f=r.item.min,l=r.item.max,c,h,p=o&&r.item.disable.filter(function(e){if(Array.isArray(e)){var n=r.create(e).pick;nt.pick&&(a=!0)}return Picker._.isInteger(e)}).length;if(!o&&r.disabled(t)||o&&r.disabled(t)&&(p||u||a)||t.pick<=f.pick||t.pick>=l.pick){o&&!p&&(!a&&s>0||!u&&s<0)&&(s*=-1);while(r.disabled(t)){Math.abs(s)>1&&(t.monthi.month)&&(t=i,s=Math.abs(s)/s),t.pick<=f.pick?(c=!0,s=1):t.pick>=l.pick&&(h=!0,s=-1);if(c&&h)break;t=r.create([t.year,t.month,t.date+s])}}return t},n.prototype.disabled=function(e){var t=this,n=t.item.disable.filter(function(n){if(Picker._.isInteger(n))return e.day===(t.settings.firstDay?n:n-1)%7;if(Array.isArray(n))return e.pick===t.create(n).pick}).length;return e.pickt.item.max.pick||t.item.enable===-1?!n:n},n.prototype.parse=function(e,t,n){var r=this,i={};if(!t||Picker._.isInteger(t)||Array.isArray(t)||Picker._.isDate(t)||Picker._.isObject(t)&&Picker._.isInteger(t.pick))return t;if(!n||!n.format)throw"Need a formatting option to parse this..";return r.formats.toArray(n.format).map(function(e){var n=r.formats[e],s=n?Picker._.trigger(n,r,[t,i]):e.replace(/^!/,"").length;n&&(i[e]=t.substr(0,s)),t=t.substr(s)}),[i.yyyy||i.yy,+(i.mm||i.m)-(n.data?1:0),i.dd||i.d]},n.prototype.formats=function(){function e(e,t,n){var r=e.match(/\w+/)[0];return!n.mm&&!n.m&&(n.m=t.indexOf(r)),r.length}function t(e){return e.match(/\w+/)[0].length}return{d:function(e,t){return e?Picker._.digits(e):t.date},dd:function(e,t){return e?2:Picker._.lead(t.date)},ddd:function(e,n){return e?t(e):this.settings.weekdaysShort[n.day]},dddd:function(e,n){return e?t(e):this.settings.weekdaysFull[n.day]},m:function(e,t){return e?Picker._.digits(e):t.month+1},mm:function(e,t){return e?2:Picker._.lead(t.month+1)},mmm:function(t,n){var r=this.settings.monthsShort;return t?e(t,r,n):r[n.month]},mmmm:function(t,n){var r=this.settings.monthsFull;return t?e(t,r,n):r[n.month]},yy:function(e,t){return e?2:(""+t.year).slice(2)},yyyy:function(e,t){return e?4:t.year},toArray:function(e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(e,t){var n=this;return n.formats.toArray(e).map(function(e){return Picker._.trigger(n.formats[e],n,[0,t])||e.replace(/^!/,"")}).join("")}}}(),n.prototype.flipItem=function(e,t){var n=this,r=n.item.disable,i=n.item.enable===-1;if(t=="flip")n.item.enable=i?1:-1;else if(!i&&e=="enable"||i&&e=="disable")r=n.removeDisabled(r,t);else if(!i&&e=="disable"||i&&e=="enable")r=n.addDisabled(r,t);return r},n.prototype.addDisabled=function(e,t){var n=this;return t.map(function(t){n.filterDisabled(e,t).length||e.push(t)}),e},n.prototype.removeDisabled=function(e,t){var n=this;return t.map(function(t){e=n.filterDisabled(e,t,1)}),e},n.prototype.filterDisabled=function(e,t,n){var r=Array.isArray(t);return e.filter(function(e){var i=!r&&t===e||r&&Array.isArray(e)&&t.toString()===e.toString();return n?!i:i})},n.prototype.nodes=function(n){var r=this,i=r.settings,s=r.item.now,o=r.item.select,u=r.item.highlight,a=r.item.view,f=r.item.disable,l=r.item.min,c=r.item.max,h=function(t){return i.firstDay&&t.push(t.shift()),Picker._.node("thead",Picker._.group({min:0,max:e-1,i:1,node:"th",item:function(e){return[t[e],i.klass.weekdays]}}))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysShort).slice(0)),p=function(e){return Picker._.node("div"," ",i.klass["nav"+(e?"Next":"Prev")]+(e&&a.year>=c.year&&a.month>=c.month||!e&&a.year<=l.year&&a.month<=l.month?" "+i.klass.navDisabled:""),"data-nav="+(e||-1))},d=function(e){return i.selectMonths?Picker._.node("select",Picker._.group({min:0,max:11,i:1,node:"option",item:function(t){return[e[t],0,"value="+t+(a.month==t?" selected":"")+(a.year==l.year&&tc.month?" disabled":"")]}}),i.klass.selectMonth,n?"":"disabled"):Picker._.node("div",e[a.month],i.klass.month)},v=function(){var e=a.year,t=i.selectYears===!0?5:~~(i.selectYears/2);if(t){var r=l.year,s=c.year,o=e-t,u=e+t;r>o&&(u+=r-o,o=r);if(sh?h:f,u=s}return Picker._.node("select",Picker._.group({min:o,max:u,i:1,node:"option",item:function(t){return[t,0,"value="+t+(e==t?" selected":"")]}}),i.klass.selectYear,n?"":"disabled")}return Picker._.node("div",e,i.klass.year)};return Picker._.node("div",p()+p(1)+d(i.showMonthsShort?i.monthsShort:i.monthsFull)+v(),i.klass.header)+Picker._.node("table",h+Picker._.node("tbody",Picker._.group({min:0,max:t-1,i:1,node:"tr",item:function(t){var n=i.firstDay&&r.create([a.year,a.month,1]).day===0?-7:0;return[Picker._.group({min:e*t-a.day+n+1,max:function(){return this.min+e-1},i:1,node:"td",item:function(e){return e=r.create([a.year,a.month,e+(i.firstDay?1:0)]),[Picker._.node("div",e.date,function(t){return t.push(a.month==e.month?i.klass.infocus:i.klass.outfocus),s.pick==e.pick&&t.push(i.klass.now),o&&o.pick==e.pick&&t.push(i.klass.selected),u&&u.pick==e.pick&&t.push(i.klass.highlighted),(f&&r.disabled(e)||e.pickc.pick)&&t.push(i.klass.disabled),t.join(" ")}([i.klass.day]),"data-pick="+e.pick)]}})]}})),i.klass.table)+Picker._.node("div",Picker._.node("button",i.today,i.klass.buttonToday,"data-pick="+s.pick+(n?"":" disabled"))+Picker._.node("button",i.clear,i.klass.buttonClear,"data-clear=1"+(n?"":" disabled")),i.klass.footer)},n.defaults=function(e){return{monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",format:"d mmmm, yyyy",klass:{table:e+"table",header:e+"header",navPrev:e+"nav--prev",navNext:e+"nav--next",navDisabled:e+"nav--disabled",month:e+"month",year:e+"year",selectMonth:e+"select--month",selectYear:e+"select--year",weekdays:e+"weekday",day:e+"day",disabled:e+"day--disabled",selected:e+"day--selected",highlighted:e+"day--highlighted",now:e+"day--today",infocus:e+"day--infocus",outfocus:e+"day--outfocus",footer:e+"footer",buttonClear:e+"button--clear",buttonToday:e+"button--today"}}}(Picker.klasses().picker+"__"),Picker.extend("pickadate",n)}(),function(){function i(e,t){var n=this,r=e.$node.data("value");n.settings=t,n.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"create validate",view:"create validate",disable:"flipItem",enable:"flipItem"},n.item={},n.item.interval=t.interval||30,n.item.disable=(t.disable||[]).slice(0),n.item.enable=-function(e){return e[0]===!0?e.shift():-1}(n.item.disable),n.set("min",t.min).set("max",t.max).set("now").set("select",r||e.$node[0].value||n.item.min,{format:r?t.formatSubmit:t.format}),n.key={40:1,38:-1,39:1,37:-1,go:function(e){n.set("highlight",n.item.highlight.pick+e*n.item.interval,{interval:e*n.item.interval}),this.render()}},e.on("render",function(){var r=e.$root.children(),i=r.find("."+t.klass.viewset);i.length?r[0].scrollTop=~~(i.position().top-i[0].clientHeight*2):console.warn("Nothing to viewset with",n.item.view)}).on("open",function(){e.$root.find("button").attr("disable",!1)}).on("close",function(){e.$root.find("button").attr("disable",!0)})}var e=24,t=60,n=12,r=e*t;i.prototype.set=function(e,t,n){var r=this;return r.item[e=="enable"?"disable":e=="flip"?"enable":e]=r.queue[e].split(" ").map(function(i){return t=r[i](e,t,n)}).pop(),e=="select"?r.set("highlight",r.item.select,n):e=="highlight"?r.set("view",r.item.highlight,n):e=="interval"?r.set("min",r.item.min,n).set("max",r.item.max,n):(e=="flip"||e=="min"||e=="max"||e=="disable"||e=="enable")&&r.item.select&&r.item.highlight&&(e=="min"&&r.set("max",r.item.max,n),r.set("select",r.item.select,n).set("highlight",r.item.highlight,n)),r},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(n,i,s){var o=this;return i=i===undefined?n:i,Picker._.isObject(i)&&Picker._.isInteger(i.pick)?i=i.pick:Array.isArray(i)?i=+i[0]*t+ +i[1]:Picker._.isInteger(i)||(i=o.now(n,i,s)),n=="max"&&i=n.item.max.pick)break}return e},i.prototype.scope=function(e){var t=this.item.min.pick,n=this.item.max.pick;return this.create(e.pick>n?n:e.pickt.time%r?"a.m.":"p.m."},A:function(e,t){return e?2:r/2>t.time%r?"AM":"PM"},toArray:function(e){return e.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(e,t){var n=this;return n.formats.toArray(e).map(function(e){return Picker._.trigger(n.formats[e],n,[0,t])||e.replace(/^!/,"")}).join("")}},i.prototype.flipItem=function(e,t){var n=this,r=n.item.disable,i=n.item.enable===-1;if(t=="flip")n.item.enable=i?1:-1;else if(!i&&e=="enable"||i&&e=="disable")r=n.removeDisabled(r,t);else if(!i&&e=="disable"||i&&e=="enable")r=n.addDisabled(r,t);return r},i.prototype.addDisabled=function(e,t){var n=this;return t.map(function(t){n.filterDisabled(e,t).length||e.push(t)}),e},i.prototype.removeDisabled=function(e,t){var n=this;return t.map(function(t){e=n.filterDisabled(e,t,1)}),e},i.prototype.filterDisabled=function(e,t,n){var r=Array.isArray(t);return e.filter(function(e){var i=!r&&t===e||r&&Array.isArray(e)&&t.toString()===e.toString();return n?!i:i})},i.prototype.i=function(e,t){return Picker._.isInteger(t)&&t>0?t:this.item.interval},i.prototype.nodes=function(e){var t=this,n=t.settings,r=t.item.select,i=t.item.highlight,s=t.item.view,o=t.item.disable;return Picker._.node("ul",Picker._.group({min:t.item.min.pick,max:t.item.max.pick,i:t.item.interval,node:"li",item:function(e){return e=t.create(e),[Picker._.trigger(t.formats.toString,t,[Picker._.trigger(n.formatLabel,t,[e])||n.format,e]),function(u,a){return r&&r.pick==a&&u.push(n.klass.selected),i&&i.pick==a&&u.push(n.klass.highlighted),s&&s.pick==a&&u.push(n.klass.viewset),o&&t.disabled(e)&&u.push(n.klass.disabled),u.join(" ")}([n.klass.listItem],e.pick),"data-pick="+e.pick]}})+Picker._.node("li",Picker._.node("button",n.clear,n.klass.buttonClear,"data-clear=1"+(e?"":" disable"))),n.klass.list)},i.defaults=function(e){return{clear:"Clear",format:"h:i A",interval:30,klass:{picker:e+" "+e+"--time",holder:e+"__holder",list:e+"__list",listItem:e+"__list-item",disabled:e+"__list-item--disabled",selected:e+"__list-item--selected",highlighted:e+"__list-item--highlighted",viewset:e+"__list-item--viewset",now:e+"__list-item--now",buttonClear:e+"__button--clear"}}}(Picker.klasses().picker),Picker.extend("pickatime",i)}(),window.Rainbow=function(){function e(e){var t,n=e.getAttribute&&e.getAttribute("data-language")||0;if(!n){e=e.attributes;for(t=0;t=h[v][n])delete h[v][n],delete c[v][n];if(e>=n&&en&&t'+t+""}function i(e,t,u,f){var l=e.exec(u);if(l){++g,!t.name&&"string"==typeof t.matches[0]&&(t.name=t.matches[0],delete t.matches[0]);var p=l[0],d=l.index,m=l[0].length+d,y=function(){function n(){i(e,t,u,f)}g%100>0?n():setTimeout(n,0)};if(n(d,m))y();else{var b=s(t.matches),w=function(e,n,i){if(e>=n.length)i(p);else{var s=l[n[e]];if(s){var u=t.matches[n[e]],f=u.language,c=u.name&&u.matches?u.matches:u,h=function(t,s,o){var u;u=0;var a;for(a=1;a/g,">").replace(/&(?![\w\#]+;)/g,"&"),t,n)}function f(e,n,r){if(n");var t=e.clone();t.find("td:not(:first-child), th:not(:first-child)").css("display","none"),t.removeClass("responsive"),e.closest(".table-wrapper").append(t),t.wrap(""),e.wrap(""),i(e,t)}function r(e){e.closest(".table-wrapper").find(".pinned").remove(),e.unwrap(),e.unwrap()}function i(e,t){var n=e.find("tr"),r=t.find("tr"),i=[];n.each(function(e){var t=$(this),n=t.find("th, td");n.each(function(){var t=$(this).outerHeight(!0);i[e]=i[e]||0,t>i[e]&&(i[e]=t)})}),r.each(function(e){$(this).height(i[e])})}var e=!1,t=function(){if($(window).width()<767&&!e)return e=!0,$("table.responsive").each(function(e,t){n($(t))}),!0;e&&$(window).width()>767&&(e=!1,$("table.responsive").each(function(e,t){r($(t))}))};$(window).load(t),$(window).on("redraw",function(){e=!1,t()}),$(window).on("resize",t)}),function(e,t,n){e.fn.responsiveSlides=function(r){var s=e.extend({auto:!0,speed:500,timeout:4e3,pager:!1,nav:!1,random:!1,pause:!1,pauseControls:!0,prevText:"Previous",nextText:"Next",maxwidth:"",navContainer:"",manualControls:"",namespace:"rslides",before:e.noop,after:e.noop},r);return this.each(function(){n++;var o=e(this),u,a,f,l,c,h,p=0,d=o.children(),v=d.size(),m=parseFloat(s.speed),g=parseFloat(s.timeout),y=parseFloat(s.maxwidth),b=s.namespace,w=b+n,E=b+"_nav "+w+"_nav",S=b+"_here",x=w+"_on",T=w+"_s",N=e(""),C={"float":"left",position:"relative",opacity:1,zIndex:2},k={"float":"none",position:"absolute",opacity:0,zIndex:1},L=function(){var e=document.body||document.documentElement,t=e.style,n="transition";if(typeof t[n]=="string")return!0;u=["Moz","Webkit","Khtml","O","ms"],n=n.charAt(0).toUpperCase()+n.substr(1);var r;for(r=0;r1){if(g"+t+""+""}),N.append(O),r.navContainer?e(s.navContainer).append(N):o.after(N)}s.manualControls&&(N=e(s.manualControls),N.addClass(b+"_tabs "+w+"_tabs")),(s.pager||s.manualControls)&&N.find("li").each(function(t){e(this).addClass(T+(t+1))});if(s.pager||s.manualControls)h=N.find("a"),a=function(e){h.closest("li").removeClass(S).eq(e).addClass(S)};s.auto&&(f=function(){c=setInterval(function(){d.stop(!0,!0);var e=p+1"+s.prevText+""+""+s.nextText+"";r.navContainer?e(s.navContainer).append(M):o.after(M);var _=e("."+w+"_nav"),D=_.filter(".prev");_.bind("click",function(t){t.preventDefault();var n=e("."+x);if(n.queue("fx").length)return;var r=d.index(n),i=r-1,o=r+1y&&o.css("width",y)};P(),e(t).bind("resize",function(){P()})}})}}(jQuery,this,0),!function(e){"use strict";var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s,o,u,a;this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,o=this.options.trigger.split(" ");for(a=o.length;a--;)u=o[a],u=="click"?this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this)):u!="manual"&&(i=u=="hover"?"mouseenter":"focus",s=u=="hover"?"mouseleave":"blur",this.$element.on(i+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.leave,this)));this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);if(!n.options.delay||!n.options.delay.show)return n.show();clearTimeout(this.timeout),n.hoverState="in",this.timeout=setTimeout(function(){n.hoverState=="in"&&n.show()},n.options.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var t,n,r,i,s,o,u=e.Event("show");if(this.hasContent()&&this.enabled){this.$element.trigger(u);if(u.isDefaultPrevented())return;t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,t.detach().css({top:0,left:0,display:"block"}),this.options.container?t.appendTo(this.options.container):t.insertAfter(this.$element),n=this.getPosition(),r=t[0].offsetWidth,i=t[0].offsetHeight;switch(s){case"bottom":o={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}this.applyPlacement(o,s),this.$element.trigger("shown")}},applyPlacement:function(e,t){var n=this.tip(),r=n[0].offsetWidth,i=n[0].offsetHeight,s,o,u,a;n.offset(e).addClass(t).addClass("in"),s=n[0].offsetWidth,o=n[0].offsetHeight,t=="top"&&o!=i&&(e.top=e.top+i-o,a=!0),t=="bottom"||t=="top"?(u=0,e.left<0&&(u=e.left*-2,e.left=0,n.offset(e),s=n[0].offsetWidth,o=n[0].offsetHeight),this.replaceArrow(u-r+s,s,"left")):this.replaceArrow(o-i,o,"top"),a&&n.offset(e)},replaceArrow:function(e,t,n){this.arrow().css(n,e?50*(1-e/t)+"%":"")},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function i(){var t=setTimeout(function(){n.off(e.support.transition.end).detach()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.detach()})}var t=this,n=this.tip(),r=e.Event("hide");this.$element.trigger(r);if(r.isDefaultPrevented())return;return n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?i():n.detach(),this.$element.trigger("hidden"),this},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var t=this.$element[0];return e.extend({},typeof t.getBoundingClientRect=="function"?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var n=t?e(t.currentTarget)[this.type](this._options).data(this.type):this;n.tip().hasClass("in")?n.hide():n.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var n=e.fn.tooltip;e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this}}(window.jQuery);
--------------------------------------------------------------------------------
/tests/demo/beewatch.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "time"
5 |
6 | "github.com/beego/beewatch"
7 | )
8 |
9 | func main() {
10 | // Start with default level: Trace,
11 | // or use `beewatch.Start(beewatch.Info())` to set the level.
12 | beewatch.Start()
13 |
14 | // Some variables.
15 | appName := "Bee Watch"
16 | boolean := true
17 | number := 3862
18 | floatNum := 3.1415926
19 | test := "fail to watch"
20 |
21 | // Add variables to be watched, must be even sized.
22 | // Note that you have to pass the pointer.
23 | // For now, it only supports basic types.
24 | // In this case, 'test' will not be watched.
25 | beewatch.AddWatchVars("test", test, "App Name", &appName,
26 | "bool", &boolean, "number", &number, "float", &floatNum)
27 |
28 | // Display something, must be even sized.
29 | beewatch.Info().Display("App Name", appName).Break().
30 | Printf("boolean value is %v; number is %d", boolean, number)
31 |
32 | beewatch.Critical().Break().Display("float", floatNum)
33 |
34 | // Change some values.
35 | appName = "Bee Watch2"
36 | number = 250
37 | // Here you will see something interesting.
38 | beewatch.Trace().Break()
39 |
40 | // Multiple goroutines test.
41 | for i := 0; i < 3; i++ {
42 | go multipletest(i)
43 | }
44 |
45 | beewatch.Trace().Printf("Wait 3 seconds...")
46 | select {
47 | case <-time.After(3 * time.Second):
48 | beewatch.Trace().Printf("Done debug")
49 | }
50 |
51 | // Close debugger,
52 | // it's not useful when you debug a web server that may not have an end.
53 | beewatch.Close()
54 | }
55 |
56 | func multipletest(num int) {
57 | beewatch.Critical().Break().Display("num", num)
58 | }
59 |
--------------------------------------------------------------------------------
/tests/demo/beewatch.json:
--------------------------------------------------------------------------------
1 | {
2 | "app_name": "Bee Watch Demo",
3 | "http_port": 23456,
4 | "watch_enabled": true,
5 | "cmd_mode": true,
6 | "skip_suspend": false,
7 | "print_stack": true,
8 | "print_source": true
9 | }
10 |
--------------------------------------------------------------------------------
/tests/images/demo_beewatch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beego/beewatch/ac58d834487e7ddda1e154ecc5eee66e9e63726f/tests/images/demo_beewatch.png
--------------------------------------------------------------------------------
/utils.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Unknown
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package beewatch
16 |
17 | import (
18 | "errors"
19 | "fmt"
20 | "os"
21 | "runtime"
22 | "strings"
23 | )
24 |
25 | const (
26 | _IMPORT_PATH = "github.com/beego/beewatch"
27 | )
28 |
29 | // isExist returns if a file or directory exists
30 | func isExist(path string) bool {
31 | _, err := os.Stat(path)
32 | return err == nil || os.IsExist(err)
33 | }
34 |
35 | // getStaticPath returns app static path in somewhere in $GOPATH,
36 | // it returns error if it cannot find.
37 | func getStaticPath() (string, error) {
38 | gps := os.Getenv("GOPATH")
39 |
40 | var sep string
41 | if runtime.GOOS == "windows" {
42 | sep = ";"
43 | } else {
44 | sep = ":"
45 | }
46 |
47 | for _, gp := range strings.Split(gps, sep) {
48 | sp := gp + "/src/" + _IMPORT_PATH + "/static"
49 | if isExist(sp) {
50 | return sp, nil
51 | }
52 | }
53 |
54 | return "", errors.New("Cannot find static path in $GOPATH")
55 | }
56 |
57 | // loadFile loads file data by given path.
58 | func loadFile(path string) ([]byte, error) {
59 | f, err := os.Open(path)
60 | if err != nil {
61 | return nil, err
62 | }
63 | defer f.Close()
64 |
65 | fi, err := f.Stat()
66 | if err != nil {
67 | return nil, err
68 | }
69 |
70 | b := make([]byte, fi.Size())
71 | f.Read(b)
72 | return b, nil
73 | }
74 |
75 | // levelToStr returns string format of debug level.
76 | func levelToStr(wl debugLevel) string {
77 | switch wl {
78 | case LevelTrace:
79 | return "TRACE"
80 | case LevelInfo:
81 | return "INFO"
82 | case LevelCritical:
83 | return "CRITICAL"
84 | default:
85 | return "UNKNOWN"
86 | }
87 | }
88 |
89 | const (
90 | Gray = uint8(iota + 90)
91 | Red
92 | Green
93 | Yellow
94 | Blue
95 | Magenta
96 | //NRed = uint8(31) // Normal
97 | EndColor = "\033[0m"
98 | )
99 |
100 | // colorLog colors log and print to stdout.
101 | // Log format: [ error ].
102 | // Level: TRAC -> blue; ERRO -> red; WARN -> Magenta; SUCC -> green; others -> default.
103 | // Content: default; path: yellow; error -> red.
104 | // Level has to be surrounded by "[" and "]".
105 | // Highlights have to be surrounded by "# " and " #"(space).
106 | // Paths have to be surrounded by "( " and " )"(sapce).
107 | // Errors have to be surrounded by "[ " and " ]"(space).
108 | func colorLog(format string, a ...interface{}) {
109 | log := fmt.Sprintf(format, a...)
110 | if runtime.GOOS != "windows" {
111 | var clog string
112 |
113 | // Level.
114 | i := strings.Index(log, "]")
115 | if log[0] == '[' && i > -1 {
116 | clog += "[" + getColorLevel(log[1:i]) + "]"
117 | }
118 |
119 | log = log[i+1:]
120 |
121 | // Error.
122 | log = strings.Replace(log, "[ ", fmt.Sprintf("[\033[%dm", Red), -1)
123 | log = strings.Replace(log, " ]", EndColor+"]", -1)
124 |
125 | // Path.
126 | log = strings.Replace(log, "( ", fmt.Sprintf("(\033[%dm", Yellow), -1)
127 | log = strings.Replace(log, " )", EndColor+")", -1)
128 |
129 | // Highlights.
130 | log = strings.Replace(log, "# ", fmt.Sprintf("\033[%dm", Gray), -1)
131 | log = strings.Replace(log, " #", EndColor, -1)
132 |
133 | log = clog + log
134 | }
135 |
136 | fmt.Print(log)
137 | }
138 |
139 | // getColorLevel returns colored level string by given level.
140 | func getColorLevel(level string) string {
141 | level = strings.ToUpper(level)
142 | switch level {
143 | case "TRAC":
144 | return fmt.Sprintf("\033[%dm%s\033[0m", Blue, level)
145 | case "ERRO":
146 | return fmt.Sprintf("\033[%dm%s\033[0m", Red, level)
147 | case "WARN":
148 | return fmt.Sprintf("\033[%dm%s\033[0m", Magenta, level)
149 | case "SUCC":
150 | return fmt.Sprintf("\033[%dm%s\033[0m", Green, level)
151 | default:
152 | return level
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/views/home.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Bee Watch Debugger
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
Variables monitor
37 |
38 |
39 |
40 | Name |
41 | Type |
42 | Value |
43 | Op. |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
72 |
73 |