|
|
@ -3,9 +3,15 @@ node_js:
|
|||
- 0.6
|
||||
- 0.8
|
||||
- 0.10
|
||||
- 0.11
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- node_js: '0.11'
|
||||
|
||||
notifications:
|
||||
#webhooks:
|
||||
#http://requestb.in/12h5bl71
|
||||
email:
|
||||
on_success: never
|
||||
on_failure: change
|
||||
on_failure: change
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ so to get it you should type a couple more commands:
|
|||
|
||||
Commit
|
||||
---------------
|
||||
Format of the commit message: **type(scope): subject**
|
||||
Format of the commit message: **type(scope) subject**
|
||||
|
||||
**Type**:
|
||||
- feature
|
||||
|
|
@ -45,5 +45,3 @@ For example util, console, view, edit, style etc...
|
|||
**Examples**:
|
||||
- [fix(style) .name{width}: 37% -> 35%](https://github.com/coderaiser/cloudcmd/commit/94b0642e3990c17b3a0ee3efeb75f343e1e7c050)
|
||||
- [fix(console) dispatch: focus -> mouseup](https://github.com/coderaiser/cloudcmd/commit/f41ec5058d1411e86a881f8e8077e0572e0409ec)
|
||||
|
||||
**Big change should be writed in ChangeLog like [this](https://github.com/coderaiser/cloudcmd/commit/e1893f77be09585decf8a260d45a42efc11c98e5).**
|
||||
106
ChangeLog
|
|
@ -1,3 +1,109 @@
|
|||
2012.09.27, v0.4.0
|
||||
|
||||
feature:
|
||||
- (edit) add showMessage
|
||||
- (config) add localStorage
|
||||
- (config) add analytics
|
||||
- (socket) max reconnection attempts: 1000000 -> Math.pow- (2, 64)
|
||||
- (css) .cmd-button - (601px - 785px): 15% -> 13%
|
||||
- (css) hide f5, f6 on one-panel-view
|
||||
- (update) git pull -> git pull --rebase
|
||||
- (client) add ability to upload files on drag'n'drop
|
||||
- (client) add route
|
||||
- (socket) add reconnection delay, max attempts
|
||||
- (console) rm jquery-migrate
|
||||
- (edit) rm "nothing to save"
|
||||
- (menu, dom) add zipFile
|
||||
|
||||
update:
|
||||
- (view) fancyBox v2.1.4 -> v2.1.5
|
||||
|
||||
fix:
|
||||
- (client) ajaxLoad fs: removeStr -> removeStrOneTime
|
||||
- (cloudcmd) indexProcessing: appcache
|
||||
- (rest) onFS: lName -> p.name, p.name -> lName
|
||||
- (cloudfunc) ";" -> ","
|
||||
- (client) route -> CloudCmd.route
|
||||
- (dom) getCurrentFileContent: add dataType check
|
||||
- (dom) Loader ajax: add dataType
|
||||
- (rest) stream.createPipe -> pipe.create
|
||||
- (socket) Win32 -> WIN32
|
||||
- (socket) crash on win7
|
||||
- (main) add stream
|
||||
- (view) show: add createTextNode
|
||||
- (css) .icon height: 14.95 -> 14.8- (ie)
|
||||
- (css) .icon height: 15 -> 14.95- (ie)
|
||||
- (css) .icon height, width: 15.5 -> 15
|
||||
- (client) unload, beforeunload
|
||||
- (dom) jqueryLoad: pCallBack -> onload: pCallBack
|
||||
- (dom) jqueryLoad: add pCallBack
|
||||
- (dom) retJSLoad: this -> Loader
|
||||
- (test) keyBinding -> key, ie -> polyfill, viewer -> view, editor/_codemirror -> edit, terminal -> console
|
||||
- (edit) change ace to noconflict
|
||||
- (filepicker) add mimetype "", rm default ".txt" ext
|
||||
- (main) sendError
|
||||
- (socket) reconnect
|
||||
- (server) Dir + Name -> path.join- (Dir, Name)
|
||||
- (rest) add lReadStream.on- (error, lError)
|
||||
- (css) .icon: {width, height: 16px -> 15.5px}
|
||||
|
||||
inside:
|
||||
- (dom) DOMTreeProto: add DOM
|
||||
- (util) add asyncCall
|
||||
- (listeners) appCache: add getConfig
|
||||
- (socket) add transports
|
||||
- (socket) add browser client etag
|
||||
- (socket) lListent: set -> enable
|
||||
- (css) rm .error:hover
|
||||
- (view,edit,console,menu) add Loading check
|
||||
- (index) rm "if lt IE"
|
||||
- (jshint) rm es5: ES5 option is now set per default
|
||||
- (dom) Loader: add xhr.upload progress
|
||||
- (jshint) rm forint - (should be wrapped in an if)
|
||||
- (dom) Images: add return img
|
||||
- (dom) Loader: add responseType
|
||||
- (jshint) add expr: "if ExpressionStatement should be allowed as Programs"
|
||||
- (clieant) multiple files load, readAsText -> readAsArrayBuffer
|
||||
- (util) add isArrayBuffer
|
||||
- (util) exec: any count of args
|
||||
- (shell) add log
|
||||
- (css) .cmd-button: add transition
|
||||
- (css) selection -> user-select
|
||||
- (cloudcmd) rm no-js redirect
|
||||
- (view) add minWidth, minHeight
|
||||
- (dom) {setSelected,unsetSelected}File -> toggleSelectedFile
|
||||
- (client) add panel backlight on drag
|
||||
- (dom) add toggleClass
|
||||
- (dom) add DOM.getCurrentFileByName
|
||||
- (util) add getStrBigFirst
|
||||
- (stream) putFile -> stream.createPipe
|
||||
- (css) .current-file: add transition
|
||||
- (rest) add zip
|
||||
- (cloudfunc) add format
|
||||
- (dom) Loader ajax: add TYPE_JSON
|
||||
- (client) mv Events.add to listeners
|
||||
- (client) google-analytics -> analytics
|
||||
- (stream) stream -> pipe
|
||||
- (css) display, width, height: .icon -> .loading
|
||||
- (css) font-family: .icon -> .error::before
|
||||
- (dom) Images showError: rm textStatus, errorThrown
|
||||
- (dom) Loader: mv percent, count, msg to if
|
||||
- (update) lStdout -> lMsg
|
||||
- (css) mv .panel, #right to max-width:1155px
|
||||
- (dom) ajax, global XMLHTTP -> local xhr
|
||||
- (dom) addClass, removeClass, toggleClass
|
||||
- (dom) removeClass: Events -> DOMTree
|
||||
- (edit) add initAce, worker condition
|
||||
- (dom) Events: process
|
||||
- (client) loadModule: getStrBigFirst
|
||||
- (rest) put: /fs/file?zip -> /zip
|
||||
- (rest) put cp: add putFile
|
||||
- (rest) putFile callback: pError, pMsg -> pError
|
||||
- (rest) main.sendResponse -> sendMsg
|
||||
- (rest) add putFile
|
||||
- (css) rm !important
|
||||
- (css) path-icon: rm font-family, font-size
|
||||
|
||||
2012.07.01, v0.3.0
|
||||
|
||||
* Changed jquery cdn to one with https suport jquery.com -> google cdn.
|
||||
|
|
|
|||
15
CodingStyle
|
|
@ -1,15 +0,0 @@
|
|||
Правила названий:
|
||||
varName - имя функции
|
||||
lVarName - имя локальной переменной
|
||||
pVarName - имя параметра
|
||||
VarName_f - имя функции созданной внутри функции
|
||||
VARNAME - имя константы
|
||||
|
||||
Varible types:
|
||||
varName_s - string
|
||||
varName_n - number
|
||||
varName_o - object
|
||||
varName_a - array
|
||||
|
||||
SS - Server Side;
|
||||
CS - Client Side;
|
||||
174
README.md
|
|
@ -1,23 +1,22 @@
|
|||
Cloud Commander v0.3.0 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
|
||||
Cloud Commander v0.4.0 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
|
||||
===============
|
||||
###[Main][MainURL] [Blog][BlogURL] [Demo][DemoURL]
|
||||
[![Flattr][FlattrIMGURL]][FlattrURL]
|
||||
[NPMIMGURL]: https://badge.fury.io/js/cloudcmd.png
|
||||
[BuildStatusIMGURL]: https://secure.travis-ci.org/coderaiser/cloudcmd.png?branch=master
|
||||
[DependencyStatusIMGURL]: https://gemnasium.com/coderaiser/cloudcmd.png
|
||||
[FlattrIMGURL]: http://api.flattr.com/button/flattr-badge-large.png
|
||||
[NPM_INFO_IMG]: https://nodei.co/npm/cloudcmd.png?downloads=true&&stars
|
||||
[NPMURL]: http://badge.fury.io/js/cloudcmd
|
||||
[BuildStatusURL]: http://travis-ci.org/coderaiser/cloudcmd "Build Status"
|
||||
[DependencyStatusURL]: https://gemnasium.com/coderaiser/cloudcmd "Dependency Status"
|
||||
[FlattrURL]: https://flattr.com/submit/auto?user_id=coderaiser&url=github.com/coderaiser/cloudcmd&title=cloudcmd&language=&tags=github&category=software
|
||||
[FlattrURL]: https://flattr.com/submit/auto?user_id=coderaiser&url=github.com/coderaiser/cloudcmd&title=cloudcmd&language=&tags=github&category=software "flattr"
|
||||
[NPM_INFO_URL]: https://npmjs.org/package/cloudcmd "npm"
|
||||
[MainURL]: http://cloudcmd.io "Main"
|
||||
[BlogURL]: http://blog.cloudcmd.io "Blog"
|
||||
[DemoURL]: http://io.cloudcmd.io "Demo"
|
||||
|
||||
**Cloud Commander** - user friendly cloud file manager.
|
||||
DEMO:
|
||||
[cloudfoundry] (https://cloudcmd.cloudfoundry.com "cloudfoundry"),
|
||||
[appfog] (https://cloudcmd.aws.af.cm "appfog"),
|
||||
[jitsu] (https://cloudcmd.jit.su "jitsu").
|
||||
|
||||
Google PageSpeed Score : [100](//developers.google.com/speed/pagespeed/insights#url=http_3A_2F_2Fcloudcmd.aws.af.cm_2F&mobile=false "score") (out of 100)
|
||||
(or 96 if js or css minification disabled in config.json).
|
||||
**Cloud Commander** - cloud file manager with console and editor.
|
||||
|
||||

|
||||
|
||||
|
|
@ -27,15 +26,15 @@ Benefits
|
|||
- responsible design
|
||||
- one full page loading, *and then just one-time json-dir-listings loading
|
||||
(with refresh opportunity).*
|
||||
- caching readed directories *to localStorage (for now)
|
||||
(so if network will disconnected or something heppen with a signal, we
|
||||
- caching read directories *to localStorage (for now)
|
||||
(so if network will disconnected or something happens with a signal, we
|
||||
definitely will can work with cached copy of directory listings)*;
|
||||
- key binding
|
||||
- disabled js support *(working in limited mode)*.
|
||||
- automated minification *client js-files and onstart-reading Cloud manager files on server starting.*
|
||||
|
||||
**Cloud Commander** uses all benefits of js, so if js is disabled,
|
||||
we moves to *limited mode*.
|
||||
we go to *limited mode*.
|
||||
|
||||
Limited-mode features
|
||||
---------------
|
||||
|
|
@ -55,14 +54,14 @@ There is a short list:
|
|||
- **F6** - rename/move
|
||||
- **F7** - new dir
|
||||
- **F8, Delete** - remove current file
|
||||
- **F9** = menu
|
||||
- **F9** - menu
|
||||
- **Ctrl + r** - reload dir content
|
||||
- **Ctrl + d** - clear local cache (wich contains dir contents)
|
||||
- **Alt + q** - disable key bindings
|
||||
- **Alt + s** - get all key bindings back
|
||||
- **Ctrl + A** - select all files in a panel
|
||||
- **Ctrl + a** - select all files in a panel
|
||||
- **up, down, enter** - filesystem navigation
|
||||
- **Tab** - move thru panels
|
||||
- **Tab** - move via panels
|
||||
- **Page Up** - up on one page
|
||||
- **Page Down** - down on one page
|
||||
- **Home** - to begin of list
|
||||
|
|
@ -72,20 +71,46 @@ There is a short list:
|
|||
- **Shift + F10** - context menu
|
||||
- **~** - console
|
||||
|
||||
Viewer's hot keys
|
||||
Edit
|
||||
---------------
|
||||
- **F3** - open
|
||||
- **Esc** - close
|
||||
[Demo](http://io.cloudcmd.io/fs/etc#/edit/passwd "Edit")
|
||||

|
||||
|
||||
Editor's hot keys
|
||||
---------------
|
||||
###Hot keys
|
||||
- **F4** - open
|
||||
- **Ctrl + s** - save
|
||||
- **Esc** - close
|
||||
|
||||
Console
|
||||
---------------
|
||||
[Demo](http://io.cloudcmd.io#/console "Console")
|
||||

|
||||
|
||||
###Hot keys
|
||||
- **~** - open
|
||||
- **Esc** - close
|
||||
|
||||
Menu
|
||||
---------------
|
||||
Right mouse click button show context menu with items:
|
||||
[Demo](http://io.cloudcmd.io#/menu "Menu")
|
||||

|
||||
Right mouse click button shows context menu with items:
|
||||
- View
|
||||
- Edit
|
||||
- Rename
|
||||
- Delete
|
||||
- Zip file
|
||||
- Upload to (Dropbox, Github, GDrive)
|
||||
- Download
|
||||
- New (File, Dir, from cloud)
|
||||
|
||||
###Hot keys
|
||||
- **F9** - open
|
||||
- **Esc** - close
|
||||
|
||||
Menu
|
||||
---------------
|
||||
Right mouse click button shows context menu with items:
|
||||
- View
|
||||
- Edit
|
||||
- Rename
|
||||
|
|
@ -96,9 +121,11 @@ Right mouse click button show context menu with items:
|
|||
|
||||
Install
|
||||
---------------
|
||||
**Cloud Commander** install is very easy.
|
||||
[![NPM_INFO][NPM_INFO_IMG]][NPM_INFO_URL]
|
||||
|
||||
Installing **Cloud Commander** is very simple.
|
||||
All you need is
|
||||
- install [node.js](//nodejs.org/ "node.js")
|
||||
- install [node.js](http://nodejs.org/ "node.js")
|
||||
- [download](https://github.com/coderaiser/cloudcmd/archive/master.zip)
|
||||
and unpack or just clone repository from github:
|
||||
|
||||
|
|
@ -115,27 +142,29 @@ or install in npm:
|
|||
|
||||
Configuration
|
||||
---------------
|
||||
All main configuration could be done thrue config.json.
|
||||
All main configuration could be done via config.json.
|
||||
```js
|
||||
{
|
||||
"api_url" :"/api/v1",
|
||||
"appcache" : false, /* html5 feature appcache */
|
||||
"cache" : true, /* cashing on a client */
|
||||
"api_url" :"/api/v1",
|
||||
"appcache" : false, /* cache files for offline use */
|
||||
"analytics" : true, /* google analytics suport */
|
||||
"localStorage" : true, /* cache directory data */
|
||||
"minification" : { /* minification of js,css,html and img */
|
||||
"js" : false, /* minify module neaded */
|
||||
"js" : false, /* minify module needed */
|
||||
"css" : false, /* npm i minify */
|
||||
"html" : true,
|
||||
"img" : false
|
||||
},
|
||||
"show_keys_panel" : true, /* show classic panel with buttons of keys */
|
||||
"server" : true, /* server mode or testing mode */
|
||||
"logs" : false, /* logs or console ouput */
|
||||
"socket" : true /* enable web sockets */
|
||||
"port" : 80, /* http port or null(default) */
|
||||
"sslPort" : 443, /* https port or null(default) */
|
||||
"ip" : "127.0.0.1", /* ip or null(default) */
|
||||
"ssl" : true /* should use https? */
|
||||
"rest" : true /* enable rest interface */
|
||||
"cache" : true,
|
||||
"logs" : false, /* logs or console ouput */
|
||||
"show_keys_panel" : true, /* show classic panel with buttons of keys */
|
||||
"server" : true, /* server mode or testing mode */
|
||||
"socket" : true /* enable web sockets */
|
||||
"port" : 8000, /* http port or null(default) */
|
||||
"sslPort" : 443, /* https port or null(default) */
|
||||
"ip" : null, /* ip or null(default) */
|
||||
"ssl" : false /* should use https? */
|
||||
"rest" : true /* enable rest interface */
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -144,27 +173,51 @@ Server
|
|||
Standard practices say no non-root process gets to talk to
|
||||
the Internet on a port less than 1024. Anyway I suggest you
|
||||
to start Cloud Commander as non-root. How it could be solved?
|
||||
There is a couple easy and fast ways. One of them is port forwarding by iptables.
|
||||
There is a couple easy and fast ways. One of them is port forwarding.
|
||||
###Iptables
|
||||
Just run [shell/addtables.sh](shell/addtables.sh) for default options.
|
||||
|
||||
```sh
|
||||
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -L # look rules before
|
||||
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000
|
||||
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 4430
|
||||
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -L # look reles after
|
||||
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -L # look rules after
|
||||
```
|
||||
You should see somethins like this ( **8000** and **4430** should be in config as **port** and **sslPort** )
|
||||
You should see something like this ( **8000** and **4430** should be in config as **port** and **sslPort** )
|
||||
|
||||
target prot opt source destination
|
||||
REDIRECT tcp -- anywhere anywhere tcp dpt:http redir ports 8000
|
||||
REDIRECT tcp -- anywhere anywhere tcp dpt:https redir ports 4430
|
||||
|
||||
If you would want to get things back just clear rules ( **1** and **2** it's rules numbers,
|
||||
If you would want to get things back just clear rules ( **1** and **2** it's rule numbers,
|
||||
in your list they could differ).
|
||||
|
||||
```sh
|
||||
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -D PREROUTING 1
|
||||
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -D PREROUTING 2
|
||||
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -D PREROUTING 1
|
||||
```
|
||||
|
||||
###nginx
|
||||
Get [nginx](http://nginx.org/ "nginx"). On linux it could be done like that
|
||||
```sh
|
||||
sudo apt-get install nginx #for ubuntu and debian
|
||||
```
|
||||
Than make host file **/etc/nginx/sites-enabled/io.cloudcmd.io**
|
||||
( *io.cloudcmd.io* is your domain name) with content:
|
||||
```sh
|
||||
server {
|
||||
listen 80;
|
||||
server_name io.cloudcmd.io;
|
||||
access_log /var/log/nginx/io.cloudcmd.io.access.log;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000/;
|
||||
}
|
||||
}
|
||||
```
|
||||
```sh
|
||||
# create symlink of this file
|
||||
ln -s ./sites-enabled/io.cloudcmd.io ./sites-available
|
||||
# restart nginx
|
||||
/etc/init.d/nginx restart
|
||||
```
|
||||
|
||||
To run Cloud Commander as daemon in linux you could set **log** to true in config and
|
||||
|
|
@ -174,31 +227,29 @@ do something like this:
|
|||
|
||||
Authorization
|
||||
---------------
|
||||
Thru openID Cloud Commander could authorize clients on GitHub.
|
||||
Cloud Commander could authorize clients on GitHub via openID.
|
||||
All things that should be done is must be added **id** and **secret** of application
|
||||
from github settings page and added to **config.json** (id just) and env varible (secret)
|
||||
with names: *github_id*, *github_secret*, *dropbox_key*, *dropbox_secret* etc.
|
||||
For more information see **config.json** and **shell/seret.bat** *(on win32)*
|
||||
or **shell/secret.sh** *(on nix)*.
|
||||
from github settings page and added to [modules.json](json/modules.json) (id just) and env variable (secret)
|
||||
with names: *github_id*, *github_secret*, *dropbox_key*, *dropbox_secret* etc in
|
||||
[secret.bat](shell/secret.bat) *(on win32)* or [secret.sh](shell/secret.sh) *(on nix)*.
|
||||
|
||||
|
||||
Start
|
||||
---------------
|
||||
To start **Cloud Commander** only one command neaded:
|
||||
To start **Cloud Commander** only one command needed:
|
||||
|
||||
node cloudcmd
|
||||
or on win platform just
|
||||
|
||||
cloudcmd
|
||||
After thet Cloud Commander reads config file **config.json** and start server
|
||||
on 80 port, if none of port varibles(*cloud9*, *cloudfoundry* and *nodester*)
|
||||
isn't exist.
|
||||
After that Cloud Commander reads port information from config file [config.json](json/config.json#L17) and start server
|
||||
on this port ( **8000** by default ), if none of port varibles ( *cloud9*, *cloudfoundry* and *nodester* ) isn't exist.
|
||||
Then type in browser
|
||||
|
||||
http://127.0.0.1
|
||||
http://127.0.0.1:8000
|
||||
or
|
||||
|
||||
http://localhost
|
||||
http://localhost:8000
|
||||
Update
|
||||
---------------
|
||||
**Cloud Commander** is very often updates.
|
||||
|
|
@ -254,7 +305,7 @@ Getting dev version of **Cloud Commander**:
|
|||
git clone git://github.com/coderaiser/cloudcmd.git
|
||||
git checkout dev
|
||||
|
||||
It is possible thet dev version Cloud Commander will needed dev version of Minify,
|
||||
It is possible that dev version of Cloud Commander will needed dev version of Minify,
|
||||
so to get it you should type a couple more commands:
|
||||
|
||||
cd node_modules
|
||||
|
|
@ -264,9 +315,10 @@ so to get it you should type a couple more commands:
|
|||
|
||||
Version history
|
||||
---------------
|
||||
- *2012.07.01*, **[v0.3.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.3.0.zip)**
|
||||
- *2012.04.22*, **[v0.2.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.2.0.zip)**
|
||||
- *2012.03.01*, **[v0.1.9](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.9.zip)**
|
||||
- *2013.09.27*, **[v0.4.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.4.0.zip)**
|
||||
- *2013.07.01*, **[v0.3.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.3.0.zip)**
|
||||
- *2013.04.22*, **[v0.2.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.2.0.zip)**
|
||||
- *2013.03.01*, **[v0.1.9](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.9.zip)**
|
||||
- *2012.12.12*, **[v0.1.8](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.8.zip)**
|
||||
- *2012.10.01*, **[v0.1.7](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.7.zip)**
|
||||
- *2012.08.24*, **[v0.1.6](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.6.zip)**
|
||||
|
|
@ -283,5 +335,5 @@ MIT [license](LICENSE "license").
|
|||
|
||||
Special Thanks
|
||||
---------------
|
||||
[Elena Zalitok](http://vk.com/politilena "Elena Zalitok") for
|
||||
[logo](img/logo/cloudcmd.png "logo") and [favicon](img/favicon/favicon.png "favicon").
|
||||
- [Polietilena](http://polietilena.github.io/ "Polietilena") for [logo](img/logo/cloudcmd.png "logo") and [favicon](img/favicon/favicon.png "favicon").
|
||||
- [Elec-ua](https://github.com/elec-ua) for [ru](http://ru.cloudcmd.io "Cloud Commander in Russian") and [ua](http://ua.cloudcmd.io "Cloud Commander in Ukrainian") translations.
|
||||
|
|
|
|||
18
cloudcmd.js
|
|
@ -67,7 +67,12 @@
|
|||
});
|
||||
|
||||
if (!Config.appcache)
|
||||
lData = Util.removeStr(lData, ' manifest="/cloudcmd.appcache"');
|
||||
lData = Util.removeStr(lData, [
|
||||
/* min */
|
||||
' manifest=/cloudcmd.appcache',
|
||||
/* normal */
|
||||
' manifest="/cloudcmd.appcache"'
|
||||
]);
|
||||
|
||||
if (!Config.show_keys_panel){
|
||||
lKeysPanel = '<div id=keyspanel';
|
||||
|
|
@ -268,16 +273,9 @@
|
|||
pParams.name = main.HTMLDIR + p.name + '.html';
|
||||
lRet = main.sendFile( pParams );
|
||||
}
|
||||
else if ( Util.isContainStrAtBegin(p.name, FS) || Util.strCmp( p.name, '/') ){
|
||||
|
||||
if ( Util.isContainStrAtBegin(p.name, FS + 'no-js/') ){
|
||||
var lURL = Util.removeStr(pParams.name, 'no-js/');
|
||||
return main.redirect(pParams, lURL);
|
||||
}
|
||||
|
||||
else if ( Util.isContainStrAtBegin(p.name, FS) || Util.strCmp( p.name, '/') )
|
||||
lRet = sendCommanderContent( pParams );
|
||||
}
|
||||
/* termporary redirect for old urls */
|
||||
|
||||
else
|
||||
lRet = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,15 +37,6 @@ a:focus { outline: thin dotted; }
|
|||
/* Improve readability when focused and hovered in all browsers: h5bp.com/h */
|
||||
a:hover, a:active { outline: 0; }
|
||||
|
||||
/* changed ul to panel, it using only in this case for now, and will css
|
||||
* processing cost 33% with name of tag, so it should be match faster
|
||||
*/
|
||||
.panel{
|
||||
/* removed default margins */
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. Display hand cursor for clickable form elements
|
||||
* 2. Allow styling of clickable form elements in iOS
|
||||
|
|
|
|||
176
css/style.css
|
|
@ -31,65 +31,58 @@ body {
|
|||
background-color:white;
|
||||
}
|
||||
|
||||
#fm::-moz-selection, #left>li::-moz-selection, #right>li::-moz-selection, .path::-moz-selection, .fm-header::-moz-selection,
|
||||
.mini-icon::-moz-selection, .name::-moz-selection, .size::-moz-selection, .owner::-moz-selection, .mode::-moz-selection {
|
||||
text-shadow: none; opacity: 0;
|
||||
}
|
||||
|
||||
#fm::selection, #left>li::selection, #right>li::selection, .path::selection, .fm-header::selection,
|
||||
.mini-icon::selection, .name::selection, .size::selection, .owner::selection, .mode::selection {
|
||||
text-shadow: none;
|
||||
opacity: 0;
|
||||
background-color:white; /* opera */
|
||||
#fm, #left>li, #right>li, .path, .fm-header,
|
||||
.mini-icon, .name, .size, .owner, .mode, #keyspanel, .cmd-button {
|
||||
-webkit-user-select : none;
|
||||
-moz-user-select : none;
|
||||
-ms-user-select : none;
|
||||
-o-user-select : none;
|
||||
user-select : none;
|
||||
}
|
||||
|
||||
.path-icon {
|
||||
position: relative;
|
||||
top: 3px;
|
||||
left: -4px;
|
||||
display: inline-block;
|
||||
/* размер иконки и позиция на png-файле*/
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
font-family:'FoundationIconsGeneralEnclosed';
|
||||
font-size:30px;
|
||||
color: #46A4C3;/*#55BF3F; green*/
|
||||
text-shadow:black 0 2px 1px;
|
||||
position : relative;
|
||||
top : 3px;
|
||||
left : -4px;
|
||||
display : inline-block;
|
||||
width : 15px;
|
||||
height : 15px;
|
||||
color : #46A4C3;/*#55BF3F; green*/
|
||||
text-shadow :black 0 2px 1px;
|
||||
}
|
||||
|
||||
.path-icon:hover {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.path-icon:active {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
text-shadow:black 0 0 1px;
|
||||
}
|
||||
.icon {
|
||||
display:inline-block;
|
||||
width:16px;
|
||||
height:16px;
|
||||
margin-left:0.5%;
|
||||
/* font-family: 'GeneralFoundicons'; */
|
||||
font-family: 'Fontello';
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-left : 0.5%;
|
||||
}
|
||||
|
||||
.error::before {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
font-family : 'Fontello';
|
||||
color: rgb(222, 41, 41);
|
||||
cursor :default;
|
||||
content: '\2757';
|
||||
}
|
||||
|
||||
.loading {
|
||||
display : inline-block;
|
||||
width : 15px;
|
||||
height : 14.8px;
|
||||
position:relative;
|
||||
top:1px;
|
||||
background:url(/img/spinner.gif);
|
||||
}
|
||||
|
||||
.error:hover {
|
||||
color:rgb(222, 41, 41);
|
||||
color:rgba(222, 41, 41, 0.81);
|
||||
}
|
||||
|
||||
.refresh-icon {
|
||||
background:url(/img/panel_refresh.png) no-repeat;
|
||||
}
|
||||
|
|
@ -99,24 +92,27 @@ body {
|
|||
}
|
||||
|
||||
.cmd-button {
|
||||
width: 8%;
|
||||
margin: 20px 2px 0 2px;
|
||||
overflow: hidden;
|
||||
color: rgb(49,123,249);
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
background-color: white;
|
||||
border: 1.5px solid rgba(49,123,249,.40);
|
||||
color: rgb(49,123,249);
|
||||
margin: 20px 2px 0 2px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
outline: 0;
|
||||
white-space: nowrap;
|
||||
width: 8%;
|
||||
transition: ease 0.1s;
|
||||
}
|
||||
|
||||
.cmd-button:hover {
|
||||
border: 1.5px solid rgb(0,0,0);
|
||||
transition: ease 0.5s;
|
||||
}
|
||||
|
||||
.cmd-button:active {
|
||||
color: white;
|
||||
background-color: rgb(49,123,249);
|
||||
transition: ease 0.1s;
|
||||
}
|
||||
|
||||
.clear-cache {
|
||||
|
|
@ -176,55 +172,50 @@ body {
|
|||
#path{
|
||||
margin-left:1.5%;
|
||||
}
|
||||
.left, #left{
|
||||
.left, #left {
|
||||
float:left;
|
||||
}
|
||||
|
||||
/* фон файла, на котором курсор*/
|
||||
.current-file {
|
||||
border: 1.5px solid rgba(49, 123, 249, .40);
|
||||
box-shadow: inset 0 0 2px rgb(49, 123, 249);
|
||||
transition: ease 0.05s;
|
||||
}
|
||||
|
||||
.selected-file, .selected-file .name > a{
|
||||
.selected-file, .selected-file .name > a {
|
||||
color: rgb(254,159,224);
|
||||
}
|
||||
|
||||
.right, #right{
|
||||
.right, #right {
|
||||
float:right;
|
||||
}
|
||||
.panel{
|
||||
.panel {
|
||||
width: 46%;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
overflow-y: auto;
|
||||
border: 1.5px solid rgba(49, 123, 249, .40);
|
||||
}
|
||||
#keyspanel{
|
||||
|
||||
.selected-panel {
|
||||
border-color: rgba(254, 159, 224, .40);
|
||||
}
|
||||
|
||||
#keyspanel {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* информация о файлах и папках*/
|
||||
.name {
|
||||
float: left;
|
||||
width: 35%;
|
||||
/* если длина имени файла больше 16 символов
|
||||
* отрезаем лишнее, оставляя лишь 16,
|
||||
* и добавляем две точки и тайтл
|
||||
*/
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.size {
|
||||
float:left;
|
||||
width:16%;
|
||||
/* Ставим отступ, что бы
|
||||
* size не налазил на uid
|
||||
* (owner)
|
||||
*/
|
||||
margin-right: 27px;
|
||||
/* Ставим выравнивание,
|
||||
* что бы размер был в
|
||||
* одной ровной колонке
|
||||
*/
|
||||
text-align: right;
|
||||
}
|
||||
.mode {
|
||||
|
|
@ -232,23 +223,21 @@ body {
|
|||
width: 23%;
|
||||
}
|
||||
|
||||
/* changin ul to panel for high speed parsing*/
|
||||
.panel, li{
|
||||
list-style-type:none;
|
||||
/* making cursor just arrow,
|
||||
* not text editing cursor
|
||||
*/
|
||||
cursor:default;
|
||||
.panel, li {
|
||||
list-style-type: none;
|
||||
cursor: default;
|
||||
}
|
||||
button{
|
||||
|
||||
button {
|
||||
width:10%;
|
||||
}
|
||||
a{
|
||||
|
||||
a {
|
||||
text-decoration:none;
|
||||
}
|
||||
a:hover, a:active {
|
||||
color: #06e;
|
||||
cursor:pointer;
|
||||
color : #06e;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Если размер окна очень маленький
|
||||
|
|
@ -256,14 +245,7 @@ a:hover, a:active {
|
|||
* друг-под-другом
|
||||
*/
|
||||
/* responsive design */
|
||||
@media only screen and (max-width: 600px){
|
||||
.panel{
|
||||
width:94% !important;
|
||||
}
|
||||
/* если правая панель не помещаеться - прячем её */
|
||||
#right{
|
||||
display:none;
|
||||
}
|
||||
@media only screen and (max-width: 600px) {
|
||||
/* текущий файл под курсором */
|
||||
.current-file {
|
||||
background-color: rgb(49, 123, 249);
|
||||
|
|
@ -309,7 +291,8 @@ a:hover, a:active {
|
|||
/* убираем заголовок*/
|
||||
.fm_header {
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
|
||||
.mode,.size,.owner {
|
||||
/* располагаем элементы
|
||||
* один под другим
|
||||
|
|
@ -352,29 +335,24 @@ a:hover, a:active {
|
|||
width: 20%;
|
||||
}
|
||||
}
|
||||
@media only screen and (min-width: 601px) and (max-width: 785px){
|
||||
.panel{
|
||||
width:94% !important;
|
||||
}
|
||||
#right{
|
||||
display:none;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 601px) and (max-width: 785px) {
|
||||
.cmd-button {
|
||||
width: 15%;
|
||||
width: 13%;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width:786px) and (max-width: 1155px){
|
||||
.panel{
|
||||
width:94% !important;
|
||||
}
|
||||
/* если правая панель не помещаеться - прячем её */
|
||||
#right{
|
||||
display:none;
|
||||
}
|
||||
|
||||
@media only screen and (min-width:786px) and (max-width: 1155px) {
|
||||
.cmd-button {
|
||||
width: 10%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1155px) {
|
||||
.panel {
|
||||
width:94%;
|
||||
}
|
||||
/* если правая панель не помещаеться - прячем её */
|
||||
#right, .cmd-button#f5, .cmd-button#f6 {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,11 +29,6 @@
|
|||
</div>
|
||||
<script src=/lib/util.js></script>
|
||||
<script src=/lib/client/dom.js></script>
|
||||
<!--[if lt IE]>
|
||||
<script src=//ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js></script>
|
||||
<script src=//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js id=jquery_min_js ></script>
|
||||
<script src=/lib/client/ie.js id=ie_js ></script>
|
||||
<![endif]-->
|
||||
<script src=/lib/client.js></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
BIN
img/screenshot/console.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
img/screenshot/edit.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
img/screenshot/menu.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"api_url" : "/api/v1",
|
||||
"appcache" : false,
|
||||
"analytics" : true,
|
||||
"localStorage" : true,
|
||||
"minification" : {
|
||||
"js" : true,
|
||||
"css" : true,
|
||||
|
|
|
|||
455
lib/client.js
|
|
@ -7,8 +7,7 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
(function(Util, DOM){
|
||||
'use strict';
|
||||
|
||||
var Key, Config, Modules, FileTemplate, PathTemplate,
|
||||
Events = DOM.Events,
|
||||
var Key, Config, Modules, FileTemplate, PathTemplate, Listeners,
|
||||
Cache = DOM.Cache;
|
||||
|
||||
CloudCmd = {
|
||||
|
|
@ -26,16 +25,6 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
})()
|
||||
};
|
||||
|
||||
CloudCmd.GoogleAnalytics = function(){
|
||||
Events.addOneTime('mousemove', function(){
|
||||
var lUrl = CloudCmd.LIBDIRCLIENT + 'google_analytics.js';
|
||||
|
||||
setTimeout(function(){
|
||||
DOM.jsload(lUrl);
|
||||
}, 5000);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Функция привязываеться ко всем ссылкам и
|
||||
* загружает содержимое каталогов
|
||||
|
|
@ -73,17 +62,12 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
* @param pDirName - имя каталога с которого мы пришли
|
||||
*/
|
||||
function currentToParent(pDirName){
|
||||
var lRootDir;
|
||||
/* убираем слэш с имени каталога */
|
||||
pDirName = Util.removeStr(pDirName, '/');
|
||||
pDirName = Util.removeStr(pDirName, '/');
|
||||
lRootDir = DOM.getCurrentFileByName(pDirName);
|
||||
|
||||
/* опредиляем в какой мы панели: *
|
||||
* правой или левой */
|
||||
var lPanel = DOM.getPanel(),
|
||||
lRootDir = DOM.getById(pDirName + '(' + lPanel.id + ')');
|
||||
|
||||
/* if found li element with ID directory name *
|
||||
* set it to current file */
|
||||
if(lRootDir){
|
||||
if (lRootDir){
|
||||
DOM.setCurrentFile(lRootDir);
|
||||
DOM.scrollIntoViewIfNeeded(lRootDir, true);
|
||||
}
|
||||
|
|
@ -104,7 +88,7 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
lPath = pParams;
|
||||
|
||||
if(lPath && !lName){
|
||||
lName = lPath[0].toUpperCase() + lPath.substring(1);
|
||||
lName = Util.getStrBigFirst(lPath);
|
||||
lName = Util.removeStr(lName, '.js');
|
||||
|
||||
var lSlash = lName.indexOf('/');
|
||||
|
|
@ -134,34 +118,67 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
* инициализации
|
||||
*/
|
||||
CloudCmd.init = function(){
|
||||
var lCallBack = function(){
|
||||
Util.loadOnLoad([
|
||||
initKeysPanel,
|
||||
initModules,
|
||||
baseInit
|
||||
]);
|
||||
},
|
||||
lFunc = function(pCallBack){
|
||||
CloudCmd.OLD_BROWSER = true;
|
||||
var lSrc = CloudCmd.LIBDIRCLIENT + 'polyfill.js';
|
||||
|
||||
DOM.jqueryLoad(
|
||||
DOM.retJSLoad(lSrc, pCallBack)
|
||||
);
|
||||
};
|
||||
var lCallBack, lFunc, lHeight;
|
||||
/* устанавливаем размер высоты таблицы файлов
|
||||
* исходя из размеров разрешения экрана
|
||||
*
|
||||
* формируем и округляем высоту экрана
|
||||
* при разрешениии 1024x1280:
|
||||
* 658 -> 700
|
||||
*/
|
||||
|
||||
lHeight = window.screen.height;
|
||||
lHeight = lHeight - (lHeight/3).toFixed();
|
||||
lHeight = (lHeight / 100).toFixed() * 100;
|
||||
|
||||
CloudCmd.HEIGHT = lHeight;
|
||||
|
||||
DOM.cssSet({
|
||||
id:'cloudcmd',
|
||||
inner:
|
||||
'.panel{' +
|
||||
'height:' + lHeight +'px;' +
|
||||
'}'
|
||||
});
|
||||
|
||||
lCallBack = function(){
|
||||
Util.loadOnLoad([
|
||||
Util.retExec(CloudCmd.route, location.hash),
|
||||
baseInit,
|
||||
initModules,
|
||||
]);
|
||||
},
|
||||
lFunc = function(pCallBack){
|
||||
CloudCmd.OLD_BROWSER = true;
|
||||
var lSrc = CloudCmd.LIBDIRCLIENT + 'polyfill.js';
|
||||
|
||||
DOM.jqueryLoad(
|
||||
DOM.retJSLoad(lSrc, pCallBack)
|
||||
);
|
||||
};
|
||||
|
||||
Util.ifExec(document.body.scrollIntoViewIfNeeded, lCallBack, lFunc);
|
||||
};
|
||||
|
||||
CloudCmd.route = function(pPath){
|
||||
var lQuery, lModule, lFile, lCurrent, lMsg;
|
||||
|
||||
DOM.Events.add(['unload', 'beforeunload'], function (pEvent) {
|
||||
var lRet, lIsBind = Key.isBind();
|
||||
|
||||
if(!lIsBind) {
|
||||
DOM.preventDefault(pEvent);
|
||||
lRet = 'Please make sure that you saved all work.';
|
||||
if (pPath.length > 0) {
|
||||
lQuery = pPath.split('/');
|
||||
|
||||
if (lQuery.length > 0) {
|
||||
lModule = Util.getStrBigFirst(lQuery[1]);
|
||||
lFile = lQuery[2];
|
||||
lCurrent = DOM.getCurrentFileByName(lFile);
|
||||
if (lFile && !lCurrent) {
|
||||
lMsg = CloudFunc.format('set current file', lFile, 'error');
|
||||
Util.log(lMsg);
|
||||
} else {
|
||||
DOM.setCurrentFile(lCurrent);
|
||||
CloudCmd.execFromModule(lModule, 'show');
|
||||
}
|
||||
|
||||
return lRet;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function initModules(pCallBack){
|
||||
|
|
@ -177,10 +194,6 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
CloudCmd.getModules(function(pModules) {
|
||||
pModules = pModules || [];
|
||||
|
||||
Events.addContextMenu(function(pEvent){
|
||||
CloudCmd.Menu.ENABLED || DOM.preventDefault(pEvent);
|
||||
}, document);
|
||||
|
||||
var i, n, lStorage = 'storage',
|
||||
lShowLoadFunc = Util.retFunc( DOM.Images.showLoad, {top:true} ),
|
||||
|
||||
|
|
@ -221,75 +234,38 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
});
|
||||
}
|
||||
|
||||
function initKeysPanel(pCallBack){
|
||||
var i, lButton, lEl,
|
||||
lKeysPanel = {},
|
||||
|
||||
lFuncs =[
|
||||
null,
|
||||
CloudCmd.Help, /* f1 */
|
||||
DOM.renameCurrent, /* f2 */
|
||||
CloudCmd.View, /* f3 */
|
||||
CloudCmd.Edit, /* f4 */
|
||||
DOM.copyCurrent, /* f5 */
|
||||
DOM.moveCurrent, /* f6 */
|
||||
DOM.promptNewDir, /* f7 */
|
||||
DOM.promptDeleteSelected, /* f8 */
|
||||
CloudCmd.Menu, /* f9 */
|
||||
];
|
||||
|
||||
for (i = 1; i <= 9; i++) {
|
||||
lButton = 'f' + i,
|
||||
lEl = DOM.getById('f' + i);
|
||||
lKeysPanel[lButton] = lEl;
|
||||
|
||||
if (i === 1 || i === 3 || i === 4 || i === 9)
|
||||
Events.addOneTime('click', lFuncs[i], lEl);
|
||||
else
|
||||
Events.addClick(lFuncs[i], lEl);
|
||||
}
|
||||
|
||||
lButton = '~',
|
||||
lEl = DOM.getById('~');
|
||||
lKeysPanel[lButton] = lEl;
|
||||
Events.addOneTime('click', CloudCmd.Console, lEl);
|
||||
|
||||
CloudCmd.KeysPanel = lKeysPanel;
|
||||
Util.exec(pCallBack);
|
||||
}
|
||||
|
||||
function baseInit(pCallBack){
|
||||
if(window.applicationCache){
|
||||
var lFunc = applicationCache.onupdateready;
|
||||
|
||||
applicationCache.onupdateready = function(){
|
||||
Util.log('app cacheed');
|
||||
location.reload();
|
||||
function baseInit(pCallBack) {
|
||||
var LIB = CloudCmd.LIBDIR,
|
||||
LIBCLIENT = CloudCmd.LIBDIRCLIENT,
|
||||
files = [
|
||||
LIB + 'cloudfunc.js',
|
||||
LIBCLIENT + 'listeners.js'
|
||||
];
|
||||
|
||||
Util.exec(lFunc);
|
||||
};
|
||||
}
|
||||
|
||||
/* загружаем общие функции для клиента и сервера */
|
||||
DOM.jsload(CloudCmd.LIBDIR + 'cloudfunc.js', function(){
|
||||
Events.add("popstate", function(pEvent) {
|
||||
var lPath = pEvent.state + '?json';
|
||||
|
||||
if(lPath)
|
||||
ajaxLoad(lPath, {nohistory: true});
|
||||
|
||||
return true;
|
||||
});
|
||||
DOM.anyLoadInParallel(files, function() {
|
||||
Listeners = CloudCmd.Listeners;
|
||||
|
||||
changeLinks(CloudFunc.LEFTPANEL);
|
||||
changeLinks(CloudFunc.RIGHTPANEL);
|
||||
Listeners.init();
|
||||
/* загружаем Google Analytics */
|
||||
Listeners.analytics();
|
||||
Listeners.changeLinks(CloudFunc.LEFTPANEL);
|
||||
Listeners.changeLinks(CloudFunc.RIGHTPANEL);
|
||||
|
||||
CloudCmd.KeysPanel = Listeners.initKeysPanel();
|
||||
|
||||
/* устанавливаем переменную доступности кэша */
|
||||
Cache.setAllowed(true);
|
||||
/* Устанавливаем кэш корневого каталога */
|
||||
var lDirPath = DOM.getCurrentDirPath();
|
||||
if( !Cache.get(lDirPath) )
|
||||
Cache.set(lDirPath, getJSONfromFileTable());
|
||||
CloudCmd.getConfig(function(config) {
|
||||
var localStorage = config.localStorage;
|
||||
/* устанавливаем переменную доступности кэша */
|
||||
Cache.setAllowed(localStorage);
|
||||
/* Устанавливаем кэш корневого каталога */
|
||||
var lDirPath = DOM.getCurrentDirPath();
|
||||
if (!Cache.get(lDirPath))
|
||||
Cache.set(lDirPath, getJSONfromFileTable());
|
||||
});
|
||||
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
|
||||
/* выделяем строку с первым файлом */
|
||||
|
|
@ -302,35 +278,10 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
/* показываем элементы, которые будут работать только, если есть js */
|
||||
var lFM = DOM.getById('fm');
|
||||
lFM.className='localstorage';
|
||||
|
||||
/* устанавливаем размер высоты таблицы файлов
|
||||
* исходя из размеров разрешения экрана
|
||||
*
|
||||
* формируем и округляем высоту экрана
|
||||
* при разрешениии 1024x1280:
|
||||
* 658 -> 700
|
||||
*/
|
||||
|
||||
var lHeight = window.screen.height;
|
||||
lHeight = lHeight - (lHeight/3).toFixed();
|
||||
|
||||
lHeight = (lHeight / 100).toFixed() * 100;
|
||||
|
||||
CloudCmd.HEIGHT = lHeight;
|
||||
|
||||
DOM.cssSet({
|
||||
id:'cloudcmd',
|
||||
inner:
|
||||
'.panel{' +
|
||||
'height:' + lHeight +'px;' +
|
||||
'}'
|
||||
});
|
||||
|
||||
Util.exec(pCallBack);
|
||||
CloudCmd.Key();
|
||||
}
|
||||
|
||||
|
||||
function getSystemFile(pGlobal, pURL){
|
||||
|
||||
function lGetSysFile(pCallBack){
|
||||
|
|
@ -354,11 +305,11 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
CloudCmd.getConfig = getSystemFile(Config, CloudCmd.JSONDIR + 'config.json');
|
||||
CloudCmd.getModules = getSystemFile(Modules, CloudCmd.JSONDIR + 'modules.json');
|
||||
CloudCmd.getFileTemplate = getSystemFile(FileTemplate, CloudCmd.HTMLDIR + 'file.html');
|
||||
CloudCmd.getpPathTemplate = getSystemFile(PathTemplate, CloudCmd.HTMLDIR + 'path.html');
|
||||
CloudCmd.getPathTemplate = getSystemFile(PathTemplate, CloudCmd.HTMLDIR + 'path.html');
|
||||
|
||||
CloudCmd.execFromModule = function(pModuleName, pFuncName, pParams){
|
||||
var lObject = CloudCmd[pModuleName];
|
||||
Util.ifExec('init' in lObject,
|
||||
Util.ifExec(Util.isObject(lObject),
|
||||
function(){
|
||||
var lObj = CloudCmd[pModuleName];
|
||||
Util.exec( lObj[pFuncName], pParams);
|
||||
|
|
@ -369,132 +320,16 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* функция меняет ссыки на ajax-овые
|
||||
* @param pPanelID
|
||||
*/
|
||||
function changeLinks(pPanelID){
|
||||
/* назначаем кнопку очистить кэш и показываем её */
|
||||
var lClearcache = DOM.getById('clear-cache');
|
||||
Events.addClick(Cache.clear, lClearcache);
|
||||
|
||||
/* меняем ссылки на ajax-запросы */
|
||||
var lPanel = DOM.getById(pPanelID),
|
||||
a = DOM.getByTag('a', lPanel),
|
||||
|
||||
/* right mouse click function varible */
|
||||
lOnContextMenu_f = function(pEvent){
|
||||
var lReturn_b = true;
|
||||
|
||||
Key && Key.unsetBind();
|
||||
|
||||
/* getting html element
|
||||
* currentTarget - DOM event
|
||||
* target - jquery event
|
||||
*/
|
||||
var lTarget = pEvent.currentTarget || pEvent.target;
|
||||
DOM.setCurrentFile(lTarget);
|
||||
|
||||
if(Util.isFunction(CloudCmd.Menu) ){
|
||||
CloudCmd.Menu({
|
||||
x: pEvent.clientX,
|
||||
y: pEvent.clientY
|
||||
});
|
||||
|
||||
/* disabling browsers menu*/
|
||||
lReturn_b = false;
|
||||
DOM.Images.showLoad();
|
||||
}
|
||||
|
||||
return lReturn_b;
|
||||
},
|
||||
|
||||
/* drag and drop function varible
|
||||
* download file from browser to descktop
|
||||
* in Chrome (HTML5)
|
||||
*/
|
||||
lOnDragStart_f = function(pEvent){
|
||||
var lElement = pEvent.target,
|
||||
lLink = lElement.href,
|
||||
lName = lElement.textContent;
|
||||
|
||||
/* if it's directory - adding json extension */
|
||||
if( DOM.isCurrentIsDir() ){
|
||||
lName += '.json';
|
||||
lLink += '?json';
|
||||
}
|
||||
|
||||
pEvent.dataTransfer.setData("DownloadURL",
|
||||
'application/octet-stream' + ':' +
|
||||
lName + ':' +
|
||||
lLink);
|
||||
},
|
||||
|
||||
lSetCurrentFile_f = function(pEvent){
|
||||
var pElement = pEvent.target,
|
||||
lTag = pElement.tagName;
|
||||
|
||||
if(lTag !== 'LI')
|
||||
do{
|
||||
pElement = pElement.parentElement;
|
||||
lTag = pElement.tagName;
|
||||
}while(lTag !== 'LI');
|
||||
|
||||
DOM.setCurrentFile(pElement);
|
||||
},
|
||||
|
||||
lUrl = CloudCmd.HOST,
|
||||
lLoadDirOnce = CloudCmd.loadDir();
|
||||
|
||||
CloudCmd.refresh = function(pCurrent){
|
||||
var lNEEDREFRESH = true,
|
||||
lPanel = pCurrent && pCurrent.parentElement,
|
||||
lPath = DOM.getCurrentDirPath(lPanel),
|
||||
lLink = CloudFunc.FS + lPath,
|
||||
lNotSlashlLink = CloudFunc.removeLastSlash(lLink),
|
||||
lLoad = CloudCmd.loadDir(lNotSlashlLink, lNEEDREFRESH);
|
||||
lLoad();
|
||||
};
|
||||
CloudCmd.refresh = function(pCurrent){
|
||||
var lNEEDREFRESH = true,
|
||||
lPanel = pCurrent && pCurrent.parentElement,
|
||||
lPath = DOM.getCurrentDirPath(lPanel),
|
||||
lLink = CloudFunc.FS + lPath,
|
||||
lNotSlashlLink = CloudFunc.removeLastSlash(lLink),
|
||||
lLoad = CloudCmd.loadDir(lNotSlashlLink, lNEEDREFRESH);
|
||||
|
||||
/* ставим загрузку гифа на клик*/
|
||||
Events.addClick( CloudCmd.refresh, a[0].parentElement );
|
||||
|
||||
/* start from 1 cous 0 is a path and it's setted up */
|
||||
for(var i = 1, n = a.length; i < n ; i++){
|
||||
/* убираем адрес хоста*/
|
||||
var ai = a[i],
|
||||
lLink = Util.removeStr(ai.href, lUrl),
|
||||
lLoadDir = CloudCmd.loadDir(lLink),
|
||||
/* устанавливаем обработчики на строку
|
||||
* на двойное нажатие на левую кнопку мышки */
|
||||
lLi = ai.parentElement.parentElement;
|
||||
|
||||
/* if we in path - set click event */
|
||||
if (lLi.className === 'path')
|
||||
Events.addClick( lLoadDir, ai );
|
||||
else {
|
||||
Events.add({
|
||||
'click' : DOM.preventDefault,
|
||||
'mousedown' : lSetCurrentFile_f,
|
||||
'contextmenu' : lOnContextMenu_f
|
||||
}, lLi);
|
||||
|
||||
Events.add('dragstart', lOnDragStart_f, ai);
|
||||
|
||||
/* если ссылка на папку, а не файл */
|
||||
if(ai.target !== '_blank'){
|
||||
Events.add({
|
||||
'dblclick' : lLoadDirOnce,
|
||||
'touchend' : lLoadDirOnce
|
||||
}, lLi);
|
||||
}
|
||||
|
||||
lLi.id = (ai.title ? ai.title : ai.textContent) +
|
||||
'(' + pPanelID + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
lLoad();
|
||||
};
|
||||
|
||||
/**
|
||||
* Функция загружает json-данные о Файловой Системе
|
||||
|
|
@ -511,7 +346,7 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
var lSLASH = '/',
|
||||
lFSPath = decodeURI(pPath),
|
||||
lNOJSPath = Util.removeStr( lFSPath, '?json' ),
|
||||
lCleanPath = Util.removeStr( lNOJSPath, CloudFunc.FS ) || lSLASH,
|
||||
lCleanPath = Util.removeStrOneTime( lNOJSPath, CloudFunc.FS ) || lSLASH,
|
||||
|
||||
lOldURL = window.location.pathname;
|
||||
|
||||
|
|
@ -549,6 +384,8 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
DOM.getCurrentFileContent({
|
||||
url : lFSPath,
|
||||
|
||||
dataType: 'json',
|
||||
|
||||
error : function(){
|
||||
DOM.setHistory(lOldURL, null, lOldURL);
|
||||
},
|
||||
|
|
@ -583,46 +420,48 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
lDir = DOM.getCurrentDirName(),
|
||||
|
||||
lName = DOM.getCurrentName(lCurrent),
|
||||
lWasRefresh_b = lPath[0].textContent === pJSON[0].path;
|
||||
lWasRefresh_b = lPath[0].textContent === pJSON[0].path,
|
||||
lFuncs = [
|
||||
CloudCmd.getFileTemplate,
|
||||
CloudCmd.getPathTemplate
|
||||
];
|
||||
|
||||
CloudCmd.getFileTemplate(function(pTemplate){
|
||||
CloudCmd.getpPathTemplate(function(pPathTemplate){
|
||||
/* очищаем панель */
|
||||
var i = lElem.childNodes.length;
|
||||
|
||||
while(i--)
|
||||
lElem.removeChild(lElem.lastChild);
|
||||
|
||||
lElem.innerHTML = CloudFunc.buildFromJSON(pJSON, pTemplate, pPathTemplate);
|
||||
|
||||
/* если нажали на ссылку на верхний каталог*/
|
||||
var lFound;
|
||||
/* searching current file */
|
||||
if(lWasRefresh_b){
|
||||
var n = lElem.childNodes.length;
|
||||
for(i = 2; i < n ; i++){
|
||||
var lVarCurrent = lElem.childNodes[i],
|
||||
lVarName = DOM.getCurrentName(lVarCurrent);
|
||||
|
||||
lFound = lVarName === lName;
|
||||
|
||||
if(lFound){
|
||||
lCurrent = lElem.childNodes[i];
|
||||
break;
|
||||
}
|
||||
Util.asyncCall(lFuncs, function(pTemplate, pPathTemplate) {
|
||||
/* очищаем панель */
|
||||
var i = lElem.childNodes.length;
|
||||
|
||||
while(i--)
|
||||
lElem.removeChild(lElem.lastChild);
|
||||
|
||||
lElem.innerHTML = CloudFunc.buildFromJSON(pJSON, pTemplate, pPathTemplate);
|
||||
|
||||
/* если нажали на ссылку на верхний каталог*/
|
||||
var lFound;
|
||||
/* searching current file */
|
||||
if(lWasRefresh_b){
|
||||
var n = lElem.childNodes.length;
|
||||
for(i = 2; i < n ; i++){
|
||||
var lVarCurrent = lElem.childNodes[i],
|
||||
lVarName = DOM.getCurrentName(lVarCurrent);
|
||||
|
||||
lFound = lVarName === lName;
|
||||
|
||||
if(lFound){
|
||||
lCurrent = lElem.childNodes[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!lFound) /* .. */
|
||||
lCurrent = lElem.childNodes[2];
|
||||
|
||||
DOM.setCurrentFile(lCurrent);
|
||||
|
||||
changeLinks(pElem);
|
||||
|
||||
if(lName === '..' && lDir !== '/')
|
||||
currentToParent(lDir);
|
||||
});
|
||||
});
|
||||
}
|
||||
if(!lFound) /* .. */
|
||||
lCurrent = lElem.childNodes[2];
|
||||
|
||||
DOM.setCurrentFile(lCurrent);
|
||||
|
||||
Listeners.changeLinks(pElem);
|
||||
|
||||
if(lName === '..' && lDir !== '/')
|
||||
currentToParent(lDir);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -666,11 +505,5 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
return Util.stringifyJSON(lFileTable);
|
||||
}
|
||||
|
||||
Events.addOneTime('load', function(){
|
||||
/* базовая инициализация*/
|
||||
CloudCmd.init();
|
||||
|
||||
/* загружаем Google Analytics */
|
||||
CloudCmd.GoogleAnalytics();
|
||||
});
|
||||
DOM.Events.addOneTime('load', CloudCmd.init);
|
||||
})(Util, DOM);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
var DOM, _gaq;
|
||||
(function(DOM, _gaq){
|
||||
|
||||
(function(DOM, _gaq) {
|
||||
'use strict';
|
||||
|
||||
/* setting google analitics tracking code */
|
||||
|
|
@ -12,4 +13,4 @@ var DOM, _gaq;
|
|||
|
||||
DOM.jsload('//google-analytics.com/ga.js');
|
||||
|
||||
})(DOM, _gaq);
|
||||
})(DOM, _gaq);
|
||||
|
|
@ -6,6 +6,7 @@ var CloudCmd, Util, DOM, $;
|
|||
|
||||
function ConsoleProto(CloudCmd, Util, DOM){
|
||||
var Name = 'Console',
|
||||
Loading,
|
||||
jqconsole,
|
||||
Element,
|
||||
MouseBinded,
|
||||
|
|
@ -16,6 +17,8 @@ var CloudCmd, Util, DOM, $;
|
|||
this.init = function(pCallBack) {
|
||||
var lFunc, lIsFunc = Util.isFunction(CloudCmd.View);
|
||||
|
||||
Loading = true;
|
||||
|
||||
if (lIsFunc)
|
||||
lFunc = CloudCmd.View;
|
||||
else
|
||||
|
|
@ -36,65 +39,67 @@ var CloudCmd, Util, DOM, $;
|
|||
};
|
||||
|
||||
this.show = function() {
|
||||
Images.showLoad({top:true});
|
||||
|
||||
if (!Element) {
|
||||
Element = DOM.anyload({
|
||||
name : 'div',
|
||||
className : 'console'
|
||||
});
|
||||
if (!Loading) {
|
||||
Images.showLoad({top:true});
|
||||
|
||||
jqconsole = $(Element).jqconsole('', '> ');
|
||||
// Abort prompt on Ctrl+Z.
|
||||
jqconsole.RegisterShortcut('Z', function() {
|
||||
jqconsole.AbortPrompt();
|
||||
handler();
|
||||
});
|
||||
|
||||
// Handle a command.
|
||||
var handler = function(command) {
|
||||
var lSocket = CloudCmd.Socket;
|
||||
if (command) {
|
||||
Images.showLoad({ top:true });
|
||||
|
||||
if(lSocket)
|
||||
lSocket.send(command);
|
||||
}
|
||||
|
||||
jqconsole.Prompt(true, handler);
|
||||
};
|
||||
|
||||
// Initiate the first prompt.
|
||||
handler();
|
||||
}
|
||||
|
||||
CloudCmd.View.show(Element, function(){
|
||||
var l$Console = jqconsole.$console,
|
||||
l$Input = jqconsole.$input_source,
|
||||
lFocus = function(){
|
||||
var x = window.scrollX,
|
||||
y = window.scrollY;
|
||||
|
||||
l$Input.focus();
|
||||
window.scrollTo(x,y);
|
||||
};
|
||||
|
||||
lFocus();
|
||||
|
||||
if (!MouseBinded) {
|
||||
MouseBinded = true;
|
||||
|
||||
$(l$Console).unbind('mouseup');
|
||||
$(l$Console).mouseup(function() {
|
||||
if( !window.getSelection().toString() ) {
|
||||
var lTop = l$Console.scrollTop();
|
||||
|
||||
lFocus();
|
||||
l$Console.scrollTop(lTop);
|
||||
}
|
||||
if (!Element) {
|
||||
Element = DOM.anyload({
|
||||
name : 'div',
|
||||
className : 'console'
|
||||
});
|
||||
|
||||
jqconsole = $(Element).jqconsole('', '> ');
|
||||
// Abort prompt on Ctrl+Z.
|
||||
jqconsole.RegisterShortcut('Z', function() {
|
||||
jqconsole.AbortPrompt();
|
||||
handler();
|
||||
});
|
||||
|
||||
// Handle a command.
|
||||
var handler = function(command) {
|
||||
var lSocket = CloudCmd.Socket;
|
||||
if (command) {
|
||||
Images.showLoad({ top:true });
|
||||
|
||||
if(lSocket)
|
||||
lSocket.send(command);
|
||||
}
|
||||
|
||||
jqconsole.Prompt(true, handler);
|
||||
};
|
||||
|
||||
// Initiate the first prompt.
|
||||
handler();
|
||||
}
|
||||
});
|
||||
|
||||
CloudCmd.View.show(Element, function(){
|
||||
var l$Console = jqconsole.$console,
|
||||
l$Input = jqconsole.$input_source,
|
||||
lFocus = function(){
|
||||
var x = window.scrollX,
|
||||
y = window.scrollY;
|
||||
|
||||
l$Input.focus();
|
||||
window.scrollTo(x,y);
|
||||
};
|
||||
|
||||
lFocus();
|
||||
|
||||
if (!MouseBinded) {
|
||||
MouseBinded = true;
|
||||
|
||||
$(l$Console).unbind('mouseup');
|
||||
$(l$Console).mouseup(function() {
|
||||
if( !window.getSelection().toString() ) {
|
||||
var lTop = l$Console.scrollTop();
|
||||
|
||||
lFocus();
|
||||
l$Console.scrollTop(lTop);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.hide = function(){
|
||||
|
|
@ -129,12 +134,12 @@ var CloudCmd, Util, DOM, $;
|
|||
lFiles = [
|
||||
lDir + 'jqconsole.js',
|
||||
lDir + 'jqconsole.css',
|
||||
lDir + 'ansi.css',
|
||||
lDir + 'jquery-migrate-1.2.1.js'
|
||||
lDir + 'ansi.css'
|
||||
];
|
||||
|
||||
DOM.anyLoadInParallel(lFiles, function(){
|
||||
console.timeEnd(Name + ' load');
|
||||
Util.timeEnd(Name + ' load');
|
||||
Loading = false;
|
||||
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,69 @@
|
|||
Copyrights 2011, the repl.it project.
|
||||
Licensed under the MIT license
|
||||
*/
|
||||
// Limit scope pollution from any deprecated API
|
||||
(function() {
|
||||
|
||||
var matched, browser;
|
||||
|
||||
// Use of jQuery.browser is frowned upon.
|
||||
// More details: http://api.jquery.com/jQuery.browser
|
||||
// jQuery.uaMatch maintained for back-compat
|
||||
jQuery.uaMatch = function( ua ) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
|
||||
matched = jQuery.uaMatch( navigator.userAgent );
|
||||
browser = {};
|
||||
|
||||
if ( matched.browser ) {
|
||||
browser[ matched.browser ] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
|
||||
// Chrome is Webkit, but Webkit is also Safari.
|
||||
if ( browser.chrome ) {
|
||||
browser.webkit = true;
|
||||
} else if ( browser.webkit ) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
jQuery.browser = browser;
|
||||
|
||||
jQuery.sub = function() {
|
||||
function jQuerySub( selector, context ) {
|
||||
return new jQuerySub.fn.init( selector, context );
|
||||
}
|
||||
jQuery.extend( true, jQuerySub, this );
|
||||
jQuerySub.superclass = this;
|
||||
jQuerySub.fn = jQuerySub.prototype = this();
|
||||
jQuerySub.fn.constructor = jQuerySub;
|
||||
jQuerySub.sub = this.sub;
|
||||
jQuerySub.fn.init = function init( selector, context ) {
|
||||
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
||||
context = jQuerySub( context );
|
||||
}
|
||||
|
||||
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
||||
};
|
||||
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
||||
var rootjQuerySub = jQuerySub(document);
|
||||
return jQuerySub;
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
(function() {
|
||||
var $, Ansi, CLASS_ANSI, CLASS_BLURRED, CLASS_CURSOR, CLASS_HEADER, CLASS_INPUT, CLASS_OLD_PROMPT, CLASS_PREFIX, CLASS_PROMPT, DEFAULT_INDENT_WIDTH, DEFAULT_PROMPT_CONINUE_LABEL, DEFAULT_PROMPT_LABEL, EMPTY_DIV, EMPTY_SELECTOR, EMPTY_SPAN, ESCAPE_CHAR, ESCAPE_SYNTAX, E_KEYPRESS, JQConsole, KEY_BACKSPACE, KEY_DELETE, KEY_DOWN, KEY_END, KEY_ENTER, KEY_HOME, KEY_LEFT, KEY_PAGE_DOWN, KEY_PAGE_UP, KEY_RIGHT, KEY_TAB, KEY_UP, NEWLINE, STATE_INPUT, STATE_OUTPUT, STATE_PROMPT, spanHtml,
|
||||
|
|
|
|||
|
|
@ -1,521 +0,0 @@
|
|||
/*!
|
||||
* jQuery Migrate - v1.2.1 - 2013-05-08
|
||||
* https://github.com/jquery/jquery-migrate
|
||||
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
|
||||
*/
|
||||
(function( jQuery, window, undefined ) {
|
||||
// See http://bugs.jquery.com/ticket/13335
|
||||
// "use strict";
|
||||
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to true to prevent console output; migrateWarnings still maintained
|
||||
// jQuery.migrateMute = false;
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
if ( !jQuery.migrateMute && window.console && window.console.log ) {
|
||||
window.console.log("JQMIGRATE: Logging is active");
|
||||
}
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg) {
|
||||
var console = window.console;
|
||||
if ( !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
if ( Object.defineProperty ) {
|
||||
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
||||
// allow property to be overwritten in case some other plugin wants it
|
||||
try {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( msg );
|
||||
value = newValue;
|
||||
}
|
||||
});
|
||||
return;
|
||||
} catch( err ) {
|
||||
// IE8 is a dope about Object.defineProperty, can't warn there
|
||||
}
|
||||
}
|
||||
|
||||
// Non-ES5 (or broken) browser; just set the property
|
||||
jQuery._definePropertyBroken = true;
|
||||
obj[ prop ] = value;
|
||||
}
|
||||
|
||||
if ( document.compatMode === "BackCompat" ) {
|
||||
// jQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
|
||||
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
|
||||
oldAttr = jQuery.attr,
|
||||
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
||||
function() { return null; },
|
||||
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
||||
function() { return undefined; },
|
||||
rnoType = /^(?:input|button)$/i,
|
||||
rnoAttrNodeType = /^[238]$/,
|
||||
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
||||
ruseDefault = /^(?:checked|selected)$/i;
|
||||
|
||||
// jQuery.attrFn
|
||||
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
|
||||
|
||||
jQuery.attr = function( elem, name, value, pass ) {
|
||||
var lowerName = name.toLowerCase(),
|
||||
nType = elem && elem.nodeType;
|
||||
|
||||
if ( pass ) {
|
||||
// Since pass is used internally, we only warn for new jQuery
|
||||
// versions where there isn't a pass arg in the formal params
|
||||
if ( oldAttr.length < 4 ) {
|
||||
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
||||
}
|
||||
if ( elem && !rnoAttrNodeType.test( nType ) &&
|
||||
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
|
||||
return jQuery( elem )[ name ]( value );
|
||||
}
|
||||
}
|
||||
|
||||
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
|
||||
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
|
||||
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
|
||||
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
||||
}
|
||||
|
||||
// Restore boolHook for boolean property/attribute synchronization
|
||||
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
||||
jQuery.attrHooks[ lowerName ] = {
|
||||
get: function( elem, name ) {
|
||||
// Align boolean attributes with corresponding properties
|
||||
// Fall back to attribute presence where some booleans are not supported
|
||||
var attrNode,
|
||||
property = jQuery.prop( elem, name );
|
||||
return property === true || typeof property !== "boolean" &&
|
||||
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
||||
|
||||
name.toLowerCase() :
|
||||
undefined;
|
||||
},
|
||||
set: function( elem, value, name ) {
|
||||
var propName;
|
||||
if ( value === false ) {
|
||||
// Remove boolean attributes when set to false
|
||||
jQuery.removeAttr( elem, name );
|
||||
} else {
|
||||
// value is true since we know at this point it's type boolean and not false
|
||||
// Set boolean attributes to the same name and set the DOM property
|
||||
propName = jQuery.propFix[ name ] || name;
|
||||
if ( propName in elem ) {
|
||||
// Only set the IDL specifically if it already exists on the element
|
||||
elem[ propName ] = true;
|
||||
}
|
||||
|
||||
elem.setAttribute( name, name.toLowerCase() );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
// Warn only for attributes that can remain distinct from their properties post-1.9
|
||||
if ( ruseDefault.test( lowerName ) ) {
|
||||
migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
|
||||
}
|
||||
}
|
||||
|
||||
return oldAttr.call( jQuery, elem, name, value );
|
||||
};
|
||||
|
||||
// attrHooks: value
|
||||
jQuery.attrHooks.value = {
|
||||
get: function( elem, name ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrGet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
|
||||
}
|
||||
return name in elem ?
|
||||
elem.value :
|
||||
null;
|
||||
},
|
||||
set: function( elem, value ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrSet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
|
||||
}
|
||||
// Does not return so that setAttribute is also used
|
||||
elem.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var matched, browser,
|
||||
oldInit = jQuery.fn.init,
|
||||
oldParseJSON = jQuery.parseJSON,
|
||||
// Note: XSS check is done below after string is trimmed
|
||||
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
|
||||
|
||||
// $(html) "looks like html" rule change
|
||||
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
||||
var match;
|
||||
|
||||
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
||||
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
|
||||
// This is an HTML string according to the "old" rules; is it still?
|
||||
if ( selector.charAt( 0 ) !== "<" ) {
|
||||
migrateWarn("$(html) HTML strings must start with '<' character");
|
||||
}
|
||||
if ( match[ 3 ] ) {
|
||||
migrateWarn("$(html) HTML text after last tag is ignored");
|
||||
}
|
||||
// Consistently reject any HTML-like string starting with a hash (#9521)
|
||||
// Note that this may break jQuery 1.6.x code that otherwise would work.
|
||||
if ( match[ 0 ].charAt( 0 ) === "#" ) {
|
||||
migrateWarn("HTML string cannot start with a '#' character");
|
||||
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
|
||||
}
|
||||
// Now process using loose rules; let pre-1.8 play too
|
||||
if ( context && context.context ) {
|
||||
// jQuery object as context; parseHTML expects a DOM object
|
||||
context = context.context;
|
||||
}
|
||||
if ( jQuery.parseHTML ) {
|
||||
return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ),
|
||||
context, rootjQuery );
|
||||
}
|
||||
}
|
||||
return oldInit.apply( this, arguments );
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
// Let $.parseJSON(falsy_value) return null
|
||||
jQuery.parseJSON = function( json ) {
|
||||
if ( !json && json !== null ) {
|
||||
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
||||
return null;
|
||||
}
|
||||
return oldParseJSON.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.uaMatch = function( ua ) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
|
||||
// Don't clobber any existing jQuery.browser in case it's different
|
||||
if ( !jQuery.browser ) {
|
||||
matched = jQuery.uaMatch( navigator.userAgent );
|
||||
browser = {};
|
||||
|
||||
if ( matched.browser ) {
|
||||
browser[ matched.browser ] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
|
||||
// Chrome is Webkit, but Webkit is also Safari.
|
||||
if ( browser.chrome ) {
|
||||
browser.webkit = true;
|
||||
} else if ( browser.webkit ) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
jQuery.browser = browser;
|
||||
}
|
||||
|
||||
// Warn if the code tries to get jQuery.browser
|
||||
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
|
||||
|
||||
jQuery.sub = function() {
|
||||
function jQuerySub( selector, context ) {
|
||||
return new jQuerySub.fn.init( selector, context );
|
||||
}
|
||||
jQuery.extend( true, jQuerySub, this );
|
||||
jQuerySub.superclass = this;
|
||||
jQuerySub.fn = jQuerySub.prototype = this();
|
||||
jQuerySub.fn.constructor = jQuerySub;
|
||||
jQuerySub.sub = this.sub;
|
||||
jQuerySub.fn.init = function init( selector, context ) {
|
||||
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
||||
context = jQuerySub( context );
|
||||
}
|
||||
|
||||
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
||||
};
|
||||
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
||||
var rootjQuerySub = jQuerySub(document);
|
||||
migrateWarn( "jQuery.sub() is deprecated" );
|
||||
return jQuerySub;
|
||||
};
|
||||
|
||||
|
||||
// Ensure that $.ajax gets the new parseJSON defined in core.js
|
||||
jQuery.ajaxSetup({
|
||||
converters: {
|
||||
"text json": jQuery.parseJSON
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var oldFnData = jQuery.fn.data;
|
||||
|
||||
jQuery.fn.data = function( name ) {
|
||||
var ret, evt,
|
||||
elem = this[0];
|
||||
|
||||
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
||||
if ( elem && name === "events" && arguments.length === 1 ) {
|
||||
ret = jQuery.data( elem, name );
|
||||
evt = jQuery._data( elem, name );
|
||||
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
||||
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
||||
return evt;
|
||||
}
|
||||
}
|
||||
return oldFnData.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var rscriptType = /\/(java|ecma)script/i,
|
||||
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
||||
if ( !jQuery.clean ) {
|
||||
jQuery.clean = function( elems, context, fragment, scripts ) {
|
||||
// Set context per 1.8 logic
|
||||
context = context || document;
|
||||
context = !context.nodeType && context[0] || context;
|
||||
context = context.ownerDocument || context;
|
||||
|
||||
migrateWarn("jQuery.clean() is deprecated");
|
||||
|
||||
var i, elem, handleScript, jsTags,
|
||||
ret = [];
|
||||
|
||||
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
||||
|
||||
// Complex logic lifted directly from jQuery 1.8
|
||||
if ( fragment ) {
|
||||
// Special handling of each script element
|
||||
handleScript = function( elem ) {
|
||||
// Check if we consider it executable
|
||||
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
||||
// Detach the script and store it in the scripts array (if provided) or the fragment
|
||||
// Return truthy to indicate that it has been handled
|
||||
return scripts ?
|
||||
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
||||
fragment.appendChild( elem );
|
||||
}
|
||||
};
|
||||
|
||||
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
||||
// Check if we're done after handling an executable script
|
||||
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
||||
// Append to fragment and handle embedded scripts
|
||||
fragment.appendChild( elem );
|
||||
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
||||
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
||||
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
||||
|
||||
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
||||
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
||||
i += jsTags.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
var eventAdd = jQuery.event.add,
|
||||
eventRemove = jQuery.event.remove,
|
||||
eventTrigger = jQuery.event.trigger,
|
||||
oldToggle = jQuery.fn.toggle,
|
||||
oldLive = jQuery.fn.live,
|
||||
oldDie = jQuery.fn.die,
|
||||
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
||||
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
||||
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
||||
hoverHack = function( events ) {
|
||||
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
|
||||
return events;
|
||||
}
|
||||
if ( rhoverHack.test( events ) ) {
|
||||
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
||||
}
|
||||
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
||||
};
|
||||
|
||||
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
||||
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
||||
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
||||
}
|
||||
|
||||
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
||||
if ( jQuery.event.dispatch ) {
|
||||
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Support for 'hover' pseudo-event and ajax event warnings
|
||||
jQuery.event.add = function( elem, types, handler, data, selector ){
|
||||
if ( elem !== document && rajaxEvent.test( types ) ) {
|
||||
migrateWarn( "AJAX events should be attached to document: " + types );
|
||||
}
|
||||
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
||||
};
|
||||
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
||||
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
||||
};
|
||||
|
||||
jQuery.fn.error = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0);
|
||||
migrateWarn("jQuery.fn.error() is deprecated");
|
||||
args.splice( 0, 0, "error" );
|
||||
if ( arguments.length ) {
|
||||
return this.bind.apply( this, args );
|
||||
}
|
||||
// error event should not bubble to window, although it does pre-1.7
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.fn.toggle = function( fn, fn2 ) {
|
||||
|
||||
// Don't mess with animation or css toggles
|
||||
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
||||
return oldToggle.apply( this, arguments );
|
||||
}
|
||||
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
||||
|
||||
// Save reference to arguments for access in closure
|
||||
var args = arguments,
|
||||
guid = fn.guid || jQuery.guid++,
|
||||
i = 0,
|
||||
toggler = function( event ) {
|
||||
// Figure out which function to execute
|
||||
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
||||
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
||||
|
||||
// Make sure that clicks stop
|
||||
event.preventDefault();
|
||||
|
||||
// and execute the function
|
||||
return args[ lastToggle ].apply( this, arguments ) || false;
|
||||
};
|
||||
|
||||
// link all the functions, so any of them can unbind this click handler
|
||||
toggler.guid = guid;
|
||||
while ( i < args.length ) {
|
||||
args[ i++ ].guid = guid;
|
||||
}
|
||||
|
||||
return this.click( toggler );
|
||||
};
|
||||
|
||||
jQuery.fn.live = function( types, data, fn ) {
|
||||
migrateWarn("jQuery.fn.live() is deprecated");
|
||||
if ( oldLive ) {
|
||||
return oldLive.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).on( types, this.selector, data, fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.fn.die = function( types, fn ) {
|
||||
migrateWarn("jQuery.fn.die() is deprecated");
|
||||
if ( oldDie ) {
|
||||
return oldDie.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).off( types, this.selector || "**", fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
// Turn global events into document-triggered events
|
||||
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
||||
if ( !elem && !rajaxEvent.test( event ) ) {
|
||||
migrateWarn( "Global events are undocumented and deprecated" );
|
||||
}
|
||||
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
||||
};
|
||||
jQuery.each( ajaxEvents.split("|"),
|
||||
function( _, name ) {
|
||||
jQuery.event.special[ name ] = {
|
||||
setup: function() {
|
||||
var elem = this;
|
||||
|
||||
// The document needs no shimming; must be !== for oldIE
|
||||
if ( elem !== document ) {
|
||||
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
||||
jQuery.event.trigger( name, null, elem, true );
|
||||
});
|
||||
jQuery._data( this, name, jQuery.guid++ );
|
||||
}
|
||||
return false;
|
||||
},
|
||||
teardown: function() {
|
||||
if ( this !== document ) {
|
||||
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
})( jQuery, window );
|
||||
|
|
@ -1,14 +1,17 @@
|
|||
var CloudCmd, Util, DOM, JsDiff, ace;
|
||||
(function(CloudCmd, Util, DOM){
|
||||
var CloudCmd, Util, DOM, CloudFunc, JsDiff, ace;
|
||||
(function(CloudCmd, Util, DOM, CloudFunc){
|
||||
'use strict';
|
||||
|
||||
CloudCmd.Edit = new EditProto(CloudCmd, Util, DOM);
|
||||
CloudCmd.Edit = new EditProto(CloudCmd, Util, DOM, CloudFunc);
|
||||
|
||||
function EditProto(CloudCmd, Util, DOM){
|
||||
function EditProto(CloudCmd, Util, DOM, CloudFunc){
|
||||
var Name = 'Edit',
|
||||
Loading = false,
|
||||
DIR = CloudCmd.LIBDIRCLIENT + 'edit/',
|
||||
Value,
|
||||
Edit = this,
|
||||
Ace,
|
||||
Msg,
|
||||
Key = CloudCmd.Key,
|
||||
Images = DOM.Images,
|
||||
|
||||
|
|
@ -17,6 +20,7 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
this.init = function(pCallBack) {
|
||||
var lFunc, lIsFunc = Util.isFunction(CloudCmd.View);
|
||||
|
||||
Loading = true;
|
||||
if (lIsFunc)
|
||||
lFunc = CloudCmd.View;
|
||||
else
|
||||
|
|
@ -35,72 +39,49 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
};
|
||||
|
||||
this.show = function(pValue) {
|
||||
var lMode, lSession;
|
||||
var lName = DOM.getCurrentName(),
|
||||
lExt = Util.getExtension(lName),
|
||||
lUseWorker = Util.strCmp(lExt, ['.js', '.json']);
|
||||
|
||||
Images.showLoad();
|
||||
|
||||
if (!Element) {
|
||||
Element = DOM.anyload({
|
||||
name : 'div',
|
||||
className : 'edit',
|
||||
style :
|
||||
'width : 100%;' +
|
||||
'height : 100%;' +
|
||||
'font : 16px "Droid Sans Mono";' +
|
||||
'position: absolute;',
|
||||
not_append : true
|
||||
});
|
||||
if (!Loading) {
|
||||
Images.showLoad();
|
||||
|
||||
Ace = ace.edit(Element);
|
||||
lSession = Ace.getSession();
|
||||
if (!Element) {
|
||||
Element = DOM.anyload({
|
||||
name : 'div',
|
||||
className : 'edit',
|
||||
style :
|
||||
'width : 100%;' +
|
||||
'height : 100%;' +
|
||||
'font : 16px "Droid Sans Mono";' +
|
||||
'position: absolute;',
|
||||
not_append : true
|
||||
});
|
||||
|
||||
initAce();
|
||||
}
|
||||
|
||||
Ace.setTheme('ace/theme/tomorrow_night_blue');
|
||||
lSession.setMode('ace/mode/javascript');
|
||||
Ace.setShowPrintMargin(false);
|
||||
Ace.setShowInvisibles(true);
|
||||
lSession.setUseSoftTabs(true);
|
||||
Ace.session.setOption('useWorker', lUseWorker);
|
||||
|
||||
Ace.commands.addCommand({
|
||||
name : 'hide',
|
||||
bindKey : { win: 'Esc', mac: 'Esc' },
|
||||
exec : function () {
|
||||
Edit.hide();
|
||||
}
|
||||
});
|
||||
|
||||
Ace.commands.addCommand({
|
||||
name : 'save',
|
||||
bindKey : { win: 'Ctrl-S', mac: 'Command-S' },
|
||||
exec : function (pEditor) {
|
||||
var lPath = DOM.getCurrentPath(),
|
||||
lValue = Ace.getValue();
|
||||
|
||||
if ( Util.strCmp(Value, lValue) )
|
||||
Util.log('edit: nothing to save');
|
||||
else
|
||||
DOM.RESTfull.save(lPath, lValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ( Util.isString(pValue) ) {
|
||||
Ace.setValue(pValue);
|
||||
CloudCmd.View.show(Element, focus);
|
||||
Key.unsetBind();
|
||||
}
|
||||
else {
|
||||
DOM.getCurrentData({
|
||||
success : function(pData){
|
||||
var lValue = '';
|
||||
|
||||
if (pData)
|
||||
lValue = pData.data;
|
||||
|
||||
Value = lValue;
|
||||
Ace.setValue(lValue);
|
||||
CloudCmd.View.show(Element, focus);
|
||||
}
|
||||
});
|
||||
if ( Util.isString(pValue) ) {
|
||||
Ace.setValue(pValue);
|
||||
CloudCmd.View.show(Element, focus);
|
||||
Key.unsetBind();
|
||||
}
|
||||
else {
|
||||
DOM.getCurrentData({
|
||||
success : function(pData){
|
||||
var lValue = '';
|
||||
|
||||
if (pData)
|
||||
lValue = pData.data;
|
||||
|
||||
Value = lValue;
|
||||
Ace.setValue(lValue);
|
||||
CloudCmd.View.show(Element, focus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -114,20 +95,49 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
Ace.moveCursorTo(0, 0);
|
||||
}
|
||||
|
||||
function initAce() {
|
||||
var lSession;
|
||||
|
||||
Ace = ace.edit(Element);
|
||||
lSession = Ace.getSession();
|
||||
|
||||
Ace.setTheme('ace/theme/tomorrow_night_blue');
|
||||
lSession.setMode('ace/mode/javascript');
|
||||
Ace.setShowPrintMargin(false);
|
||||
Ace.setShowInvisibles(true);
|
||||
lSession.setUseSoftTabs(true);
|
||||
|
||||
Ace.commands.addCommand({
|
||||
name : 'hide',
|
||||
bindKey : { win: 'Esc', mac: 'Esc' },
|
||||
exec : function () {
|
||||
Edit.hide();
|
||||
}
|
||||
});
|
||||
|
||||
Ace.commands.addCommand({
|
||||
name : 'save',
|
||||
bindKey : { win: 'Ctrl-S', mac: 'Command-S' },
|
||||
exec : function (pEditor) {
|
||||
var lPath = DOM.getCurrentPath(),
|
||||
lValue = Ace.getValue();
|
||||
|
||||
DOM.RESTfull.save(lPath, lValue, Edit.showMessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function load(pCallBack){
|
||||
Util.time(Name + ' load');
|
||||
|
||||
var lDir = CloudCmd.LIBDIRCLIENT + 'edit/',
|
||||
|
||||
lFiles = [
|
||||
lDir + 'mode-javascript.js',
|
||||
lDir + 'worker-javascript.js',
|
||||
lDir + 'ace.js',
|
||||
var lFiles = [
|
||||
DIR + 'theme-tomorrow_night_blue.js',
|
||||
DIR + 'ace.js',
|
||||
];
|
||||
|
||||
DOM.anyLoadOnLoad(lFiles, function(){
|
||||
Util.timeEnd(Name + ' load');
|
||||
|
||||
Loading = false;
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
}
|
||||
|
|
@ -143,6 +153,39 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
Edit.show();
|
||||
}
|
||||
}
|
||||
|
||||
this.showMessage = function(text) {
|
||||
var parent,
|
||||
TWO_SECONDS = 2000;
|
||||
|
||||
if (!Msg) {
|
||||
DOM.cssSet({
|
||||
id : 'msg-css',
|
||||
inner : '.msg {' +
|
||||
'z-index' + ': 1;' +
|
||||
'background-color' + ': #7285B7;' +
|
||||
'color' + ': #D1F1A9;' +
|
||||
'position' + ': fixed;' +
|
||||
'left' + ': 40%;' +
|
||||
'top' + ': 25px;' +
|
||||
'padding' + ': 5px;' +
|
||||
'opacity' + ': 0.9;' +
|
||||
'transition' + ': ease 0.5s;' +
|
||||
'}'
|
||||
});
|
||||
parent = Element;
|
||||
|
||||
Msg = DOM.anyload({
|
||||
name : 'div',
|
||||
className : 'msg',
|
||||
parent : parent
|
||||
});
|
||||
}
|
||||
|
||||
Msg.innerHTML = text;
|
||||
DOM.show(Msg);
|
||||
setTimeout(Util.retExec(DOM.hide, Msg), 2000);
|
||||
};
|
||||
}
|
||||
|
||||
})(CloudCmd, Util, DOM);
|
||||
})(CloudCmd, Util, DOM, CloudFunc);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/ext/searchbox', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/event', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) {
|
||||
ace.define('ace/ext/searchbox', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/event', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) {
|
||||
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
|
|
@ -198,7 +198,7 @@ var html = '<div class="ace_search right">\
|
|||
</div>\
|
||||
<div class="ace_replace_form">\
|
||||
<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
|
||||
<button type="button" action="replace" class="ace_replacebtn">Replace</button>\
|
||||
<button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\
|
||||
<button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
|
||||
</div>\
|
||||
<div class="ace_search_options">\
|
||||
|
|
@ -244,7 +244,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
|||
event.stopPropagation(e);
|
||||
});
|
||||
event.addListener(sb, "click", function(e) {
|
||||
var t = e.target;
|
||||
var t = e.target || e.srcElement;
|
||||
var action = t.getAttribute("action");
|
||||
if (action && _this[action])
|
||||
_this[action]();
|
||||
|
|
@ -369,10 +369,18 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
|||
this.find(true, true);
|
||||
};
|
||||
this.replace = function() {
|
||||
this.editor.replace(this.replaceInput.value);
|
||||
if (!this.editor.getReadOnly())
|
||||
this.editor.replace(this.replaceInput.value);
|
||||
};
|
||||
this.replaceAndFindNext = function() {
|
||||
if (!this.editor.getReadOnly()) {
|
||||
this.editor.replace(this.replaceInput.value);
|
||||
this.findNext()
|
||||
}
|
||||
};
|
||||
this.replaceAll = function() {
|
||||
this.editor.replaceAll(this.replaceInput.value);
|
||||
if (!this.editor.getReadOnly())
|
||||
this.editor.replaceAll(this.replaceInput.value);
|
||||
};
|
||||
|
||||
this.hide = function() {
|
||||
|
|
@ -403,45 +411,4 @@ exports.Search = function(editor, isReplace) {
|
|||
sb.show(editor.session.getTextRange(), isReplace);
|
||||
};
|
||||
|
||||
|
||||
exports.ISearch = function(session, options) {
|
||||
this.$changeListener = this.$changeListener.bind(this);
|
||||
this.startRange = session.selection.toOrientedRange();
|
||||
this.options = options || {};
|
||||
};
|
||||
|
||||
(function(){
|
||||
this.setSession = function(session) {
|
||||
if (this.session) {
|
||||
this.session.removeListener(this.$changeListener);
|
||||
}
|
||||
this.session = session;
|
||||
this.session.addListener(this.$changeListener);
|
||||
};
|
||||
this.setSearchString = function() {
|
||||
|
||||
};
|
||||
this.getValue = function() {
|
||||
if (this.value == null)
|
||||
this.value = this.session.getValue();
|
||||
return this.value;
|
||||
};
|
||||
this.$changeListener = function() {
|
||||
this.value = null;
|
||||
};
|
||||
this.find = function() {
|
||||
|
||||
};
|
||||
this.$edgeBefore = function() {
|
||||
this.cursor = this.startRange[this.options.backwards ? "start" : "end"];
|
||||
};
|
||||
this.$edgeAfter = function() {
|
||||
|
||||
};
|
||||
this.next = function(dir) {
|
||||
|
||||
};
|
||||
}).call(exports.ISearch.prototype);
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||
ace.define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
|
|
@ -42,9 +42,12 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
|||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
|
||||
var highlighter = new JavaScriptHighlightRules();
|
||||
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
this.$keywordList = highlighter.$keywordList;
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
|
@ -114,7 +117,7 @@ oop.inherits(Mode, TextMode);
|
|||
exports.Mode = Mode;
|
||||
});
|
||||
|
||||
define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
ace.define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
|
|
@ -163,7 +166,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"no_regex" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
regex : "\\/\\/",
|
||||
next : "line_comment"
|
||||
},
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
|
|
@ -238,7 +242,7 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "start"
|
||||
}, {
|
||||
token : ["punctuation.operator", "support.function"],
|
||||
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||
}, {
|
||||
token : ["punctuation.operator", "support.function.dom"],
|
||||
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||
|
|
@ -283,8 +287,8 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment_regex_allowed"
|
||||
}, {
|
||||
token : "comment",
|
||||
regex : "\\/\\/.*$",
|
||||
next : "start"
|
||||
regex : "\\/\\/",
|
||||
next : "line_comment_regex_allowed"
|
||||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "\\/",
|
||||
|
|
@ -371,6 +375,14 @@ var JavaScriptHighlightRules = function() {
|
|||
{token : "comment", regex : "\\*\\/", next : "no_regex"},
|
||||
{defaultToken : "comment"}
|
||||
],
|
||||
"line_comment_regex_allowed" : [
|
||||
{token : "comment", regex : "$|^", next : "start"},
|
||||
{defaultToken : "comment"}
|
||||
],
|
||||
"line_comment" : [
|
||||
{token : "comment", regex : "$|^", next : "no_regex"},
|
||||
{defaultToken : "comment"}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "constant.language.escape",
|
||||
|
|
@ -414,7 +426,7 @@ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
|||
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
|
||||
});
|
||||
|
||||
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
|
|
@ -458,7 +470,7 @@ exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
|||
|
||||
});
|
||||
|
||||
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||
|
||||
|
||||
var Range = require("../range").Range;
|
||||
|
|
@ -498,7 +510,7 @@ var MatchingBraceOutdent = function() {};
|
|||
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||
});
|
||||
|
||||
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||||
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
|
|
@ -821,7 +833,7 @@ oop.inherits(CstyleBehaviour, Behaviour);
|
|||
exports.CstyleBehaviour = CstyleBehaviour;
|
||||
});
|
||||
|
||||
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
|
|
@ -873,4 +885,4 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
2
lib/client/edit/package.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
package 07.31.2013
|
||||
https://github.com/ajaxorg/ace-builds/tree/995de31e6513ddfd5e9f66b8216f5b316fcd2253
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/theme/tomorrow_night_blue', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
|
||||
ace.define('ace/theme/tomorrow_night_blue', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
|
||||
|
||||
exports.isDark = true;
|
||||
exports.cssClass = "ace-tomorrow-night-blue";
|
||||
|
|
@ -119,7 +119,7 @@ color: #BBDAFF\
|
|||
.ace-tomorrow-night-blue .ace_support.ace_type {\
|
||||
color: #FFEEAD\
|
||||
}\
|
||||
.ace-tomorrow-night-blue .ace_markup.ace_heading,\
|
||||
.ace-tomorrow-night-blue .ace_heading,\
|
||||
.ace-tomorrow-night-blue .ace_string {\
|
||||
color: #D1F1A9\
|
||||
}\
|
||||
|
|
@ -133,13 +133,10 @@ color: #FF9DA4\
|
|||
.ace-tomorrow-night-blue .ace_comment {\
|
||||
color: #7285B7\
|
||||
}\
|
||||
.ace-tomorrow-night-blue .ace_markup.ace_underline {\
|
||||
text-decoration: underline\
|
||||
}\
|
||||
.ace-tomorrow-night-blue .ace_indent-guide {\
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYJDzqfwPAANXAeNsiA+ZAAAAAElFTkSuQmCC) right repeat-y;\
|
||||
}";
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
dom.importCssString(exports.cssText, exports.cssClass);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
var CloudCmd, Util, DOM;
|
||||
(function(CloudCmd, Util, DOM){
|
||||
(function(CloudCmd, Util, DOM) {
|
||||
'use strict';
|
||||
|
||||
var KEY = {
|
||||
|
|
@ -46,7 +46,7 @@ var CloudCmd, Util, DOM;
|
|||
KeyProto.prototype = KEY;
|
||||
CloudCmd.Key = new KeyProto(CloudCmd, Util, DOM);
|
||||
|
||||
function KeyProto(CloudCmd, Util, DOM){
|
||||
function KeyProto(CloudCmd, Util, DOM) {
|
||||
var Key = this,
|
||||
Binded,
|
||||
lTabPanel = {
|
||||
|
|
@ -55,20 +55,20 @@ var CloudCmd, Util, DOM;
|
|||
|
||||
};
|
||||
|
||||
this.isBind = function(){return Binded;};
|
||||
this.isBind = function() {return Binded;};
|
||||
|
||||
this.setBind = function(){Binded = true;};
|
||||
this.setBind = function() {Binded = true;};
|
||||
|
||||
this.unsetBind = function(){Binded = false;};
|
||||
this.unsetBind = function() {Binded = false;};
|
||||
|
||||
this.bind = function(){
|
||||
this.bind = function() {
|
||||
DOM.Events.addKey(listener);
|
||||
|
||||
/* клавиши назначены*/
|
||||
Binded = true;
|
||||
};
|
||||
|
||||
function listener(pEvent){
|
||||
function listener(pEvent) {
|
||||
/* получаем выдленный файл*/
|
||||
var i, n, lCurrent = DOM.getCurrentFile(),
|
||||
lKeyCode = pEvent.keyCode,
|
||||
|
|
@ -76,255 +76,250 @@ var CloudCmd, Util, DOM;
|
|||
lAlt = pEvent.altKey,
|
||||
lCtrl = pEvent.ctrlKey;
|
||||
/* если клавиши можно обрабатывать*/
|
||||
if(Binded){
|
||||
switch(lKeyCode){
|
||||
case Key.TAB:
|
||||
/* changing parent panel of curent-file */
|
||||
var lPanel = DOM.getPanel(),
|
||||
lId = lPanel.id;
|
||||
|
||||
lTabPanel[lId] = lCurrent;
|
||||
|
||||
lPanel = DOM.getPanel({active:false});
|
||||
if (Binded) {
|
||||
switch (lKeyCode) {
|
||||
case Key.TAB:
|
||||
/* changing parent panel of curent-file */
|
||||
var lPanel = DOM.getPanel(),
|
||||
lId = lPanel.id;
|
||||
|
||||
if(lTabPanel[lId])
|
||||
DOM.setCurrentFile(lTabPanel[lId]);
|
||||
else{
|
||||
var lFirstFileOnList = DOM.getByTag('li', lPanel)[2];
|
||||
|
||||
DOM.setCurrentFile(lFirstFileOnList);
|
||||
}
|
||||
|
||||
DOM.preventDefault(pEvent);//запрет на дальнейшее действие
|
||||
break;
|
||||
|
||||
case Key.INSERT:
|
||||
DOM.setSelectedFile( lCurrent );
|
||||
DOM.setCurrentFile( lCurrent.nextSibling );
|
||||
break;
|
||||
lTabPanel[lId] = lCurrent;
|
||||
|
||||
case Key.DELETE:
|
||||
if(lShift){
|
||||
var lUrl = DOM.getCurrentPath(lCurrent);
|
||||
lPanel = DOM.getPanel({active:false});
|
||||
lId = lPanel.id;
|
||||
|
||||
if (lTabPanel[lId])
|
||||
DOM.setCurrentFile(lTabPanel[lId]);
|
||||
else{
|
||||
var lFirstFileOnList = DOM.getByTag('li', lPanel)[2];
|
||||
|
||||
if( DOM.isCurrentIsDir(lCurrent) )
|
||||
lUrl += '?dir';
|
||||
|
||||
DOM.RESTfull.delete(lUrl, function(){
|
||||
DOM.deleteCurrent(lCurrent);
|
||||
});
|
||||
}
|
||||
else
|
||||
DOM.promptDeleteSelected(lCurrent);
|
||||
break;
|
||||
DOM.setCurrentFile(lFirstFileOnList);
|
||||
}
|
||||
|
||||
case Key.F1:
|
||||
Util.exec(CloudCmd.Help);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.F2:
|
||||
DOM.renameCurrent(lCurrent);
|
||||
break;
|
||||
DOM.preventDefault(pEvent);//запрет на дальнейшее действие
|
||||
break;
|
||||
|
||||
case Key.INSERT:
|
||||
DOM .toggleSelectedFile(lCurrent)
|
||||
.setCurrentFile(lCurrent.nextSibling);
|
||||
break;
|
||||
|
||||
case Key.DELETE:
|
||||
if (lShift) {
|
||||
var lUrl = DOM.getCurrentPath(lCurrent);
|
||||
|
||||
case Key.F3:
|
||||
Util.exec(CloudCmd.View);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.F4:
|
||||
Util.exec(CloudCmd.Edit);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.F5:
|
||||
DOM.copyCurrent(lCurrent);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.F6:
|
||||
DOM.moveCurrent(lCurrent);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.F7:
|
||||
DOM.promptNewDir();
|
||||
break;
|
||||
|
||||
case Key.F8:
|
||||
DOM.promptDeleteSelected(lCurrent);
|
||||
break;
|
||||
|
||||
case Key.F:
|
||||
DOM.promptDeleteCurrent(lCurrent);
|
||||
break;
|
||||
|
||||
case Key.F9:
|
||||
Util.exec(CloudCmd.Menu);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.TRA:
|
||||
DOM.Images.showLoad({top: true});
|
||||
Util.exec(CloudCmd.Console);
|
||||
break;
|
||||
if ( DOM.isCurrentIsDir(lCurrent) )
|
||||
lUrl += '?dir';
|
||||
|
||||
case Key.SPACE:
|
||||
var lSelected = DOM.isSelected(lCurrent),
|
||||
lDir = DOM.isCurrentIsDir(lCurrent),
|
||||
lName = DOM.getCurrentName(lCurrent);
|
||||
|
||||
if(!lDir || lName === '..')
|
||||
lSelected = true;
|
||||
|
||||
Util.ifExec(lSelected, function(){
|
||||
DOM.setSelectedFile(lCurrent);
|
||||
}, function(pCallBack){
|
||||
DOM.loadCurrentSize(pCallBack, lCurrent);
|
||||
DOM.RESTfull.delete(lUrl, function() {
|
||||
DOM.deleteCurrent(lCurrent);
|
||||
});
|
||||
|
||||
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
/* навигация по таблице файлов *
|
||||
* если нажали клавишу вверх *
|
||||
* выделяем предыдущую строку */
|
||||
case Key.UP:
|
||||
if(lShift)
|
||||
DOM.setSelectedFile(lCurrent);
|
||||
|
||||
DOM.setCurrentFile( lCurrent.previousSibling );
|
||||
DOM.preventDefault( pEvent );
|
||||
break;
|
||||
|
||||
/* если нажали клавишу в низ *
|
||||
* выделяем следующую строку */
|
||||
case Key.DOWN:
|
||||
if(lShift)
|
||||
DOM.setSelectedFile(lCurrent);
|
||||
|
||||
DOM.setCurrentFile( lCurrent.nextSibling );
|
||||
DOM.preventDefault( pEvent );
|
||||
break;
|
||||
|
||||
/* если нажали клавишу Home *
|
||||
* переходим к самому верхнему *
|
||||
* элементу */
|
||||
case Key.HOME:
|
||||
DOM.setCurrentFile( lCurrent.parentElement.firstChild );
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
/* если нажали клавишу End
|
||||
* выделяем последний элемент */
|
||||
case Key.END:
|
||||
DOM.setCurrentFile( lCurrent.parentElement.lastElementChild );
|
||||
DOM.preventDefault( pEvent );
|
||||
break;
|
||||
|
||||
/* если нажали клавишу page down
|
||||
* проматываем экран */
|
||||
case Key.PAGE_DOWN:
|
||||
DOM.scrollByPages( DOM.getPanel(), 1 );
|
||||
|
||||
for(i=0; i<30; i++){
|
||||
if(!lCurrent.nextSibling) break;
|
||||
|
||||
lCurrent = lCurrent.nextSibling;
|
||||
}
|
||||
DOM.setCurrentFile(lCurrent);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
/* если нажали клавишу page up проматываем экран */
|
||||
case Key.PAGE_UP:
|
||||
DOM.scrollByPages( DOM.getPanel(), -1 );
|
||||
|
||||
var lC = lCurrent,
|
||||
tryCatch = function(pCurrentFile){
|
||||
Util.tryCatch(function(){
|
||||
return pCurrentFile
|
||||
.previousSibling
|
||||
.previousSibling
|
||||
.previousSibling
|
||||
.previousSibling;
|
||||
});
|
||||
};
|
||||
|
||||
for(i = 0; i < 30; i++){
|
||||
if(!lC.previousSibling || tryCatch(lC) ) break;
|
||||
|
||||
lC = lC.previousSibling;
|
||||
}
|
||||
DOM.setCurrentFile(lC);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
/* открываем папку*/
|
||||
case Key.ENTER:
|
||||
if( DOM.isCurrentIsDir() )
|
||||
Util.exec( CloudCmd.loadDir() );
|
||||
break;
|
||||
|
||||
case Key.A:
|
||||
if(pEvent.ctrlKey){
|
||||
var lParent = lCurrent.parentElement,
|
||||
lNodes = lParent.childNodes;
|
||||
|
||||
/* not path and fm_header */
|
||||
for(i = 2, n = lNodes.length; i < n; i++)
|
||||
DOM.setSelectedFile( lNodes[i] );
|
||||
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/*
|
||||
* обновляем страницу,
|
||||
* загружаем содержимое каталога
|
||||
* при этом данные берём всегда с
|
||||
* сервера, а не из кэша
|
||||
* (обновляем кэш)
|
||||
*/
|
||||
case Key.R:
|
||||
if(lCtrl){
|
||||
Util.log('<ctrl>+r pressed\n' +
|
||||
'reloading page...\n' +
|
||||
'press <alt>+q to remove all key-handlers');
|
||||
|
||||
CloudCmd.refresh();
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
}
|
||||
else
|
||||
DOM.promptDeleteSelected(lCurrent);
|
||||
break;
|
||||
|
||||
case Key.F1:
|
||||
Util.exec(CloudCmd.Help);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.F2:
|
||||
DOM.renameCurrent(lCurrent);
|
||||
break;
|
||||
|
||||
/* чистим кэш */
|
||||
case Key.D:
|
||||
if(lCtrl){
|
||||
Util.log('<ctrl>+d pressed\n' +
|
||||
'clearing cache...\n' +
|
||||
'press <alt>+q to remove all key-handlers');
|
||||
|
||||
DOM.Cache.clear();
|
||||
DOM.preventDefault();
|
||||
}
|
||||
break;
|
||||
case Key.F3:
|
||||
Util.exec(CloudCmd.View);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
/* убираем все обработчики
|
||||
* нажатий клавиш */
|
||||
case Key.Q:
|
||||
if(lAlt){
|
||||
Util.log('<alt>+q pressed\n' +
|
||||
'<ctrl>+r reload key-handerl - removed' +
|
||||
'<ctrl>+s clear cache key-handler - removed'+
|
||||
'press <alt>+s to to set them');
|
||||
|
||||
/* обработчик нажатий клавиш снят*/
|
||||
Binded = false;
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
case Key.F4:
|
||||
Util.exec(CloudCmd.Edit);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.F5:
|
||||
DOM.copyCurrent(lCurrent);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.F6:
|
||||
DOM.moveCurrent(lCurrent);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
case Key.F7:
|
||||
DOM.promptNewDir();
|
||||
break;
|
||||
|
||||
case Key.F8:
|
||||
DOM.promptDeleteSelected(lCurrent);
|
||||
break;
|
||||
|
||||
case Key.F9:
|
||||
Util.exec(CloudCmd.Menu);
|
||||
DOM.preventDefault(pEvent);
|
||||
|
||||
break;
|
||||
|
||||
case Key.TRA:
|
||||
DOM.Images.showLoad({top: true});
|
||||
Util.exec(CloudCmd.Console);
|
||||
|
||||
break;
|
||||
|
||||
case Key.SPACE:
|
||||
var lSelected = DOM.isSelected(lCurrent),
|
||||
lDir = DOM.isCurrentIsDir(lCurrent),
|
||||
lName = DOM.getCurrentName(lCurrent);
|
||||
|
||||
if (!lDir || lName === '..')
|
||||
lSelected = true;
|
||||
|
||||
Util.ifExec(lSelected, function() {
|
||||
DOM.toggleSelectedFile(lCurrent);
|
||||
}, function(pCallBack) {
|
||||
DOM.loadCurrentSize(pCallBack, lCurrent);
|
||||
});
|
||||
|
||||
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
/* навигация по таблице файлов *
|
||||
* если нажали клавишу вверх *
|
||||
* выделяем предыдущую строку */
|
||||
case Key.UP:
|
||||
if (lShift)
|
||||
DOM.toggleSelectedFile(lCurrent);
|
||||
|
||||
DOM.setCurrentFile( lCurrent.previousSibling );
|
||||
DOM.preventDefault( pEvent );
|
||||
break;
|
||||
|
||||
/* если нажали клавишу в низ - выделяем следующую строку */
|
||||
case Key.DOWN:
|
||||
if (lShift)
|
||||
DOM.toggleSelectedFile(lCurrent);
|
||||
|
||||
DOM.setCurrentFile( lCurrent.nextSibling );
|
||||
DOM.preventDefault( pEvent );
|
||||
break;
|
||||
|
||||
/* если нажали клавишу Home *
|
||||
* переходим к самому верхнему *
|
||||
* элементу */
|
||||
case Key.HOME:
|
||||
DOM.setCurrentFile( lCurrent.parentElement.firstChild );
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
/* если нажали клавишу End выделяем последний элемент */
|
||||
case Key.END:
|
||||
DOM.setCurrentFile( lCurrent.parentElement.lastElementChild );
|
||||
DOM.preventDefault( pEvent );
|
||||
break;
|
||||
|
||||
/* если нажали клавишу page down проматываем экран */
|
||||
case Key.PAGE_DOWN:
|
||||
DOM.scrollByPages( DOM.getPanel(), 1 );
|
||||
|
||||
for (i = 0; i < 30; i++) {
|
||||
|
||||
if (!lCurrent.nextSibling)
|
||||
break;
|
||||
|
||||
lCurrent = lCurrent.nextSibling;
|
||||
}
|
||||
DOM.setCurrentFile(lCurrent);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
/* если нажали клавишу page up проматываем экран */
|
||||
case Key.PAGE_UP:
|
||||
DOM.scrollByPages(DOM.getPanel(), -1);
|
||||
|
||||
var lC = lCurrent,
|
||||
tryCatch = function(pCurrentFile) {
|
||||
Util.tryCatch(function() {
|
||||
return pCurrentFile
|
||||
.previousSibling
|
||||
.previousSibling
|
||||
.previousSibling
|
||||
.previousSibling;
|
||||
});
|
||||
};
|
||||
|
||||
for (i = 0; i < 30; i++) {
|
||||
if (!lC.previousSibling || tryCatch(lC) ) break;
|
||||
|
||||
lC = lC.previousSibling;
|
||||
}
|
||||
|
||||
DOM.setCurrentFile(lC);
|
||||
DOM.preventDefault(pEvent);
|
||||
break;
|
||||
|
||||
/* открываем папку*/
|
||||
case Key.ENTER:
|
||||
if (DOM.isCurrentIsDir())
|
||||
Util.exec( CloudCmd.loadDir() );
|
||||
break;
|
||||
|
||||
case Key.A:
|
||||
if (pEvent.ctrlKey) {
|
||||
var lParent = lCurrent.parentElement,
|
||||
lNodes = lParent.childNodes;
|
||||
|
||||
/* not path and fm_header */
|
||||
for (i = 2, n = lNodes.length; i < n; i++)
|
||||
DOM.toggleSelectedFile( lNodes[i] );
|
||||
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
* обновляем страницу,
|
||||
* загружаем содержимое каталога
|
||||
* при этом данные берём всегда с
|
||||
* сервера, а не из кэша
|
||||
* (обновляем кэш)
|
||||
*/
|
||||
case Key.R:
|
||||
if (lCtrl) {
|
||||
Util.log('<ctrl>+r pressed\n' +
|
||||
'reloading page...\n' +
|
||||
'press <alt>+q to remove all key-handlers');
|
||||
|
||||
CloudCmd.refresh();
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
break;
|
||||
|
||||
/* чистим кэш */
|
||||
case Key.D:
|
||||
if (lCtrl) {
|
||||
Util.log('<ctrl>+d pressed\n' +
|
||||
'clearing cache...\n' +
|
||||
'press <alt>+q to remove all key-handlers');
|
||||
|
||||
DOM.Cache.clear();
|
||||
DOM.preventDefault();
|
||||
}
|
||||
break;
|
||||
|
||||
/* убираем все обработчики нажатий клавиш */
|
||||
case Key.Q:
|
||||
if (lAlt) {
|
||||
Util.log('<alt>+q pressed\n' +
|
||||
'<ctrl>+r reload key-handerl - removed' +
|
||||
'<ctrl>+s clear cache key-handler - removed'+
|
||||
'press <alt>+s to to set them');
|
||||
|
||||
Binded = false;
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -332,13 +327,14 @@ var CloudCmd, Util, DOM;
|
|||
/* устанавливаем все обработчики
|
||||
* нажатий клавиш
|
||||
*/
|
||||
else if(lKeyCode === Key.S && lAlt){
|
||||
else if (lKeyCode === Key.S && lAlt) {
|
||||
/* обрабатываем нажатия на клавиши*/
|
||||
Binded = true;
|
||||
Util.log('<alt>+s pressed\n' +
|
||||
'<ctrl>+r reload key-handerl - set\n' +
|
||||
'<ctrl>+s clear cache key-handler - set\n' +
|
||||
Util.log('<alt>+s pressed \n' +
|
||||
'<ctrl>+r reload key-handerl - set \n' +
|
||||
'<ctrl>+s clear cache key-handler - set \n' +
|
||||
'press <alt>+q to remove them');
|
||||
|
||||
DOM.preventDefault(pEvent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
291
lib/client/listeners.js
Normal file
|
|
@ -0,0 +1,291 @@
|
|||
var Util, DOM, CloudCmd;
|
||||
|
||||
(function (Util, DOM) {
|
||||
'use strict';
|
||||
|
||||
CloudCmd.Listeners = new ListenersProto(CloudCmd, Util, DOM);
|
||||
|
||||
function ListenersProto(CloudCmd, Util, DOM){
|
||||
var Cache = DOM.Cache,
|
||||
Events = DOM.Events,
|
||||
getConfig = CloudCmd.getConfig;
|
||||
|
||||
this.analytics = function() {
|
||||
getConfig(function(config) {
|
||||
if (config.analytics) {
|
||||
Events.addOneTime('mousemove', function(){
|
||||
var FIVE_SECONDS = 5000,
|
||||
lUrl = CloudCmd.LIBDIRCLIENT + 'analytics.js';
|
||||
|
||||
setTimeout(function(){
|
||||
DOM.jsload(lUrl);
|
||||
}, FIVE_SECONDS);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.init = function () {
|
||||
appCache();
|
||||
contextMenu();
|
||||
dragndrop();
|
||||
unload();
|
||||
pop();
|
||||
};
|
||||
|
||||
this.initKeysPanel = function() {
|
||||
var i, lButton, lEl,
|
||||
lKeysPanel = {},
|
||||
|
||||
lFuncs =[
|
||||
null,
|
||||
CloudCmd.Help, /* f1 */
|
||||
DOM.renameCurrent, /* f2 */
|
||||
CloudCmd.View, /* f3 */
|
||||
CloudCmd.Edit, /* f4 */
|
||||
DOM.copyCurrent, /* f5 */
|
||||
DOM.moveCurrent, /* f6 */
|
||||
DOM.promptNewDir, /* f7 */
|
||||
DOM.promptDeleteSelected, /* f8 */
|
||||
CloudCmd.Menu, /* f9 */
|
||||
];
|
||||
|
||||
for (i = 1; i <= 9; i++) {
|
||||
lButton = 'f' + i,
|
||||
lEl = DOM.getById('f' + i);
|
||||
lKeysPanel[lButton] = lEl;
|
||||
|
||||
if (i === 1 || i === 3 || i === 4 || i === 9)
|
||||
Events.addOneTime('click', lFuncs[i], lEl);
|
||||
else
|
||||
Events.addClick(lFuncs[i], lEl);
|
||||
}
|
||||
|
||||
lButton = '~',
|
||||
lEl = DOM.getById('~');
|
||||
lKeysPanel[lButton] = lEl;
|
||||
Events.addOneTime('click', CloudCmd.Console, lEl);
|
||||
|
||||
return lKeysPanel;
|
||||
};
|
||||
|
||||
/**
|
||||
* функция меняет ссыки на ajax-овые
|
||||
* @param pPanelID
|
||||
*/
|
||||
this.changeLinks = function(pPanelID){
|
||||
/* назначаем кнопку очистить кэш и показываем её */
|
||||
var lClearcache = DOM.getById('clear-cache');
|
||||
Events.addClick(Cache.clear, lClearcache);
|
||||
|
||||
/* меняем ссылки на ajax-запросы */
|
||||
var lPanel = DOM.getById(pPanelID),
|
||||
a = DOM.getByTag('a', lPanel),
|
||||
|
||||
/* right mouse click function varible */
|
||||
lOnContextMenu_f = function(pEvent){
|
||||
var lReturn_b = true,
|
||||
Key = CloudCmd.Key;
|
||||
|
||||
Key && Key.unsetBind();
|
||||
|
||||
/* getting html element
|
||||
* currentTarget - DOM event
|
||||
* target - jquery event
|
||||
*/
|
||||
var lTarget = pEvent.currentTarget || pEvent.target;
|
||||
DOM.setCurrentFile(lTarget);
|
||||
|
||||
if(Util.isFunction(CloudCmd.Menu) ){
|
||||
CloudCmd.Menu({
|
||||
x: pEvent.clientX,
|
||||
y: pEvent.clientY
|
||||
});
|
||||
|
||||
/* disabling browsers menu*/
|
||||
lReturn_b = false;
|
||||
DOM.Images.showLoad();
|
||||
}
|
||||
|
||||
return lReturn_b;
|
||||
},
|
||||
|
||||
/* drag and drop function varible
|
||||
* download file from browser to descktop
|
||||
* in Chrome (HTML5)
|
||||
*/
|
||||
lOnDragStart_f = function(pEvent){
|
||||
var lElement = pEvent.target,
|
||||
lLink = lElement.href,
|
||||
lName = lElement.textContent;
|
||||
|
||||
/* if it's directory - adding json extension */
|
||||
if( DOM.isCurrentIsDir() ){
|
||||
lName += '.json';
|
||||
lLink += '?json';
|
||||
}
|
||||
|
||||
pEvent.dataTransfer.setData("DownloadURL",
|
||||
'application/octet-stream' + ':' +
|
||||
lName + ':' +
|
||||
lLink);
|
||||
},
|
||||
|
||||
lSetCurrentFile_f = function(pEvent){
|
||||
var pElement = pEvent.target,
|
||||
lTag = pElement.tagName;
|
||||
|
||||
if(lTag !== 'LI')
|
||||
do{
|
||||
pElement = pElement.parentElement;
|
||||
lTag = pElement.tagName;
|
||||
}while(lTag !== 'LI');
|
||||
|
||||
DOM.setCurrentFile(pElement);
|
||||
},
|
||||
|
||||
lUrl = CloudCmd.HOST,
|
||||
lLoadDirOnce = CloudCmd.loadDir();
|
||||
|
||||
/* ставим загрузку гифа на клик*/
|
||||
Events.addClick( CloudCmd.refresh, a[0].parentElement );
|
||||
|
||||
/* start from 1 cous 0 is a path and it's setted up */
|
||||
for(var i = 1, n = a.length; i < n ; i++){
|
||||
/* убираем адрес хоста*/
|
||||
var ai = a[i],
|
||||
lLink = Util.removeStr(ai.href, lUrl),
|
||||
lLoadDir = CloudCmd.loadDir(lLink),
|
||||
/* устанавливаем обработчики на строку
|
||||
* на двойное нажатие на левую кнопку мышки */
|
||||
lLi = ai.parentElement.parentElement;
|
||||
|
||||
/* if we in path - set click event */
|
||||
if (lLi.className === 'path')
|
||||
Events.addClick( lLoadDir, ai );
|
||||
else {
|
||||
Events.add({
|
||||
'click' : DOM.preventDefault,
|
||||
'mousedown' : lSetCurrentFile_f,
|
||||
'contextmenu' : lOnContextMenu_f
|
||||
}, lLi);
|
||||
|
||||
Events.add('dragstart', lOnDragStart_f, ai);
|
||||
|
||||
/* если ссылка на папку, а не файл */
|
||||
if(ai.target !== '_blank'){
|
||||
Events.add({
|
||||
'dblclick' : lLoadDirOnce,
|
||||
'touchend' : lLoadDirOnce
|
||||
}, lLi);
|
||||
}
|
||||
|
||||
lLi.id = (ai.title ? ai.title : ai.textContent) +
|
||||
'(' + pPanelID + ')';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function appCache() {
|
||||
getConfig(function(config) {
|
||||
var isAppCache = config.appcache,
|
||||
appCache = window.applicationCache;
|
||||
|
||||
if (isAppCache && appCache)
|
||||
Events.add('updateready', function() {
|
||||
var ret = confirm('An update is available. Reload now?');
|
||||
|
||||
if (ret)
|
||||
location.reload();
|
||||
|
||||
}, appCache);
|
||||
});
|
||||
}
|
||||
|
||||
function contextMenu() {
|
||||
Events.addContextMenu(function(pEvent){
|
||||
CloudCmd.Menu.ENABLED || DOM.preventDefault(pEvent);
|
||||
}, document);
|
||||
}
|
||||
|
||||
function dragndrop() {
|
||||
var panels = DOM.getByClass('panel'),
|
||||
i = 0,
|
||||
n = panels.length,
|
||||
preventDefault = function (event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
},
|
||||
toggle = function () {
|
||||
for (i = 0; i < n; i++)
|
||||
DOM.toggleClass(panels[i], 'selected-panel');
|
||||
},
|
||||
onDrop = function (event) {
|
||||
var reader, file, files,
|
||||
dir = DOM.getCurrentDirPath(),
|
||||
load = function(file){
|
||||
return function(event) {
|
||||
var path = dir + file.name,
|
||||
data = event.target.result;
|
||||
|
||||
DOM.RESTfull.save(path, data, CloudCmd.refresh);
|
||||
};
|
||||
};
|
||||
|
||||
preventDefault(event);
|
||||
toggle();
|
||||
|
||||
files = event.dataTransfer.files;
|
||||
|
||||
if (files.length) {
|
||||
n = files.length;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
reader = new FileReader();
|
||||
file = files[i];
|
||||
Events.add('load', load(file), reader);
|
||||
reader.readAsArrayBuffer(file);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Events.add(['dragenter', 'dragleave'], toggle);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
Events.add('dragover', preventDefault, panels[i]);
|
||||
Events.add('drop', onDrop, panels[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function unload() {
|
||||
DOM.Events.add(['unload', 'beforeunload'], function (pEvent) {
|
||||
var lRet,
|
||||
Key = CloudCmd.Key,
|
||||
lIsBind = Key && Key.isBind();
|
||||
|
||||
if(!lIsBind) {
|
||||
DOM.preventDefault(pEvent);
|
||||
lRet = 'Please make sure that you saved all work.';
|
||||
}
|
||||
|
||||
return lRet;
|
||||
});
|
||||
}
|
||||
|
||||
function pop() {
|
||||
Events.add("popstate", function(pEvent) {
|
||||
var lPath = pEvent.state + '?json';
|
||||
|
||||
if (pEvent.state) {
|
||||
lPath = pEvent.state + '?json';
|
||||
ajaxLoad(lPath, {nohistory: true});
|
||||
} else
|
||||
CloudCmd.route(location.hash);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})(Util, DOM);
|
||||
|
|
@ -9,7 +9,9 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
CloudCmd.Menu = new MenuProto(CloudCmd, Util, DOM, CloudFunc);
|
||||
|
||||
function MenuProto(CloudCmd, Util, DOM, CloudFunc) {
|
||||
var Key = CloudCmd.Key,
|
||||
var Name = 'Menu',
|
||||
Loading = false,
|
||||
Key = CloudCmd.Key,
|
||||
Events = DOM.Events,
|
||||
MenuSeted = false,
|
||||
Menu = this,
|
||||
|
|
@ -19,6 +21,8 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
this.ENABLED = false;
|
||||
|
||||
this.init = function(pPosition){
|
||||
Loading = true;
|
||||
|
||||
Position = pPosition;
|
||||
|
||||
Util.loadOnLoad([
|
||||
|
|
@ -40,13 +44,15 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
};
|
||||
|
||||
this.show = function() {
|
||||
set();
|
||||
DOM.Images.hideLoad();
|
||||
|
||||
if(Position && !Position.x )
|
||||
Position = undefined;
|
||||
|
||||
$('li').contextMenu(Position);
|
||||
if (!Loading) {
|
||||
set();
|
||||
DOM.Images.hideLoad();
|
||||
|
||||
if(Position && !Position.x )
|
||||
Position = undefined;
|
||||
|
||||
$('li').contextMenu(Position);
|
||||
}
|
||||
};
|
||||
|
||||
/* function read data from modules.json
|
||||
|
|
@ -173,7 +179,8 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
'Rename' : function(){
|
||||
setTimeout( Util.retExec(DOM.renameCurrent), 100);
|
||||
},
|
||||
'Delete' : Util.retExec(DOM.promptDeleteSelected)
|
||||
'Delete' : Util.retExec(DOM.promptDeleteSelected),
|
||||
'Zip file' : DOM.zipFile
|
||||
};
|
||||
|
||||
if (UploadToItemNames.length)
|
||||
|
|
@ -185,7 +192,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
'File' : DOM.promptNewFile,
|
||||
'Dir' : DOM.promptNewDir,
|
||||
|
||||
'From cloud...' : function(){
|
||||
'From Filepicker' : function(){
|
||||
CloudCmd.execFromModule('FilePicker', 'saveFile', function(pName, pData){
|
||||
var lPath = DOM.getCurrentDirPath() + pName;
|
||||
|
||||
|
|
@ -227,7 +234,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
* @param pCallBack
|
||||
*/
|
||||
function load(pCallBack){
|
||||
Util.time('menu load');
|
||||
Util.time(Name + ' load');
|
||||
|
||||
var lDir = '/lib/client/menu/',
|
||||
lFiles = [
|
||||
|
|
@ -236,7 +243,8 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
];
|
||||
|
||||
DOM.anyLoadInParallel(lFiles, function(){
|
||||
Util.timeEnd('menu load');
|
||||
Util.timeEnd(Name + ' load');
|
||||
Loading = false;
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,14 @@ var CloudCmd, Util, DOM, io;
|
|||
});
|
||||
|
||||
function connect() {
|
||||
socket = io.connect(CloudCmd.HOST);
|
||||
socket = io.connect(CloudCmd.HOST, {
|
||||
'reconnect' : true,
|
||||
'reconnection delay' : 500,
|
||||
'max reconnection attempts' : Math.pow(2, 64),
|
||||
'reconnect_failed' : function() {
|
||||
Util.log('Could not reconnect. Reload page.');
|
||||
}
|
||||
});
|
||||
|
||||
CloudCmd.Socket = socket;
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ var CloudCmd, Util, DOM, Dropbox, cb, Client;
|
|||
load
|
||||
]);
|
||||
|
||||
CloudCmd.DropBox.init = null;
|
||||
delete DropBoxStore.init;
|
||||
};
|
||||
|
||||
CloudCmd.DropBox = DropBoxStore;
|
||||
|
|
|
|||
|
|
@ -16,20 +16,25 @@ var CloudCmd, Util, DOM, $, filepicker;
|
|||
var lContent = pParams.data,
|
||||
lName = pParams.name;
|
||||
|
||||
filepicker.store(lContent, {filename: lName}, function(pFPFile){
|
||||
console.log(pFPFile);
|
||||
|
||||
filepicker.exportFile(pFPFile, Util.log, Util.log);
|
||||
filepicker.store(lContent, {
|
||||
mimetype: '',
|
||||
filename: lName
|
||||
},
|
||||
function(pFPFile){
|
||||
Util.log(pFPFile);
|
||||
|
||||
filepicker.exportFile(pFPFile, Util.log, Util.log);
|
||||
});
|
||||
};
|
||||
|
||||
this.saveFile = function(pCallBack){
|
||||
filepicker.pick(function(FPFile){
|
||||
console.log(FPFile);
|
||||
Util.log(FPFile);
|
||||
|
||||
DOM.ajax({
|
||||
url : FPFile.url,
|
||||
success : function(pData){
|
||||
url : FPFile.url,
|
||||
responseType :'arraybuffer',
|
||||
success : function(pData){
|
||||
Util.exec(pCallBack, FPFile.filename, pData);
|
||||
}
|
||||
});
|
||||
|
|
@ -37,7 +42,7 @@ var CloudCmd, Util, DOM, $, filepicker;
|
|||
};
|
||||
|
||||
function load(pCallBack){
|
||||
console.time('filepicker load');
|
||||
Util.time('filepicker load');
|
||||
var lHTTP = document.location.protocol;
|
||||
|
||||
DOM.jsload(lHTTP + '//api.filepicker.io/v1/filepicker.js', function(){
|
||||
|
|
@ -48,7 +53,7 @@ var CloudCmd, Util, DOM, $, filepicker;
|
|||
|
||||
filepicker.setKey(lKey);
|
||||
DOM.Images.hideLoad();
|
||||
console.timeEnd('filepicker loaded');
|
||||
Util.timeEnd('filepicker loaded');
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
CloudCmd.View = new ViewProto(CloudCmd, Util, DOM, CloudFunc);
|
||||
|
||||
function ViewProto(CloudCmd, Util, DOM, CloudFunc){
|
||||
var Key = CloudCmd.Key,
|
||||
var Name = 'View',
|
||||
Loading = false,
|
||||
Key = CloudCmd.Key,
|
||||
Images = DOM.Images,
|
||||
View = this,
|
||||
Element,
|
||||
|
|
@ -27,6 +29,8 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
autoSize : false,
|
||||
height : window.innerHeight,
|
||||
width : window.innerWidth/0.75,
|
||||
minWidth : 0,
|
||||
minHeight : 0,
|
||||
|
||||
helpers : {
|
||||
overlay : {
|
||||
|
|
@ -41,6 +45,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
this.init = function(pCallBack){
|
||||
var lFunc, lIsFunc, lIsCallBack;
|
||||
|
||||
Loading = true;
|
||||
if (pCallBack){
|
||||
lIsFunc = Util.isFunction(pCallBack);
|
||||
lIsCallBack = Util.isFunction(pCallBack.callback);
|
||||
|
|
@ -70,28 +75,31 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
var lPath, lElement,
|
||||
lAfterFunc, lFunc;
|
||||
|
||||
Element = $('<div id=view tabindex=0>');
|
||||
if (pData) {
|
||||
lElement = $(Element).append(pData);
|
||||
lAfterFunc = Config.afterShow,
|
||||
lFunc = function(){
|
||||
Util.exec(lAfterFunc);
|
||||
Util.exec(pCallBack);
|
||||
};
|
||||
|
||||
Config.afterShow = lFunc;
|
||||
|
||||
$.fancybox(lElement, Config);
|
||||
|
||||
} else {
|
||||
lPath = CloudFunc.FS + DOM.getCurrentPath();
|
||||
if( Util.checkExtension(lPath, ['png','jpg', 'gif','ico']) ) {
|
||||
$.fancybox.open({ href : lPath }, Config);
|
||||
if (!Loading) {
|
||||
Element = $('<div id=view tabindex=0>');
|
||||
if (pData) {
|
||||
lElement = $(Element).append(pData);
|
||||
lAfterFunc = Config.afterShow,
|
||||
lFunc = function(){
|
||||
Util.exec(lAfterFunc);
|
||||
Util.exec(pCallBack);
|
||||
};
|
||||
|
||||
Config.afterShow = lFunc;
|
||||
|
||||
$.fancybox(lElement, Config);
|
||||
|
||||
} else {
|
||||
lPath = CloudFunc.FS + DOM.getCurrentPath();
|
||||
if( Util.checkExtension(lPath, ['png','jpg', 'gif','ico']) ) {
|
||||
$.fancybox.open({ href : lPath }, Config);
|
||||
}
|
||||
else
|
||||
DOM.getCurrentData(function(pParams){
|
||||
var data = document.createTextNode(pParams.data);
|
||||
$.fancybox( Element.append(data), Config );
|
||||
});
|
||||
}
|
||||
else
|
||||
DOM.getCurrentData(function(pParams){
|
||||
$.fancybox( Element.append(pParams.data), Config );
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -105,13 +113,14 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
* @pCallBack - executes, when everything loaded
|
||||
*/
|
||||
function load(pCallBack){
|
||||
Util.time('fancybox load');
|
||||
Util.time(Name + ' load');
|
||||
var lDir = CloudCmd.LIBDIRCLIENT + 'view/fancyBox/source/',
|
||||
lFiles = [ lDir + 'jquery.fancybox.css',
|
||||
lDir + 'jquery.fancybox.js' ];
|
||||
|
||||
DOM.anyLoadOnLoad([lFiles], function(){
|
||||
Util.timeEnd('fancybox load');
|
||||
Util.timeEnd(Name + ' load');
|
||||
Loading = false;
|
||||
Util.exec( pCallBack );
|
||||
Images.hideLoad();
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
fancyBox - Changelog
|
||||
=========
|
||||
|
||||
### Version 2.1.5 - June 14, 2013
|
||||
* Fixed #493 - Broken slideshow
|
||||
* Fixed #556 - Parent option
|
||||
* Retina graphics (#564) and retina display support (#420)
|
||||
* Improved "lock" feature
|
||||
|
||||
### Version 2.1.4 - January 10, 2013
|
||||
* Update to be compatible with jQuery v1.9
|
||||
* Small changes that should fix usability issues for certain users
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<!-- Add jQuery library -->
|
||||
<script type="text/javascript" src="../lib/jquery-1.9.0.min.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery-1.10.1.min.js"></script>
|
||||
|
||||
<!-- Add mousewheel plugin (this is optional) -->
|
||||
<script type="text/javascript" src="../lib/jquery.mousewheel-3.0.6.pack.js"></script>
|
||||
|
||||
<!-- Add fancyBox main JS and CSS files -->
|
||||
<script type="text/javascript" src="../source/jquery.fancybox.js?v=2.1.4"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../source/jquery.fancybox.css?v=2.1.4" media="screen" />
|
||||
<script type="text/javascript" src="../source/jquery.fancybox.js?v=2.1.5"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../source/jquery.fancybox.css?v=2.1.5" media="screen" />
|
||||
|
||||
<!-- Add Button helper (this is optional) -->
|
||||
<link rel="stylesheet" type="text/css" href="../source/helpers/jquery.fancybox-buttons.css?v=1.0.5" />
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<script type="text/javascript" src="../source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
|
||||
|
||||
<!-- Add Media helper (this is optional) -->
|
||||
<script type="text/javascript" src="../source/helpers/jquery.fancybox-media.js?v=1.0.5"></script>
|
||||
<script type="text/javascript" src="../source/helpers/jquery.fancybox-media.js?v=1.0.6"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
|
@ -205,6 +205,11 @@
|
|||
.fancybox-custom .fancybox-skin {
|
||||
box-shadow: 0 0 50px #222;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 700px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -285,7 +290,7 @@
|
|||
|
||||
<ul>
|
||||
<li><a class="fancybox-media" href="http://www.youtube.com/watch?v=opj24KnzrWo">Youtube</a></li>
|
||||
<li><a class="fancybox-media" href="http://vimeo.com/25634903">Vimeo</a></li>
|
||||
<li><a class="fancybox-media" href="http://vimeo.com/47480346">Vimeo</a></li>
|
||||
<li><a class="fancybox-media" href="http://www.metacafe.com/watch/7635964/">Metacafe</a></li>
|
||||
<li><a class="fancybox-media" href="http://www.dailymotion.com/video/xoeylt_electric-guest-this-head-i-hold_music">Dailymotion</a></li>
|
||||
<li><a class="fancybox-media" href="http://twitvid.com/QY7MD">Twitvid</a></li>
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
||||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||||
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
||||
*
|
||||
* Version: 3.0.6
|
||||
*
|
||||
* Requires: 1.2.2+
|
||||
*/
|
||||
(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=
|
||||
d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,false);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
|
||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 6.4 KiB |
BIN
lib/client/view/fancyBox/source/fancybox_loading@2x.gif
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
lib/client/view/fancyBox/source/fancybox_sprite@2x.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
|
|
@ -46,6 +46,7 @@
|
|||
width: 30px;
|
||||
height: 30px;
|
||||
text-indent: -9999px;
|
||||
background-color: transparent;
|
||||
background-image: url('fancybox_buttons.png');
|
||||
background-repeat: no-repeat;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
defaults : {
|
||||
skipSingle : false, // disables if gallery contains single image
|
||||
position : 'top', // 'top' or 'bottom'
|
||||
tpl : '<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:jQuery.fancybox.close();"></a></li></ul></div>'
|
||||
tpl : '<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:;"></a></li></ul></div>'
|
||||
},
|
||||
|
||||
list : null,
|
||||
|
|
@ -64,7 +64,8 @@
|
|||
prev : this.list.find('.btnPrev').click( F.prev ),
|
||||
next : this.list.find('.btnNext').click( F.next ),
|
||||
play : this.list.find('.btnPlay').click( F.play ),
|
||||
toggle : this.list.find('.btnToggle').click( F.toggle )
|
||||
toggle : this.list.find('.btnToggle').click( F.toggle ),
|
||||
close : this.list.find('.btnClose').click( F.close )
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -118,4 +119,4 @@
|
|||
}
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
}(jQuery));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*!
|
||||
* Media helper for fancyBox
|
||||
* version: 1.0.5 (Tue, 23 Oct 2012)
|
||||
* version: 1.0.6 (Fri, 14 Jun 2013)
|
||||
* @requires fancyBox v2.0 or later
|
||||
*
|
||||
* Usage:
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
* Or:
|
||||
* $(".fancybox").fancybox({,
|
||||
* helpers : {
|
||||
* helpers : {
|
||||
* media: true
|
||||
* },
|
||||
* youtube : {
|
||||
|
|
@ -39,6 +39,7 @@
|
|||
* http://www.youtube.com/watch?v=opj24KnzrWo
|
||||
* http://www.youtube.com/embed/opj24KnzrWo
|
||||
* http://youtu.be/opj24KnzrWo
|
||||
* http://www.youtube-nocookie.com/embed/opj24KnzrWo
|
||||
* Vimeo
|
||||
* http://vimeo.com/40648169
|
||||
* http://vimeo.com/channels/staffpicks/38843628
|
||||
|
|
@ -88,7 +89,7 @@
|
|||
F.helpers.media = {
|
||||
defaults : {
|
||||
youtube : {
|
||||
matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
|
||||
matcher : /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
|
||||
params : {
|
||||
autoplay : 1,
|
||||
autohide : 1,
|
||||
|
|
@ -151,7 +152,7 @@
|
|||
instagram : {
|
||||
matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
|
||||
type : 'image',
|
||||
url : '//$1/p/$2/media/'
|
||||
url : '//$1/p/$2/media/?size=l'
|
||||
},
|
||||
google_maps : {
|
||||
matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i,
|
||||
|
|
@ -171,16 +172,18 @@
|
|||
params;
|
||||
|
||||
for (what in opts) {
|
||||
item = opts[ what ];
|
||||
rez = url.match( item.matcher );
|
||||
if (opts.hasOwnProperty(what)) {
|
||||
item = opts[ what ];
|
||||
rez = url.match( item.matcher );
|
||||
|
||||
if (rez) {
|
||||
type = item.type;
|
||||
params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null));
|
||||
if (rez) {
|
||||
type = item.type;
|
||||
params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null));
|
||||
|
||||
url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params );
|
||||
url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params );
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,4 +51,5 @@
|
|||
position: relative;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
max-width: none;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */
|
||||
/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
|
||||
.fancybox-wrap,
|
||||
.fancybox-skin,
|
||||
.fancybox-outer,
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
.fancybox-nav span,
|
||||
.fancybox-tmp
|
||||
{
|
||||
padding: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
outline: none;
|
||||
|
|
@ -52,6 +52,10 @@
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fancybox-type-iframe .fancybox-inner {
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.fancybox-error {
|
||||
color: #444;
|
||||
font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
|
|
@ -161,7 +165,16 @@
|
|||
/* Overlay helper */
|
||||
|
||||
.fancybox-lock {
|
||||
overflow: hidden;
|
||||
overflow: hidden !important;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.fancybox-lock body {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.fancybox-lock-test {
|
||||
overflow-y: hidden !important;
|
||||
}
|
||||
|
||||
.fancybox-overlay {
|
||||
|
|
@ -242,4 +255,20 @@
|
|||
padding: 10px;
|
||||
background: #000;
|
||||
background: rgba(0, 0, 0, .8);
|
||||
}
|
||||
|
||||
/*Retina graphics!*/
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
||||
only screen and (min--moz-device-pixel-ratio: 1.5),
|
||||
only screen and (min-device-pixel-ratio: 1.5){
|
||||
|
||||
#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
|
||||
background-image: url('fancybox_sprite@2x.png');
|
||||
background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/
|
||||
}
|
||||
|
||||
#fancybox-loading div {
|
||||
background-image: url('fancybox_loading@2x.gif');
|
||||
background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/
|
||||
}
|
||||
}
|
||||
121
lib/client/view/fancyBox/source/jquery.fancybox.js
vendored
Normal file → Executable file
|
|
@ -1,6 +1,6 @@
|
|||
/*!
|
||||
* fancyBox - jQuery Plugin
|
||||
* version: 2.1.4 (Thu, 10 Jan 2013)
|
||||
* version: 2.1.5 (Fri, 14 Jun 2013)
|
||||
* @requires jQuery v1.6 or later
|
||||
*
|
||||
* Examples at http://fancyapps.com/fancybox/
|
||||
|
|
@ -13,14 +13,15 @@
|
|||
(function (window, document, $, undefined) {
|
||||
"use strict";
|
||||
|
||||
var W = $(window),
|
||||
var H = $("html"),
|
||||
W = $(window),
|
||||
D = $(document),
|
||||
F = $.fancybox = function () {
|
||||
F.open.apply( this, arguments );
|
||||
},
|
||||
IE = navigator.userAgent.match(/msie/),
|
||||
didUpdate = null,
|
||||
isTouch = document.createTouch !== undefined,
|
||||
IE = navigator.userAgent.match(/msie/i),
|
||||
didUpdate = null,
|
||||
isTouch = document.createTouch !== undefined,
|
||||
|
||||
isQuery = function(obj) {
|
||||
return obj && obj.hasOwnProperty && obj instanceof $;
|
||||
|
|
@ -49,7 +50,7 @@
|
|||
|
||||
$.extend(F, {
|
||||
// The current version of fancyBox
|
||||
version: '2.1.4',
|
||||
version: '2.1.5',
|
||||
|
||||
defaults: {
|
||||
padding : 15,
|
||||
|
|
@ -61,6 +62,7 @@
|
|||
minHeight : 100,
|
||||
maxWidth : 9999,
|
||||
maxHeight : 9999,
|
||||
pixelRatio: 1, // Set to 2 for retina display support
|
||||
|
||||
autoSize : true,
|
||||
autoHeight : false,
|
||||
|
|
@ -438,7 +440,7 @@
|
|||
stop = function () {
|
||||
clear();
|
||||
|
||||
$('body').unbind('.player');
|
||||
D.unbind('.player');
|
||||
|
||||
F.player.isActive = false;
|
||||
|
||||
|
|
@ -448,9 +450,9 @@
|
|||
if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
|
||||
F.player.isActive = true;
|
||||
|
||||
$('body').bind({
|
||||
'afterShow.player onUpdate.player' : set,
|
||||
D.bind({
|
||||
'onCancel.player beforeClose.player' : stop,
|
||||
'onUpdate.player' : set,
|
||||
'beforeLoad.player' : clear
|
||||
});
|
||||
|
||||
|
|
@ -754,18 +756,16 @@
|
|||
if (obj.helpers) {
|
||||
$.each(obj.helpers, function (helper, opts) {
|
||||
if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
|
||||
opts = $.extend(true, {}, F.helpers[helper].defaults, opts);
|
||||
|
||||
F.helpers[helper][event](opts, obj);
|
||||
F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$.event.trigger(event + '.fb');
|
||||
D.trigger(event);
|
||||
},
|
||||
|
||||
isImage: function (str) {
|
||||
return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i);
|
||||
return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
|
||||
},
|
||||
|
||||
isSWF: function (str) {
|
||||
|
|
@ -942,8 +942,8 @@
|
|||
img.onload = function () {
|
||||
this.onload = this.onerror = null;
|
||||
|
||||
F.coming.width = this.width;
|
||||
F.coming.height = this.height;
|
||||
F.coming.width = this.width / F.opts.pixelRatio;
|
||||
F.coming.height = this.height / F.opts.pixelRatio;
|
||||
|
||||
F._afterLoad();
|
||||
};
|
||||
|
|
@ -1228,7 +1228,7 @@
|
|||
body.css('overflow-x', 'hidden');
|
||||
}
|
||||
|
||||
origHeight = body.height();
|
||||
origHeight = body.outerHeight(true);
|
||||
}
|
||||
|
||||
} catch (e) {}
|
||||
|
|
@ -1689,16 +1689,17 @@
|
|||
|
||||
F.helpers.overlay = {
|
||||
defaults : {
|
||||
closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay
|
||||
speedOut : 200, // duration of fadeOut animation
|
||||
showEarly : true, // indicates if should be opened immediately or wait until the content is ready
|
||||
css : {}, // custom CSS properties
|
||||
closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay
|
||||
speedOut : 200, // duration of fadeOut animation
|
||||
showEarly : true, // indicates if should be opened immediately or wait until the content is ready
|
||||
css : {}, // custom CSS properties
|
||||
locked : !isTouch, // if true, the content will be locked into overlay
|
||||
fixed : true // if false, the overlay CSS position property will not be set to "fixed"
|
||||
fixed : true // if false, the overlay CSS position property will not be set to "fixed"
|
||||
},
|
||||
|
||||
overlay : null, // current handle
|
||||
fixed : false, // indicates if the overlay has position "fixed"
|
||||
overlay : null, // current handle
|
||||
fixed : false, // indicates if the overlay has position "fixed"
|
||||
el : $('html'), // element that contains "the lock"
|
||||
|
||||
// Public methods
|
||||
create : function(opts) {
|
||||
|
|
@ -1708,7 +1709,7 @@
|
|||
this.close();
|
||||
}
|
||||
|
||||
this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( 'body' );
|
||||
this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent );
|
||||
this.fixed = false;
|
||||
|
||||
if (opts.fixed && F.defaults.fixed) {
|
||||
|
|
@ -1744,6 +1745,8 @@
|
|||
} else {
|
||||
that.close();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -1752,21 +1755,27 @@
|
|||
},
|
||||
|
||||
close : function() {
|
||||
$('.fancybox-overlay').remove();
|
||||
var scrollV, scrollH;
|
||||
|
||||
W.unbind('resize.overlay');
|
||||
|
||||
this.overlay = null;
|
||||
if (this.el.hasClass('fancybox-lock')) {
|
||||
$('.fancybox-margin').removeClass('fancybox-margin');
|
||||
|
||||
if (this.margin !== false) {
|
||||
$('body').css('margin-right', this.margin);
|
||||
scrollV = W.scrollTop();
|
||||
scrollH = W.scrollLeft();
|
||||
|
||||
this.margin = false;
|
||||
}
|
||||
|
||||
if (this.el) {
|
||||
this.el.removeClass('fancybox-lock');
|
||||
|
||||
W.scrollTop( scrollV ).scrollLeft( scrollH );
|
||||
}
|
||||
|
||||
$('.fancybox-overlay').remove().hide();
|
||||
|
||||
$.extend(this, {
|
||||
overlay : null,
|
||||
fixed : false
|
||||
});
|
||||
},
|
||||
|
||||
// Private, callbacks
|
||||
|
|
@ -1794,16 +1803,19 @@
|
|||
|
||||
// This is where we can manipulate DOM, because later it would cause iframes to reload
|
||||
onReady : function (opts, obj) {
|
||||
var overlay = this.overlay;
|
||||
|
||||
$('.fancybox-overlay').stop(true, true);
|
||||
|
||||
if (!this.overlay) {
|
||||
this.margin = D.height() > W.height() || $('body').css('overflow-y') === 'scroll' ? $('body').css('margin-right') : false;
|
||||
this.el = document.all && !document.querySelector ? $('html') : $('body');
|
||||
|
||||
if (!overlay) {
|
||||
this.create(opts);
|
||||
}
|
||||
|
||||
if (opts.locked && this.fixed) {
|
||||
if (opts.locked && this.fixed && obj.fixed) {
|
||||
if (!overlay) {
|
||||
this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false;
|
||||
}
|
||||
|
||||
obj.locked = this.overlay.append( obj.wrap );
|
||||
obj.fixed = false;
|
||||
}
|
||||
|
|
@ -1814,12 +1826,23 @@
|
|||
},
|
||||
|
||||
beforeShow : function(opts, obj) {
|
||||
var scrollV, scrollH;
|
||||
|
||||
if (obj.locked) {
|
||||
if (this.margin !== false) {
|
||||
$('*').filter(function(){
|
||||
return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") );
|
||||
}).addClass('fancybox-margin');
|
||||
|
||||
this.el.addClass('fancybox-margin');
|
||||
}
|
||||
|
||||
scrollV = W.scrollTop();
|
||||
scrollH = W.scrollLeft();
|
||||
|
||||
this.el.addClass('fancybox-lock');
|
||||
|
||||
if (this.margin !== false) {
|
||||
$('body').css('margin-right', getScalar( this.margin ) + obj.scrollbarWidth);
|
||||
}
|
||||
W.scrollTop( scrollV ).scrollLeft( scrollH );
|
||||
}
|
||||
|
||||
this.open(opts);
|
||||
|
|
@ -1834,7 +1857,8 @@
|
|||
afterClose: function (opts) {
|
||||
// Remove overlay if exists and fancyBox is not opening
|
||||
// (e.g., it is not being open using afterClose callback)
|
||||
if (this.overlay && !F.isActive) {
|
||||
//if (this.overlay && !F.isActive) {
|
||||
if (this.overlay && !F.coming) {
|
||||
this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
|
||||
}
|
||||
}
|
||||
|
|
@ -1949,6 +1973,8 @@
|
|||
|
||||
// Tests that need a body at doc ready
|
||||
D.ready(function() {
|
||||
var w1, w2;
|
||||
|
||||
if ( $.scrollbarWidth === undefined ) {
|
||||
// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
|
||||
$.scrollbarWidth = function() {
|
||||
|
|
@ -1978,6 +2004,17 @@
|
|||
fixed : $.support.fixedPosition,
|
||||
parent : $('body')
|
||||
});
|
||||
|
||||
//Get real width of page scroll-bar
|
||||
w1 = $(window).width();
|
||||
|
||||
H.addClass('fancybox-lock-test');
|
||||
|
||||
w2 = $(window).width();
|
||||
|
||||
H.removeClass('fancybox-lock-test');
|
||||
|
||||
$("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head");
|
||||
});
|
||||
|
||||
}(window, document, jQuery));
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */
|
||||
(function(C,z,f,r){var q=f(C),n=f(z),b=f.fancybox=function(){b.open.apply(this,arguments)},H=navigator.userAgent.match(/msie/),w=null,s=z.createTouch!==r,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},F=function(a){return p(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&F(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},x=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.4",defaults:{padding:15,margin:20,width:800,
|
||||
height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},keys:{next:{13:"left",
|
||||
34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+
|
||||
(H?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,
|
||||
openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,
|
||||
isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k,
|
||||
c.metadata())):k=c);g=d.href||k.href||(p(c)?c:null);h=d.title!==r?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));p(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":p(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&&
|
||||
k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==r&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current||
|
||||
b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer=
|
||||
setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,f("body").bind({"afterShow.player onUpdate.player":e,"onCancel.player beforeClose.player":c,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(p(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},
|
||||
prev:function(a){var d=b.current;d&&(p(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==r&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},
|
||||
e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(w),w=null);b.isOpen&&!w&&(w=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),w=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),
|
||||
b.trigger("onUpdate")),b.update())},hideLoading:function(){n.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");n.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||
|
||||
!1,d={x:q.scrollLeft(),y:q.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&C.innerWidth?C.innerWidth:q.width(),d.h=s&&C.innerHeight?C.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&n.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=
|
||||
e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==r)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&
|
||||
"hidden"===h[0].style.overflow)&&(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,
|
||||
e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&
|
||||
(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=
|
||||
!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady");
|
||||
if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=
|
||||
this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,
|
||||
(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=
|
||||
b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();
|
||||
e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",
|
||||
!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");
|
||||
a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,
|
||||
v=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,p=l(y[1]+y[3]),r=l(y[0]+y[2]),z,A,t,D,B,G,C,E,w;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=l(k.outerWidth(!0)-k.width());z=l(k.outerHeight(!0)-k.height());A=p+y;t=r+z;D=F(c)?(a.w-A)*l(c)/100:c;B=F(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(w=h.content,h.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(g.width(D).height(9999),G=w.contents().find("body"),q&&G.css("overflow-x",
|
||||
"hidden"),B=G.height())}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=l(D);j=l(B);E=D/B;m=l(F(m)?l(m,"w")-A:m);n=l(F(n)?l(n,"w")-A:n);u=l(F(u)?l(u,"h")-t:u);v=l(F(v)?l(v,"h")-t:v);G=n;C=v;h.fitToView&&(n=Math.min(a.w-A,n),v=Math.min(a.h-t,v));A=a.w-p;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/E)),j>v&&(j=v,c=l(j*E)),c<m&&(c=m,j=l(c/E)),j<u&&
|
||||
(j=u,c=l(j*E))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&&"iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,v)));if(h.fitToView)if(g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height(),h.aspectRatio)for(;(a>A||p>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(v,j-10)),c=l(j*E),c<m&&(c=m,j=l(c/E)),c>n&&(c=n,j=l(c/E)),g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height();else c=Math.max(m,Math.min(c,c-(a-A))),j=Math.max(u,Math.min(j,j-(p-r)));q&&("auto"===s&&j<B&&c+y+
|
||||
q<A)&&(c+=q);g.width(c).height(j);e.width(c+y);a=e.width();p=e.height();e=(a>A||p>r)&&c>m&&j>u;c=h.aspectRatio?c<G&&j<C&&c<D&&j<B:(c<G||j<C)&&(c<D||j<B);f.extend(h,{dim:{width:x(a),height:x(p)},origWidth:D,origHeight:B,canShrink:e,canExpand:c,wPadding:y,hPadding:z,wrapSpace:p-k.outerHeight(!0),skinSpace:k.height()-j});!w&&(h.autoHeight&&j>u&&j<v&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",
|
||||
top:c[0],left:c[3]};d.autoCenter&&d.fixed&&!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=x(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=x(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&
|
||||
(d.preventDefault(),b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a=
|
||||
a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())):
|
||||
(c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:x(c.top-h*a.topRatio),left:x(c.left-j*a.leftRatio),width:x(f+j),height:x(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"===
|
||||
f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c,
|
||||
{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=x(l(e[g])-200),c[g]="+=200px"):(e[g]=x(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a=
|
||||
b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay=f('<div class="fancybox-overlay"></div>').appendTo("body");
|
||||
this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&&(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()},
|
||||
close:function(){f(".fancybox-overlay").remove();q.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");H?(b=Math.max(z.documentElement.offsetWidth,z.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>q.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,b){f(".fancybox-overlay").stop(!0,
|
||||
!0);this.overlay||(this.margin=n.height()>q.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=z.all&&!z.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",l(this.margin)+b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed||
|
||||
this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),
|
||||
H&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+
|
||||
'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):n.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};n.ready(function(){f.scrollbarWidth===r&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),
|
||||
b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===r){var a=f.support,d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery);
|
||||
BIN
lib/client/view/fancyBox/sprite.psd
Normal file
|
|
@ -1,6 +1,6 @@
|
|||
var Util, exports, CloudFunc = {};
|
||||
|
||||
(function(Util, CloudFunc, exports){
|
||||
(function(Util, CloudFunc, exports) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
|
|
@ -8,7 +8,7 @@ var Util, exports, CloudFunc = {};
|
|||
* будут работать и на клиенте и на сервере
|
||||
*/
|
||||
var FS;
|
||||
if(exports){
|
||||
if(exports) {
|
||||
if(!global.cloudcmd)
|
||||
return console.log(
|
||||
'# cloudfunc.js' + '\n' +
|
||||
|
|
@ -16,7 +16,7 @@ var Util, exports, CloudFunc = {};
|
|||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for generate html from json.' + '\n' +
|
||||
'# ' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# http://coderaiser.github.io/cloudcmd' + '\n');
|
||||
|
||||
Util = global.cloudcmd.main.util;
|
||||
CloudFunc = exports;
|
||||
|
|
@ -41,11 +41,17 @@ var Util, exports, CloudFunc = {};
|
|||
CloudFunc.LEFTPANEL = 'left';
|
||||
CloudFunc.RIGHTPANEL = 'right';
|
||||
|
||||
CloudFunc.formatMsg = function(pMsg, pName, pStatus) {
|
||||
var status = pStatus || 'ok',
|
||||
msg = pMsg + ': ' + status + '("' + pName + '")';
|
||||
|
||||
return msg;
|
||||
};
|
||||
/**
|
||||
* Функция убирает последний слеш,
|
||||
* если он - последний символ строки
|
||||
*/
|
||||
CloudFunc.removeLastSlash = function(pPath){
|
||||
CloudFunc.removeLastSlash = function(pPath) {
|
||||
var lRet = pPath,
|
||||
lIsStr = typeof pPath==='string',
|
||||
lLengh = pPath.length-1,
|
||||
|
|
@ -60,7 +66,7 @@ var Util, exports, CloudFunc = {};
|
|||
/** Функция возвращает заголовок веб страницы
|
||||
* @pPath
|
||||
*/
|
||||
CloudFunc.getTitle = function(pPath){
|
||||
CloudFunc.getTitle = function(pPath) {
|
||||
if(!CloudFunc.Path)
|
||||
CloudFunc.Path = '/';
|
||||
|
||||
|
|
@ -72,7 +78,7 @@ var Util, exports, CloudFunc = {};
|
|||
* @param pPerm_s - строка с правами доступа
|
||||
* к файлу в 8-миричной системе
|
||||
*/
|
||||
CloudFunc.getSymbolicPermissions = function(pPerm_s){
|
||||
CloudFunc.getSymbolicPermissions = function(pPerm_s) {
|
||||
/*
|
||||
S_IRUSR 0000400 protection: readable by owner
|
||||
S_IWUSR 0000200 writable by owner
|
||||
|
|
@ -145,7 +151,7 @@ var Util, exports, CloudFunc = {};
|
|||
* Функция конвертирует права доступа к файлам из символьного вида
|
||||
* в цыфровой
|
||||
*/
|
||||
CloudFunc.getNumericPermissions = function(pPerm_s){
|
||||
CloudFunc.getNumericPermissions = function(pPerm_s) {
|
||||
if(!pPerm_s || pPerm_s.length!==11)return pPerm_s;
|
||||
|
||||
var lOwner= (pPerm_s[0] === 'r' ? 4 : 0) +
|
||||
|
|
@ -169,8 +175,8 @@ var Util, exports, CloudFunc = {};
|
|||
* гигайбайты и терабайты
|
||||
* @pSize - размер в байтах
|
||||
*/
|
||||
CloudFunc.getShortSize = function(pSize){
|
||||
if (pSize === pSize-0){
|
||||
CloudFunc.getShortSize = function(pSize) {
|
||||
if (pSize === pSize-0) {
|
||||
/* Константы размеров, что используются внутри функции */
|
||||
var l1KB = 1024,
|
||||
l1MB = l1KB * l1KB,
|
||||
|
|
@ -194,7 +200,7 @@ var Util, exports, CloudFunc = {};
|
|||
* и возвращает массив обьектов имён и uid пользователей
|
||||
* @pPasswd_s - строка, в которой находиться файл /etc/passwd
|
||||
*/
|
||||
CloudFunc.getUserUIDsAndNames = function(pPasswd_s){
|
||||
CloudFunc.getUserUIDsAndNames = function(pPasswd_s) {
|
||||
var lUsers = {name:'', uid:''},
|
||||
lUsersData = [],
|
||||
i = 0;
|
||||
|
|
@ -202,7 +208,7 @@ var Util, exports, CloudFunc = {};
|
|||
/* получаем первую строку */
|
||||
var lLine = pPasswd_s.substr(pPasswd_s, pPasswd_s.indexOf('\n') + 1);
|
||||
|
||||
if(lLine){
|
||||
if(lLine) {
|
||||
|
||||
/* удаляем первую строку из /etc/passwd*/
|
||||
pPasswd_s = Util.removeStr(pPasswd_s, lLine);
|
||||
|
|
@ -213,7 +219,7 @@ var Util, exports, CloudFunc = {};
|
|||
|
||||
/* получаем uid*/
|
||||
var lUID = lLine.substr(lLine,lLine.indexOf(':'));
|
||||
if((lUID - 0).toString()!=='NaN'){
|
||||
if((lUID - 0).toString()!=='NaN') {
|
||||
lUsers.name = lName;
|
||||
lUsers.uid = lUID;
|
||||
lUsersData[i++] = lUsers;
|
||||
|
|
@ -229,7 +235,7 @@ var Util, exports, CloudFunc = {};
|
|||
* возвращаеться массив каталогов
|
||||
* @param url - адрес каталога
|
||||
*/
|
||||
CloudFunc._getDirPath = function(url){
|
||||
CloudFunc._getDirPath = function(url) {
|
||||
var lShortName,
|
||||
folders = [],
|
||||
i = 0;
|
||||
|
|
@ -249,7 +255,7 @@ var Util, exports, CloudFunc = {};
|
|||
'/' + _l + '/' +
|
||||
lHrefEnd;
|
||||
|
||||
for(i = folders.length - 1; i > 0; i--){
|
||||
for(i = folders.length - 1; i > 0; i--) {
|
||||
var lUrl = folders[i],
|
||||
lSlashIndex = lUrl.lastIndexOf('/') + 1;
|
||||
|
||||
|
|
@ -324,7 +330,7 @@ var Util, exports, CloudFunc = {};
|
|||
CloudFunc.Path = lPath;
|
||||
|
||||
/* Если мы не в корне */
|
||||
if(lPath !== '/'){
|
||||
if(lPath !== '/') {
|
||||
/* ссылка на верхний каталог*/
|
||||
var lDotDot, lLink;
|
||||
/* убираем последний слеш и каталог в котором мы сейчас находимся*/
|
||||
|
|
@ -348,7 +354,7 @@ var Util, exports, CloudFunc = {};
|
|||
});
|
||||
}
|
||||
|
||||
for(var i = 1, n = files.length; i < n; i++){
|
||||
for(var i = 1, n = files.length; i < n; i++) {
|
||||
var lFile = files[i];
|
||||
|
||||
lFileTable += Util.render(pTemplate,{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(function(){
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
if(!global.cloudcmd)
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# easy to use web server.' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
Server, Rest, Route, Minimize;
|
||||
|
||||
/* базовая инициализация */
|
||||
function init(pAppCachProcessing){
|
||||
function init(pAppCachProcessing) {
|
||||
var lConfig = main.config,
|
||||
lMinifyAllowed = lConfig.minification;
|
||||
|
||||
|
|
@ -74,12 +74,12 @@
|
|||
lConfig.ip ||
|
||||
(main.WIN32 ? '127.0.0.1' : '0.0.0.0'),
|
||||
|
||||
lSSL = pProcessing.ssl,
|
||||
lSSL = pProcessing.ssl,
|
||||
lSSLPort = lConfig.sslPort,
|
||||
lHTTP = 'http://',
|
||||
lHTTPS = 'https://',
|
||||
|
||||
lSockets = function(pServer){
|
||||
lSockets = function(pServer) {
|
||||
var lListen;
|
||||
if(lConfig.socket && Socket)
|
||||
lListen = Socket.listen(pServer);
|
||||
|
|
@ -87,25 +87,23 @@
|
|||
Util.log('* Sockets ' + (lListen ? 'running' : 'disabled'));
|
||||
},
|
||||
|
||||
lHTTPServer = function(){
|
||||
lHTTPServer = function() {
|
||||
Server = http.createServer( controller );
|
||||
Server.on('error', function (pError) {
|
||||
Util.log(pError);
|
||||
});
|
||||
Server.on('error', Util.log);
|
||||
Server.listen(lPort, lIP);
|
||||
lServerLog(lHTTP, lPort);
|
||||
lSockets(Server);
|
||||
},
|
||||
|
||||
lServerLog = function(pHTTP, pPort){
|
||||
lServerLog = function(pHTTP, pPort) {
|
||||
Util.log('* Server running at ' + pHTTP + lIP + ':' + pPort);
|
||||
};
|
||||
/* server mode or testing mode */
|
||||
if (lConfig.server) {
|
||||
if(lSSL){
|
||||
if (lSSL) {
|
||||
Util.log('* Redirection http -> https is setted up');
|
||||
lServerLog(lHTTP, lPort);
|
||||
var lRedirectServer = http.createServer( function(pReq, pRes){
|
||||
var lRedirectServer = http.createServer( function(pReq, pRes) {
|
||||
var lHost = pReq.headers.host;
|
||||
|
||||
main.redirect({
|
||||
|
|
@ -143,8 +141,7 @@
|
|||
* @param req - запрос клиента (Request)
|
||||
* @param res - ответ сервера (Response)
|
||||
*/
|
||||
function controller(pReq, pRes)
|
||||
{
|
||||
function controller(pReq, pRes) {
|
||||
/* Читаем содержимое папки, переданное в url */
|
||||
var lRet, lName, lMin, lExt, lResult,
|
||||
lConfig = main.config,
|
||||
|
|
@ -169,8 +166,7 @@
|
|||
if( !lRet && Route)
|
||||
lRet = Util.exec(Route, lData);
|
||||
|
||||
if(!lRet){
|
||||
/* добавляем текующий каталог к пути */
|
||||
if(!lRet) {
|
||||
lName = lData.name;
|
||||
Util.log('reading ' + lName);
|
||||
|
||||
|
|
@ -180,8 +176,7 @@
|
|||
|
||||
Util.log(Path.basename(lName));
|
||||
|
||||
lName = DIR + lName;
|
||||
|
||||
lName = Path.join(DIR, lName);
|
||||
lMin = Minify.allowed,
|
||||
lExt = Util.getExtension(lName),
|
||||
lResult = lExt === '.js' && lMin.js ||
|
||||
|
|
@ -189,7 +184,7 @@
|
|||
lExt === '.html' && lMin.html;
|
||||
|
||||
Util.ifExec(!lResult,
|
||||
function(pParams){
|
||||
function(pParams) {
|
||||
var lSendName = pParams && pParams.name || lName;
|
||||
|
||||
main.sendFile({
|
||||
|
|
@ -199,7 +194,7 @@
|
|||
request : pReq,
|
||||
response : pRes
|
||||
});
|
||||
}, function(pCallBack){
|
||||
}, function(pCallBack) {
|
||||
Minify.optimize(lName, {
|
||||
callback : pCallBack,
|
||||
returnName : true
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
(function(){
|
||||
"use strict";
|
||||
|
||||
if(!global.cloudcmd)
|
||||
if (!global.cloudcmd)
|
||||
return console.log(
|
||||
'# appcache.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
'# used for work with Aplication Cache.' + '\n' +
|
||||
'# If you wont to see at work set appcache: true' + '\n' +
|
||||
'# in config.json and start cloudcmd.js' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
fs = main.fs,
|
||||
|
|
@ -39,47 +39,55 @@
|
|||
* exports.addFiles(['jquery.js', 'client.js']);
|
||||
* exports.addFiles([{'http://cdn.jquery/jq.js':'jquery.js'}, 'client.js']);
|
||||
*/
|
||||
exports.addFiles = function(pFileNames){
|
||||
exports.addFiles = function(pFileNames) {
|
||||
var i, n, lName, lCurrentName,
|
||||
watch = exports.watch;
|
||||
|
||||
/* if a couple files */
|
||||
if(pFileNames instanceof Array)
|
||||
for(var i=0; i < pFileNames.length; i++){
|
||||
if (Util.isArray(pFileNames)) {
|
||||
n = pFilesNames.length;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
/* if fallback setted up */
|
||||
var lCurrentName = pFileNames[i];
|
||||
if(typeof lCurrentName === 'object')
|
||||
for(var lName in lCurrentName){
|
||||
lCurrentName = pFileNames[i];
|
||||
|
||||
if (Util.isObject(lCurrentName))
|
||||
for (lName in lCurrentName) {
|
||||
FallBack_s += lName + ' ' + lCurrentName[lName] + '\n';
|
||||
exports.watch(lCurrentName[lName]);
|
||||
watch(lCurrentName[lName]);
|
||||
}
|
||||
|
||||
else exports.watch(pFileNames[i]);
|
||||
else
|
||||
watch(pFileNames[i]);
|
||||
}
|
||||
else exports.watch(pFileNames);
|
||||
} else
|
||||
watch(pFileNames);
|
||||
|
||||
};
|
||||
|
||||
|
||||
exports.createManifest = function(){
|
||||
var lAllNames = main.require('node_modules/minify/hashes');
|
||||
if(lAllNames)
|
||||
for(var lName in lAllNames){
|
||||
if(lName.indexOf('min') > 0)
|
||||
|
||||
if (lAllNames)
|
||||
for (var lName in lAllNames){
|
||||
if (lName.indexOf('min') > 0)
|
||||
lName = 'node_modules/minify/min/' + lName;
|
||||
exports.watch(lName);
|
||||
}
|
||||
processManifest();
|
||||
};
|
||||
|
||||
exports.watch = function(pFileName){
|
||||
console.log(pFileName + ' is watched');
|
||||
|
||||
if(!FileNames[pFileName] &&
|
||||
pFileName !== './cloudcmd.appcache'){
|
||||
|
||||
exports.watch = function(pFileName) {
|
||||
if (!FileNames[pFileName] &&
|
||||
pFileName !== './cloudcmd.appcache') {
|
||||
|
||||
Util.log(pFileName + ' is watched');
|
||||
|
||||
/* adding try...catch
|
||||
* if watched files would be more then system limit
|
||||
*/
|
||||
var lWatch_f = function(){
|
||||
Util.tryCatch(function(){
|
||||
var lWatch_f = function() {
|
||||
Util.tryCatch(function() {
|
||||
fs_watch(pFileName, on_fs_watch(pFileName));
|
||||
});
|
||||
};
|
||||
|
|
@ -87,26 +95,26 @@
|
|||
/* if file.exists function exist and
|
||||
* file actually exists
|
||||
*/
|
||||
if(fs.exists)
|
||||
if (fs.exists)
|
||||
fs.exists(pFileName, lWatch_f);
|
||||
else lWatch_f();
|
||||
else
|
||||
lWatch_f();
|
||||
|
||||
NamesList_s += pFileName + '\n';
|
||||
FileNames[pFileName] = true;
|
||||
}
|
||||
else if(firstFileRead_b){
|
||||
} else if (firstFileRead_b) {
|
||||
processManifest();
|
||||
firstFileRead_b = false;
|
||||
}
|
||||
};
|
||||
|
||||
function setWatachFunctions(){
|
||||
if(main.WIN32){
|
||||
function setWatachFunctions() {
|
||||
if (main.WIN32) {
|
||||
/* good on windows */
|
||||
fs_watch = fs.watch;
|
||||
on_fs_watch = onWatch;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
/* good on linux */
|
||||
fs_watch = fs.watchFile;
|
||||
on_fs_watch = onWatchFile;
|
||||
|
|
@ -114,24 +122,24 @@
|
|||
|
||||
}
|
||||
|
||||
function onWatch (){
|
||||
return function(pEvent, pFileName){
|
||||
console.log(pEvent);
|
||||
console.log('file ' + pFileName + ' is changed');
|
||||
function onWatch () {
|
||||
return function(pEvent, pFileName) {
|
||||
Util.log(pEvent);
|
||||
Util.log('file ' + pFileName + ' is changed');
|
||||
processManifest();
|
||||
};
|
||||
}
|
||||
|
||||
function onWatchFile(pFileName){
|
||||
return function(pCurr, pPrev){
|
||||
if(pCurr.mtime !== pPrev.mtime){
|
||||
console.log('file ' + pFileName + ' is changed');
|
||||
function onWatchFile(pFileName) {
|
||||
return function(pCurr, pPrev) {
|
||||
if (pCurr.mtime !== pPrev.mtime) {
|
||||
Util.log('file ' + pFileName + ' is changed');
|
||||
processManifest();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function processManifest(){
|
||||
function processManifest() {
|
||||
Manifest = 'CACHE MANIFEST\n' +
|
||||
'#' + new Date() + '\n' +
|
||||
'CACHE:\n' +
|
||||
|
|
@ -141,8 +149,8 @@
|
|||
'FALLBACK:\n' +
|
||||
FallBack_s;
|
||||
|
||||
fs.writeFile('cloudcmd.appcache', Manifest, function(){
|
||||
console.log('cloudcmd.appcache refreshed');
|
||||
fs.writeFile('cloudcmd.appcache', Manifest, function() {
|
||||
Util.log('cloudcmd.appcache refreshed');
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
'# parameters in config.json or environment' + '\n' +
|
||||
'# and start cloudcmd.js or just do' + '\n' +
|
||||
'# require(\'auth.js\').auth(pCode, pCallBack)' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
if(!global.cloudcmd)
|
||||
return console.log(
|
||||
'# commander.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for getting dir content.' + '\n' +
|
||||
'# and forming html content' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# commander.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for getting dir content.' + '\n' +
|
||||
'# and forming html content' + '\n' +
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
fs = main.fs,
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
|
||||
if(!global.cloudcmd)
|
||||
return console.log(
|
||||
'# dir.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for getting dir size.' + '\n' +
|
||||
'# If you wont to see at work' + '\n' +
|
||||
'# try GET /api/v1/fs/etc?size or' + '\n' +
|
||||
'# dir.getSize(\'/etc, function(err, size){' + '\n' +
|
||||
'# });' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# dir.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for getting dir size.' + '\n' +
|
||||
'# If you wont to see at work' + '\n' +
|
||||
'# try GET /api/v1/fs/etc?size or' + '\n' +
|
||||
'# dir.getSize(\'/etc, function(err, size) {' + '\n' +
|
||||
'# });' + '\n' +
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
fs = main.fs,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
fs.stat(pFileName, function(pError, pStat){
|
||||
var lTimeChanged, lFileTime;
|
||||
|
||||
if (!pError){
|
||||
if (!pError) {
|
||||
lFileTime = pStat.mtime.getTime();
|
||||
|
||||
if(lReadedTime !== lFileTime)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
(function(){
|
||||
'strict mode';
|
||||
'use strict';
|
||||
|
||||
/* Global var accessible from any loaded module */
|
||||
global.cloudcmd = {};
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
SLASH,
|
||||
ISWIN32,
|
||||
ext,
|
||||
path, fs, zlib, url,
|
||||
path, fs, zlib, url, pipe,
|
||||
|
||||
OK, FILE_NOT_FOUND, MOVED_PERMANENTLY = 301,
|
||||
REQUEST, RESPONSE,
|
||||
|
|
@ -100,6 +100,7 @@
|
|||
exports.VOLUMES = getVolumes(),
|
||||
|
||||
/* Additional Modules */
|
||||
exports.pipe = pipe = srvrequire('pipe'),
|
||||
exports.socket = srvrequire('socket'),
|
||||
exports.auth = srvrequire('auth').auth,
|
||||
exports.appcache = srvrequire('appcache'),
|
||||
|
|
@ -220,21 +221,11 @@
|
|||
* @param pGzip - данные сжаты gzip'ом
|
||||
*/
|
||||
function sendFile(pParams){
|
||||
var lZipStream, lRet = checkParams(pParams);
|
||||
|
||||
if(lRet){
|
||||
var lRet = checkParams(pParams);
|
||||
if (lRet) {
|
||||
var p = pParams,
|
||||
lGzip = isGZIP(p.request) && p.gzip,
|
||||
|
||||
lReadStream = fs.createReadStream(p.name, {
|
||||
'bufferSize': 4 * 1024
|
||||
});
|
||||
|
||||
lReadStream.on('error', function(pError){
|
||||
p.response.writeHead(FILE_NOT_FOUND, 'OK');
|
||||
p.response.end(String(pError));
|
||||
});
|
||||
|
||||
lGzip = isGZIP(p.request) && p.gzip;
|
||||
|
||||
p.response.writeHead(OK, generateHeaders({
|
||||
name : p.name,
|
||||
cache : p.cache,
|
||||
|
|
@ -242,14 +233,18 @@
|
|||
query : getQuery(p.request)
|
||||
}) );
|
||||
|
||||
if (lGzip && !p.gziped)
|
||||
lZipStream = lReadStream.pipe( zlib.createGzip() );
|
||||
else
|
||||
lZipStream = lReadStream;
|
||||
|
||||
lZipStream.pipe(p.response);
|
||||
|
||||
lRet = true;
|
||||
pipe.create({
|
||||
from: p.name,
|
||||
write: p.response,
|
||||
zip : lGzip && !p.gziped,
|
||||
callback: function(pError) {
|
||||
var lError = pError && pError.toString();
|
||||
if (pError) {
|
||||
p.response.writeHead(FILE_NOT_FOUND, 'OK');
|
||||
p.response.end(lError);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return lRet;
|
||||
|
|
@ -280,10 +275,10 @@
|
|||
|
||||
/* если браузер поддерживает gzip-сжатие - сжимаем данные*/
|
||||
Util.ifExec(!lGzip,
|
||||
function(pParams){
|
||||
function(pParams) {
|
||||
var lRet = Util.checkObj(pParams, ['data']);
|
||||
|
||||
if(lRet){
|
||||
if(lRet) {
|
||||
p.status = pParams.status || p.status;
|
||||
p.data = pParams.data;
|
||||
}
|
||||
|
|
@ -294,7 +289,7 @@
|
|||
Util.log( p.name + ' sended');
|
||||
},
|
||||
|
||||
function(pCallBack){
|
||||
function(pCallBack) {
|
||||
zlib.gzip (p.data || pData, Util.call(gzipData, {
|
||||
callback : pCallBack
|
||||
}));
|
||||
|
|
@ -322,13 +317,15 @@
|
|||
/**
|
||||
* send error response
|
||||
*/
|
||||
function sendError(pParams, pError){
|
||||
function sendError(pParams, pError) {
|
||||
var lRet = checkParams(pParams);
|
||||
|
||||
if(lRet){
|
||||
var p = pParams;
|
||||
p.status = FILE_NOT_FOUND;
|
||||
p.data = p.data || pError.toString();
|
||||
if (!p.data && pError)
|
||||
p.data = pError.toString();
|
||||
|
||||
sendResponse(p);
|
||||
}
|
||||
}
|
||||
|
|
@ -398,7 +395,7 @@
|
|||
else
|
||||
lFiles = [pFiles];
|
||||
|
||||
for(var i = 0, n = lFiles.length; i < n; i++){
|
||||
for(var i = 0, n = lFiles.length; i < n; i++) {
|
||||
var lName = lFiles.pop();
|
||||
lDone.push(lName);
|
||||
|
||||
|
|
@ -409,7 +406,7 @@
|
|||
function checkParams(pParams, pAdditional){
|
||||
var lRet = Util.checkObjTrue( pParams, ['name', REQUEST, RESPONSE] );
|
||||
|
||||
if(lRet && pAdditional)
|
||||
if (lRet && pAdditional)
|
||||
lRet = Util.checkObjTrue( pParams, pAdditional);
|
||||
|
||||
return lRet;
|
||||
|
|
@ -418,7 +415,7 @@
|
|||
function getQuery(pReq){
|
||||
var lQuery, lParsedUrl;
|
||||
|
||||
if(pReq){
|
||||
if (pReq) {
|
||||
lParsedUrl = url.parse(pReq.url);
|
||||
lQuery = lParsedUrl.query;
|
||||
}
|
||||
|
|
@ -428,7 +425,7 @@
|
|||
|
||||
function isGZIP(pReq){
|
||||
var lEnc, lGZIP;
|
||||
if(pReq){
|
||||
if (pReq) {
|
||||
lEnc = pReq.headers['accept-encoding'] || '';
|
||||
lGZIP = lEnc.match(/\bgzip\b/);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
/* Обьект для сжатия скриптов и стилей */
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
if(!global.cloudcmd)
|
||||
return console.log(
|
||||
'# minify.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for work with minification.' + '\n' +
|
||||
'# If you wont to see at work set minify' + '\n' +
|
||||
'# parameters in config.json or environment' + '\n' +
|
||||
'# and start cloudcmd.js' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# minify.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for work with minification.' + '\n' +
|
||||
'# If you wont to see at work set minify' + '\n' +
|
||||
'# parameters in config.json or environment' + '\n' +
|
||||
'# and start cloudcmd.js' + '\n' +
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
DIR = main.DIR,
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
* img отвечает за перевод картинок в base64
|
||||
* и сохранение их в css-файл
|
||||
*/
|
||||
setAllowed :function(pAllowed){
|
||||
setAllowed :function(pAllowed) {
|
||||
this.allowed = pAllowed && Minify ? pAllowed : {
|
||||
js : false,
|
||||
css : false,
|
||||
|
|
@ -54,9 +54,9 @@
|
|||
};
|
||||
},
|
||||
|
||||
optimize: function(pName, pParams){
|
||||
optimize: function(pName, pParams) {
|
||||
var lRet;
|
||||
if(Minify){
|
||||
if (Minify) {
|
||||
pParams.name = Minify.getName(pName);
|
||||
|
||||
lRet = this.allowed.css || this.allowed.js || this.allowed.html;
|
||||
|
|
@ -67,14 +67,14 @@
|
|||
if(pParams && pParams.force)
|
||||
Minify.optimize(pName, pParams);
|
||||
else if(lRet)
|
||||
IsChanged.isFileChanged(pName, function(pChanged){
|
||||
IsChanged.isFileChanged(pName, function(pChanged) {
|
||||
if(pChanged)
|
||||
Minify.optimize(pName, pParams);
|
||||
else
|
||||
Util.exec(pParams.callback, pParams);
|
||||
});
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.allowed = {
|
||||
js : false,
|
||||
css : false,
|
||||
|
|
|
|||
60
lib/server/pipe.js
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
if (!global.cloudcmd)
|
||||
return console.log(
|
||||
'# pipe.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for work with stream.' + '\n' +
|
||||
'# If you wont to see at work call' + '\n' +
|
||||
'# stream.createPipe' + '\n' +
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
fs = main.fs,
|
||||
Util = main.util,
|
||||
zlib = main.zlib;
|
||||
|
||||
exports.create = function(pParams) {
|
||||
var lZlib, lError, lMsg, lRead, lWrite, lIsFsWrite,
|
||||
p = pParams;
|
||||
|
||||
if (p) {
|
||||
lRead = p.read || fs.createReadStream(p.from, {
|
||||
bufferSize: 4 * 1024
|
||||
});
|
||||
|
||||
if (p.write)
|
||||
lWrite = p.write;
|
||||
else {
|
||||
lWrite = fs.createWriteStream(p.to);
|
||||
lIsFsWrite = true;
|
||||
}
|
||||
|
||||
lError = function(pError) {
|
||||
Util.exec(p.callback, pError);
|
||||
};
|
||||
|
||||
if (p.zip) {
|
||||
lZlib = zlib.createGzip();
|
||||
lRead.on('error', lError);
|
||||
lRead = lRead.pipe(lZlib);
|
||||
}
|
||||
|
||||
lWrite.on('error', lError);
|
||||
lRead.on('error', lError);
|
||||
|
||||
if (lIsFsWrite)
|
||||
lWrite.on('open', function() {
|
||||
lRead.pipe(lWrite);
|
||||
lRead.on('end', Util.retExec(p.callback));
|
||||
});
|
||||
else {
|
||||
lRead.pipe(lWrite);
|
||||
lRead.on('end', Util.retExec(p.callback));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
/* RESTfull module */
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
if(!global.cloudcmd)
|
||||
if (!global.cloudcmd)
|
||||
return console.log(
|
||||
'# rest.js' + '\n' +
|
||||
'# -----------' + '\n' +
|
||||
|
|
@ -11,12 +11,13 @@
|
|||
'# used for work with REST API.' + '\n' +
|
||||
'# If you wont to see at work set rest: true' + '\n' +
|
||||
'# and api_url in config.json' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
fs = main.fs,
|
||||
path = main.path,
|
||||
Util = main.util,
|
||||
pipe = main.pipe,
|
||||
CloudFunc = main.cloudfunc,
|
||||
dir = main.dir,
|
||||
OK = 200,
|
||||
|
|
@ -28,14 +29,15 @@
|
|||
* rest interface
|
||||
* @pParams {request, responce}
|
||||
*/
|
||||
exports.api = function(pParams){
|
||||
exports.api = function(pParams) {
|
||||
var lRet = main.checkParams(pParams);
|
||||
if(lRet){
|
||||
|
||||
if (lRet) {
|
||||
var lAPIURL = main.config.api_url,
|
||||
p = pParams;
|
||||
|
||||
lRet = Util.isContainStr(p.name, lAPIURL);
|
||||
if( lRet ){
|
||||
if (lRet) {
|
||||
p.name = Util.removeStrOneTime(p.name, lAPIURL);
|
||||
sendData( pParams);
|
||||
}
|
||||
|
|
@ -49,7 +51,7 @@
|
|||
* @param pRes
|
||||
* @param pData
|
||||
*/
|
||||
function send(pParams){
|
||||
function send(pParams) {
|
||||
var lRes = pParams.response,
|
||||
lData = pParams.data;
|
||||
|
||||
|
|
@ -62,12 +64,12 @@
|
|||
*
|
||||
* @param pParams {command, method, body, requrest, response}
|
||||
*/
|
||||
function sendData(pParams){
|
||||
function sendData(pParams) {
|
||||
var p, lRet = main.checkParams(pParams);
|
||||
if(lRet){
|
||||
p = pParams;
|
||||
|
||||
p = pParams;
|
||||
lRet = Util.isContainStrAtBegin(p.name, CloudFunc.FS);
|
||||
|
||||
if (lRet)
|
||||
onFS(pParams);
|
||||
else {
|
||||
|
|
@ -91,137 +93,137 @@
|
|||
return lRet;
|
||||
}
|
||||
|
||||
function onFS(pParams){
|
||||
var p, lError, lWriteStream, lSize, lQuery,
|
||||
function onFS(pParams) {
|
||||
var p, lError, lMsg, lSize, lQuery,
|
||||
lRet = main.checkParams(pParams);
|
||||
if(lRet){
|
||||
|
||||
if (lRet){
|
||||
p = pParams,
|
||||
lQuery = main.getQuery(p.request);
|
||||
|
||||
p.name = Util.removeStrOneTime(p.name, CloudFunc.FS) || '/';
|
||||
switch(p.request.method){
|
||||
case 'GET':
|
||||
if( Util.strCmp(lQuery, 'size') )
|
||||
dir.getSize(p.name, function(pErr, pSize){
|
||||
if (!pErr){
|
||||
lSize = CloudFunc.getShortSize(pSize);
|
||||
Util.log(lSize);
|
||||
main.sendResponse(p, lSize);
|
||||
}
|
||||
else
|
||||
main.sendError(p, pErr);
|
||||
});
|
||||
else
|
||||
fs.stat(p.name, function(pError, pStat){
|
||||
if(!pError)
|
||||
if( pStat.isDirectory() )
|
||||
main.commander.getDirContent(p.name, function(pError, pData){
|
||||
if(!pError){
|
||||
p.name += '.json';
|
||||
p.data = Util.stringifyJSON(pData);
|
||||
main.sendResponse(p);
|
||||
}
|
||||
else
|
||||
main.sendError(p, pError);
|
||||
});
|
||||
else
|
||||
main.sendFile(p);
|
||||
else
|
||||
main.sendError(p, pError);
|
||||
|
||||
});
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
if (lQuery === 'dir')
|
||||
fs.mkdir(p.name, function(pError){
|
||||
if(!pError)
|
||||
main.sendResponse(pParams, 'Folder ' + p.name + ' created.');
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
else {
|
||||
lWriteStream = fs.createWriteStream(p.name);
|
||||
|
||||
lError = function(pError) {
|
||||
main.sendError(pParams, pError);
|
||||
};
|
||||
|
||||
lWriteStream.on('error', lError);
|
||||
p.request.on('error', lError);
|
||||
|
||||
lWriteStream.on('open', function() {
|
||||
p.request.pipe(lWriteStream);
|
||||
//p.request.pipe(process.stdout);
|
||||
p.request.on('end', function() {
|
||||
var lName = path.basename(p.name);
|
||||
main.sendResponse(pParams, 'save: ok("' + lName +'")');
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'DELETE':
|
||||
if(lQuery === 'dir')
|
||||
fs.rmdir(p.name, function(pError){
|
||||
if(!pError)
|
||||
main.sendResponse(pParams, 'Folder ' + p.name + ' deleted.');
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
else if(lQuery === 'files'){
|
||||
getBody(p.request, function(pBody){
|
||||
var lFiles = Util.parseJSON(pBody),
|
||||
n = lFiles.length,
|
||||
lDir = p.name,
|
||||
log = Util.retExec(Util.log),
|
||||
lAssync = 0;
|
||||
|
||||
function stat(pStat){
|
||||
var lRet = Util.checkObjTrue(pStat, 'params') &&
|
||||
Util.checkObjTrue(pStat.params, 'name');
|
||||
|
||||
if(lRet){
|
||||
var p = pStat,
|
||||
d = p.params;
|
||||
|
||||
++lAssync;
|
||||
|
||||
if( p.error ){
|
||||
main.sendError(pParams, p.error);
|
||||
Util.log(p.error);
|
||||
|
||||
switch (p.request.method) {
|
||||
case 'GET':
|
||||
if (Util.strCmp(lQuery, 'size'))
|
||||
dir.getSize(p.name, function(pErr, pSize) {
|
||||
if (!pErr){
|
||||
lSize = CloudFunc.getShortSize(pSize);
|
||||
Util.log(lSize);
|
||||
main.sendResponse(p, lSize);
|
||||
}
|
||||
else
|
||||
main.sendError(p, pErr);
|
||||
});
|
||||
else
|
||||
fs.stat(p.name, function(pError, pStat) {
|
||||
if (!pError)
|
||||
if (pStat.isDirectory())
|
||||
main.commander.getDirContent(p.name, function(pError, pData) {
|
||||
if (!pError){
|
||||
p.name += '.json';
|
||||
p.data = Util.stringifyJSON(pData);
|
||||
main.sendResponse(p);
|
||||
}
|
||||
else
|
||||
if(p.data.isDirectory())
|
||||
fs.rmdir(d.name, log);
|
||||
|
||||
else if(p.data.isFile())
|
||||
fs.unlink(d.name, log);
|
||||
|
||||
if(lAssync === n && !p.error)
|
||||
main.sendResponse(pParams, 'Files deleted: ' + pBody);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(var i = 0; i < n; i ++){
|
||||
var lName = lDir + lFiles[i];
|
||||
Util.log(lName);
|
||||
fs.stat(lName, Util.call(stat, {
|
||||
name: lName
|
||||
}));
|
||||
}
|
||||
});
|
||||
}else
|
||||
fs.unlink(p.name, function(pError){
|
||||
if(!pError)
|
||||
main.sendResponse(pParams, 'File ' + p.name + ' delete.');
|
||||
main.sendError(p, pError);
|
||||
});
|
||||
else
|
||||
main.sendFile(p);
|
||||
else
|
||||
main.sendError(p, pError);
|
||||
|
||||
});
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
if (lQuery === 'dir')
|
||||
fs.mkdir(p.name, function(pError) {
|
||||
if (!pError)
|
||||
sendMsg(pParams, 'make dir', p.name);
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
|
||||
else
|
||||
pipe.create({
|
||||
read : p.request,
|
||||
to : p.name,
|
||||
callback : function(pError) {
|
||||
var lName;
|
||||
|
||||
if (pError)
|
||||
main.sendError(pParams, pError);
|
||||
else {
|
||||
lName = path.basename(p.name);
|
||||
sendMsg(pParams, 'save', lName);
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case 'DELETE':
|
||||
if (lQuery === 'dir')
|
||||
fs.rmdir(p.name, function(pError){
|
||||
if (!pError)
|
||||
sendMsg(pParams, 'delete', p.name);
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
else if (lQuery === 'files') {
|
||||
getBody(p.request, function(pBody) {
|
||||
var lFiles = Util.parseJSON(pBody),
|
||||
n = lFiles.length,
|
||||
lDir = p.name,
|
||||
log = Util.retExec(Util.log),
|
||||
lAssync = 0;
|
||||
|
||||
function stat(pStat) {
|
||||
var lRet = Util.checkObjTrue(pStat, 'params') &&
|
||||
Util.checkObjTrue(pStat.params, 'name');
|
||||
|
||||
if (lRet) {
|
||||
var p = pStat,
|
||||
d = p.params;
|
||||
|
||||
++lAssync;
|
||||
|
||||
if (p.error){
|
||||
main.sendError(pParams, p.error);
|
||||
Util.log(p.error);
|
||||
}
|
||||
else
|
||||
if (p.data.isDirectory())
|
||||
fs.rmdir(d.name, log);
|
||||
|
||||
else if (p.data.isFile())
|
||||
fs.unlink(d.name, log);
|
||||
|
||||
if (lAssync === n && !p.error)
|
||||
sendMsg(pParams, 'delete', pBody);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(var i = 0; i < n; i ++) {
|
||||
var lName = lDir + lFiles[i];
|
||||
Util.log(lName);
|
||||
fs.stat(lName, Util.call(stat, {
|
||||
name: lName
|
||||
}));
|
||||
}
|
||||
});
|
||||
}else
|
||||
fs.unlink(p.name, function(pError) {
|
||||
if (!pError)
|
||||
sendMsg(pParams, 'delete', p.name);
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
||||
|
|
@ -230,40 +232,41 @@
|
|||
*
|
||||
* @param pParams {command, method, body, requrest, response}
|
||||
*/
|
||||
function onGET(pParams){
|
||||
function onGET(pParams) {
|
||||
var lRet = main.checkParams(pParams);
|
||||
if(lRet){
|
||||
if (lRet) {
|
||||
var p = pParams,
|
||||
lCmd = p.command;
|
||||
|
||||
switch(lCmd){
|
||||
case '':
|
||||
p.data = {
|
||||
info: 'Cloud Commander API v1'
|
||||
};
|
||||
send(p);
|
||||
break;
|
||||
switch(lCmd) {
|
||||
case '':
|
||||
p.data = {
|
||||
info: 'Cloud Commander API v1'
|
||||
};
|
||||
send(p);
|
||||
break;
|
||||
|
||||
case 'proxy':
|
||||
|
||||
case 'proxy':
|
||||
|
||||
break;
|
||||
|
||||
case 'zip':
|
||||
main.sendFile(pParams);
|
||||
break;
|
||||
|
||||
case 'kill':
|
||||
p.data = {
|
||||
mesage: 'Cloud Commander was killed'
|
||||
};
|
||||
send(p);
|
||||
break;
|
||||
default:
|
||||
p.data = {
|
||||
error: 'command not found'
|
||||
};
|
||||
send(p);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'zip':
|
||||
main.sendFile(pParams);
|
||||
break;
|
||||
|
||||
case 'kill':
|
||||
p.data = {
|
||||
mesage: 'Cloud Commander was killed'
|
||||
};
|
||||
send(p);
|
||||
break;
|
||||
|
||||
default:
|
||||
p.data = {
|
||||
error: 'command not found'
|
||||
};
|
||||
send(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -275,72 +278,87 @@
|
|||
*
|
||||
* @param pParams {command, method, body, requrest, response}
|
||||
*/
|
||||
function onPUT(pParams){
|
||||
function onPUT(pParams) {
|
||||
var lRet = main.checkParams(pParams, ['body']);
|
||||
if(lRet){
|
||||
if (lRet) {
|
||||
var p = pParams,
|
||||
lCmd = p.command,
|
||||
lFiles = Util.parseJSON(p.body);
|
||||
console.log(p.body);
|
||||
switch(lCmd){
|
||||
case 'auth':
|
||||
main.auth(p.body, function(pTocken){
|
||||
send({
|
||||
response: p.response,
|
||||
data: pTocken
|
||||
});
|
||||
|
||||
switch(lCmd) {
|
||||
case 'auth':
|
||||
main.auth(p.body, function(pTocken){
|
||||
send({
|
||||
response: p.response,
|
||||
data: pTocken
|
||||
});
|
||||
break;
|
||||
|
||||
case 'cmd':
|
||||
main.child_process.exec(p.body, function(pError, pStdout, pStderr){
|
||||
var lError = pError || pStderr;
|
||||
if(!lError)
|
||||
main.sendResponse(pParams, pStdout);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'cmd':
|
||||
main.child_process.exec(p.body, function(pError, pStdout, pStderr) {
|
||||
var lError = pError || pStderr;
|
||||
if (!lError)
|
||||
main.sendResponse(pParams, pStdout);
|
||||
else
|
||||
main.sendError(pParams, lError);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'mv':
|
||||
if( Util.checkObjTrue(lFiles, ['from', 'to']) )
|
||||
fs.rename(lFiles.from, lFiles.to, function(pError) {
|
||||
if(!pError)
|
||||
main.sendResponse(pParams);
|
||||
else
|
||||
main.sendError(pParams, lError);
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'mv':
|
||||
if( Util.checkObjTrue(lFiles, ['from', 'to']) )
|
||||
fs.rename(lFiles.from, lFiles.to, function(pError){
|
||||
if(!pError)
|
||||
main.sendResponse(pParams);
|
||||
else
|
||||
main.sendError(pParams, p.data);
|
||||
break;
|
||||
|
||||
case 'cp':
|
||||
if (Util.checkObjTrue(lFiles, ['from', 'to']))
|
||||
pipe.create({
|
||||
from : lFiles.from,
|
||||
to : lFiles.to,
|
||||
callback : function(pError) {
|
||||
if (pError)
|
||||
main.sendError(pParams, pError);
|
||||
else
|
||||
sendMsg(pParams, 'copy', lFiles.to);
|
||||
}
|
||||
});
|
||||
else
|
||||
main.sendError(pParams, p.data);
|
||||
break;
|
||||
|
||||
case 'zip':
|
||||
if (Util.checkObjTrue(lFiles, ['from']))
|
||||
pipe.create({
|
||||
from : lFiles.from,
|
||||
to : lFiles.to || lFiles.from + '.zip',
|
||||
zip : true,
|
||||
callback : function(pError) {
|
||||
var lName;
|
||||
|
||||
if (pError)
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
else
|
||||
main.sendError(pParams, p.data);
|
||||
break;
|
||||
|
||||
case 'cp':
|
||||
if( Util.checkObjTrue(lFiles, ['from', 'to']) ){
|
||||
var l = lFiles,
|
||||
lReadStream = fs.createReadStream(l.from),
|
||||
lWriteStream = fs.createWriteStream(l.to),
|
||||
|
||||
lError = function(pError){
|
||||
main.sendError(pParams, pError);
|
||||
};
|
||||
|
||||
lWriteStream.on('error', lError);
|
||||
lReadStream.on('error', lError);
|
||||
|
||||
lReadStream.on('end', function(){
|
||||
main.sendResponse(pParams, 'copied to: ' + l.to);
|
||||
});
|
||||
|
||||
lReadStream.pipe(lWriteStream);
|
||||
}
|
||||
else
|
||||
main.sendError(pParams, p.data);
|
||||
break;
|
||||
default:
|
||||
send(pParams);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
lName = path.basename(lFiles.from);
|
||||
sendMsg(pParams, 'zip', lName);
|
||||
}
|
||||
}
|
||||
});
|
||||
else
|
||||
main.sendError(pParams, p.data);
|
||||
break;
|
||||
|
||||
default:
|
||||
send(pParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
|
@ -351,10 +369,10 @@
|
|||
* @param pReq
|
||||
* @param pCallBack
|
||||
*/
|
||||
function getBody(pReq, pCallBack){
|
||||
function getBody(pReq, pCallBack) {
|
||||
var lBody = '';
|
||||
|
||||
pReq.on('data', function(chunk){
|
||||
pReq.on('data', function(chunk) {
|
||||
lBody += chunk.toString();
|
||||
});
|
||||
|
||||
|
|
@ -363,4 +381,9 @@
|
|||
});
|
||||
}
|
||||
|
||||
function sendMsg(pParams, pMsg, pName) {
|
||||
var msg = CloudFunc.formatMsg(pMsg, pName);
|
||||
main.sendResponse(pParams, msg);
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -47,8 +47,27 @@
|
|||
lConnNum = 0;
|
||||
|
||||
lListen.set('log level', INFO_LOG_LEVEL);
|
||||
lListen.set('browser client minification', true);
|
||||
lListen.set('browser client gzip', true);
|
||||
|
||||
/*
|
||||
* on Win7 application is crashing,
|
||||
* when options below is used.
|
||||
*
|
||||
* https://github.com/LearnBoost/socket.io/issues/1314
|
||||
*
|
||||
*/
|
||||
if (!WIN32) {
|
||||
lListen.enable('browser client minification');
|
||||
lListen.enable('browser client gzip');
|
||||
lListen.enable('browser client etag');
|
||||
}
|
||||
|
||||
lListen.set('transports', [
|
||||
'websocket',
|
||||
'flashsocket',
|
||||
'htmlfile',
|
||||
'xhr-polling',
|
||||
'jsonp-polling'
|
||||
]);
|
||||
|
||||
lRet = lListen.sockets.on('connection', function (socket){
|
||||
++lConnNum;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for work update thru git.' + '\n' +
|
||||
'# If you wont to see at work install git' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
mainpackage = main.mainpackage || {},
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
DIR = main.DIR;
|
||||
|
||||
exports.get = function(){
|
||||
exec('git pull', {cwd : DIR}, pull);
|
||||
exec('git pull --rebase', {cwd : DIR}, pull);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -29,22 +29,23 @@
|
|||
* @param pStderr
|
||||
*/
|
||||
function pull(pError, pStdout, pStderr){
|
||||
var lExec, lStdout,
|
||||
var lExec, lMsg,
|
||||
lError = pError || pStderr,
|
||||
lName = mainpackage.name,
|
||||
lVersion = mainpackage.version;
|
||||
lVersion = mainpackage.version,
|
||||
lIsUpToDate = ' is up to date.';
|
||||
|
||||
if(!pError) {
|
||||
pStderr = '';
|
||||
|
||||
if (pStdout !== 'Already up-to-date.\n')
|
||||
lStdout = ' updated, restart to use new version.';
|
||||
if (Util.isContainStr(pStdout, lIsUpToDate))
|
||||
lMsg = lIsUpToDate;
|
||||
else
|
||||
lStdout = ' is up to date.';
|
||||
lMsg = ' updated, restart to use new version.';
|
||||
|
||||
lStdout = lName + ' v' + lVersion + lStdout;
|
||||
lMsg = lName + ' v' + lVersion + lMsg;
|
||||
|
||||
lExec = pStderr || pError || lStdout;
|
||||
lExec = pStderr || pError || lMsg;
|
||||
Util.log(lExec);
|
||||
} else
|
||||
Util.log(lError);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
'# Module is part of Cloud Commander,' + '\n' +
|
||||
'# used for work with windows specific' + '\n' +
|
||||
'# functions like work with drives(etc c).' + '\n' +
|
||||
'# http://coderaiser.github.com/cloudcmd' + '\n');
|
||||
'# http://cloudcmd.io' + '\n');
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
Charset ={
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
exports.getVolumes = function(pCallBack){
|
||||
var lCHCP = 'chcp ' + Charset.UNICODE,
|
||||
lGetVolumes = 'wmic logicaldisk get name'
|
||||
lGetVolumes = 'wmic logicaldisk get name';
|
||||
|
||||
exec(lCHCP + ' && ' + lGetVolumes, retProcessOuput(pCallBack));
|
||||
};
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
if(!lError) {
|
||||
lVolumes = Util.removeStr(pStdout, lRemoveStr)
|
||||
.split(' ')
|
||||
.split(' ');
|
||||
|
||||
lVolumes.pop();
|
||||
}
|
||||
|
|
|
|||
298
lib/util.js
|
|
@ -5,19 +5,45 @@
|
|||
var Util, exports;
|
||||
Util = exports || {};
|
||||
|
||||
(function(Util){
|
||||
(function(Util) {
|
||||
'use strict';
|
||||
|
||||
var Scope = exports ? global : window;
|
||||
|
||||
Util.asyncCall = function(pFuncs, pOnLoad, pContext) {
|
||||
var i, element, name, func,
|
||||
n = pFuncs.length,
|
||||
count = 0,
|
||||
data = [];
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
func = pFuncs[i];
|
||||
callCheckFunc(i, func);
|
||||
}
|
||||
|
||||
function checkFunc(pNum, pData) {
|
||||
++count;
|
||||
data[pNum] = pData;
|
||||
|
||||
if (count === n)
|
||||
pOnLoad.apply(pContext, data);
|
||||
}
|
||||
|
||||
function callCheckFunc(pNum, pFunc) {
|
||||
Util.exec(pFunc, function(pData){
|
||||
checkFunc(pNum, pData);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/** setting function context
|
||||
* @param {function} pFunction
|
||||
* @param {object} pContext
|
||||
*/
|
||||
Util.bind = function(pFunction, pContext){
|
||||
Util.bind = function(pFunction, pContext) {
|
||||
var lRet;
|
||||
|
||||
if ( Util.isFunction(pFunction) )
|
||||
if (Util.isFunction(pFunction))
|
||||
lRet = pFunction.bind(pContext);
|
||||
|
||||
return lRet;
|
||||
|
|
@ -30,8 +56,8 @@ Util = exports || {};
|
|||
* @param pFunc
|
||||
* @param pParams
|
||||
*/
|
||||
Util.call = function(pFunc, pParams){
|
||||
function lFunc(pError, pData){
|
||||
Util.call = function(pFunc, pParams) {
|
||||
function lFunc(pError, pData) {
|
||||
Util.exec(pFunc, {
|
||||
error : pError,
|
||||
data : pData,
|
||||
|
|
@ -48,27 +74,27 @@ Util = exports || {};
|
|||
* @param pName - получает имя файла
|
||||
* @param pExt - расширение
|
||||
*/
|
||||
Util.checkExtension = function(pName, pExt){
|
||||
var lRet = false,
|
||||
Util.checkExtension = function(pName, pExt) {
|
||||
var i, lExtNum, lExtSub,
|
||||
lRet = false,
|
||||
lLength = pName.length; /* длина имени*/
|
||||
|
||||
/* если длина имени больше длинны расширения - имеет смысл продолжать
|
||||
*/
|
||||
if (Util.isString(pExt) && pName.length > pExt.length) {
|
||||
var lExtNum = pName.lastIndexOf(pExt), /* последнее вхождение расширения*/
|
||||
lExtSub = lLength - lExtNum; /* длина расширения*/
|
||||
lExtNum = pName.lastIndexOf(pExt), /* последнее вхождение расширения*/
|
||||
lExtSub = lLength - lExtNum; /* длина расширения*/
|
||||
|
||||
/* если pExt - расширение pName */
|
||||
lRet = lExtSub === pExt.length;
|
||||
|
||||
}else if (Util.isObject(pExt) && pExt.length){
|
||||
for(var i=0; i < pName.length; i++){
|
||||
} else if (Util.isObject(pExt) && pExt.length)
|
||||
for(i = 0; i < pName.length; i++) {
|
||||
lRet = Util.checkExtension(pName, pExt[i]);
|
||||
|
||||
if (lRet)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
|
@ -81,17 +107,18 @@ Util = exports || {};
|
|||
* @param pPropArr
|
||||
* @param pTrueArr
|
||||
*/
|
||||
Util.checkObj = function(pObj, pPropArr, pTrueArr){
|
||||
Util.checkObj = function(pObj, pPropArr, pTrueArr) {
|
||||
var lRet,
|
||||
i, n;
|
||||
if ( pObj ){
|
||||
|
||||
if (pObj) {
|
||||
lRet = Util.isArray(pPropArr);
|
||||
if (lRet){
|
||||
if (lRet) {
|
||||
n = pPropArr.length;
|
||||
for (i = 0; i < n; i++){
|
||||
for (i = 0; i < n; i++) {
|
||||
var lProp = pPropArr[i];
|
||||
lRet = pObj.hasOwnProperty( lProp );
|
||||
if (!lRet){
|
||||
if (!lRet) {
|
||||
Util.logError(lProp + ' not in Obj!');
|
||||
Util.log(pObj);
|
||||
break;
|
||||
|
|
@ -99,8 +126,8 @@ Util = exports || {};
|
|||
}
|
||||
}
|
||||
|
||||
if ( lRet && Util.isArray(pTrueArr) )
|
||||
lRet = Util.checkObjTrue( pObj, pTrueArr );
|
||||
if (lRet && Util.isArray(pTrueArr))
|
||||
lRet = Util.checkObjTrue(pObj, pTrueArr);
|
||||
}
|
||||
|
||||
return lRet;
|
||||
|
|
@ -113,18 +140,18 @@ Util = exports || {};
|
|||
* @param pPropArr
|
||||
* @param pTrueArr
|
||||
*/
|
||||
Util.checkObjTrue = function(pObj, pTrueArr){
|
||||
Util.checkObjTrue = function(pObj, pTrueArr) {
|
||||
var lRet, lTrueArr,
|
||||
i, n;
|
||||
if ( pObj ){
|
||||
if (pObj) {
|
||||
lTrueArr = Util.isArray(pTrueArr) ? pTrueArr : [pTrueArr];
|
||||
|
||||
n = lTrueArr.length;
|
||||
for(i = 0; i < n; i++){
|
||||
for(i = 0; i < n; i++) {
|
||||
var lProp = lTrueArr[i];
|
||||
lRet = pObj[lProp];
|
||||
|
||||
if ( !lRet){
|
||||
if (!lRet) {
|
||||
Util.logError(lProp + ' not true!');
|
||||
Util.log(pObj);
|
||||
break;
|
||||
|
|
@ -142,13 +169,13 @@ Util = exports || {};
|
|||
* @param pToObj
|
||||
* @param pProps
|
||||
*/
|
||||
Util.copyObj = function(pFromObj, pToObj, pProps){
|
||||
Util.copyObj = function(pFromObj, pToObj, pProps) {
|
||||
var lRet;
|
||||
|
||||
if ( !pToObj )
|
||||
if (!pToObj)
|
||||
lRet = pToObj = {};
|
||||
|
||||
function copy(pI){
|
||||
function copy(pI) {
|
||||
var lName = pProps ? pProps[pI] : pI,
|
||||
lValue = pFromObj[lName];
|
||||
|
||||
|
|
@ -156,7 +183,7 @@ Util = exports || {};
|
|||
pToObj[lName] = pFromObj[lName];
|
||||
}
|
||||
|
||||
if ( Util.isObject(pFromObj) ){
|
||||
if ( Util.isObject(pFromObj) ) {
|
||||
if (!pProps)
|
||||
Util.forIn(pFromObj, copy);
|
||||
else
|
||||
|
|
@ -168,11 +195,11 @@ Util = exports || {};
|
|||
return lRet;
|
||||
};
|
||||
|
||||
Util.convertArrToObj = function(pArrKeys, pArrVal){
|
||||
Util.convertArrToObj = function(pArrKeys, pArrVal) {
|
||||
var i, n, lName, lRet;
|
||||
|
||||
if (pArrKeys && pArrVal){
|
||||
for(i = 0, n = pArrKeys; i < n; i++){
|
||||
if (pArrKeys && pArrVal) {
|
||||
for(i = 0, n = pArrKeys; i < n; i++) {
|
||||
lName = pArrKeys[i];
|
||||
lRet[lName] = pArrVal[i];
|
||||
}
|
||||
|
|
@ -187,14 +214,14 @@ Util = exports || {};
|
|||
* @pTarget
|
||||
* @pObj
|
||||
*/
|
||||
Util.extend = function(pTarget, PObj){
|
||||
Util.extend = function(pTarget, PObj) {
|
||||
var i, n, lObj, lRet = Util.isObject(pTarget) ? pTarget : {};
|
||||
|
||||
if ( Util.isArray(PObj) )
|
||||
for(i = 0, n = PObj.length; i < n; i++)
|
||||
lRet = Util.extend(pTarget, PObj[i]);
|
||||
|
||||
else if (PObj){
|
||||
else if (PObj) {
|
||||
lObj = Util.isFunction(PObj) ? new PObj() : PObj;
|
||||
|
||||
for(i in lObj)
|
||||
|
|
@ -210,8 +237,8 @@ Util = exports || {};
|
|||
* @pTarget
|
||||
* @pObj
|
||||
*/
|
||||
Util.extendProto = function(pObj){
|
||||
var lRet, F = function(){};
|
||||
Util.extendProto = function(pObj) {
|
||||
var lRet, F = function() {};
|
||||
F.prototype = Util.extend({}, pObj);
|
||||
lRet = new F();
|
||||
|
||||
|
|
@ -223,9 +250,9 @@ Util = exports || {};
|
|||
* @param pN
|
||||
* @param pFunc
|
||||
*/
|
||||
Util.for = function(pI, pN, pFunc){
|
||||
Util.for = function(pI, pN, pFunc) {
|
||||
if (Util.isFunction(pFunc))
|
||||
for(var i = pI, n = pN; i < n; i++){
|
||||
for(var i = pI, n = pN; i < n; i++) {
|
||||
if (pFunc(i))
|
||||
break;
|
||||
}
|
||||
|
|
@ -235,7 +262,7 @@ Util = exports || {};
|
|||
* @param pObj
|
||||
* @param pFunc
|
||||
*/
|
||||
Util.forIn = function(pObj, pFunc){
|
||||
Util.forIn = function(pObj, pFunc) {
|
||||
if (Util.isFunction(pFunc))
|
||||
for(var lName in pObj)
|
||||
if (pFunc(lName))
|
||||
|
|
@ -246,19 +273,19 @@ Util = exports || {};
|
|||
* @param pN
|
||||
* @param pFunc
|
||||
*/
|
||||
Util.fori = function(pN, pFunc){
|
||||
Util.fori = function(pN, pFunc) {
|
||||
var lRet = Util.for(0, pN, pFunc);
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
/**
|
||||
* @pJSON
|
||||
/**
|
||||
* @param pJSON
|
||||
*/
|
||||
Util.parseJSON = function(pJSON){
|
||||
Util.parseJSON = function(pJSON) {
|
||||
var lRet;
|
||||
|
||||
Util.tryCatch(function(){
|
||||
Util.tryCatch(function() {
|
||||
lRet = JSON.parse(pJSON);
|
||||
});
|
||||
|
||||
|
|
@ -266,30 +293,29 @@ Util = exports || {};
|
|||
};
|
||||
|
||||
/**
|
||||
* pObj
|
||||
* @param pObj
|
||||
*/
|
||||
Util.stringifyJSON = function(pObj){
|
||||
Util.stringifyJSON = function(pObj) {
|
||||
var lRet;
|
||||
|
||||
Util.tryCatchLog(function(){
|
||||
Util.tryCatchLog(function() {
|
||||
lRet = JSON.stringify(pObj, null, 4);
|
||||
});
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
/* STRINGS */
|
||||
/**
|
||||
* function check is strings are equal
|
||||
* @param pStr1
|
||||
* @param pStr2
|
||||
*/
|
||||
Util.strCmp = function (pStr1, pStr2){
|
||||
Util.strCmp = function(pStr1, pStr2) {
|
||||
var lRet = Util.isString(pStr1);
|
||||
|
||||
if (lRet){
|
||||
if (lRet) {
|
||||
if ( Util.isArray(pStr2) )
|
||||
for(var i = 0, n = pStr2.length; i < n; i++){
|
||||
for(var i = 0, n = pStr2.length; i < n; i++) {
|
||||
lRet = Util.strCmp( pStr1, pStr2[i] );
|
||||
|
||||
if (lRet)
|
||||
|
|
@ -304,18 +330,30 @@ Util = exports || {};
|
|||
|
||||
};
|
||||
|
||||
Util.getStrBigFirst = function(pStr) {
|
||||
var lRet;
|
||||
|
||||
if (Util.isString(pStr) && pStr.length > 0)
|
||||
lRet = pStr[0].toUpperCase() +
|
||||
pStr.substring(1);
|
||||
else
|
||||
lRet = pStr;
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
/**
|
||||
* function returns is pStr1 contains pStr2
|
||||
* @param pStr1
|
||||
* @param pStr2
|
||||
*/
|
||||
|
||||
Util.isContainStr = function(pStr1, pStr2){
|
||||
Util.isContainStr = function(pStr1, pStr2) {
|
||||
var lRet = Util.isString(pStr1);
|
||||
|
||||
if ( lRet ){
|
||||
if ( lRet ) {
|
||||
if ( Util.isArray(pStr2) )
|
||||
for(var i = 0, n = pStr2.length; i < n; i++){
|
||||
for(var i = 0, n = pStr2.length; i < n; i++) {
|
||||
lRet = Util.isContainStr( pStr1, pStr2[i] );
|
||||
|
||||
if (lRet)
|
||||
|
|
@ -333,10 +371,10 @@ Util = exports || {};
|
|||
* @param pStr1
|
||||
* @param pStr2
|
||||
*/
|
||||
Util.isContainStrAtBegin = function(pStr1, pStr2){
|
||||
Util.isContainStrAtBegin = function(pStr1, pStr2) {
|
||||
var lRet;
|
||||
|
||||
if ( Util.isString(pStr1) && Util.isString(pStr2) ){
|
||||
if ( Util.isString(pStr1) && Util.isString(pStr2) ) {
|
||||
var lLength = pStr2.length,
|
||||
lSubStr = pStr1.substring(0, lLength);
|
||||
|
||||
|
|
@ -350,7 +388,7 @@ Util = exports || {};
|
|||
* function log pArg if it's not empty
|
||||
* @param pArg
|
||||
*/
|
||||
Util.log = function(){
|
||||
Util.log = function() {
|
||||
var lArg = arguments,
|
||||
lConsole = Scope.console,
|
||||
lDate = '[' + Util.getDate() + '] ',
|
||||
|
|
@ -386,11 +424,11 @@ Util = exports || {};
|
|||
* function log pArg if it's not empty
|
||||
* @param pArg
|
||||
*/
|
||||
Util.logError = function(pArg){
|
||||
Util.logError = function(pArg) {
|
||||
var lConsole = Scope.console,
|
||||
lDate = '[' + Util.getDate() + '] ';
|
||||
|
||||
if (lConsole && pArg){
|
||||
if (lConsole && pArg) {
|
||||
var lMsg = pArg.message;
|
||||
if ( lMsg )
|
||||
lDate += pArg.message + ' ';
|
||||
|
|
@ -406,11 +444,11 @@ Util = exports || {};
|
|||
* @param pFunc_a {Array} - array of functions
|
||||
* @param pData - not necessarily
|
||||
*/
|
||||
Util.loadOnLoad = function(pFunc_a, pData){
|
||||
Util.loadOnLoad = function(pFunc_a, pData) {
|
||||
if ( Util.isArray(pFunc_a) && pFunc_a.length) {
|
||||
var lFunc_a = pFunc_a.slice(),
|
||||
lFunc = lFunc_a.pop(),
|
||||
lCallBack = function(pData){
|
||||
lCallBack = function(pData) {
|
||||
return Util.loadOnLoad(lFunc_a, pData);
|
||||
};
|
||||
|
||||
|
|
@ -429,14 +467,14 @@ Util = exports || {};
|
|||
* @param pStr
|
||||
* @param pSubStr
|
||||
*/
|
||||
Util.removeStr = function(pStr, pSubStr){
|
||||
Util.removeStr = function(pStr, pSubStr) {
|
||||
var lRet = Util.isString(pStr) && pSubStr;
|
||||
|
||||
if ( lRet ) {
|
||||
var n = pSubStr.length;
|
||||
|
||||
if ( Util.isArray(pSubStr) )
|
||||
Util.fori(n, function(i){
|
||||
Util.fori(n, function(i) {
|
||||
lRet = pStr = Util.replaceStr(pStr, pSubStr[i], '');
|
||||
});
|
||||
else
|
||||
|
|
@ -453,14 +491,14 @@ Util = exports || {};
|
|||
* @param pStr
|
||||
* @param pSubStr
|
||||
*/
|
||||
Util.removeStrOneTime = function(pStr, pSubStr){
|
||||
Util.removeStrOneTime = function(pStr, pSubStr) {
|
||||
var lRet = Util.isString(pStr) && pSubStr;
|
||||
|
||||
if ( lRet ) {
|
||||
var n = pSubStr.length;
|
||||
|
||||
if ( Util.isArray(pSubStr) )
|
||||
Util.fori(n, function(i){
|
||||
Util.fori(n, function(i) {
|
||||
lRet = pStr = pStr.replace(pSubStr[i], '');
|
||||
});
|
||||
else
|
||||
|
|
@ -479,7 +517,7 @@ Util = exports || {};
|
|||
* @pTo
|
||||
*/
|
||||
|
||||
Util.replaceStr = function(pStr, pFrom, pTo){
|
||||
Util.replaceStr = function(pStr, pFrom, pTo) {
|
||||
var lRet = pStr;
|
||||
|
||||
if (pStr && pFrom) {
|
||||
|
|
@ -505,7 +543,7 @@ Util = exports || {};
|
|||
* @pTempl
|
||||
* @pView
|
||||
*/
|
||||
Util.render = function(pTempl, pView){
|
||||
Util.render = function(pTempl, pView) {
|
||||
var lRet = Util.ownRender(pTempl, pView, ['{', '}']);
|
||||
|
||||
return lRet;
|
||||
|
|
@ -517,7 +555,7 @@ Util = exports || {};
|
|||
* @pView
|
||||
* @pSymbols
|
||||
*/
|
||||
Util.ownRender = function(pTempl, pView, pSymbols){
|
||||
Util.ownRender = function(pTempl, pView, pSymbols) {
|
||||
if (!pSymbols)
|
||||
pSymbols = ['{', '}'];
|
||||
|
||||
|
|
@ -528,7 +566,7 @@ Util = exports || {};
|
|||
lFirstChar = pSymbols[0];
|
||||
lSecondChar = pSymbols[1] || lFirstChar;
|
||||
|
||||
for(var lVar in pView){
|
||||
for(var lVar in pView) {
|
||||
var lStr = pView[lVar];
|
||||
lStr = Util.exec(lStr) || lStr;
|
||||
|
||||
|
|
@ -546,13 +584,13 @@ Util = exports || {};
|
|||
* @param {function} pCallback
|
||||
*
|
||||
* Example:
|
||||
* i >=0, pFuncs[i] = function(param, callback){}
|
||||
* i >=0, pFuncs[i] = function(param, callback) {}
|
||||
*/
|
||||
Util.paralelExec = function(pFuncs, pCallback){
|
||||
Util.paralelExec = function(pFuncs, pCallback) {
|
||||
var done = [];
|
||||
|
||||
/* add items to array done*/
|
||||
function addFunc(pNum){
|
||||
function addFunc(pNum) {
|
||||
done.push(pNum);
|
||||
}
|
||||
|
||||
|
|
@ -561,16 +599,16 @@ Util = exports || {};
|
|||
* we pop number of function and
|
||||
* if it's last we call pCallBack
|
||||
*/
|
||||
function doneFunc(pParams){
|
||||
function doneFunc(pParams) {
|
||||
Util.exec(pParams.callback);
|
||||
|
||||
var lNum = done.pop (pParams.number);
|
||||
if (!lNum){
|
||||
if (!lNum) {
|
||||
Util.exec(pCallback);
|
||||
}
|
||||
}
|
||||
|
||||
for(var i = 0, n = pFuncs.length; i < n; i++){
|
||||
for(var i = 0, n = pFuncs.length; i < n; i++) {
|
||||
addFunc(i);
|
||||
|
||||
var lFunc = pFuncs[i].callback;
|
||||
|
|
@ -586,15 +624,23 @@ Util = exports || {};
|
|||
* functions check is pVarible is array
|
||||
* @param pVarible
|
||||
*/
|
||||
Util.isArray = function(pVarible){
|
||||
Util.isArray = function(pVarible) {
|
||||
return pVarible instanceof Array;
|
||||
};
|
||||
|
||||
/**
|
||||
* functions check is pVarible is ArrayBuffer
|
||||
* @param pVarible
|
||||
*/
|
||||
Util.isArrayBuffer = function(pVarible) {
|
||||
return pVarible instanceof ArrayBuffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* functions check is pVarible is boolean
|
||||
* @param pVarible
|
||||
*/
|
||||
Util.isBoolean = function(pVarible){
|
||||
Util.isBoolean = function(pVarible) {
|
||||
return Util.isType(pVarible, 'boolean');
|
||||
};
|
||||
|
||||
|
|
@ -602,7 +648,7 @@ Util = exports || {};
|
|||
* functions check is pVarible is function
|
||||
* @param pVarible
|
||||
*/
|
||||
Util.isFunction = function(pVarible){
|
||||
Util.isFunction = function(pVarible) {
|
||||
return Util.isType(pVarible, 'function');
|
||||
};
|
||||
|
||||
|
|
@ -610,7 +656,7 @@ Util = exports || {};
|
|||
* functions check is pVarible is number
|
||||
* @param pVarible
|
||||
*/
|
||||
Util.isNumber = function(pVarible){
|
||||
Util.isNumber = function(pVarible) {
|
||||
return Util.isType(pVarible, 'number');
|
||||
};
|
||||
|
||||
|
|
@ -618,7 +664,7 @@ Util = exports || {};
|
|||
* functions check is pVarible is object
|
||||
* @param pVarible
|
||||
*/
|
||||
Util.isObject = function(pVarible){
|
||||
Util.isObject = function(pVarible) {
|
||||
return Util.isType(pVarible, 'object');
|
||||
};
|
||||
|
||||
|
|
@ -626,7 +672,7 @@ Util = exports || {};
|
|||
* functions check is pVarible is string
|
||||
* @param pVarible
|
||||
*/
|
||||
Util.isString = function(pVarible){
|
||||
Util.isString = function(pVarible) {
|
||||
return Util.isType(pVarible, 'string');
|
||||
};
|
||||
|
||||
|
|
@ -634,7 +680,7 @@ Util = exports || {};
|
|||
* functions check is pVarible is string
|
||||
* @param pVarible
|
||||
*/
|
||||
Util.isUndefined = function(pVarible){
|
||||
Util.isUndefined = function(pVarible) {
|
||||
return Util.isType(pVarible, 'undefined');
|
||||
};
|
||||
|
||||
|
|
@ -643,7 +689,7 @@ Util = exports || {};
|
|||
* @param pVarible
|
||||
* @param pType
|
||||
*/
|
||||
Util.isType = function(pVarible, pType){
|
||||
Util.isType = function(pVarible, pType) {
|
||||
return typeof pVarible === pType;
|
||||
};
|
||||
|
||||
|
|
@ -653,8 +699,8 @@ Util = exports || {};
|
|||
* @param pCallBack
|
||||
* @param pArg
|
||||
*/
|
||||
Util.retExec = function(pCallBack, pArg){
|
||||
return function(pArgument){
|
||||
Util.retExec = function(pCallBack, pArg) {
|
||||
return function(pArgument) {
|
||||
if ( !Util.isUndefined(pArg) )
|
||||
pArgument = pArg;
|
||||
Util.exec(pCallBack, pArgument);
|
||||
|
|
@ -666,8 +712,8 @@ Util = exports || {};
|
|||
* @param pCallBack
|
||||
* @param pArg
|
||||
*/
|
||||
Util.retFunc = function(pCallBack, pArg){
|
||||
return function(){
|
||||
Util.retFunc = function(pCallBack, pArg) {
|
||||
return function() {
|
||||
return Util.exec(pCallBack, pArg);
|
||||
};
|
||||
};
|
||||
|
|
@ -675,7 +721,7 @@ Util = exports || {};
|
|||
/**
|
||||
* function return false
|
||||
*/
|
||||
Util.retFalse = function(){
|
||||
Util.retFalse = function() {
|
||||
var lRet = false;
|
||||
|
||||
return lRet;
|
||||
|
|
@ -684,7 +730,7 @@ Util = exports || {};
|
|||
/**
|
||||
* function return param
|
||||
*/
|
||||
Util.retParam = function(pParam){
|
||||
Util.retParam = function(pParam) {
|
||||
return pParam;
|
||||
};
|
||||
|
||||
|
|
@ -693,8 +739,8 @@ Util = exports || {};
|
|||
* @param pFunc_a {Array} - array of functions
|
||||
* @param pData - not necessarily
|
||||
*/
|
||||
Util.retLoadOnLoad = function(pFunc_a, pData){
|
||||
return function(){
|
||||
Util.retLoadOnLoad = function(pFunc_a, pData) {
|
||||
return function() {
|
||||
Util.loadOnLoad(pFunc_a, pData);
|
||||
};
|
||||
};
|
||||
|
|
@ -703,15 +749,15 @@ Util = exports || {};
|
|||
* set value to property of object, if object exist
|
||||
* @param pArgs {object, property, value}
|
||||
*/
|
||||
Util.setValue = function(pArgs){
|
||||
Util.setValue = function(pArgs) {
|
||||
var lRet = false;
|
||||
|
||||
if ( Util.isObject(pArgs) ){
|
||||
if ( Util.isObject(pArgs) ) {
|
||||
var lObj = pArgs.object,
|
||||
lProp = pArgs.property,
|
||||
lVal = pArgs.lVal;
|
||||
|
||||
if (lObj){
|
||||
if (lObj) {
|
||||
lObj[lProp] = lVal;
|
||||
lRet = true;
|
||||
}
|
||||
|
|
@ -724,18 +770,18 @@ Util = exports || {};
|
|||
* set timout before callback would be called
|
||||
* @param pArgs {func, callback, time}
|
||||
*/
|
||||
Util.setTimeout = function(pArgs){
|
||||
Util.setTimeout = function(pArgs) {
|
||||
var lDone,
|
||||
lFunc = pArgs.func,
|
||||
lTime = pArgs.time || 1000,
|
||||
lCallBack = function(pArgument){
|
||||
if (!lDone){
|
||||
lCallBack = function(pArgument) {
|
||||
if (!lDone) {
|
||||
lDone = Util.exec(pArgs.callback, pArgument);
|
||||
}
|
||||
};
|
||||
|
||||
var lTimeoutFunc = function(){
|
||||
setTimeout(function(){
|
||||
var lTimeoutFunc = function() {
|
||||
setTimeout(function() {
|
||||
Util.exec(lFunc, lCallBack);
|
||||
if (!lDone)
|
||||
lTimeoutFunc();
|
||||
|
|
@ -752,12 +798,12 @@ Util = exports || {};
|
|||
*
|
||||
* @param pCallBack
|
||||
*/
|
||||
Util.tryCatch = function(pCallBack){
|
||||
Util.tryCatch = function(pCallBack) {
|
||||
var lRet;
|
||||
try{
|
||||
lRet = pCallBack();
|
||||
}
|
||||
catch(pError){
|
||||
catch(pError) {
|
||||
lRet = pError;
|
||||
}
|
||||
|
||||
|
|
@ -770,7 +816,7 @@ Util = exports || {};
|
|||
*
|
||||
* @param pTryFunc
|
||||
*/
|
||||
Util.tryCatchDebug = function(pTryFunc){
|
||||
Util.tryCatchDebug = function(pTryFunc) {
|
||||
var lRet = Util.tryCatch(pTryFunc);
|
||||
|
||||
if (lRet)
|
||||
|
|
@ -785,7 +831,7 @@ Util = exports || {};
|
|||
*
|
||||
* @param pTryFunc
|
||||
*/
|
||||
Util.tryCatchLog = function(pTryFunc){
|
||||
Util.tryCatchLog = function(pTryFunc) {
|
||||
var lRet;
|
||||
|
||||
lRet = Util.tryCatch(pTryFunc);
|
||||
|
|
@ -799,7 +845,7 @@ Util = exports || {};
|
|||
*
|
||||
* @param pCallBack
|
||||
*/
|
||||
Util.tryCatchCall = function(pTryFunc, pCallBack){
|
||||
Util.tryCatchCall = function(pTryFunc, pCallBack) {
|
||||
var lRet;
|
||||
|
||||
lRet = Util.tryCatch(pTryFunc);
|
||||
|
|
@ -813,17 +859,23 @@ Util = exports || {};
|
|||
/**
|
||||
* function do save exec of function
|
||||
* @param pCallBack
|
||||
* @param pArg
|
||||
* @param pArg1
|
||||
* ...
|
||||
* @param pArgN
|
||||
*/
|
||||
Util.exec = function(pCallBack, pArg, pArg1){
|
||||
var lRet;
|
||||
Util.exec = function(pCallBack) {
|
||||
var lRet, lCallBack;
|
||||
|
||||
if (pCallBack){
|
||||
if ( Util.isFunction(pCallBack) )
|
||||
lRet = pCallBack(pArg, pArg1);
|
||||
/* drop first element */
|
||||
[].shift.call(arguments);
|
||||
if (pCallBack) {
|
||||
if (Util.isFunction(pCallBack))
|
||||
lRet = pCallBack.apply(null, arguments);
|
||||
else {
|
||||
var lCallBack = pCallBack.callback || pCallBack.success;
|
||||
lRet = Util.exec(lCallBack, pArg, pArg1);
|
||||
lCallBack = pCallBack.callback || pCallBack.success;
|
||||
/* add first element */
|
||||
[].unshift.call(arguments, lCallBack);
|
||||
lRet = Util.exec.apply(null, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -834,10 +886,10 @@ Util = exports || {};
|
|||
* exec function if it exist in object
|
||||
* @pArg
|
||||
*/
|
||||
Util.execIfExist = function(pObj, pName, pArg){
|
||||
Util.execIfExist = function(pObj, pName, pArg) {
|
||||
var lRet;
|
||||
|
||||
if (pObj){
|
||||
if (pObj) {
|
||||
var lFunc = Util.bind(pObj[pName], pObj);
|
||||
lRet = Util.exec(lFunc, pArg);
|
||||
}
|
||||
|
|
@ -851,7 +903,7 @@ Util = exports || {};
|
|||
* @param pCallBack
|
||||
* @param pFunc
|
||||
*/
|
||||
Util.ifExec = function(pCondition, pCallBack, pFunc){
|
||||
Util.ifExec = function(pCondition, pCallBack, pFunc) {
|
||||
var lRet;
|
||||
|
||||
if (pCondition)
|
||||
|
|
@ -867,10 +919,10 @@ Util = exports || {};
|
|||
* @param pFileName
|
||||
* @return Ext
|
||||
*/
|
||||
Util.getExtension = function(pFileName){
|
||||
Util.getExtension = function(pFileName) {
|
||||
var lRet, lDot;
|
||||
|
||||
if ( Util.isString(pFileName) ){
|
||||
if ( Util.isString(pFileName) ) {
|
||||
lDot = pFileName.lastIndexOf('.');
|
||||
lRet = pFileName.substr(lDot);
|
||||
}
|
||||
|
|
@ -883,14 +935,14 @@ Util = exports || {};
|
|||
* or
|
||||
* @pObj
|
||||
*/
|
||||
Util.getNamesFromObjArray = function(pArr){
|
||||
Util.getNamesFromObjArray = function(pArr) {
|
||||
var lRet = [];
|
||||
|
||||
if (pArr && !Util.isArray(pArr))
|
||||
pArr = pArr.data;
|
||||
|
||||
if (pArr)
|
||||
Util.fori(pArr.length, function(i){
|
||||
Util.fori(pArr.length, function(i) {
|
||||
lRet[i] = pArr[i].name || pArr[i];
|
||||
});
|
||||
|
||||
|
|
@ -902,10 +954,10 @@ Util = exports || {};
|
|||
* or
|
||||
* @pObj
|
||||
*/
|
||||
Util.findObjByNameInArr = function(pArr, pObjName){
|
||||
Util.findObjByNameInArr = function(pArr, pObjName) {
|
||||
var lRet;
|
||||
|
||||
if (pArr){
|
||||
if (pArr) {
|
||||
for(var i = 0, n = pArr.length; i < n; i++ )
|
||||
if (pArr[i].name === pObjName) break;
|
||||
|
||||
|
|
@ -918,7 +970,7 @@ Util = exports || {};
|
|||
/**
|
||||
* Gets current time in format hh:mm:ss
|
||||
*/
|
||||
Util.getTime = function(){
|
||||
Util.getTime = function() {
|
||||
var lRet,
|
||||
date = new Date(),
|
||||
hours = date.getHours(),
|
||||
|
|
@ -938,7 +990,7 @@ Util = exports || {};
|
|||
* start timer
|
||||
* @pArg
|
||||
*/
|
||||
Util.time = function(pArg){
|
||||
Util.time = function(pArg) {
|
||||
var lRet,
|
||||
lConsole = Scope.console;
|
||||
|
||||
|
|
@ -951,7 +1003,7 @@ Util = exports || {};
|
|||
* stop timer
|
||||
* @pArg
|
||||
*/
|
||||
Util.timeEnd = function(pArg){
|
||||
Util.timeEnd = function(pArg) {
|
||||
var lRet,
|
||||
lConsole = Scope.console;
|
||||
|
||||
|
|
@ -963,7 +1015,7 @@ Util = exports || {};
|
|||
/**
|
||||
* Gets current date in format yy.mm.dd hh:mm:ss
|
||||
*/
|
||||
Util.getDate = function(){
|
||||
Util.getDate = function() {
|
||||
var date = new Date(),
|
||||
day = date.getDate(),
|
||||
month = date.getMonth() + 1,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cloudcmd",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
||||
"description": "User friendly cloud file manager.",
|
||||
"homepage": "https://github.com/coderaiser/cloudcmd",
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
"node": "0.6.17",
|
||||
"subdomain": "cloudcmd",
|
||||
"dependencies": {
|
||||
"dropbox": "0.10.0",
|
||||
"dropbox": "0.10.1",
|
||||
"minify": "0.2.1",
|
||||
"socket.io": "0.9.16"
|
||||
},
|
||||
|
|
|
|||
9
shell/log.sh
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
if test -z $1
|
||||
then
|
||||
echo "log.sh <tag>"
|
||||
else
|
||||
git log $1..HEAD --pretty=format:"* %s" --grep feature
|
||||
git log $1..HEAD --pretty=format:"* %s" --grep fix
|
||||
git log $1..HEAD --pretty=format:"* %s" --grep refactor
|
||||
fi
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
# win32 version
|
||||
# secrets of github and dropbox
|
||||
# must not be shared
|
||||
# http://github.com/coderaiser/cloudcmd
|
||||
# http://cloudcmd.io
|
||||
#
|
||||
# for using just add %-symbol on start and end of name
|
||||
# like %github_secret%
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
# *nix version
|
||||
# secrets of github and dropbox
|
||||
# must not be shared
|
||||
# http://github.com/coderaiser/cloudcmd
|
||||
# http://cloudcmd.io
|
||||
#
|
||||
# for using just add $-symbol on start of name
|
||||
# like $github_secret
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
openssl genrsa -out privatekey.pem 1024
|
||||
openssl genrsa -out privatekey.pem 2048
|
||||
openssl req -new -key privatekey.pem -out certrequest.csr
|
||||
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
|
||||
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
"browser" : true,
|
||||
"devel" : true,
|
||||
"eqeqeq" : true,
|
||||
"es5" : true,
|
||||
"forin" : true,
|
||||
"globalstrict" : true,
|
||||
"jquery" : false,
|
||||
"newcap" : true,
|
||||
|
|
@ -14,5 +12,6 @@
|
|||
"nonew" : true,
|
||||
"strict" : true,
|
||||
"undef" : true,
|
||||
"evil" : true /* using for JSON-parsing if brawser old and crappy */
|
||||
}
|
||||
"evil" : true,
|
||||
"expr" : true
|
||||
}
|
||||
|
|
|
|||
14
test/test.sh
|
|
@ -1,15 +1,11 @@
|
|||
#!/bin/sh
|
||||
npm i recess jshint
|
||||
echo "jshint server.js client.js cloudcmd.js"
|
||||
node_modules/jshint/bin/jshint --config test/.jshintrc lib/server.js lib/client.js cloudcmd.js
|
||||
echo "jshint lib/cloudfunc.js lib/client/keyBinding.js"
|
||||
node_modules/jshint/bin/jshint --config test/.jshintrc lib/util.js lib/cloudfunc.js lib/client/keyBinding.js
|
||||
echo "lib/client/dom.js lib/client/ie.js lib/client/menu.js lib/client/socket.js ./lib/client/terminal.js lib/client/viewer.js lib/client/storage/_github.js lib/client/menu.js lib/client/editor/_codemirror.js"
|
||||
node_modules/jshint/bin/jshint --config test/.jshintrc lib/client/dom.js lib/client/ie.js lib/client/menu.js lib/client/socket.js ./lib/client/terminal.js lib/client/viewer.js lib/client/storage/_github.js lib/client/menu.js lib/client/editor/_codemirror.js
|
||||
echo "jshint ./package.json ./json/config.json"
|
||||
node_modules/jshint/bin/jshint --config test/.jshintrc ./package.json ./json/config.json
|
||||
echo "jshint lib/*.js lib/client/*.js lib/client/storage/*.js lib/server/*.js"
|
||||
node_modules/jshint/bin/jshint --config test/.jshintrc lib/*.js `ls lib/client/*.js| grep -v jquery` lib/client/storage/*.js lib/server/*.js
|
||||
echo "jshint package.json json/*.json"
|
||||
node_modules/jshint/bin/jshint --config test/.jshintrc package.json json/*.json
|
||||
#linting css files
|
||||
echo "recess css/*.css"
|
||||
./node_modules/recess/bin/recess css/*.css
|
||||
node test/test.js
|
||||
node cloudcmd.js test
|
||||
node cloudcmd.js test
|
||||
|
|
|
|||