Compare commits

...

35 Commits

Author SHA1 Message Date
Matt Pass
f071f84eb4 Version 3.0 beta 2013-06-07 12:46:37 +01:00
Matt Pass
8db478d8f0 New color settings added, BG image removed
tabBGopen now a lighter color, plus tabFGcurrent and tabFGopenFile
colors added
Removed bgVPos and no longer setting BG position as we're not using an
image anymore
(Instead we set either the current or open tabBG color
We also set the FG color of the filename to current or openFile
2013-06-05 18:11:54 +01:00
Matt Pass
ce481b0f25 3px radius on filenames, slight adjusts to margin
Plus padding added to filenames
2013-06-05 18:07:21 +01:00
Matt Pass
6af16d7fca No longer using tab BG image, add background #aaa 2013-06-05 17:59:13 +01:00
Matt Pass
850cc3b2bd Remove tab BG image
We are now setting with CSS background
2013-06-05 17:57:02 +01:00
Matt Pass
a1363ef41b Remove old template file
Is now config___users-template.php and this is no longer used
(duplicate)
2013-06-05 17:56:29 +01:00
Matt Pass
71f82251f6 Remove progress bar and fade on hiding file menu
Progress bar removed as it's not accurate or indicative of amount
loaded/progress
Call hideFileMenu instead of manually setting display, so now we have
fade effect
Add opacity transition of 0.15s
2013-06-05 17:11:03 +01:00
Matt Pass
eaf39661ba Fade menu in/out plus get rid of progress bar
No longer manually set display to none on fileMenu on actions, should be
calling hideFileMenu
On showing the menu, set the opacity to 1 4ms after setting the display
to inline-block
Simply set opacity to 0 on hiding so it's more an instant hide
Get rid of progress bar reset
2013-06-05 17:08:21 +01:00
Matt Pass
2b991d9958 Features moved to website
No need to be part of the ICEcoder repo, plus saves 2k
2013-06-05 17:04:07 +01:00
Matt Pass
eed8b29753 ICEcoder logo update and docRoot setting added
New ICEcoder logo added plus docRoot available as a setting in
config___settings.php
2013-06-05 16:14:36 +01:00
Matt Pass
ebc8e3a27b Error catching on range select
Will only now begin to select a range of files if we have selected files
already.
If not, it will add this first file as a start point.
Will also only range select if we are range selecting in the same
folder, otherwise will add this file. This enables you to select ranges
of files in different folders.
Lastly, the root has a very slightly different node structure, as we
can't start at 0 and step in increments of 2, it needs to be 1, 3, 5
etc. So as a failsafe, if the node we're looking at is not a LI,
increase the i counter by 1.
2013-06-04 18:47:06 +01:00
Matt Pass
aa2ed93d74 Load system and user settings files
$configSettings is a seperate file now, containing the array of settings
we have buried in this file
Renamed user template, so change of filename here
Also using $configUsersTemplate to be clearer about things
2013-06-04 18:03:32 +01:00
Matt Pass
ba520e6aa1 Added config settings file
These were buried in the settings.php file, now pulled out of the file
and put into their own array
This is so they can be found easier
2013-06-04 18:01:44 +01:00
Matt Pass
61373e87ea Rename, was config___template.php & array rename
As we now have 2 files beginning config___, be more specific about what
this relates to
Also renamed the array to $ICEcoderUserSettings
2013-06-04 18:00:49 +01:00
Matt Pass
4dd95b1b0f Ignore config-*
Be less specific about the files we do want to include
config-*.php for files to ignore and those we want to keep will begin
config___
2013-06-04 17:59:00 +01:00
Matt Pass
f160b4fa80 Range select added, shuffle of layout and Ctrl
Range select (Shift + click) added as a shortcut
File manager shortcuts moved under document shortcuts
All instances of CTRL now Ctrl
2013-06-04 17:39:03 +01:00
Matt Pass
de637f1048 Ctrl + s and +o noted on Save and Open icons 2013-06-04 17:37:57 +01:00
Matt Pass
f628868a8e Logo updated to show a capital ICE
The letters stand for Inspire, Create, Evolve. Should capitalise the I.
2013-06-04 17:31:40 +01:00
Matt Pass
9dd2221841 All variations of password now just password
To make things simpler, everything is now just called password rather
than accountPassword etc
settings.php also now gone back to checking for the existance of the
$_POST password rather than looking for a submit button named 'set
password'. This obviously wouldn't work as that's not the name of the
button on the settings screen, it's 'update'
2013-06-04 17:25:46 +01:00
Matt Pass
24d68efd4b Get 1st array value seperately
Some older versions of PHP don't seem to like calling [0] on the same
line as explode
Now getting value on seperate line of code
2013-06-04 14:14:49 +01:00
Matt Pass
ad8c3da48b Shift click now available to select file ranges
New vars added for the new event of shift-clicking to select ranges of
files in the file manager
Get the last file clicked and work out if the file we've just clicked is
alphabetically greater than it or not, so we end up with a startFile <
endFile and are therefore selecting from startFile downwards
In a for loop, run until we find our startFile and begin selecting.
If we're selecting and the file we're looking at isn't in our
selectedFiles array, select that file and add it to the array
Finally, when we reach our endFile, break out of the loop
2013-05-31 23:37:35 +01:00
Matt Pass
7255ea4805 Consider extensions up to a space char
This enables ICEcoder to understand that image.jpg (2) is a jpeg and can
be opened as an image
2013-05-31 21:16:18 +01:00
Matt Pass
47cf80102c Run processes on events
On logout event, include that process
Settings template file is now config___template.php
Create new if statement for login success and fail, plus run processes
for each event
On new user setup, run that process
If multiUser, always show the checkUpdates box as we don't know if we're
setting up a new user or logging in, so have to assume it's a new user
and allow this setting to show
2013-05-31 20:25:44 +01:00
Matt Pass
2cebe069f2 onLoad, run processes/on-load.php
open this in the new iFrame, processControl
2013-05-31 20:19:11 +01:00
Matt Pass
3326ba5784 New iframe added for processControl
Processes will be loaded into this. For now it's only used by
processes/on-load.php.
As more processes are added this will be used by them.
2013-05-31 20:18:22 +01:00
Matt Pass
5e5fa22566 Renamed template to config___template.php 2013-05-31 20:17:10 +01:00
Matt Pass
95dbad842d Processes added
Files added to put custom processes into, including events for:
load, login fail, login, logout and new user
2013-05-31 20:14:54 +01:00
Matt Pass
5576c9e2e9 If we have no fileLoc, show /
This covers saving new files/save as in the root
2013-05-31 14:35:08 +01:00
Matt Pass
3577fc613e Update file to match main JS 2013-05-31 14:34:26 +01:00
Matt Pass
7bdeefd7e1 Only do layout things if ready, fix to path
Can only resize the file manager if ICEcoder is ready
Need a selectedFiles[0] in order to prefix to filePath
If we add a new file to the root, we end up with a ||[NEW], so replace
|| with | to fix this
Can only set tab widths if ICEcoder is ready
2013-05-31 14:32:02 +01:00
Matt Pass
df2697c68b [none] moved left & up
To match style of other data items on display
2013-05-31 12:36:51 +01:00
Matt Pass
d859075e97 multiUser is false by default 2013-05-31 10:39:08 +01:00
Matt Pass
d6c282a70a Multi user setup & login added
Session accountUsername is now just username
Settings filename now may contain the username if available from a post
or session var
setPWorLogin is now login by default, set password if we create a new
config file
Instead of the posted accountPassword value, we now look to the value of
the submit button and if it contains 'set password' or not
Set session username to the posted value on login or set password and
set to itself on every load
accountPassword form field now just password
Focus on the username or password field, depending on the 1st one shown
on page
Set the value of the submit button to 'set password / login' if
multiUser
2013-05-31 10:36:39 +01:00
Matt Pass
f541fae982 Get function added for byte saving and clarity
New global function added called 'get'
This is because top.document.getElementById is used so often, we
actually save 2kb by having a function to return the object, plus it's
much more readable to have:
get('serverMessage').style.opacity = '1';
rather than
document.getElementById('#serverMessage').style.opacity = '1';
2013-05-30 18:11:04 +01:00
Matt Pass
054cc5cad9 newTab behind others and fix move glitch
newTab now has a z-index of 0 so that it slides behind other tabs when
new tabs are opened
serverMessage is now display: inline-block and hiding and showing is
done on moving the left position to 0 or 2000px to show or hide (doing
the show/hide on changing the display type was causing reflow issues
which seemed to mean occassionally the newTab wasn't moving to the
correct position)
2013-05-30 08:41:39 +01:00
25 changed files with 423 additions and 358 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,3 @@
error-log.txt
backups/*.zip
lib/config*.php
!lib/config-template.php
lib/config-*.php

View File

@@ -3,53 +3,11 @@
ICEcoder is a web IDE / browser based code editor, which allows you to develop websites directly within the web browser. It uses the brilliant CodeMirror for code highlighting & editing, with a slick IDE wrapped around it to make the whole thing work.
<img src="http://icecoder.net/images/icecoder-v2-5-browser-code-editor.png" alt="ICEcoder web IDE">
<img src="http://icecoder.net/images/icecoder-v3-0-beta-browser-code-editor.png" alt="ICEcoder web IDE">
###Requirements
You can run ICEcoder either online or locally, on Linux, Windows or Mac based platforms. The only requirement is to have PHP 5 available (5.3 recommended). You can have this either as a vanilla installation or via a program such as WAMP or XAMPP (for Windows) or MAMP (for Mac).
###Features you'd expect
* Context aware code highlighting
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP, Python, Ruby, Markdown & more
* Smart tab key system (selected text indents line)
* File manager
* Find & replace/replace all
* Document tabs indicate current doc & changes made
* Code folding
* Open last files on load
* Web based, access from anywhere
* Free, open source & customisable
###Cool features you wouldn't expect
* Find & replace in current doc, open docs, files & filenames
* Found match & current position counter
* Indicates content type cursor is on
* Account login to keep certain files secure
* Restrict files, ban files and restrict by IP
* Settings to change functionality & editor theme
* Code Assist system
* Displays nest position of text cursor, hover to select, click to set cursor
* Nest structure OK/broken indicator
* Highlight word and press CTRL+I to Google search that
* Adds end tags as you type and in a context aware way
* Can rename open files (whoaah!)
* CTRL+Enter open current webpage in new tab
* Window to view live edits
* ESC = Comment/Uncomment line, incl partial lines
* Image viewer
* Colour preview block on CSS colours, ie red, #f00 or RGBA(255,0,0,0.5)
* MySQL Database management via Adminer plugin
* Backs up files every 30 mins or on click of backup plugin icon
* Github repo syncing with ICErepo plugin
* Linux terminal
* JS Hint validation as you type
* Emmet snippet typing booster
* HTML & JavaScript code hinting
* Alphanumeric tab sorting
* Tag wrappers
* Config template
* Farbtastic color picker integrated
###Installation
####Step 1: Clone the repo

View File

@@ -80,7 +80,7 @@ $activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat"
$last10FilesArray = explode(",",$ICEcoder["last10Files"]);
for ($i=0;$i<count($last10FilesArray);$i++) {
if ($ICEcoder["last10Files"]=="") {
echo '[none]<br><br>';
echo '<div style="display: inline-block; margin-left: -39px; margin-top: -18px">[none]</div><br><br>';
} else {
$fileFolderName = str_replace("\\","/",$last10FilesArray[$i]);
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -21,6 +21,8 @@
<iframe name="fileControl" style="display: none"></iframe>
<iframe name="testControl" style="display: none"></iframe>
<iframe name="processControl" style="display: none"></iframe>
</body>

BIN
images/ice-coder-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -75,7 +75,7 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
echo $ICEcoder["indentSize"];
echo ';top.ICEcoder.demoMode = ';
echo $ICEcoder["demoMode"] ? 'true' : 'false';
?>;ICEcoder.init()<?php echo $updateMsg.$onLoadExtras;?>" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
?>;ICEcoder.init()<?php echo $updateMsg.$onLoadExtras;?>;top.ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = 'processes/on-load.php';" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
<div id="blackMask" class="blackMask" onClick="if (!ICEcoder.overPopup) {ICEcoder.showHide('hide',this)}" onContextMenu="return false">
<div class="popupVCenter">
@@ -84,7 +84,6 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
</div>
<div id="loadingMask" class="blackMask" style="visibility: visible" onContextMenu="return false">
<span class="progressBar" id="progressBar" style="-webkit-animation:fullexpand 10s ease-out; -moz-animation:fullexpand 10s ease-out"></span>
<div class="popupVCenter">
<div class="popup">
<div class="circleOutside"></div>
@@ -94,7 +93,7 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
</div>
</div>
<div id="fileMenu" class="fileMenu" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract');this.style.display='none'" onContextMenu="return false">
<div id="fileMenu" class="fileMenu" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract');top.ICEcoder.hideFileMenu()" style="opacity: 0" onContextMenu="return false">
<span id="folderMenuItems">
<a href="javascript:top.ICEcoder.newFile()" onMouseOver="ICEcoder.showFileMenu()">New File</a>
<a href="javascript:top.ICEcoder.newFolder()" onMouseOver="ICEcoder.showFileMenu()">New Folder</a>
@@ -126,14 +125,14 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
<?php echo $pluginsDisplay; ?>
</div>
<div class="version"><a href="javascript:top:ICEcoder.logout()">logout</a> : v <?php echo $ICEcoder["versionNo"];?></div><img src="images/full-screen.gif" id="screenMode" class="screenModeIcon" onClick="top.ICEcoder.fullScreenSwitcher()">
<img src="images/ice-coder.png" class="logo" onClick="ICEcoder.helpScreen()" onContextMenu="ICEcoder.settingsScreen()">
<img src="images/ice-coder-icon.png" class="logo" onClick="ICEcoder.helpScreen()" onContextMenu="ICEcoder.settingsScreen()">
</div>
<div id="files" class="files" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract'); top.document.getElementById('fileMenu').style.display='none';">
<div id="files" class="files" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract'); top.ICEcoder.hideFileMenu();">
<div class="account" id="account">
<div class="accountOptions">
<div title="Save" onClick="ICEcoder.fMIcon('save')" id="fMSave" class="save"></div>
<div title="Open" onClick="ICEcoder.fMIcon('open')" id="fMOpen" class="open"></div>
<div title="Save (Ctrl + s)" onClick="ICEcoder.fMIcon('save')" id="fMSave" class="save"></div>
<div title="Open (Ctrl + o)" onClick="ICEcoder.fMIcon('open')" id="fMOpen" class="open"></div>
<div title="New File" onClick="ICEcoder.fMIcon('newFile')" id="fMNewFile" class="newFile"></div>
<div title="New Folder" onClick="ICEcoder.fMIcon('newFolder')" id="fMNewFolder" class="newFolder"></div>
<div title="Delete" onClick="ICEcoder.fMIcon('delete')" id="fMDelete" class="delete"></div>

12
lib/config___settings.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
// ICEcoder system settings
$ICEcoderSettings = array(
"versionNo" => "3.0 beta",
"codeMirrorDir" => "CodeMirror-3.13",
"docRoot" => $_SERVER['DOCUMENT_ROOT'],
"demoMode" => false,
"devMode" => false,
"multiUser" => false,
"lineEnding" => "\n"
);
?>

View File

@@ -1,5 +1,5 @@
<?php
$ICEcoder = array(
$ICEcoderUserSettings = array(
"root" => "",
"checkUpdates" => true,
"openLastFiles" => true,
@@ -7,7 +7,7 @@ $ICEcoder = array(
"codeAssist" => true,
"visibleTabs" => false,
"lockedNav" => true,
"accountPassword" => "",
"password" => "",
"bannedFiles" => array("_coder","ICEcoder"),
"bannedPaths" => array("/var/www/.git","/var/www/sites/all/modules","/var/www/sites/default/files"),
"allowedIPs" => array("*"),

View File

@@ -30,7 +30,8 @@ if ($_GET['action']=="load") {
$finfo = finfo_file($finfoMIME, $file);
finfo_close($finfoMIME);
} else {
$fileExt = pathinfo($file, PATHINFO_EXTENSION);
$fileExt = explode(" ",pathinfo($file, PATHINFO_EXTENSION));
$fileExt = $fileExt[0];
if (array_search($fileExt,array("coffee","css","htm","html","js","less","md","php","py","rb","ruby","txt","xml"))!==false) {$finfo = "text";};
if (array_search($fileExt,array("gif","jpg","jpeg","png"))!==false) {$finfo = "image";};
}
@@ -405,7 +406,7 @@ if (action=="save") {
if (strpos($file,"[NEW]")>0||$saveType=="saveAs") {
?>
fileLoc = '<?php echo $fileLoc;?>';
newFileName = top.ICEcoder.getInput('Enter filename to save at '+fileLoc,'');
newFileName = top.ICEcoder.getInput('Enter filename to save at '+(fileLoc!='' ? fileLoc : '/'),'');
if (newFileName) {
if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}
newFileName = fileLoc + newFileName;

View File

@@ -1,19 +1,19 @@
.fileManager {
margin: 15px 0 15px 22px;
margin: 15px 0 15px 20px;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
.fileManager span {font-family: helvetica, arial, swiss, verdana}
.fileManager span {font-family: helvetica, arial, swiss, verdana; padding: 1px 3px; border-radius: 3px}
.fileManager a {color: #eee; text-decoration: none; cursor: pointer}
.fileManager .pft-directory, .fileManager .pft-file {list-style-image: url(../images/blank.gif)}
.fileManager ul, .fileManager li {margin-left: 15px}
/* Default file */
.fileManager LI.pft-directory:before, .fileManager LI.pft-file:before {
position: absolute; display: block; width: 16px; height: 16px; content: ""; margin-top: -2px; margin-left: -23px; background:url(../images/file-folder-icons.png) no-repeat 0 0;
position: absolute; display: block; width: 16px; height: 16px; content: ""; margin-top: -2px; margin-left: -20px; background:url(../images/file-folder-icons.png) no-repeat 0 0;
}
.fileManager LI.dirOpen:before {background-position: -16px 0}

View File

@@ -17,49 +17,50 @@
<div style="display: inline-block; width: 365px; margin-right: 20px">
<h2>Within document</h2>
<span class="key">CTRL <span class="plus">+</span> &uarr;</span> <span class="shortcut">Move line up</span><br>
<span class="key">CTRL <span class="plus">+</span> &darr;</span> <span class="shortcut">Move line down</span><br>
<span class="key">CTRL <span class="plus">+</span> +</span> <span class="shortcut">Duplicate line</span><br>
<span class="key">CTRL <span class="plus">+</span> -</span> <span class="shortcut">Remove line</span><br>
<span class="key">CTRL <span class="plus">+</span> i</span> <span class="shortcut">Search selected text</span><br>
<span class="key">CTRL <span class="plus">+</span> j</span> <span class="shortcut">Jump to definition</span><br>
<span class="key">Ctrl <span class="plus">+</span> &uarr;</span> <span class="shortcut">Move line up</span><br>
<span class="key">Ctrl <span class="plus">+</span> &darr;</span> <span class="shortcut">Move line down</span><br>
<span class="key">Ctrl <span class="plus">+</span> +</span> <span class="shortcut">Duplicate line</span><br>
<span class="key">Ctrl <span class="plus">+</span> -</span> <span class="shortcut">Remove line</span><br>
<span class="key">Ctrl <span class="plus">+</span> i</span> <span class="shortcut">Search selected text</span><br>
<span class="key">Ctrl <span class="plus">+</span> j</span> <span class="shortcut">Jump to definition</span><br>
<span class="key">Esc</span> <span class="shortcut">Comment / uncomment text</span><br>
<span class="key">Tab</span> <span class="shortcut">Insert tab / indent selected text</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> d</span> <span class="shortcut">Wrap selected in &lt;div&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> s</span> <span class="shortcut">Wrap selected in &lt;span&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> p</span> <span class="shortcut">Wrap selected in &lt;p&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> a</span> <span class="shortcut">Wrap selected in &lt;a&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> b</span> <span class="shortcut">Wrap selected in &lt;b&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> i</span> <span class="shortcut">Wrap selected in &lt;i&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> g</span> <span class="shortcut">Wrap selected in &lt;strong&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> e</span> <span class="shortcut">Wrap selected in &lt;em&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> nums 1 - 7</span> <span class="shortcut">Wrap selected in &lt;h1&gt; - &lt;h7&gt;</span><br>
<span class="key">CTRL <span class="plus">+</span> Alt <span class="plus">+</span> Enter</span> <span class="shortcut">End line with &lt;br&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> d</span> <span class="shortcut">Wrap selected in &lt;div&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> s</span> <span class="shortcut">Wrap selected in &lt;span&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> p</span> <span class="shortcut">Wrap selected in &lt;p&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> a</span> <span class="shortcut">Wrap selected in &lt;a&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> b</span> <span class="shortcut">Wrap selected in &lt;b&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> i</span> <span class="shortcut">Wrap selected in &lt;i&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> g</span> <span class="shortcut">Wrap selected in &lt;strong&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> e</span> <span class="shortcut">Wrap selected in &lt;em&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> nums 1 - 7</span> <span class="shortcut">Wrap selected in &lt;h1&gt; - &lt;h7&gt;</span><br>
<span class="key">Ctrl <span class="plus">+</span> Alt <span class="plus">+</span> Enter</span> <span class="shortcut">End line with &lt;br&gt;</span><br><br>
<h2>On logo</h2>
<span class="key">Left click</span> <span class="shortcut">Help</span><br>
<span class="key">Right click</span> <span class="shortcut">Settings</span><br>
</div>
<div style="display: inline-block; width: 365px">
<h2>On logo</h2>
<span class="key">Left click</span> <span class="shortcut">Help</span><br>
<span class="key">Right click</span> <span class="shortcut">Settings</span><br><br>
<h2>Within file manager</h2>
<span class="key">Left click</span> <span class="shortcut">Select file / folder</span><br>
<span class="key">Double click / click (mobile)</span> <span class="shortcut">Open file</span><br>
<span class="key">CTRL <span class="plus">+</span> left click</span> <span class="shortcut">Multiple select</span><br>
<span class="key">Ctrl <span class="plus">+</span> left click</span> <span class="shortcut">Multiple select</span><br>
<span class="key">Shift <span class="plus">+</span> left click</span> <span class="shortcut">Range select</span><br>
<span class="key">Right click</span> <span class="shortcut">Options for selected</span><br>
<span class="key">Delete</span> <span class="shortcut">Delete selected</span><br><br>
<h2>Anywhere</h2>
<span class="key">CTRL <span class="plus">+</span> &rarr;</span> <span class="shortcut">Next tab</span><br>
<span class="key">CTRL <span class="plus">+</span> &larr;</span> <span class="shortcut">Previous tab</span><br>
<span class="key">CTRL <span class="plus">+</span> +</span> <span class="shortcut">New tab</span><br>
<span class="key">CTRL <span class="plus">+</span> -</span> <span class="shortcut">Close current tab</span><br>
<span class="key">CTRL <span class="plus">+</span> o</span> <span class="shortcut">Open file prompt</span><br>
<span class="key">CTRL <span class="plus">+</span> f</span> <span class="shortcut">Find</span><br>
<span class="key">CTRL <span class="plus">+</span> g</span> <span class="shortcut">Focus on Go to line input</span><br>
<span class="key">CTRL <span class="plus">+</span> s</span> <span class="shortcut">Save</span><br>
<span class="key">CTRL <span class="plus">+</span> Shift <span class="plus">+</span> s</span> <span class="shortcut">Save as...</span><br>
<span class="key">CTRL <span class="plus">+</span> Enter</span> <span class="shortcut">View webpage</span><br>
<span class="key">Ctrl <span class="plus">+</span> &rarr;</span> <span class="shortcut">Next tab</span><br>
<span class="key">Ctrl <span class="plus">+</span> &larr;</span> <span class="shortcut">Previous tab</span><br>
<span class="key">Ctrl <span class="plus">+</span> +</span> <span class="shortcut">New tab</span><br>
<span class="key">Ctrl <span class="plus">+</span> -</span> <span class="shortcut">Close current tab</span><br>
<span class="key">Ctrl <span class="plus">+</span> o</span> <span class="shortcut">Open file prompt</span><br>
<span class="key">Ctrl <span class="plus">+</span> f</span> <span class="shortcut">Find</span><br>
<span class="key">Ctrl <span class="plus">+</span> g</span> <span class="shortcut">Focus on Go to line input</span><br>
<span class="key">Ctrl <span class="plus">+</span> s</span> <span class="shortcut">Save</span><br>
<span class="key">Ctrl <span class="plus">+</span> Shift <span class="plus">+</span> s</span> <span class="shortcut">Save as...</span><br>
<span class="key">Ctrl <span class="plus">+</span> Enter</span> <span class="shortcut">View webpage</span><br>
<span class="key">Space</span> <span class="shortcut">Refocus on document</span><br>
<span class="key">Esc</span> <span class="shortcut">Cancel tasks</span><br>

View File

@@ -55,21 +55,11 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
100% {-webkit-transform:rotate(-360deg)}
}
.progressBar {position:absolute; top: 0; left: 0; width:100%; height:1px; margin:2px 0; background:#2187e7; box-shadow:0 0 10px 1px rgba(0,198,255,0.7)}
@-moz-keyframes fullexpand {
0% {width:0}
100%{width:100%}
}
@-webkit-keyframes fullexpand {
0% {width:0}
100%{width:100%}
}
.header {position: absolute; display: inline-block; top: 0; left: 0; width: 100%; height: 40px; background-color: #fff; text-align: right; z-index: 2}
.header .tools {position: absolute; display: inline-block; left: 15px; top: 3px}
.header .plugins {position: absolute; display: inline-block; left: 55px; top: 3px}
.header .plugins img {position: relative; display: inline-block; margin-right: 15px}
.header .screenModeIcon {position: absolute; top: 5px; right: 178px; cursor: pointer}
.header .screenModeIcon {position: absolute; top: 5px; right: 46px; cursor: pointer}
.header .version {position: relative; display: inline-block; margin-top: 25px; font-size: 10px; color: #bbb}
.header .version a {font-size: 10px; color: #bbb; text-decoration: none}
.header .logo {position: relative; margin: 5px 10px 0 5px; cursor: pointer}
@@ -88,11 +78,11 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.files .accountOptions .rename {width: 16px; height: 16px; background-position: -116px 0; margin: 8px 0 0 5px; opacity: 0.3}
.files .accountOptions .view {width: 16px; height: 16px; background-position: -132px 0; margin: 8px 0 0 5px; opacity: 0.3}
.files .accountOptions .lock {position: relative; margin-left: 208px; margin-top: -27px; width: 12px; height: 16px; background-position: -64px -16px; z-index: 1}
.files input:focus, .findReplace input:focus, .findReplace select:focus, .accountPassword:focus {outline: none; box-shadow: 0 0 10px 1px rgba(0,198,255,1)}
.files input:focus, .findReplace input:focus, .findReplace select:focus, .password:focus {outline: none; box-shadow: 0 0 10px 1px rgba(0,198,255,1)}
.files .button {position: absolute; border: 0; background: #444; color: #eee; height:20px; margin-top: 16px; margin-left: 5px; font-size: 11px; cursor: pointer}
.files .button:hover {background-color: #222; color: #eee}
.files .frame {display: inline-block; width: 250px}
.files .serverMessage {position: absolute; display: none; width: 450px; bottom: 0; margin-bottom: 30px; background-color: rgba(255,255,255,0.8); font-size: 10px; padding: 7px 12px; opacity: 0;
.files .serverMessage {position: absolute; display: inline-block; width: 450px; bottom: 0; margin-bottom: 30px; background-color: rgba(255,255,255,0.8); font-size: 10px; padding: 7px 12px; opacity: 0;
-webkit-transition: opacity 0.2s;
-moz-transition: opacity 0.2s;
transition: opacity 0.2s;
@@ -101,7 +91,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.editor {position: absolute; display: inline-block; top: 0; left: 15px; width: 2400px}
.editor .tabsBar {display: inline-block; height: 22px; width: 2400px; margin-top: 40px; padding-left: 41px; background: #ddd}
.tabsBar .tab {position: absolute; display: none; background: url('../images/nav-bg.jpg') repeat-x 0 0; padding: 5px 8px 2px 8px; font-size: 10px; border-left: solid 1px #eee; border-right: solid 1px #777; border-radius: 4px 4px 0 0; color: #fff; white-space: nowrap; overflow: hidden; cursor: pointer; z-index: 1;
.tabsBar .tab {position: absolute; display: none; padding: 5px 8px 2px 8px; font-size: 10px; border-left: solid 1px #eee; border-right: solid 1px #777; border-radius: 5px 5px 0 0; color: #fff; white-space: nowrap; overflow: hidden; cursor: pointer; z-index: 1;
-webkit-transition: width 0.15s ease-in-out;
-moz-transition: width 0.15s ease-in-out;
transition: width 0.15s ease-in-out;
@@ -125,7 +115,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.tabsBar .alphaTabs:hover {background: #000}
.tabsBar .closeAllTabs {position: absolute; margin: 6px 0 0 -33px; background: #bbb}
.tabsBar .closeAllTabs:hover {background: #000}
.tabsBar .newTab {position: absolute; display: inline-block; background-image: url('../images/nav-bg.jpg'); background-repeat: repeat-x; background-position: 0 0; padding: 6px 5px 5px 5px; border-left: solid 1px #eee; border-right: solid 1px #777; border-radius: 4px 4px 0 0; cursor: pointer; z-index: 1;
.tabsBar .newTab {position: absolute; display: inline-block; padding: 6px 5px 5px 5px; border-left: solid 1px #eee; border-right: solid 1px #777; background: #aaa; border-radius: 4px 4px 0 0; cursor: pointer; z-index: 0;
-webkit-transition: left 0.15s ease-in-out;
-moz-transition: left 0.15s ease-in-out;
transition: left 0.15s ease-in-out;
@@ -160,7 +150,11 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.textbox {box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.4)}
.fileMenu {position: absolute; display: none; left: 0; top: 0; background-color: #333; z-index: 10}
.fileMenu {position: absolute; display: none; left: 0; top: 0; background-color: #333; z-index: 10;
-webkit-transition: opacity 0.15s;
-moz-transition: opacity 0.15s;
transition: opacity 0.15s;
}
.fileMenu a {display: block; padding: 2px 5px; background-color: #333; color: #eee; text-decoration: none}
.fileMenu a:hover {background-color: #666}
@@ -171,6 +165,6 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.screenCenter .text {position: relative; display: block; margin-top: 15px; font-size: 10px; color: #888}
.screenCenter .text input {margin-top: 1px}
.screenCenter .text a {position: relative; display: block; margin-top: 15px; font-size: 10px; color: #888; text-decoration: none}
.screenCenter .accountPassword {border: 0; background-color: #333; color: #fff; height: 20px}
.screenCenter .password {border: 0; background-color: #333; color: #fff; height: 20px}
.screenCenter .button {border: 0; background: #444; color: #eee; height: 22px; cursor: pointer}
.screenCenter .button:hover {background: #2187e7; color: #eee}

View File

@@ -1,3 +1,9 @@
// Get any elem by ID
var get = function(elem) {
return top.document.getElementById(elem);
};
// Main ICEcoder object
var ICEcoder = {
// ==============
@@ -26,9 +32,11 @@ var ICEcoder = {
tabLeftPos: [], // Left position of tabs inside content area
tabBGcurrent: '#141414', // BG of current tab
tabBGselected: '#49d', // BG of selected tab
tabBGopen: '#888', // BG of open tab
tabBGopen: '#aaa', // BG of open tab
tabBGnormal: 'transparent', // BG of normal tab
tabFGcurrent: '#fff', // FG of selected tab
tabFGselected: '#fff', // FG of selected tab
tabFGopenFile: '#000', // FG of open file
tabFGnormalFile: '#eee', // FG of normal file
tabFGnormalTab: '#000', // FG of normal tab
serverQueueItems: [], // Array of URLs to call in order
@@ -43,7 +51,7 @@ var ICEcoder = {
// Create our ID aliases
for (var i=0;i<aliasArray.length;i++) {
ICEcoder[aliasArray[i]] = top.document.getElementById(aliasArray[i]);
ICEcoder[aliasArray[i]] = top.get(aliasArray[i]);
}
},
@@ -55,13 +63,13 @@ var ICEcoder = {
ICEcoder.setLayout();
// Hide the loading screen & auto open last files?
top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask'));
top.ICEcoder.showHide('hide',top.get('loadingMask'));
if (top.ICEcoder.openLastFiles) {top.ICEcoder.autoOpenFiles()};
setInterval(ICEcoder.updateNestingIndicator,30);
// Setup fullscreen detection and change icon
screenIcon = top.document.getElementById('screenMode');
screenIcon = top.get('screenMode');
sISrc = ["images/restored-screen.gif","images/full-screen.gif"];
document.addEventListener("fullscreenchange", function () {screenIcon.src = document.fullscreen ? sISrc[0] : sISrc[1];}, false);
document.addEventListener("mozfullscreenchange", function () {screenIcon.src = document.mozFullScreen ? sISrc[0] : sISrc[1];}, false);
@@ -132,7 +140,7 @@ var ICEcoder = {
// Can click-drag file manager width?
canResizeFilesW: function() {
// If we have the cursor set we must be able!
if (top.document.body.style.cursor == "w-resize") {
if (top.ICEcoder.ready && top.document.body.style.cursor == "w-resize") {
// If our mouse is down and we're within a 250-400px range
if (top.ICEcoder.mouseDown) {
top.ICEcoder.filesW = top.ICEcoder.maxFilesW = top.ICEcoder.mouseX >=250 && top.ICEcoder.mouseX <= 400
@@ -151,7 +159,7 @@ var ICEcoder = {
lockUnlockNav: function() {
var lockIcon;
lockIcon = top.document.getElementById('fmLock');
lockIcon = top.get('fmLock');
ICEcoder.lockedNav = ICEcoder.lockedNav ? false : true;
lockIcon.style.backgroundPosition = ICEcoder.lockedNav ? "-64px -16px" : "-80px -16px";
},
@@ -482,7 +490,7 @@ var ICEcoder = {
// Select file or folder on demand
selectFileFolder: function(evt) {
var tgtFile, shortURL;
var tgtFile, shortURL, selecting, dirList, lastFileClicked, startFile, endFile, thisFileObj;
// If we've clicked somewhere other than a file/folder
if (top.ICEcoder.thisFileFolderLink=="") {
@@ -504,6 +512,33 @@ var ICEcoder = {
ICEcoder.selectDeselectFile('select',tgtFile);
top.ICEcoder.selectedFiles.push(shortURL);
}
// Select from last click to this one
} else if (evt.shiftKey) {
selecting = false;
dirList = tgtFile.parentNode.parentNode.parentNode;
lastFileClicked = top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1];
startFile = shortURL < lastFileClicked ? shortURL : lastFileClicked;
endFile = shortURL > lastFileClicked ? shortURL : lastFileClicked;
if (top.ICEcoder.selectedFiles.length > 0 && startFile.substr(0,startFile.lastIndexOf("|")) == endFile.substr(0,endFile.lastIndexOf("|"))) {
for (var i=0; i<1000000; i+=2) {
if(dirList.childNodes[i].nodeName != "LI") {i++;};
thisFileObj = dirList.childNodes[i].childNodes[0].childNodes[1];
if (thisFileObj.id == startFile) {
selecting = true;
}
if (selecting==true && top.ICEcoder.selectedFiles.indexOf(thisFileObj.id)==-1) {
ICEcoder.selectDeselectFile('select',thisFileObj);
top.ICEcoder.selectedFiles.push(thisFileObj.id);
}
if (thisFileObj.id == endFile) {
break;
}
}
} else {
ICEcoder.selectDeselectFile('select',tgtFile);
top.ICEcoder.selectedFiles.push(shortURL);
}
// We are single clicking
} else {
top.ICEcoder.deselectAllFiles();
@@ -524,7 +559,7 @@ var ICEcoder = {
top.ICEcoder.fMIconVis('fMDelete',top.ICEcoder.selectedFiles.length > 0 ? 1 : 0.3);
top.ICEcoder.fMIconVis('fMRename',top.ICEcoder.selectedFiles.length == 1 ? 1 : 0.3);
// Hide the file menu incase it's showing
top.document.getElementById('fileMenu').style.display = "none";
top.ICEcoder.hideFileMenu();
},
// Deselect all files
@@ -553,7 +588,7 @@ var ICEcoder = {
? top.ICEcoder.tabBGselected : file.style.backgroundColor = isOpen
? top.ICEcoder.tabBGopen : top.ICEcoder.tabBGnormal;
}
file.style.color= action=="select" ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalFile;
file.style.color = action=="select" ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalFile;
}
},
@@ -645,9 +680,10 @@ var ICEcoder = {
saveType = saveAs ? "saveAs" : "save";
filePath = ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|");
if (filePath=="|[NEW]") {
if (filePath=="|[NEW]" && top.ICEcoder.selectedFiles.length>0) {
filePath = top.ICEcoder.selectedFiles[0]+filePath;
}
filePath = filePath.replace("||","|");
top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+filePath+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+saveType);
top.ICEcoder.serverMessage('<b>Saving</b><br>'+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,""));
},
@@ -672,8 +708,8 @@ var ICEcoder = {
top.ICEcoder.openFiles[i] = newName;
closeTabLink = '<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>';
fileName = top.ICEcoder.openFiles[i];
top.document.getElementById('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
top.document.getElementById('tab'+(i+1)).title = newName;
top.get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
top.get('tab'+(i+1)).title = newName;
}
top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+newName+"&oldFileName="+oldName.replace(/\|/g,"/"));
top.ICEcoder.serverMessage('<b>Renaming to</b><br>'+newName);
@@ -706,7 +742,7 @@ var ICEcoder = {
for (var i=0; i<top.ICEcoder.selectedFiles.length; i++) {
top.ICEcoder.copiedFiles[i] = top.ICEcoder.selectedFiles[i];
}
top.document.getElementById('fmMenuPasteOption').style.display = "block";
top.get('fmMenuPasteOption').style.display = "block";
top.ICEcoder.hideFileMenu();
},
@@ -724,12 +760,12 @@ var ICEcoder = {
// Upload file(s) - select & submit
uploadFilesSelect: function(location) {
top.document.getElementById('uploadDir').value = location;
top.document.getElementById("fileInput").click();
top.get('uploadDir').value = location;
top.get("fileInput").click();
},
uploadFilesSubmit: function(obj) {
if (top.document.getElementById('fileInput').value!="") {
top.ICEcoder.showHide('show',top.document.getElementById('loadingMask'));
if (top.get('fileInput').value!="") {
top.ICEcoder.showHide('show',top.get('loadingMask'));
document.getElementById('uploadFilesForm').submit();
event.preventDefault();
}
@@ -746,10 +782,11 @@ var ICEcoder = {
if ("undefined" != typeof top.ICEcoder.thisFileFolderLink && top.ICEcoder.thisFileFolderLink!="") {
menuType = top.ICEcoder.selectedFiles[0].indexOf(".")>-1 ? "file" : "folder";
folderMenuItems = top.document.getElementById('folderMenuItems');
folderMenuItems = top.get('folderMenuItems');
folderMenuItems.style.display = menuType == "folder" && top.ICEcoder.selectedFiles.length == 1 ? "block" : "none";
singleFileMenuItems.style.display = top.ICEcoder.selectedFiles.length > 1 ? "none" : "block";
document.getElementById('fileMenu').style.display = "inline-block";
setTimeout(function() {document.getElementById('fileMenu').style.opacity = "1"},4);
document.getElementById('fileMenu').style.left = (top.ICEcoder.mouseX+20) + "px";
document.getElementById('fileMenu').style.top = (top.ICEcoder.mouseY-top.ICEcoder.filesFrame.contentWindow.document.body.scrollTop-10) + "px";
}
@@ -759,11 +796,13 @@ var ICEcoder = {
// Continue to show the file manager
showFileMenu: function() {
document.getElementById('fileMenu').style.display='inline-block';
setTimeout(function() {document.getElementById('fileMenu').style.opacity = "1"},4);
},
// Hide the file manager
hideFileMenu: function() {
document.getElementById('fileMenu').style.display='none';
document.getElementById('fileMenu').style.opacity = "0";
},
// Update the file manager tree list on demand
@@ -894,20 +933,12 @@ var ICEcoder = {
// Refresh file manager
refreshFileManager: function() {
var pB;
pB = top.document.getElementById('progressBar').style;
pB.webkitAnimation = pB.mozAnimation = '';
setTimeout(function () {
pB.webkitAnimation = pB.mozAnimation = 'fullexpand 10s ease-out';
}, 4);
top.ICEcoder.showHide('show',top.document.getElementById('loadingMask'));
top.ICEcoder.showHide('show',top.get('loadingMask'));
top.ICEcoder.filesFrame.src="files.php";
top.ICEcoder.filesFrame.style.opacity="0";
top.ICEcoder.filesFrame.onload = function() {
top.ICEcoder.filesFrame.style.opacity="1";
top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask'));
top.ICEcoder.showHide('hide',top.get('loadingMask'));
}
},
@@ -917,9 +948,9 @@ var ICEcoder = {
// Update find & replace options based on user selection
findReplaceOptions: function() {
top.document.getElementById('rText').style.display =
top.document.getElementById('replace').style.display =
top.document.getElementById('rTarget').style.display =
top.get('rText').style.display =
top.get('replace').style.display =
top.get('rTarget').style.display =
document.findAndReplace.connector.value=="and"
? "inline-block" : "none";
},
@@ -930,8 +961,8 @@ var ICEcoder = {
// Determine our find & replace strings and the length of them
find = findString.toLowerCase();
replace = top.document.getElementById('replace').value;
results = top.document.getElementById('results');
replace = top.get('replace').value;
results = top.get('results');
// If we have something to find in currrent document
cM = ICEcoder.getcMInstance();
@@ -1041,8 +1072,8 @@ var ICEcoder = {
}
find = find.replace(/\'/g, '\&#39;');
find != encodeURIComponent(find) ? find = 'ICEcoder:'+encodeURIComponent(find) : find;
top.ICEcoder.showHide('show',top.document.getElementById('loadingMask'));
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/multiple-results.php?find='+find+replaceQS+targetQS+filesQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>';
top.ICEcoder.showHide('show',top.get('loadingMask'));
top.get('mediaContainer').innerHTML = '<iframe src="lib/multiple-results.php?find='+find+replaceQS+targetQS+filesQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>';
}
}
},
@@ -1265,9 +1296,9 @@ var ICEcoder = {
serverMessage = document.getElementById('serverMessage');
if (message) {
serverMessage.innerHTML = message;
serverMessage.style.display = "inline-block";
serverMessage.style.left = "0";
} else {
setTimeout(function() {serverMessage.style.display = "none"},200);
setTimeout(function() {serverMessage.style.left = "2000px";},200);
}
serverMessage.style.opacity = message ? 1 : 0;
},
@@ -1282,7 +1313,7 @@ var ICEcoder = {
while((match = rx.exec(string)) && cM.getCursor().ch > match.index+match[0].length);
oldBlock = top.document.getElementById('content').contentWindow.document.getElementById('cssColor');
oldBlock = top.get('content').contentWindow.document.getElementById('cssColor');
if (oldBlock) {oldBlock.parentNode.removeChild(oldBlock)};
if (top.ICEcoder.codeAssist && top.ICEcoder.caretLocType=="CSS") {
newBlock = top.document.createElement("div");
@@ -1295,22 +1326,22 @@ var ICEcoder = {
newBlock.style.cursor = "pointer";
newBlock.onclick = function() {top.ICEcoder.showColorPicker(match[0])};
if (newBlock.style.backgroundColor=="") {newBlock.style.display = "none"};
top.document.getElementById('header').appendChild(newBlock);
cM.addWidget(cM.getCursor(), top.document.getElementById('cssColor'), true);
top.get('header').appendChild(newBlock);
cM.addWidget(cM.getCursor(), top.get('cssColor'), true);
}
},
// Show color picker
showColorPicker: function(color) {
top.document.getElementById('blackMask').style.visibility = "visible";
top.document.getElementById('mediaContainer').innerHTML = '<div id="picker" class="picker"></div><br><br>'+
top.get('blackMask').style.visibility = "visible";
top.get('mediaContainer').innerHTML = '<div id="picker" class="picker"></div><br><br>'+
'<input type="text" id="color" name="color" value="#000" class="colorValue">'+
'<input type="button" onClick="top.ICEcoder.insertColorValue(top.document.getElementById(\'color\').value)" value="insert &gt;" class="insertColorValue"><br>'+
'<input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'color\').value)" value="insert &gt;" class="insertColorValue"><br>'+
'<input type="text" id="colorRGB" name="colorRGB" value="rgb(0,0,0)" class="colorValue">'+
'<input type="button" onClick="top.ICEcoder.insertColorValue(top.document.getElementById(\'colorRGB\').value)" value="insert &gt;" class="insertColorValue">';
'<input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'colorRGB\').value)" value="insert &gt;" class="insertColorValue">';
farbtastic('picker','color');
if (color) {
top.document.getElementById('picker').farbtastic.setColor(color);
top.get('picker').farbtastic.setColor(color);
}
},
@@ -1377,7 +1408,7 @@ var ICEcoder = {
fMIconVis: function(icon, vis) {
var i;
if (i = top.document.getElementById(icon)) {
if (i = top.get(icon)) {
i.style.opacity = vis;
}
},
@@ -1521,7 +1552,7 @@ var ICEcoder = {
if (ICEcoder.serverQueueItems.length>0) {
ICEcoder.serverQueueItems.splice(1,ICEcoder.serverQueueItems.length);
}
top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask'));
top.ICEcoder.showHide('hide',top.get('loadingMask'));
top.ICEcoder.serverMessage('<b style="color: #d00">Cancelled tasks</b>');
setTimeout(function() {top.ICEcoder.serverMessage();},2000);
},
@@ -1550,27 +1581,27 @@ var ICEcoder = {
// Show the settings screen
settingsScreen: function(hide) {
if (!hide) {
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/settings-screen.php" class="whiteGlow" style="width: 970px; height: 600px"></iframe>';
top.get('mediaContainer').innerHTML = '<iframe src="lib/settings-screen.php" class="whiteGlow" style="width: 970px; height: 600px"></iframe>';
}
top.ICEcoder.showHide(hide?'hide':'show',top.document.getElementById('blackMask'));
top.ICEcoder.showHide(hide?'hide':'show',top.get('blackMask'));
},
// Show the help screen
helpScreen: function() {
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/help.php" class="whiteGlow" style="width: 800px; height: 470px"></iframe>';
top.ICEcoder.showHide('show',top.document.getElementById('blackMask'));
top.get('mediaContainer').innerHTML = '<iframe src="lib/help.php" class="whiteGlow" style="width: 800px; height: 470px"></iframe>';
top.ICEcoder.showHide('show',top.get('blackMask'));
},
// Show the ICEcoder manual, loaded remotely
showManual: function(version) {
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="http://icecoder.net/manual?version='+version+'" class="whiteGlow" style="width: 500px; height: 500px"></iframe>';
top.ICEcoder.showHide('show',top.document.getElementById('blackMask'));
top.get('mediaContainer').innerHTML = '<iframe src="http://icecoder.net/manual?version='+version+'" class="whiteGlow" style="width: 500px; height: 500px"></iframe>';
top.ICEcoder.showHide('show',top.get('blackMask'));
},
// Show the properties screen
propertiesScreen: function(fileName) {
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/properties.php?fileName='+fileName.replace(/\//g,"|")+'" class="whiteGlow" style="width: 660px; height: 330px"></iframe>';
top.ICEcoder.showHide('show',top.document.getElementById('blackMask'));
top.get('mediaContainer').innerHTML = '<iframe src="lib/properties.php?fileName='+fileName.replace(/\//g,"|")+'" class="whiteGlow" style="width: 660px; height: 330px"></iframe>';
top.ICEcoder.showHide('show',top.get('blackMask'));
},
// Update the settings used when we make a change to them
@@ -1589,13 +1620,13 @@ var ICEcoder = {
top.ICEcoder.switchTab(top.ICEcoder.selectedTab);
// Check/uncheck Code Assist setting
top.document.getElementById('codeAssist').checked = codeAssist;
top.get('codeAssist').checked = codeAssist;
// Unlock/lock the file manager
if (lockedNav != top.ICEcoder.lockedNav) {top.ICEcoder.lockUnlockNav()};
if (!lockedNav) {
ICEcoder.changeFilesW('contract');
top.document.getElementById('fileMenu').style.display='none';
top.ICEcoder.hideFileMenu();
}
cMCSS = ICEcoder.content.contentWindow.document.styleSheets[3];
@@ -1620,7 +1651,7 @@ var ICEcoder = {
// Update and show/hide found results display?
updateResultsDisplay: function(showHide) {
ICEcoder.findReplace(top.document.getElementById('find').value,true,false);
ICEcoder.findReplace(top.get('find').value,true,false);
document.getElementById('results').style.display = showHide=="show" ? 'inline-block' : 'none';
},
@@ -1646,7 +1677,7 @@ var ICEcoder = {
// Change permissions on a file/folder
chmod: function(file,perms) {
top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));
top.ICEcoder.showHide('hide',top.get('blackMask'));
top.ICEcoder.serverQueue("add","lib/file-control.php?action=perms&file="+file.replace(top.iceRoot,"")+"&perms="+perms);
top.ICEcoder.serverMessage('<b>chMod '+perms+' on </b><br>'+file.replace(top.iceRoot,""));
},
@@ -1734,7 +1765,7 @@ var ICEcoder = {
// Redo our find display
top.ICEcoder.findMode = false;
ICEcoder.findReplace(top.document.getElementById('find').value,true,false);
ICEcoder.findReplace(top.get('find').value,true,false);
// Rerun JS Hint
if (top.ICEcoder.codeAssist) {top.ICEcoder.updateHints()};
@@ -1777,10 +1808,10 @@ var ICEcoder = {
// Setup a new tab
closeTabLink = '<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>';
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).style.display = "inline-block";
top.get('tab'+(top.ICEcoder.openFiles.length)).style.display = "inline-block";
fileName = top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1];
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).title = "/" + top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//,"");
top.get('tab'+(top.ICEcoder.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
top.get('tab'+(top.ICEcoder.openFiles.length)).title = "/" + top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//,"");
// Set the widths
top.ICEcoder.setTabWidths();
@@ -1821,13 +1852,13 @@ var ICEcoder = {
// Setup a new tab
closeTabLink = '<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>';
fileName = top.ICEcoder.openFiles[tabNum-1];
top.document.getElementById('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
top.document.getElementById('tab'+tabNum).title = "/" + top.ICEcoder.openFiles[tabNum-1].replace(/\//,"");
top.get('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
top.get('tab'+tabNum).title = "/" + top.ICEcoder.openFiles[tabNum-1].replace(/\//,"");
},
// Reset all tabs to be without a highlight and then highlight the selected
redoTabHighlight: function(selectedTab) {
var bgVPos, tColor, fileLink;
var tColor, fileLink;
for(var i=1;i<=ICEcoder.changedContent.length;i++) {
if (document.getElementById('tab'+i).childNodes[0]) {
@@ -1837,11 +1868,13 @@ var ICEcoder = {
tColor = i==selectedTab ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalTab;
if ("undefined" != typeof top.ICEcoder.openFiles[i-1] && top.ICEcoder.openFiles[i-1] != "/[NEW]") {
fileLink = top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[i-1].replace(/\//g,"|"));
if (fileLink) {fileLink.style.backgroundColor = i==selectedTab ? top.ICEcoder.tabBGcurrent : top.ICEcoder.tabBGopen;};
if (fileLink) {
fileLink.style.backgroundColor = i==selectedTab ? top.ICEcoder.tabBGcurrent : top.ICEcoder.tabBGopen;
fileLink.style.color = i==selectedTab ? top.ICEcoder.tabFGcurrent : top.ICEcoder.tabFGopenFile;
};
}
document.getElementById('tab'+i).style.color = tColor;
bgVPos = i==selectedTab ? -22 : 0;
document.getElementById('tab'+i).style.backgroundPosition = "0 "+bgVPos+"px";
document.getElementById('tab'+i).style.background = i==selectedTab ? top.ICEcoder.tabBGcurrent : top.ICEcoder.tabBGopen;
}
top.ICEcoder.fMIconVis('fMSave',ICEcoder.changedContent[selectedTab-1]==1 ? 1 : 0.3);
},
@@ -1862,8 +1895,8 @@ var ICEcoder = {
// recursively copy over all tabs & data from the tab to the right, if there is one
for (var i=closeTabNum;i<ICEcoder.openFiles.length;i++) {
top.document.getElementById('tab'+i).innerHTML = top.document.getElementById('tab'+(i+1)).innerHTML;
top.document.getElementById('tab'+i).title = top.document.getElementById('tab'+(i+1)).title;
top.get('tab'+i).innerHTML = top.get('tab'+(i+1)).innerHTML;
top.get('tab'+i).title = top.get('tab'+(i+1)).title;
ICEcoder.openFiles[i-1] = ICEcoder.openFiles[i];
ICEcoder.openFileMDTs[i-1] = ICEcoder.openFileMDTs[i];
}
@@ -1871,9 +1904,9 @@ var ICEcoder = {
ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[closeTabNum-1]].getWrapperElement().style.display = "none";
top.ICEcoder.cMInstances.splice(closeTabNum-1,1);
// clear the rightmost tab (or only one left in a 1 tab scenario) & remove from the array
top.document.getElementById('tab'+ICEcoder.openFiles.length).style.display = "none";
top.document.getElementById('tab'+ICEcoder.openFiles.length).innerHTML = "";
top.document.getElementById('tab'+ICEcoder.openFiles.length).title = "";
top.get('tab'+ICEcoder.openFiles.length).style.display = "none";
top.get('tab'+ICEcoder.openFiles.length).innerHTML = "";
top.get('tab'+ICEcoder.openFiles.length).title = "";
ICEcoder.openFiles.pop();
ICEcoder.openFileMDTs.pop();
// If we're closing the selected tab, determin the new selectedTab number, reduced by 1 if we have some tabs, 0 for a reset state
@@ -1924,26 +1957,28 @@ var ICEcoder = {
setTabWidths: function(posOnlyNewTab) {
var availWidth, avgWidth, tabWidth, lastLeft, lastWidth;
availWidth = parseInt(top.ICEcoder.content.style.width,10)-41-24-10; // - left margin - new tab - right margin
avgWidth = (availWidth/top.ICEcoder.openFiles.length)-18;
tabWidth = -18; // Incl 18px offset
lastLeft = 41;
lastWidth = 0;
top.ICEcoder.tabLeftPos = [];
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
if (posOnlyNewTab) {i=top.ICEcoder.openFiles.length};
tabWidth = top.ICEcoder.openFiles.length*(150+18) > availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150;
lastLeft = i==0 ? 41 : parseInt(top.document.getElementById('tab'+(i)).style.left,10);
lastWidth = i==0 ? 0 : parseInt(top.document.getElementById('tab'+(i)).style.width,10)+18;
if (!posOnlyNewTab) {
top.document.getElementById('tab'+(i+1)).style.left = (lastLeft+lastWidth) + "px";
top.document.getElementById('tab'+(i+1)).style.width = tabWidth + "px";
} else {
tabWidth = -18;
if (top.ICEcoder.ready) {
availWidth = parseInt(top.ICEcoder.content.style.width,10)-41-24-10; // - left margin - new tab - right margin
avgWidth = (availWidth/top.ICEcoder.openFiles.length)-18;
tabWidth = -18; // Incl 18px offset
lastLeft = 41;
lastWidth = 0;
top.ICEcoder.tabLeftPos = [];
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
if (posOnlyNewTab) {i=top.ICEcoder.openFiles.length};
tabWidth = top.ICEcoder.openFiles.length*(150+18) > availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150;
lastLeft = i==0 ? 41 : parseInt(top.get('tab'+(i)).style.left,10);
lastWidth = i==0 ? 0 : parseInt(top.get('tab'+(i)).style.width,10)+18;
if (!posOnlyNewTab) {
top.get('tab'+(i+1)).style.left = (lastLeft+lastWidth) + "px";
top.get('tab'+(i+1)).style.width = tabWidth + "px";
} else {
tabWidth = -18;
}
top.ICEcoder.tabLeftPos.push(lastLeft+lastWidth);
}
top.ICEcoder.tabLeftPos.push(lastLeft+lastWidth);
top.get('newTab').style.left = (lastLeft+lastWidth+tabWidth+18) + "px";
}
top.document.getElementById('newTab').style.left = (lastLeft+lastWidth+tabWidth+18) + "px";
},
// Tab dragging start
@@ -1951,9 +1986,9 @@ var ICEcoder = {
top.ICEcoder.draggingTab = tab;
top.ICEcoder.diffStartX = top.ICEcoder.mouseX;
top.ICEcoder.tabDragMouseXStart = (top.ICEcoder.mouseX - (parseInt(top.ICEcoder.files.style.width,10)+41+18)) % 150;
top.document.getElementById('tab'+tab).style.zIndex = 2;
top.get('tab'+tab).style.zIndex = 2;
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
top.document.getElementById('tab'+i).className = i!==tab
top.get('tab'+i).className = i!==tab
? "tab tabSlide"
: "tab tabDrag";
}
@@ -1963,25 +1998,25 @@ var ICEcoder = {
tabDragMove: function() {
var lastTabWidth, thisLeft, dragTabNo, tabWidth;
lastTabWidth = parseInt(top.document.getElementById('tab'+top.ICEcoder.openFiles.length).style.width,10)+18;
lastTabWidth = parseInt(top.get('tab'+top.ICEcoder.openFiles.length).style.width,10)+18;
top.ICEcoder.thisLeft = thisLeft = top.ICEcoder.tabDragMouseX >= 41
? top.ICEcoder.tabDragMouseX <= parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth
? top.ICEcoder.tabDragMouseX : (parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth) : 41;
? top.ICEcoder.tabDragMouseX <= parseInt(top.get('newTab').style.left,10) - lastTabWidth
? top.ICEcoder.tabDragMouseX : (parseInt(top.get('newTab').style.left,10) - lastTabWidth) : 41;
top.document.getElementById('tab'+top.ICEcoder.draggingTab).style.left = thisLeft + "px";
top.get('tab'+top.ICEcoder.draggingTab).style.left = thisLeft + "px";
top.ICEcoder.dragTabNo = dragTabNo = top.ICEcoder.draggingTab;
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
top.document.getElementById('tab'+i).style.opacity = i == top.ICEcoder.draggingTab ? 1 : 0.5;
top.get('tab'+i).style.opacity = i == top.ICEcoder.draggingTab ? 1 : 0.5;
tabWidth = top.ICEcoder.tabLeftPos[i] ? top.ICEcoder.tabLeftPos[i] - top.ICEcoder.tabLeftPos[i-1] : tabWidth;
if (i!=top.ICEcoder.draggingTab) {
if (i < top.ICEcoder.draggingTab) {
top.document.getElementById('tab'+i).style.left = thisLeft <= top.ICEcoder.tabLeftPos[i-1]
top.get('tab'+i).style.left = thisLeft <= top.ICEcoder.tabLeftPos[i-1]
? top.ICEcoder.tabLeftPos[i-1]+tabWidth
: top.ICEcoder.tabLeftPos[i-1];
} else {
top.document.getElementById('tab'+i).style.left = thisLeft >= top.ICEcoder.tabLeftPos[i-1]
top.get('tab'+i).style.left = thisLeft >= top.ICEcoder.tabLeftPos[i-1]
? top.ICEcoder.tabLeftPos[i-1]-tabWidth
: top.ICEcoder.tabLeftPos[i-1];
}
@@ -1998,13 +2033,13 @@ var ICEcoder = {
if (top.ICEcoder.thisLeft >= top.ICEcoder.tabLeftPos[i-1]) {
swapWith = top.ICEcoder.thisLeft == top.ICEcoder.tabLeftPos[0] ? 1 : top.ICEcoder.dragTabNo > i ? i+1 : i;
}
top.document.getElementById('tab'+i).className = "tab";
top.document.getElementById('tab'+i).style.opacity = 1;
top.get('tab'+i).className = "tab";
top.get('tab'+i).style.opacity = 1;
if (i!=top.ICEcoder.dragTabNo) {
top.document.getElementById('tab'+i).style.zIndex = 1;
top.get('tab'+i).style.zIndex = 1;
} else {
setTimeout(function() {
top.document.getElementById('tab'+i).style.zIndex = 1;
top.get('tab'+i).style.zIndex = 1;
},150);
}
}
@@ -2043,8 +2078,8 @@ var ICEcoder = {
for (var i=0;i<newOrder.length;i++) {
document.getElementById('tab'+(i+1)+'.temp').id = "tab"+(i+1);
}
if (top.document.getElementById('tab'+selectedTabWillBe)) {
top.document.getElementById('tab'+selectedTabWillBe).className = "tab tabSlide";
if (top.get('tab'+selectedTabWillBe)) {
top.get('tab'+selectedTabWillBe).className = "tab tabSlide";
}
ICEcoder.changedContent = a[0];
ICEcoder.openFiles = a[1];
@@ -2065,7 +2100,7 @@ var ICEcoder = {
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
currentArray.push(top.ICEcoder.openFiles[i].slice(top.ICEcoder.openFiles[i].lastIndexOf('/')+1));
currentArrayFull.push(top.ICEcoder.openFiles[i]);
top.document.getElementById('tab'+(i+1)).className = "tab tabSlide";
top.get('tab'+(i+1)).className = "tab tabSlide";
}
while (currentArray.length>0) {
nextValue = currentArray[0];
@@ -2130,12 +2165,12 @@ var ICEcoder = {
// CTRL+F (Find)
if(key==70 && evt.ctrlKey) {
top.document.getElementById('find').focus();
top.get('find').focus();
return false;
// CTRL+G (Go to line)
} else if(key==71 && evt.ctrlKey) {
top.document.getElementById('goToLineNo').focus();
top.get('goToLineNo').focus();
return false;
// CTRL+I (Get info)

201
lib/ice-coder.min.js vendored
View File

@@ -1,108 +1,107 @@
var ICEcoder={filesW:250,minFilesW:14,maxFilesW:250,selectedTab:0,changedContent:[],canSwitchTabs:!0,openFiles:[],openFileMDTs:[],cMInstances:[],nextcMInstance:1,selectedFiles:[],findMode:!1,lockedNav:!0,htmlTagArray:[],codeAssist:!0,mouseDown:!1,draggingFilesW:!1,draggingTab:!1,tabLeftPos:[],tabBGcurrent:"#141414",tabBGselected:"#49d",tabBGopen:"#888",tabBGnormal:"transparent",tabFGselected:"#fff",tabFGnormalFile:"#eee",tabFGnormalTab:"#000",serverQueueItems:[],previewWindow:!1,pluginIntervalRefs:[],
overPopup:!1,ready:!1,initAliases:function(){for(var a="header files account fmLock filesFrame editor tabsBar findBar content footer system nestValid nestDisplay charDisplay byteDisplay".split(" "),b=0;b<a.length;b++)ICEcoder[a[b]]=top.document.getElementById(a[b])},init:function(){var a,b;ICEcoder.setLayout();top.ICEcoder.showHide("hide",top.document.getElementById("loadingMask"));top.ICEcoder.openLastFiles&&top.ICEcoder.autoOpenFiles();setInterval(ICEcoder.updateNestingIndicator,30);a=top.document.getElementById("screenMode");
b=["images/restored-screen.gif","images/full-screen.gif"];document.addEventListener("fullscreenchange",function(){a.src=document.fullscreen?b[0]:b[1]},!1);document.addEventListener("mozfullscreenchange",function(){a.src=document.mozFullScreen?b[0]:b[1]},!1);document.addEventListener("webkitfullscreenchange",function(){a.src=document.webkitIsFullScreen?b[0]:b[1]},!1);top.ICEcoder.ready=!0},setLayout:function(a){var b,c;b=window.innerWidth?window.innerWidth:document.body.clientWidth;c=window.innerHeight?
window.innerHeight:document.body.clientHeight;this.header.style.width=this.tabsBar.style.width=this.findBar.style.width=b+"px";this.files.style.width=this.editor.style.left=this.filesW+"px";this.account.style.height=this.accountH+"px";this.fmLock.style.marginLeft=this.filesW-42+"px";this.filesFrame.style.height=c-40-50-30+"px";this.nestValid.style.left=this.filesW+10+"px";this.nestDisplay.style.left=this.filesW+17+"px";top.ICEcoder.setTabWidths();a||(this.editor.style.width=ICEcoder.content.style.width=
var get=function(a){return top.document.getElementById(a)},ICEcoder={filesW:250,minFilesW:14,maxFilesW:250,selectedTab:0,changedContent:[],canSwitchTabs:!0,openFiles:[],openFileMDTs:[],cMInstances:[],nextcMInstance:1,selectedFiles:[],findMode:!1,lockedNav:!0,htmlTagArray:[],codeAssist:!0,mouseDown:!1,draggingFilesW:!1,draggingTab:!1,tabLeftPos:[],tabBGcurrent:"#141414",tabBGselected:"#49d",tabBGopen:"#aaa",tabBGnormal:"transparent",tabFGcurrent:"#fff",tabFGselected:"#fff",tabFGopenFile:"#000",tabFGnormalFile:"#eee",
tabFGnormalTab:"#000",serverQueueItems:[],previewWindow:!1,pluginIntervalRefs:[],overPopup:!1,ready:!1,initAliases:function(){for(var a="header files account fmLock filesFrame editor tabsBar findBar content footer system nestValid nestDisplay charDisplay byteDisplay".split(" "),b=0;b<a.length;b++)ICEcoder[a[b]]=top.get(a[b])},init:function(){var a,b;ICEcoder.setLayout();top.ICEcoder.showHide("hide",top.get("loadingMask"));top.ICEcoder.openLastFiles&&top.ICEcoder.autoOpenFiles();setInterval(ICEcoder.updateNestingIndicator,
30);a=top.get("screenMode");b=["images/restored-screen.gif","images/full-screen.gif"];document.addEventListener("fullscreenchange",function(){a.src=document.fullscreen?b[0]:b[1]},!1);document.addEventListener("mozfullscreenchange",function(){a.src=document.mozFullScreen?b[0]:b[1]},!1);document.addEventListener("webkitfullscreenchange",function(){a.src=document.webkitIsFullScreen?b[0]:b[1]},!1);top.ICEcoder.ready=!0},setLayout:function(a){var b,c;b=window.innerWidth?window.innerWidth:document.body.clientWidth;
c=window.innerHeight?window.innerHeight:document.body.clientHeight;this.header.style.width=this.tabsBar.style.width=this.findBar.style.width=b+"px";this.files.style.width=this.editor.style.left=this.filesW+"px";this.account.style.height=this.accountH+"px";this.fmLock.style.marginLeft=this.filesW-42+"px";this.filesFrame.style.height=c-40-50-30+"px";this.nestValid.style.left=this.filesW+10+"px";this.nestDisplay.style.left=this.filesW+17+"px";top.ICEcoder.setTabWidths();a||(this.editor.style.width=ICEcoder.content.style.width=
b-this.filesW+"px",ICEcoder.content.style.height=c-40-30-21-28+"px",setTimeout(function(){for(var a=0;a<top.ICEcoder.openFiles.length;a++)top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize("100%",top.ICEcoder.content.style.height)},4))},changeFilesW:function(a){if(!ICEcoder.lockedNav||ICEcoder.lockedNav&&ICEcoder.filesW==ICEcoder.minFilesW)"undefined"!=typeof ICEcoder.changeFilesInt&&clearInterval(ICEcoder.changeFilesInt),ICEcoder.changeFilesInt=setInterval(function(){ICEcoder.changeFilesWStep(a)},
10)},changeFilesWStep:function(a){"expand"==a?ICEcoder.filesW<ICEcoder.maxFilesW-1?ICEcoder.filesW+=Math.ceil((ICEcoder.maxFilesW-ICEcoder.filesW)/2):ICEcoder.filesW=ICEcoder.maxFilesW:ICEcoder.filesW>ICEcoder.minFilesW+1?ICEcoder.filesW-=Math.ceil((ICEcoder.filesW-ICEcoder.minFilesW)/2):ICEcoder.filesW=ICEcoder.minFilesW;("expand"==a&&ICEcoder.filesW==ICEcoder.maxFilesW||"contract"==a&&ICEcoder.filesW==ICEcoder.minFilesW)&&clearInterval(ICEcoder.changeFilesInt);ICEcoder.setLayout()},canResizeFilesW:function(){"w-resize"==
top.document.body.style.cursor?top.ICEcoder.mouseDown&&(top.ICEcoder.filesW=top.ICEcoder.maxFilesW=250<=top.ICEcoder.mouseX&&400>=top.ICEcoder.mouseX?top.ICEcoder.mouseX:250>top.ICEcoder.mouseX?250:400,top.ICEcoder.files.style.width=top.ICEcoder.account.style.width=top.ICEcoder.filesFrame.style.width=top.ICEcoder.filesW+"px",top.ICEcoder.setLayout(),top.ICEcoder.draggingFilesW=!0):top.ICEcoder.draggingFilesW=!1},lockUnlockNav:function(){var a;a=top.document.getElementById("fmLock");ICEcoder.lockedNav=
ICEcoder.lockedNav?!1:!0;a.style.backgroundPosition=ICEcoder.lockedNav?"-64px -16px":"-80px -16px"},contentCleanUp:function(){var a,b;0>["js","coffee","css","less"].indexOf(ICEcoder.openFiles[ICEcoder.selectedTab-1].split(".")[1])&&(a=ICEcoder.getcMInstance(),b=a.getValue(),b=b.replace(/<ICEcoder:\/:textarea>/g,"</textarea>"),a.setValue(b),a.clearHistory())},moveLine:function(a){var b,c,d;b=top.ICEcoder.getcMInstance();c=b.getCursor().line;"up"==a&&0<c&&(d=c-1);"down"==a&&c<b.lineCount()-1&&(d=c+
1);isNaN(d)||(a=b.getLine(d),b.setLine(d,b.getLine(c)),b.setLine(c,a),ICEcoder.highlightLine(d))},highlightLine:function(a){var b;b=top.ICEcoder.getcMInstance();b.setSelection({line:a,ch:0},{line:a,ch:b.lineInfo(a).text.length})},goToLine:function(a){var b;b=ICEcoder.getcMInstance();b.setCursor(a?a-1:document.getElementById("goToLineNo").value-1);b.focus();return!1},switchMode:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a?b.setOption("mode",a):c&&(0<
c.indexOf(".js")?b.setOption("mode","javascript"):0<c.indexOf(".coffee")?b.setOption("mode","coffeescript"):0<c.indexOf(".rb")?b.setOption("mode","ruby"):0<c.indexOf(".py")?b.setOption("mode","python"):0<c.indexOf(".css")?b.setOption("mode","css"):0<c.indexOf(".less")?b.setOption("mode","less"):0<c.indexOf(".md")?b.setOption("mode","markdown"):b.setOption("mode","application/x-httpd-php"))},lineCommentToggle:function(){var a,b,c,d,e,f;a=ICEcoder.getcMInstance();b=a.getCursor().ch;c=a.getCursor().line;
d=a.getLine(c);e=d.length;f=2;if(-1<"JavaScript CoffeeScript PHP Python Ruby CSS".split(" ").indexOf(ICEcoder.caretLocType))if(a.somethingSelected())if("Ruby"==ICEcoder.caretLocType||"Python"==ICEcoder.caretLocType){e=a.getCursor(!0).line;for(d=a.getCursor().line;e<=d;e++)a.setLine(e,"#"!=a.getLine(e).slice(0,1)?"#"+a.getLine(e):a.getLine(e).slice(1,a.getLine(e).length))}else a.replaceSelection("/*"!=a.getSelection().slice(0,2)?"/*"+a.getSelection()+"*/":a.getSelection().slice(2,a.getSelection().length-
2));else-1<["CoffeeScript","CSS"].indexOf(ICEcoder.caretLocType)?(a.setLine(c,"/*"!=d.slice(0,2)?"/*"+d+"*/":d.slice(2,e).slice(0,e-4)),"/*"==d.slice(0,2)&&(f=-f)):"Ruby"==ICEcoder.caretLocType?(a.setLine(c,"#"!=d.slice(0,1)?"#"+d:d.slice(1,e)),"#"==d.slice(0,1)&&(f=-f)):(a.setLine(c,"//"!=d.slice(0,2)?"//"+d:d.slice(2,e)),"//"==d.slice(0,2)&&(f=-f));else a.somethingSelected()?a.replaceSelection("\x3c!--"!=a.getSelection().slice(0,4)?"\x3c!--"+a.getSelection()+"//--\x3e":a.getSelection().slice(4,
a.getSelection().length-5)):(a.setLine(c,"\x3c!--"!=d.slice(0,4)?"\x3c!--"+d+"//--\x3e":d.slice(4,e).slice(0,e-9)),f="\x3c!--"==d.slice(0,4)?-4:4);a.somethingSelected()||a.setCursor(c,b+f)},highlightBlock:function(a,b){var c,d,e,f;c=top.ICEcoder.getcMInstance();if(b)top.ICEcoder.dontUpdateNest?c.setCursor(top.ICEcoder.cursorOrigLine,top.ICEcoder.cursorOrigCh):top.ICEcoder.getNestLocation("updateNestDisplay"),top.ICEcoder.dontUpdateNest=!1;else{top.ICEcoder.cursorOrigCh=c.getCursor().ch;top.ICEcoder.cursorOrigLine=
c.getCursor().line;top.ICEcoder.dontUpdateNest=!0;d={};d.ch=c.getCursor().ch;d.line=c.getCursor().line;for(var g=top.ICEcoder.htmlTagArray.length-1;g>=a;g--)e=c.getSearchCursor("<"+top.ICEcoder.htmlTagArray[g],d),e.findPrevious(),d.ch=e.from().ch,d.line=e.from().line,g==a&&(f=c.getSearchCursor(">",d),f.findNext(),c.setCursor(f.from().line,f.from().ch+1),top.ICEcoder.getNestLocation(),ICEcoder.htmlTagArray.length-1!=a&&g++);e.from()&&(d={},top.ICEcoder.startPosLine=d.line=e.from().line,top.ICEcoder.startPosCh=
d.ch=e.from().ch,e={},e.line=top.ICEcoder.content.contentWindow.CodeMirror.tagRangeFinder(c,d)||d.line,e.line=e.line.to?e.line.to.line:e.line,e.ch=c.getLine(e.line).indexOf("</"+top.ICEcoder.htmlTagArray[a]+">")+top.ICEcoder.htmlTagArray[a].length+3,!top.ICEcoder.dontSelect?c.setSelection(d,e):top.ICEcoder.dontSelect=!1,c.scrollIntoView(d))}},setPosition:function(a,b,c){var d;d=ICEcoder.getcMInstance();c=d.getLine(b).indexOf(">",d.getLine(b).indexOf("<"+c))+1;d.setCursor(b,c);d.focus();for(d=b=0;d<=
a;d++)b=ICEcoder.nestDisplay.innerHTML.indexOf("&gt;",b+1);ICEcoder.nestDisplay.innerHTML=ICEcoder.nestDisplay.innerHTML.substr(0,b).replace(/<(?:.|\n)*?>/gm,"");top.ICEcoder.dontUpdateNest=!1;top.ICEcoder.dontSelect=!0},tagWrapper:function(a){var b,c,d,e;b=ICEcoder.getcMInstance();c=a;"div"==a?(d=b.getCursor("start").line,e=b.getCursor().line,b.operation(function(){b.replaceSelection("<div>\n"+b.getSelection()+"\n</div>");for(var a=d+1;a<=e+1;a++)b.indentLine(a);b.indentLine(e+2,"prev");b.indentLine(e+
2,"subtract")})):("a"==a&&(c='a href=""'),b.replaceSelection("<"+c+">"+b.getSelection()+"</"+a+">"));"a"==a&&b.setCursor({line:b.getCursor("start").line,ch:b.getCursor("start").ch+9})},addLineBreakAtEnd:function(a){var b;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);b.setLine(a,b.getLine(a)+"<br>")},duplicateLine:function(a){var b,c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.setLine(a,b.getLine(a)+"\n"+b.getLine(a));b.setCursor(a+1,c)},removeLine:function(a){var b,
c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.removeLine(a);b.setCursor(a-1,c)},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);else{top.ICEcoder.origCurorPos=a.getCursor();a=["var "+b,"function "+b,b+"=function",b+"= function",b+" =function",b+" = function",b+"=new function",b+"= new function",b+" =new function",b+" = new function",
"window['"+b+"']",'window["'+b+'"]',"this['"+b+"']",'this["'+b+'"]',b+":",b+" :","def "+b,"class "+b];for(b=0;b<a.length;b++)top.ICEcoder.findReplace(a[b],!1,!1)&&(b=a.length)}},openCloseDir:function(a,b){var c,d;a.onclick=function(a){a.ctrlKey||top.ICEcoder.openCloseDir(this,!1)};c=a.parentNode;c.nextSibling&&(c=c.nextSibling);c&&"UL"==c.tagName&&((d="none"==c.style.display)?b=!0:c.style.display="none",a.parentNode.className=a.className=d?"pft-directory dirOpen":"pft-directory");b&&(top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=
"lib/get-branch.php?location="+a.childNodes[1].id);return!1},overFileFolder:function(a,b){ICEcoder.thisFileFolderType=a;ICEcoder.thisFileFolderLink=b},selectFileFolder:function(a){var b,c;""==top.ICEcoder.thisFileFolderLink?a.ctrlKey||top.ICEcoder.deselectAllFiles():top.ICEcoder.thisFileFolderLink&&(c=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),b=ICEcoder.filesFrame.contentWindow.document.getElementById(c),a.ctrlKey?-1<top.ICEcoder.selectedFiles.indexOf(c)?(ICEcoder.selectDeselectFile("deselect",
b),top.ICEcoder.selectedFiles.splice(top.ICEcoder.selectedFiles.indexOf(c),1)):(ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c)):(top.ICEcoder.deselectAllFiles(),ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c)));document.findAndReplace.target[2].innerHTML=!top.ICEcoder.selectedFiles[0]?"all files":"selected files";document.findAndReplace.target[3].innerHTML=!top.ICEcoder.selectedFiles[0]?"all filenames":"selected filenames";top.ICEcoder.fMIconVis("fMOpen",
1==top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.fMIconVis("fMNewFile",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMNewFolder",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMDelete",0<top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.fMIconVis("fMRename",1==top.ICEcoder.selectedFiles.length?1:0.3);top.document.getElementById("fileMenu").style.display="none"},
deselectAllFiles:function(){for(var a,b=0;b<top.ICEcoder.selectedFiles.length;b++)a=top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.selectedFiles[b]),ICEcoder.selectDeselectFile("deselect",a);top.ICEcoder.selectedFiles.length=0},selectDeselectFile:function(a,b){var c;b&&(c=-1<top.ICEcoder.openFiles.indexOf(b.id.replace(/\|/g,"/"))?!0:!1,b.style.backgroundColor=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]==b.id.replace(/\|/g,"/")?"select"==a?top.ICEcoder.tabBGselected:
top.ICEcoder.tabBGcurrent:"select"==a?top.ICEcoder.tabBGselected:b.style.backgroundColor=c?top.ICEcoder.tabBGopen:top.ICEcoder.tabBGnormal,b.style.color="select"==a?top.ICEcoder.tabFGselected:top.ICEcoder.tabFGnormalFile)},newFile:function(){top.ICEcoder.newTab();top.ICEcoder.saveFile()},newFolder:function(){var a,b;a=top.ICEcoder.rightClickedFile.replace(/\|/g,"/");if(b=top.ICEcoder.getInput("Enter New Folder Name at "+a,""))b=(a+"/"+b).replace(/\/\//,"/"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=newFolder&file="+
b.replace(/\//g,"|")),top.ICEcoder.serverMessage("<b>Creating Folder</b><br>"+b)},openFile:function(a){var b;a&&(top.ICEcoder.thisFileFolderLink=a,top.ICEcoder.thisFileFolderType="file");!1!==top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)?top.ICEcoder.switchTab(top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)+1):""!=top.ICEcoder.thisFileFolderLink&&"file"==top.ICEcoder.thisFileFolderType&&(a=top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/"),b=!0,100>top.ICEcoder.openFiles.length?-1<top.ICEcoder.openFiles.indexOf(a)&&
"/[NEW]"!=a&&(b=!1,top.ICEcoder.switchTab(i+1)):(top.ICEcoder.message("Sorry, you can only have 100 files open at a time!"),b=!1),b&&(top.ICEcoder.shortURL=a,"/[NEW]"!=a?(top.ICEcoder.thisFileFolderLink=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=load&file="+top.ICEcoder.thisFileFolderLink),top.ICEcoder.serverMessage("<b>Opening File</b><br>"+top.ICEcoder.shortURL)):top.ICEcoder.createNewTab(),top.ICEcoder.fMIconVis("fMView",1)))},
openPrompt:function(){var a;if(a=top.ICEcoder.getInput("Enter relative file path (prefixed with /) or remote URL",""))-1<a.indexOf("://")?top.ICEcoder.getRemoteFile(a):top.ICEcoder.openFile(a)},getRemoteFile:function(a){top.ICEcoder.serverQueue("add","lib/file-control.php?action=getRemoteFile&file="+a);top.ICEcoder.serverMessage("<b>Getting</b><br>"+a)},saveFile:function(a){var b;a=a?"saveAs":"save";b=ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|");"|[NEW]"==
b&&(b=top.ICEcoder.selectedFiles[0]+b);top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+b+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+a);top.ICEcoder.serverMessage("<b>Saving</b><br>"+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,""))},renameFile:function(a,b){var c,d;a?c=a.replace(/\|/g,"/"):(c=top.ICEcoder.rightClickedFile.replace(/\|/g,"/"),a=top.ICEcoder.rightClickedFile.replace(/\|/g,"/"));b||(b=top.ICEcoder.getInput("Please enter the new name for",
c));b&&(d=top.ICEcoder.openFiles.indexOf(c.replace(/\|/g,"/")),-1<d&&(top.ICEcoder.openFiles[d]=b,closeTabLink='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>',c=top.ICEcoder.openFiles[d],top.document.getElementById("tab"+
(d+1)).innerHTML=closeTabLink+" "+c.slice(c.lastIndexOf("/")).replace(/\//,""),top.document.getElementById("tab"+(d+1)).title=b),top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+b+"&oldFileName="+a.replace(/\|/g,"/")),top.ICEcoder.serverMessage("<b>Renaming to</b><br>"+b),top.ICEcoder.setPreviousFiles())},deleteFile:function(){var a;0<top.ICEcoder.selectedFiles.length&&(a=top.ICEcoder.ask("Delete:\n\n"+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,
"\n")+"?"));if(a){a="";for(var b=0;b<top.ICEcoder.selectedFiles.length;b++)a+=top.ICEcoder.selectedFiles[b],b<top.ICEcoder.selectedFiles.length-1&&(a+=";");top.ICEcoder.serverQueue("add","lib/file-control.php?action=delete&file="+a);top.ICEcoder.serverMessage("<b>Deleting File</b><br>"+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"))}},copyFile:function(){top.ICEcoder.copiedFiles=[];for(var a=0;a<top.ICEcoder.selectedFiles.length;a++)top.ICEcoder.copiedFiles[a]=top.ICEcoder.selectedFiles[a];
top.document.getElementById("fmMenuPasteOption").style.display="block";top.ICEcoder.hideFileMenu()},pasteFile:function(a){if(top.ICEcoder.copiedFiles)for(var b=0;b<top.ICEcoder.copiedFiles.length;b++)top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+top.ICEcoder.copiedFiles[b]+"&location="+a),top.ICEcoder.serverMessage("<b>Pasting File</b><br>"+top.ICEcoder.copiedFiles[b].toString().replace(/\|/g,"/").replace(/,/g,"\n"));else top.ICEcoder.message("Nothing to paste, copy a file/folder first!")},
uploadFilesSelect:function(a){top.document.getElementById("uploadDir").value=a;top.document.getElementById("fileInput").click()},uploadFilesSubmit:function(){""!=top.document.getElementById("fileInput").value&&(top.ICEcoder.showHide("show",top.document.getElementById("loadingMask")),document.getElementById("uploadFilesForm").submit(),event.preventDefault())},showMenu:function(a){var b;(0==top.ICEcoder.selectedFiles.length||-1==top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.rightClickedFile.replace(/\//g,
"|")))&&top.ICEcoder.selectFileFolder(a);"undefined"!=typeof top.ICEcoder.thisFileFolderLink&&""!=top.ICEcoder.thisFileFolderLink&&(a=-1<top.ICEcoder.selectedFiles[0].indexOf(".")?"file":"folder",b=top.document.getElementById("folderMenuItems"),b.style.display="folder"==a&&1==top.ICEcoder.selectedFiles.length?"block":"none",singleFileMenuItems.style.display=1<top.ICEcoder.selectedFiles.length?"none":"block",document.getElementById("fileMenu").style.display="inline-block",document.getElementById("fileMenu").style.left=
top.ICEcoder.mouseX+20+"px",document.getElementById("fileMenu").style.top=top.ICEcoder.mouseY-top.ICEcoder.filesFrame.contentWindow.document.body.scrollTop-10+"px");return!1},showFileMenu:function(){document.getElementById("fileMenu").style.display="inline-block"},hideFileMenu:function(){document.getElementById("fileMenu").style.display="none"},updateFileManagerList:function(a,b,c,d,e,f){var g,l,h,j,m,n,k,p;if("add"==a&&!document.getElementById("filesFrame").contentWindow.document.getElementById(b.replace(/\/$/,
"").replace(/\//g,"|")+"|"+c)){g=-1<c.indexOf(".")?"file":"folder";l="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?664:705;b||(b="/");b=b.replace(top.iceRoot,"");h=document.getElementById("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));j=h.parentNode.parentNode.nextSibling;m=document.createTextNode("\n");n='<a nohref title="'+b.replace(/\/$/,"")+"/"+c+'" onMouseOver="top.ICEcoder.overFileFolder(\''+g+"','"+b.replace(/\/$/,"").replace(/\//g,
"|")+"|"+c+"')\" onMouseOut=\"top.ICEcoder.overFileFolder('"+g+'\',\'\')" style="position: relative; left:-22px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'">'+c+'</span> <span style="color: #888; font-size: 8px" id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'_perms">'+d+"</span></a>";if(3>j.childNodes.length)k=document.createElement("ul"),j=h.parentNode.parentNode,j.parentNode.insertBefore(k,j.nextSibling),k=document.createElement("li"),
k.className=l,k.innerHTML=n,j.nextSibling.appendChild(k),j.nextSibling.appendChild(m);else for(h=0;h<=j.childNodes.length-1;h++)if(j.childNodes[h].className&&(k=0<j.childNodes[h].className.indexOf("directory")?"folder":"file",p=j.childNodes[h].getElementsByTagName("span")[0].innerHTML,k==g&&p>c||"folder"==g&&"file"==k||h==j.childNodes.length-1)){k=document.createElement("li");k.className=l;k.innerHTML=n;h==j.childNodes.length-1?(j.appendChild(k),j.appendChild(m)):(j.insertBefore(k,j.childNodes[h]),
j.insertBefore(m,j.childNodes[h+1]));break}"file"==g&&!f&&(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]=b+c)}"rename"==a&&(e=e.replace(/\//g,"|"),h=document.getElementById("filesFrame").contentWindow.document.getElementById(e),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=document.getElementById("filesFrame").contentWindow.document.getElementById(e+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms");"chmod"==a&&(e=top.ICEcoder.rightClickedFile.replace(/\|/g,
"/"),h=document.getElementById("filesFrame").contentWindow.document.getElementById(e.replace(/\//g,"|")+"_perms"),h.innerHTML=d);"delete"==a&&(h=document.getElementById("filesFrame").contentWindow.document.getElementById(b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c).parentNode.parentNode,h.parentNode.removeChild(h))},fMIcon:function(a){"save"==a&&0<ICEcoder.openFiles.length&&top.ICEcoder.saveFile();1==ICEcoder.selectedFiles.length&&(top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=top.ICEcoder.selectedFiles[0].replace("|",
"/"),"open"==a&&-1<ICEcoder.selectedFiles[0].indexOf(".")?(top.ICEcoder.thisFileFolderType="file",top.ICEcoder.openFile()):"newFile"==a?top.ICEcoder.newFile():"newFolder"==a?top.ICEcoder.newFolder():"rename"==a&&top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile));"delete"==a&&0<ICEcoder.selectedFiles.length&&top.ICEcoder.deleteFile();"view"==a&&0<ICEcoder.openFiles.length&&window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1])},refreshFileManager:function(){var a;a=top.document.getElementById("progressBar").style;
a.webkitAnimation=a.mozAnimation="";setTimeout(function(){a.webkitAnimation=a.mozAnimation="fullexpand 10s ease-out"},4);top.ICEcoder.showHide("show",top.document.getElementById("loadingMask"));top.ICEcoder.filesFrame.src="files.php";top.ICEcoder.filesFrame.style.opacity="0";top.ICEcoder.filesFrame.onload=function(){top.ICEcoder.filesFrame.style.opacity="1";top.ICEcoder.showHide("hide",top.document.getElementById("loadingMask"))}},findReplaceOptions:function(){top.document.getElementById("rText").style.display=
top.document.getElementById("replace").style.display=top.document.getElementById("rTarget").style.display="and"==document.findAndReplace.connector.value?"inline-block":"none"},findReplace:function(a,b,c){var d,e,f,g;a=a.toLowerCase();d=top.document.getElementById("replace").value;e=top.document.getElementById("results");if((f=ICEcoder.getcMInstance())&&0<a.length&&"this document"==document.findAndReplace.target.value){f.getValue().toLowerCase();"and"==document.findAndReplace.connector.value&&("replace"==
document.findAndReplace.replaceAction.value&&f.getSelection().toLowerCase()==a?f.replaceSelection(d):"replace all"==document.findAndReplace.replaceAction.value&&c&&(c=RegExp(a,"gi"),f.setValue(f.getValue().replace(c,d))));c=f.getValue().toLowerCase();if(!top.ICEcoder.findMode||a!=top.ICEcoder.lastsearch){ICEcoder.results=[];for(d=0;d<c.length;d++)c.substr(d,a.length)==a&&d!=ICEcoder.findResult&&ICEcoder.results.push(d);ICEcoder.lastsearch=a}if(0<ICEcoder.results.length){if(b)e.innerHTML=ICEcoder.results.length+
" results";else{b=1;for(d=g=0;d<c.length;d++)c.indexOf("\n",d)==d&&b<=f.getCursor().line&&(b++,g=d);b=g+f.getCursor().ch+1;for(d=ICEcoder.findResult=0;d<ICEcoder.results.length;d++)ICEcoder.results[d]<b&&ICEcoder.findResult++;ICEcoder.findResult>ICEcoder.results.length-1&&(ICEcoder.findResult=0);e.innerHTML="Highlighted result "+(ICEcoder.findResult+1)+" of "+ICEcoder.results.length+" results";for(d=b=0;d<ICEcoder.results[ICEcoder.findResult];d++)c.indexOf("\n",d)==d&&b++;f.lineInfo(0);e=f.getSearchCursor(a,
f.getCursor(),!0);e.findNext();e.from()||(e=f.getSearchCursor(a,{line:0,ch:0},!0),e.findNext());f.setSelection(e.from(),e.to());f.focus();top.ICEcoder.findMode=!0}return!0}e.innerHTML="No results";return!1}if(""!=a&&c){filesQS=e=f="";"and"==document.findAndReplace.connector.value&&(f="&replace="+d);0<=document.findAndReplace.target.value.indexOf("file")&&(e="&target="+document.findAndReplace.target.value.replace(/ /g,"-"));if("selected files"==document.findAndReplace.target.value){filesQS="&selectedFiles=";
for(d=0;d<top.ICEcoder.selectedFiles.length;d++)filesQS+=top.ICEcoder.selectedFiles[d]+":";filesQS=filesQS.replace(/\:$/,"")}a=a.replace(/\'/g,"&#39;");a!=encodeURIComponent(a)?a="ICEcoder:"+encodeURIComponent(a):a;top.ICEcoder.showHide("show",top.document.getElementById("loadingMask"));top.document.getElementById("mediaContainer").innerHTML='<iframe src="lib/multiple-results.php?find='+a+f+e+filesQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>'}},replaceInFile:function(a,b,
c){top.ICEcoder.serverQueue("add","lib/file-control.php?action=replaceText&fileRef="+a.replace(/\//g,"|")+"&find="+b+"&replace="+c);top.ICEcoder.serverMessage("<b>Replacing text in</b><br>"+a)},getNestLocation:function(a){var b,c,d;if(b=ICEcoder.getcMInstance()){c=b.getValue();b=b.getTokenAt(b.getCursor()).state;if("undefined"!=typeof b.curState&&"undefined"!=typeof b.curState.htmlState){ICEcoder.htmlTagArray=[];for(d=b.curState.htmlState.context;d;d=d.prev)"undefined"!=typeof d.tagName&&ICEcoder.htmlTagArray.unshift(d.tagName)}ICEcoder.tagString=
ICEcoder.htmlTagArray[ICEcoder.htmlTagArray.length-1];"JavaScript"==ICEcoder.caretLocType&&(ICEcoder.tagString="script");if(a&&!top.ICEcoder.dontUpdateNest&&(ICEcoder.nestDisplay.innerHTML="","undefined"!=typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]&&(a=ICEcoder.openFiles[ICEcoder.selectedTab-1],0>["js","coffee","css","less"].indexOf(a.split(".")[1])&&-1==c.indexOf("include(")&&-1==c.indexOf("include_once(")&&(-1<c.indexOf("<html")||-1<c.indexOf("<body"))))){for(a=0;a<ICEcoder.htmlTagArray.length;a++)c=
'onMouseover="top.ICEcoder.highlightBlock('+a+')" onMouseout="top.ICEcoder.highlightBlock('+a+",'hide')\" onClick=\"top.ICEcoder.setPosition("+a+",top.ICEcoder.startPosLine,'"+ICEcoder.htmlTagArray[a]+"')\"",0==a&&(ICEcoder.nestDisplay.innerHTML+="<div "+c+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif)"></div>'),ICEcoder.nestDisplay.innerHTML+="<a "+c+' style="display: inline-block; cursor: pointer; background: #333; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px">'+
ICEcoder.htmlTagArray[a]+"</a>",ICEcoder.nestDisplay.innerHTML+=a<ICEcoder.htmlTagArray.length-1?"<div "+c+' style="display: inline-block; width: 8px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -7px 0; cursor: pointer"></div>':"<div "+c+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -15px 0; cursor: pointer"></div>';"undefined"!=typeof b.curState&&
0<ICEcoder.htmlTagArray.length&&(ICEcoder.nestDisplay.innerHTML+='<a style="display: inline-block; cursor: default; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px; color: #666">'+(b.curState.tagName?b.curState.tagName:"content")+"</a>")}}},updateNestingIndicator:function(){var a,b,c;a=ICEcoder.getcMInstance();b=!0;c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a&&(c&&-1==["js","coffee","css","less"].indexOf(c.split(".")[1]))&&(b="error"!=a.getTokenAt({line:a.lineCount(),ch:a.lineInfo(a.lineCount()-
1).text.length}).className?!0:!1);ICEcoder.nestValid.style.background=b?"#0b0":"#f00";ICEcoder.nestValid.title=b?"Nesting OK":"Nesting Broken"},getCaretPosition:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=a.getValue();c=a.getCursor().line;a=a.getCursor().ch;for(var e=d=0;e<c;e++)d=b.indexOf("\n",d),d+=1;ICEcoder.caretPos=d+a-1;ICEcoder.getNestLocation("yes")},updateCharDisplay:function(){var a;a=ICEcoder.getcMInstance();ICEcoder.caretLocationType();ICEcoder.charDisplay.innerHTML=ICEcoder.caretLocType+
", Line: "+(a.getCursor().line+1)+", Char: "+a.getCursor().ch},updateByteDisplay:function(){ICEcoder.byteDisplay.innerHTML=ICEcoder.getcMInstance().getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" bytes"},showDisplay:function(a){top.ICEcoder.byteDisplay.style.display="byte"==a?"inline-block":"none";top.ICEcoder.charDisplay.style.display="char"==a?"inline-block":"none"},caretLocationType:function(){var a,b;a=ICEcoder.getcMInstance();b="Unknown";a=a.getValue().substr(0,ICEcoder.caretPos+
1);a.lastIndexOf("<script")>a.lastIndexOf("\x3c/script>")&&"Unknown"==b?b="JavaScript":a.lastIndexOf("<?")>a.lastIndexOf("?>")&&"Unknown"==b?b="PHP":a.lastIndexOf("<%")>a.lastIndexOf("%>")&&"Unknown"==b?b="Ruby":a.lastIndexOf("<")>a.lastIndexOf(">")&&"Unknown"==b?b="HTML":"Unknown"==b&&(b="Content");a=ICEcoder.openFiles[ICEcoder.selectedTab-1];0<a.indexOf(".js")?b="JavaScript":0<a.indexOf(".coffee")?b="CoffeeScript":0<a.indexOf(".py")?b="Python":0<a.indexOf(".rb")?b="Ruby":0<a.indexOf(".css")?b="CSS":
0<a.indexOf(".less")?b="LESS":0<a.indexOf(".md")&&(b="Markdown");ICEcoder.caretLocType=b},redoChangedContent:function(a){var b,c;b=ICEcoder.getcMInstance();c=a.keyCode?a.keyCode:a.which?a.which:a.charCode;if(!a.ctrlKey&&27!=c&&20!=c&&(16>c||19<c)&&(37>c||40<c)&&(144!=c||145!=c)&&(45!=c||46!=c)&&(33>c||36<c)&&(91!=c||92!=c)&&(112>c||123<c))ICEcoder.changedContent[ICEcoder.selectedTab-1]=0<b.historySize().undo?1:0,ICEcoder.redoTabHighlight(ICEcoder.selectedTab)},showHide:function(a,b){b.style.visibility=
10)},changeFilesWStep:function(a){"expand"==a?ICEcoder.filesW<ICEcoder.maxFilesW-1?ICEcoder.filesW+=Math.ceil((ICEcoder.maxFilesW-ICEcoder.filesW)/2):ICEcoder.filesW=ICEcoder.maxFilesW:ICEcoder.filesW>ICEcoder.minFilesW+1?ICEcoder.filesW-=Math.ceil((ICEcoder.filesW-ICEcoder.minFilesW)/2):ICEcoder.filesW=ICEcoder.minFilesW;("expand"==a&&ICEcoder.filesW==ICEcoder.maxFilesW||"contract"==a&&ICEcoder.filesW==ICEcoder.minFilesW)&&clearInterval(ICEcoder.changeFilesInt);ICEcoder.setLayout()},canResizeFilesW:function(){top.ICEcoder.ready&&
"w-resize"==top.document.body.style.cursor?top.ICEcoder.mouseDown&&(top.ICEcoder.filesW=top.ICEcoder.maxFilesW=250<=top.ICEcoder.mouseX&&400>=top.ICEcoder.mouseX?top.ICEcoder.mouseX:250>top.ICEcoder.mouseX?250:400,top.ICEcoder.files.style.width=top.ICEcoder.account.style.width=top.ICEcoder.filesFrame.style.width=top.ICEcoder.filesW+"px",top.ICEcoder.setLayout(),top.ICEcoder.draggingFilesW=!0):top.ICEcoder.draggingFilesW=!1},lockUnlockNav:function(){var a;a=top.get("fmLock");ICEcoder.lockedNav=ICEcoder.lockedNav?
!1:!0;a.style.backgroundPosition=ICEcoder.lockedNav?"-64px -16px":"-80px -16px"},contentCleanUp:function(){var a,b;0>["js","coffee","css","less"].indexOf(ICEcoder.openFiles[ICEcoder.selectedTab-1].split(".")[1])&&(a=ICEcoder.getcMInstance(),b=a.getValue(),b=b.replace(/<ICEcoder:\/:textarea>/g,"</textarea>"),a.setValue(b),a.clearHistory())},moveLine:function(a){var b,c,d;b=top.ICEcoder.getcMInstance();c=b.getCursor().line;"up"==a&&0<c&&(d=c-1);"down"==a&&c<b.lineCount()-1&&(d=c+1);isNaN(d)||(a=b.getLine(d),
b.setLine(d,b.getLine(c)),b.setLine(c,a),ICEcoder.highlightLine(d))},highlightLine:function(a){var b;b=top.ICEcoder.getcMInstance();b.setSelection({line:a,ch:0},{line:a,ch:b.lineInfo(a).text.length})},goToLine:function(a){var b;b=ICEcoder.getcMInstance();b.setCursor(a?a-1:document.getElementById("goToLineNo").value-1);b.focus();return!1},switchMode:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a?b.setOption("mode",a):c&&(0<c.indexOf(".js")?b.setOption("mode",
"javascript"):0<c.indexOf(".coffee")?b.setOption("mode","coffeescript"):0<c.indexOf(".rb")?b.setOption("mode","ruby"):0<c.indexOf(".py")?b.setOption("mode","python"):0<c.indexOf(".css")?b.setOption("mode","css"):0<c.indexOf(".less")?b.setOption("mode","less"):0<c.indexOf(".md")?b.setOption("mode","markdown"):b.setOption("mode","application/x-httpd-php"))},lineCommentToggle:function(){var a,b,c,d,e,f;a=ICEcoder.getcMInstance();b=a.getCursor().ch;c=a.getCursor().line;d=a.getLine(c);e=d.length;f=2;if(-1<
"JavaScript CoffeeScript PHP Python Ruby CSS".split(" ").indexOf(ICEcoder.caretLocType))if(a.somethingSelected())if("Ruby"==ICEcoder.caretLocType||"Python"==ICEcoder.caretLocType){e=a.getCursor(!0).line;for(d=a.getCursor().line;e<=d;e++)a.setLine(e,"#"!=a.getLine(e).slice(0,1)?"#"+a.getLine(e):a.getLine(e).slice(1,a.getLine(e).length))}else a.replaceSelection("/*"!=a.getSelection().slice(0,2)?"/*"+a.getSelection()+"*/":a.getSelection().slice(2,a.getSelection().length-2));else-1<["CoffeeScript","CSS"].indexOf(ICEcoder.caretLocType)?
(a.setLine(c,"/*"!=d.slice(0,2)?"/*"+d+"*/":d.slice(2,e).slice(0,e-4)),"/*"==d.slice(0,2)&&(f=-f)):"Ruby"==ICEcoder.caretLocType?(a.setLine(c,"#"!=d.slice(0,1)?"#"+d:d.slice(1,e)),"#"==d.slice(0,1)&&(f=-f)):(a.setLine(c,"//"!=d.slice(0,2)?"//"+d:d.slice(2,e)),"//"==d.slice(0,2)&&(f=-f));else a.somethingSelected()?a.replaceSelection("\x3c!--"!=a.getSelection().slice(0,4)?"\x3c!--"+a.getSelection()+"//--\x3e":a.getSelection().slice(4,a.getSelection().length-5)):(a.setLine(c,"\x3c!--"!=d.slice(0,4)?
"\x3c!--"+d+"//--\x3e":d.slice(4,e).slice(0,e-9)),f="\x3c!--"==d.slice(0,4)?-4:4);a.somethingSelected()||a.setCursor(c,b+f)},highlightBlock:function(a,b){var c,d,e,f;c=top.ICEcoder.getcMInstance();if(b)top.ICEcoder.dontUpdateNest?c.setCursor(top.ICEcoder.cursorOrigLine,top.ICEcoder.cursorOrigCh):top.ICEcoder.getNestLocation("updateNestDisplay"),top.ICEcoder.dontUpdateNest=!1;else{top.ICEcoder.cursorOrigCh=c.getCursor().ch;top.ICEcoder.cursorOrigLine=c.getCursor().line;top.ICEcoder.dontUpdateNest=
!0;d={};d.ch=c.getCursor().ch;d.line=c.getCursor().line;for(var g=top.ICEcoder.htmlTagArray.length-1;g>=a;g--)e=c.getSearchCursor("<"+top.ICEcoder.htmlTagArray[g],d),e.findPrevious(),d.ch=e.from().ch,d.line=e.from().line,g==a&&(f=c.getSearchCursor(">",d),f.findNext(),c.setCursor(f.from().line,f.from().ch+1),top.ICEcoder.getNestLocation(),ICEcoder.htmlTagArray.length-1!=a&&g++);e.from()&&(d={},top.ICEcoder.startPosLine=d.line=e.from().line,top.ICEcoder.startPosCh=d.ch=e.from().ch,e={},e.line=top.ICEcoder.content.contentWindow.CodeMirror.tagRangeFinder(c,
d)||d.line,e.line=e.line.to?e.line.to.line:e.line,e.ch=c.getLine(e.line).indexOf("</"+top.ICEcoder.htmlTagArray[a]+">")+top.ICEcoder.htmlTagArray[a].length+3,!top.ICEcoder.dontSelect?c.setSelection(d,e):top.ICEcoder.dontSelect=!1,c.scrollIntoView(d))}},setPosition:function(a,b,c){var d;d=ICEcoder.getcMInstance();c=d.getLine(b).indexOf(">",d.getLine(b).indexOf("<"+c))+1;d.setCursor(b,c);d.focus();for(d=b=0;d<=a;d++)b=ICEcoder.nestDisplay.innerHTML.indexOf("&gt;",b+1);ICEcoder.nestDisplay.innerHTML=
ICEcoder.nestDisplay.innerHTML.substr(0,b).replace(/<(?:.|\n)*?>/gm,"");top.ICEcoder.dontUpdateNest=!1;top.ICEcoder.dontSelect=!0},tagWrapper:function(a){var b,c,d,e;b=ICEcoder.getcMInstance();c=a;"div"==a?(d=b.getCursor("start").line,e=b.getCursor().line,b.operation(function(){b.replaceSelection("<div>\n"+b.getSelection()+"\n</div>");for(var a=d+1;a<=e+1;a++)b.indentLine(a);b.indentLine(e+2,"prev");b.indentLine(e+2,"subtract")})):("a"==a&&(c='a href=""'),b.replaceSelection("<"+c+">"+b.getSelection()+
"</"+a+">"));"a"==a&&b.setCursor({line:b.getCursor("start").line,ch:b.getCursor("start").ch+9})},addLineBreakAtEnd:function(a){var b;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);b.setLine(a,b.getLine(a)+"<br>")},duplicateLine:function(a){var b,c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.setLine(a,b.getLine(a)+"\n"+b.getLine(a));b.setCursor(a+1,c)},removeLine:function(a){var b,c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.removeLine(a);
b.setCursor(a-1,c)},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);else{top.ICEcoder.origCurorPos=a.getCursor();a=["var "+b,"function "+b,b+"=function",b+"= function",b+" =function",b+" = function",b+"=new function",b+"= new function",b+" =new function",b+" = new function","window['"+b+"']",'window["'+b+'"]',"this['"+b+"']",'this["'+b+'"]',b+":",b+" :","def "+
b,"class "+b];for(b=0;b<a.length;b++)top.ICEcoder.findReplace(a[b],!1,!1)&&(b=a.length)}},openCloseDir:function(a,b){var c,d;a.onclick=function(a){a.ctrlKey||top.ICEcoder.openCloseDir(this,!1)};c=a.parentNode;c.nextSibling&&(c=c.nextSibling);c&&"UL"==c.tagName&&((d="none"==c.style.display)?b=!0:c.style.display="none",a.parentNode.className=a.className=d?"pft-directory dirOpen":"pft-directory");b&&(top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="lib/get-branch.php?location="+
a.childNodes[1].id);return!1},overFileFolder:function(a,b){ICEcoder.thisFileFolderType=a;ICEcoder.thisFileFolderLink=b},selectFileFolder:function(a){var b,c,d,e,f;if(""==top.ICEcoder.thisFileFolderLink)a.ctrlKey||top.ICEcoder.deselectAllFiles();else if(top.ICEcoder.thisFileFolderLink)if(c=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),b=ICEcoder.filesFrame.contentWindow.document.getElementById(c),a.ctrlKey)-1<top.ICEcoder.selectedFiles.indexOf(c)?(ICEcoder.selectDeselectFile("deselect",b),top.ICEcoder.selectedFiles.splice(top.ICEcoder.selectedFiles.indexOf(c),
1)):(ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c));else if(a.shiftKey)if(a=!1,d=b.parentNode.parentNode.parentNode,e=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1],f=c<e?c:e,e=c>e?c:e,0<top.ICEcoder.selectedFiles.length&&f.substr(0,f.lastIndexOf("|"))==e.substr(0,e.lastIndexOf("|")))for(c=0;1E6>c&&!("LI"!=d.childNodes[c].nodeName&&c++,b=d.childNodes[c].childNodes[0].childNodes[1],b.id==f&&(a=!0),!0==a&&-1==top.ICEcoder.selectedFiles.indexOf(b.id)&&(ICEcoder.selectDeselectFile("select",
b),top.ICEcoder.selectedFiles.push(b.id)),b.id==e);c+=2);else ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c);else top.ICEcoder.deselectAllFiles(),ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c);document.findAndReplace.target[2].innerHTML=!top.ICEcoder.selectedFiles[0]?"all files":"selected files";document.findAndReplace.target[3].innerHTML=!top.ICEcoder.selectedFiles[0]?"all filenames":"selected filenames";top.ICEcoder.fMIconVis("fMOpen",1==top.ICEcoder.selectedFiles.length?
1:0.3);top.ICEcoder.fMIconVis("fMNewFile",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMNewFolder",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMDelete",0<top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.fMIconVis("fMRename",1==top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.hideFileMenu()},deselectAllFiles:function(){for(var a,b=0;b<top.ICEcoder.selectedFiles.length;b++)a=
top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.selectedFiles[b]),ICEcoder.selectDeselectFile("deselect",a);top.ICEcoder.selectedFiles.length=0},selectDeselectFile:function(a,b){var c;b&&(c=-1<top.ICEcoder.openFiles.indexOf(b.id.replace(/\|/g,"/"))?!0:!1,b.style.backgroundColor=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]==b.id.replace(/\|/g,"/")?"select"==a?top.ICEcoder.tabBGselected:top.ICEcoder.tabBGcurrent:"select"==a?top.ICEcoder.tabBGselected:b.style.backgroundColor=
c?top.ICEcoder.tabBGopen:top.ICEcoder.tabBGnormal,b.style.color="select"==a?top.ICEcoder.tabFGselected:top.ICEcoder.tabFGnormalFile)},newFile:function(){top.ICEcoder.newTab();top.ICEcoder.saveFile()},newFolder:function(){var a,b;a=top.ICEcoder.rightClickedFile.replace(/\|/g,"/");if(b=top.ICEcoder.getInput("Enter New Folder Name at "+a,""))b=(a+"/"+b).replace(/\/\//,"/"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=newFolder&file="+b.replace(/\//g,"|")),top.ICEcoder.serverMessage("<b>Creating Folder</b><br>"+
b)},openFile:function(a){var b;a&&(top.ICEcoder.thisFileFolderLink=a,top.ICEcoder.thisFileFolderType="file");!1!==top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)?top.ICEcoder.switchTab(top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)+1):""!=top.ICEcoder.thisFileFolderLink&&"file"==top.ICEcoder.thisFileFolderType&&(a=top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/"),b=!0,100>top.ICEcoder.openFiles.length?-1<top.ICEcoder.openFiles.indexOf(a)&&"/[NEW]"!=a&&(b=!1,top.ICEcoder.switchTab(i+1)):
(top.ICEcoder.message("Sorry, you can only have 100 files open at a time!"),b=!1),b&&(top.ICEcoder.shortURL=a,"/[NEW]"!=a?(top.ICEcoder.thisFileFolderLink=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=load&file="+top.ICEcoder.thisFileFolderLink),top.ICEcoder.serverMessage("<b>Opening File</b><br>"+top.ICEcoder.shortURL)):top.ICEcoder.createNewTab(),top.ICEcoder.fMIconVis("fMView",1)))},openPrompt:function(){var a;if(a=top.ICEcoder.getInput("Enter relative file path (prefixed with /) or remote URL",
""))-1<a.indexOf("://")?top.ICEcoder.getRemoteFile(a):top.ICEcoder.openFile(a)},getRemoteFile:function(a){top.ICEcoder.serverQueue("add","lib/file-control.php?action=getRemoteFile&file="+a);top.ICEcoder.serverMessage("<b>Getting</b><br>"+a)},saveFile:function(a){var b;a=a?"saveAs":"save";b=ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|");"|[NEW]"==b&&0<top.ICEcoder.selectedFiles.length&&(b=top.ICEcoder.selectedFiles[0]+b);b=b.replace("||","|");top.ICEcoder.serverQueue("add",
"lib/file-control.php?action=save&file="+b+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+a);top.ICEcoder.serverMessage("<b>Saving</b><br>"+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,""))},renameFile:function(a,b){var c,d;a?c=a.replace(/\|/g,"/"):(c=top.ICEcoder.rightClickedFile.replace(/\|/g,"/"),a=top.ICEcoder.rightClickedFile.replace(/\|/g,"/"));b||(b=top.ICEcoder.getInput("Please enter the new name for",c));b&&(d=top.ICEcoder.openFiles.indexOf(c.replace(/\|/g,
"/")),-1<d&&(top.ICEcoder.openFiles[d]=b,closeTabLink='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>',c=top.ICEcoder.openFiles[d],top.get("tab"+(d+1)).innerHTML=closeTabLink+" "+c.slice(c.lastIndexOf("/")).replace(/\//,
""),top.get("tab"+(d+1)).title=b),top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+b+"&oldFileName="+a.replace(/\|/g,"/")),top.ICEcoder.serverMessage("<b>Renaming to</b><br>"+b),top.ICEcoder.setPreviousFiles())},deleteFile:function(){var a;0<top.ICEcoder.selectedFiles.length&&(a=top.ICEcoder.ask("Delete:\n\n"+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n")+"?"));if(a){a="";for(var b=0;b<top.ICEcoder.selectedFiles.length;b++)a+=top.ICEcoder.selectedFiles[b],
b<top.ICEcoder.selectedFiles.length-1&&(a+=";");top.ICEcoder.serverQueue("add","lib/file-control.php?action=delete&file="+a);top.ICEcoder.serverMessage("<b>Deleting File</b><br>"+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"))}},copyFile:function(){top.ICEcoder.copiedFiles=[];for(var a=0;a<top.ICEcoder.selectedFiles.length;a++)top.ICEcoder.copiedFiles[a]=top.ICEcoder.selectedFiles[a];top.get("fmMenuPasteOption").style.display="block";top.ICEcoder.hideFileMenu()},pasteFile:function(a){if(top.ICEcoder.copiedFiles)for(var b=
0;b<top.ICEcoder.copiedFiles.length;b++)top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+top.ICEcoder.copiedFiles[b]+"&location="+a),top.ICEcoder.serverMessage("<b>Pasting File</b><br>"+top.ICEcoder.copiedFiles[b].toString().replace(/\|/g,"/").replace(/,/g,"\n"));else top.ICEcoder.message("Nothing to paste, copy a file/folder first!")},uploadFilesSelect:function(a){top.get("uploadDir").value=a;top.get("fileInput").click()},uploadFilesSubmit:function(){""!=top.get("fileInput").value&&
(top.ICEcoder.showHide("show",top.get("loadingMask")),document.getElementById("uploadFilesForm").submit(),event.preventDefault())},showMenu:function(a){var b;(0==top.ICEcoder.selectedFiles.length||-1==top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.rightClickedFile.replace(/\//g,"|")))&&top.ICEcoder.selectFileFolder(a);"undefined"!=typeof top.ICEcoder.thisFileFolderLink&&""!=top.ICEcoder.thisFileFolderLink&&(a=-1<top.ICEcoder.selectedFiles[0].indexOf(".")?"file":"folder",b=top.get("folderMenuItems"),
b.style.display="folder"==a&&1==top.ICEcoder.selectedFiles.length?"block":"none",singleFileMenuItems.style.display=1<top.ICEcoder.selectedFiles.length?"none":"block",document.getElementById("fileMenu").style.display="inline-block",setTimeout(function(){document.getElementById("fileMenu").style.opacity="1"},4),document.getElementById("fileMenu").style.left=top.ICEcoder.mouseX+20+"px",document.getElementById("fileMenu").style.top=top.ICEcoder.mouseY-top.ICEcoder.filesFrame.contentWindow.document.body.scrollTop-
10+"px");return!1},showFileMenu:function(){document.getElementById("fileMenu").style.display="inline-block";setTimeout(function(){document.getElementById("fileMenu").style.opacity="1"},4)},hideFileMenu:function(){document.getElementById("fileMenu").style.display="none";document.getElementById("fileMenu").style.opacity="0"},updateFileManagerList:function(a,b,c,d,e,f){var g,l,h,j,m,n,k,p;if("add"==a&&!document.getElementById("filesFrame").contentWindow.document.getElementById(b.replace(/\/$/,"").replace(/\//g,
"|")+"|"+c)){g=-1<c.indexOf(".")?"file":"folder";l="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?664:705;b||(b="/");b=b.replace(top.iceRoot,"");h=document.getElementById("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));j=h.parentNode.parentNode.nextSibling;m=document.createTextNode("\n");n='<a nohref title="'+b.replace(/\/$/,"")+"/"+c+'" onMouseOver="top.ICEcoder.overFileFolder(\''+g+"','"+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+"')\" onMouseOut=\"top.ICEcoder.overFileFolder('"+
g+'\',\'\')" style="position: relative; left:-22px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'">'+c+'</span> <span style="color: #888; font-size: 8px" id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'_perms">'+d+"</span></a>";if(3>j.childNodes.length)k=document.createElement("ul"),j=h.parentNode.parentNode,j.parentNode.insertBefore(k,j.nextSibling),k=document.createElement("li"),k.className=l,k.innerHTML=n,j.nextSibling.appendChild(k),
j.nextSibling.appendChild(m);else for(h=0;h<=j.childNodes.length-1;h++)if(j.childNodes[h].className&&(k=0<j.childNodes[h].className.indexOf("directory")?"folder":"file",p=j.childNodes[h].getElementsByTagName("span")[0].innerHTML,k==g&&p>c||"folder"==g&&"file"==k||h==j.childNodes.length-1)){k=document.createElement("li");k.className=l;k.innerHTML=n;h==j.childNodes.length-1?(j.appendChild(k),j.appendChild(m)):(j.insertBefore(k,j.childNodes[h]),j.insertBefore(m,j.childNodes[h+1]));break}"file"==g&&!f&&
(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]=b+c)}"rename"==a&&(e=e.replace(/\//g,"|"),h=document.getElementById("filesFrame").contentWindow.document.getElementById(e),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=document.getElementById("filesFrame").contentWindow.document.getElementById(e+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms");"chmod"==a&&(e=top.ICEcoder.rightClickedFile.replace(/\|/g,"/"),h=document.getElementById("filesFrame").contentWindow.document.getElementById(e.replace(/\//g,
"|")+"_perms"),h.innerHTML=d);"delete"==a&&(h=document.getElementById("filesFrame").contentWindow.document.getElementById(b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c).parentNode.parentNode,h.parentNode.removeChild(h))},fMIcon:function(a){"save"==a&&0<ICEcoder.openFiles.length&&top.ICEcoder.saveFile();1==ICEcoder.selectedFiles.length&&(top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=top.ICEcoder.selectedFiles[0].replace("|","/"),"open"==a&&-1<ICEcoder.selectedFiles[0].indexOf(".")?(top.ICEcoder.thisFileFolderType=
"file",top.ICEcoder.openFile()):"newFile"==a?top.ICEcoder.newFile():"newFolder"==a?top.ICEcoder.newFolder():"rename"==a&&top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile));"delete"==a&&0<ICEcoder.selectedFiles.length&&top.ICEcoder.deleteFile();"view"==a&&0<ICEcoder.openFiles.length&&window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1])},refreshFileManager:function(){top.ICEcoder.showHide("show",top.get("loadingMask"));top.ICEcoder.filesFrame.src="files.php";top.ICEcoder.filesFrame.style.opacity=
"0";top.ICEcoder.filesFrame.onload=function(){top.ICEcoder.filesFrame.style.opacity="1";top.ICEcoder.showHide("hide",top.get("loadingMask"))}},findReplaceOptions:function(){top.get("rText").style.display=top.get("replace").style.display=top.get("rTarget").style.display="and"==document.findAndReplace.connector.value?"inline-block":"none"},findReplace:function(a,b,c){var d,e,f,g;a=a.toLowerCase();d=top.get("replace").value;e=top.get("results");if((f=ICEcoder.getcMInstance())&&0<a.length&&"this document"==
document.findAndReplace.target.value){f.getValue().toLowerCase();"and"==document.findAndReplace.connector.value&&("replace"==document.findAndReplace.replaceAction.value&&f.getSelection().toLowerCase()==a?f.replaceSelection(d):"replace all"==document.findAndReplace.replaceAction.value&&c&&(c=RegExp(a,"gi"),f.setValue(f.getValue().replace(c,d))));c=f.getValue().toLowerCase();if(!top.ICEcoder.findMode||a!=top.ICEcoder.lastsearch){ICEcoder.results=[];for(d=0;d<c.length;d++)c.substr(d,a.length)==a&&d!=
ICEcoder.findResult&&ICEcoder.results.push(d);ICEcoder.lastsearch=a}if(0<ICEcoder.results.length){if(b)e.innerHTML=ICEcoder.results.length+" results";else{b=1;for(d=g=0;d<c.length;d++)c.indexOf("\n",d)==d&&b<=f.getCursor().line&&(b++,g=d);b=g+f.getCursor().ch+1;for(d=ICEcoder.findResult=0;d<ICEcoder.results.length;d++)ICEcoder.results[d]<b&&ICEcoder.findResult++;ICEcoder.findResult>ICEcoder.results.length-1&&(ICEcoder.findResult=0);e.innerHTML="Highlighted result "+(ICEcoder.findResult+1)+" of "+
ICEcoder.results.length+" results";for(d=b=0;d<ICEcoder.results[ICEcoder.findResult];d++)c.indexOf("\n",d)==d&&b++;f.lineInfo(0);e=f.getSearchCursor(a,f.getCursor(),!0);e.findNext();e.from()||(e=f.getSearchCursor(a,{line:0,ch:0},!0),e.findNext());f.setSelection(e.from(),e.to());f.focus();top.ICEcoder.findMode=!0}return!0}e.innerHTML="No results";return!1}if(""!=a&&c){filesQS=e=f="";"and"==document.findAndReplace.connector.value&&(f="&replace="+d);0<=document.findAndReplace.target.value.indexOf("file")&&
(e="&target="+document.findAndReplace.target.value.replace(/ /g,"-"));if("selected files"==document.findAndReplace.target.value){filesQS="&selectedFiles=";for(d=0;d<top.ICEcoder.selectedFiles.length;d++)filesQS+=top.ICEcoder.selectedFiles[d]+":";filesQS=filesQS.replace(/\:$/,"")}a=a.replace(/\'/g,"&#39;");a!=encodeURIComponent(a)?a="ICEcoder:"+encodeURIComponent(a):a;top.ICEcoder.showHide("show",top.get("loadingMask"));top.get("mediaContainer").innerHTML='<iframe src="lib/multiple-results.php?find='+
a+f+e+filesQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>'}},replaceInFile:function(a,b,c){top.ICEcoder.serverQueue("add","lib/file-control.php?action=replaceText&fileRef="+a.replace(/\//g,"|")+"&find="+b+"&replace="+c);top.ICEcoder.serverMessage("<b>Replacing text in</b><br>"+a)},getNestLocation:function(a){var b,c,d;if(b=ICEcoder.getcMInstance()){c=b.getValue();b=b.getTokenAt(b.getCursor()).state;if("undefined"!=typeof b.curState&&"undefined"!=typeof b.curState.htmlState){ICEcoder.htmlTagArray=
[];for(d=b.curState.htmlState.context;d;d=d.prev)"undefined"!=typeof d.tagName&&ICEcoder.htmlTagArray.unshift(d.tagName)}ICEcoder.tagString=ICEcoder.htmlTagArray[ICEcoder.htmlTagArray.length-1];"JavaScript"==ICEcoder.caretLocType&&(ICEcoder.tagString="script");if(a&&!top.ICEcoder.dontUpdateNest&&(ICEcoder.nestDisplay.innerHTML="","undefined"!=typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]&&(a=ICEcoder.openFiles[ICEcoder.selectedTab-1],0>["js","coffee","css","less"].indexOf(a.split(".")[1])&&-1==
c.indexOf("include(")&&-1==c.indexOf("include_once(")&&(-1<c.indexOf("<html")||-1<c.indexOf("<body"))))){for(a=0;a<ICEcoder.htmlTagArray.length;a++)c='onMouseover="top.ICEcoder.highlightBlock('+a+')" onMouseout="top.ICEcoder.highlightBlock('+a+",'hide')\" onClick=\"top.ICEcoder.setPosition("+a+",top.ICEcoder.startPosLine,'"+ICEcoder.htmlTagArray[a]+"')\"",0==a&&(ICEcoder.nestDisplay.innerHTML+="<div "+c+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif)"></div>'),
ICEcoder.nestDisplay.innerHTML+="<a "+c+' style="display: inline-block; cursor: pointer; background: #333; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px">'+ICEcoder.htmlTagArray[a]+"</a>",ICEcoder.nestDisplay.innerHTML+=a<ICEcoder.htmlTagArray.length-1?"<div "+c+' style="display: inline-block; width: 8px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -7px 0; cursor: pointer"></div>':"<div "+c+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -15px 0; cursor: pointer"></div>';
"undefined"!=typeof b.curState&&0<ICEcoder.htmlTagArray.length&&(ICEcoder.nestDisplay.innerHTML+='<a style="display: inline-block; cursor: default; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px; color: #666">'+(b.curState.tagName?b.curState.tagName:"content")+"</a>")}}},updateNestingIndicator:function(){var a,b,c;a=ICEcoder.getcMInstance();b=!0;c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a&&(c&&-1==["js","coffee","css","less"].indexOf(c.split(".")[1]))&&(b="error"!=a.getTokenAt({line:a.lineCount(),
ch:a.lineInfo(a.lineCount()-1).text.length}).className?!0:!1);ICEcoder.nestValid.style.background=b?"#0b0":"#f00";ICEcoder.nestValid.title=b?"Nesting OK":"Nesting Broken"},getCaretPosition:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=a.getValue();c=a.getCursor().line;a=a.getCursor().ch;for(var e=d=0;e<c;e++)d=b.indexOf("\n",d),d+=1;ICEcoder.caretPos=d+a-1;ICEcoder.getNestLocation("yes")},updateCharDisplay:function(){var a;a=ICEcoder.getcMInstance();ICEcoder.caretLocationType();ICEcoder.charDisplay.innerHTML=
ICEcoder.caretLocType+", Line: "+(a.getCursor().line+1)+", Char: "+a.getCursor().ch},updateByteDisplay:function(){ICEcoder.byteDisplay.innerHTML=ICEcoder.getcMInstance().getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" bytes"},showDisplay:function(a){top.ICEcoder.byteDisplay.style.display="byte"==a?"inline-block":"none";top.ICEcoder.charDisplay.style.display="char"==a?"inline-block":"none"},caretLocationType:function(){var a,b;a=ICEcoder.getcMInstance();b="Unknown";a=a.getValue().substr(0,
ICEcoder.caretPos+1);a.lastIndexOf("<script")>a.lastIndexOf("\x3c/script>")&&"Unknown"==b?b="JavaScript":a.lastIndexOf("<?")>a.lastIndexOf("?>")&&"Unknown"==b?b="PHP":a.lastIndexOf("<%")>a.lastIndexOf("%>")&&"Unknown"==b?b="Ruby":a.lastIndexOf("<")>a.lastIndexOf(">")&&"Unknown"==b?b="HTML":"Unknown"==b&&(b="Content");a=ICEcoder.openFiles[ICEcoder.selectedTab-1];0<a.indexOf(".js")?b="JavaScript":0<a.indexOf(".coffee")?b="CoffeeScript":0<a.indexOf(".py")?b="Python":0<a.indexOf(".rb")?b="Ruby":0<a.indexOf(".css")?
b="CSS":0<a.indexOf(".less")?b="LESS":0<a.indexOf(".md")&&(b="Markdown");ICEcoder.caretLocType=b},redoChangedContent:function(a){var b,c;b=ICEcoder.getcMInstance();c=a.keyCode?a.keyCode:a.which?a.which:a.charCode;if(!a.ctrlKey&&27!=c&&20!=c&&(16>c||19<c)&&(37>c||40<c)&&(144!=c||145!=c)&&(45!=c||46!=c)&&(33>c||36<c)&&(91!=c||92!=c)&&(112>c||123<c))ICEcoder.changedContent[ICEcoder.selectedTab-1]=0<b.historySize().undo?1:0,ICEcoder.redoTabHighlight(ICEcoder.selectedTab)},showHide:function(a,b){b.style.visibility=
"show"==a?"visible":"hidden"},getcMInstance:function(a){return top.ICEcoder.content.contentWindow["new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1"]},getMouseXY:function(a,b){top.ICEcoder.mouseX=a.pageX?a.pageX:a.clientX+document.body.scrollLeft;top.ICEcoder.mouseY=a.pageY?a.pageY:a.clientY+document.body.scrollTop;"top"!=b&&(top.ICEcoder.mouseY+=90);"editor"==b&&(top.ICEcoder.mouseX+=top.ICEcoder.filesW);top.ICEcoder.dragCursorTest();62<top.ICEcoder.mouseY&&
top.ICEcoder.setTabWidths()},dragCursorTest:function(){var a,b;a=top.ICEcoder.mouseX-top.ICEcoder.diffStartX;if(!1!==top.ICEcoder.draggingTab&&(top.ICEcoder.diffStartX&&(-10>=a||10<=a))&&top.ICEcoder.mouseX>parseInt(top.ICEcoder.files.style.width,10))top.ICEcoder.tabDragMouseX=top.ICEcoder.mouseX-parseInt(top.ICEcoder.files.style.width,10)-top.ICEcoder.tabDragMouseXStart,top.ICEcoder.tabDragMove();if(top.ICEcoder.ready&&(a=window.innerWidth?window.innerHeight:document.body.clientHeight,top.ICEcoder.mouseDown||
(top.ICEcoder.draggingFilesW=!1),a=!ICEcoder.draggingTab&&(top.ICEcoder.mouseX>top.ICEcoder.filesW-7&&top.ICEcoder.mouseX<top.ICEcoder.filesW+7&&40<top.ICEcoder.mouseY&&top.ICEcoder.mouseY<a-30||top.ICEcoder.draggingFilesW)?"w-resize":"auto",top.ICEcoder.content.contentWindow.document&&top.ICEcoder.filesFrame.contentWindow)){top.document.body.style.cursor=a;if(b=top.ICEcoder.content.contentWindow.document.body)b.style.cursor=a;if(b=top.ICEcoder.filesFrame.contentWindow.document.body)b.style.cursor=
a}},serverMessage:function(a){var b;b=document.getElementById("serverMessage");a?(b.innerHTML=a,b.style.display="inline-block"):setTimeout(function(){b.style.display="none"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=a.getLine(a.getCursor().line);for(c=/(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi;(d=c.exec(b))&&a.getCursor().ch>d.index+d[0].length;);(b=top.document.getElementById("content").contentWindow.document.getElementById("cssColor"))&&
b.parentNode.removeChild(b);top.ICEcoder.codeAssist&&"CSS"==top.ICEcoder.caretLocType&&(b=top.document.createElement("div"),b.id="cssColor",b.style.position="absolute",b.style.display="block",b.style.width=b.style.height="20px",b.style.zIndex="1000",b.style.background=d?d[0]:"",b.style.cursor="pointer",b.onclick=function(){top.ICEcoder.showColorPicker(d[0])},""==b.style.backgroundColor&&(b.style.display="none"),top.document.getElementById("header").appendChild(b),a.addWidget(a.getCursor(),top.document.getElementById("cssColor"),
!0))},showColorPicker:function(a){top.document.getElementById("blackMask").style.visibility="visible";top.document.getElementById("mediaContainer").innerHTML='<div id="picker" class="picker"></div><br><br><input type="text" id="color" name="color" value="#000" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.document.getElementById(\'color\').value)" value="insert &gt;" class="insertColorValue"><br><input type="text" id="colorRGB" name="colorRGB" value="rgb(0,0,0)" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.document.getElementById(\'colorRGB\').value)" value="insert &gt;" class="insertColorValue">';
farbtastic("picker","color");a&&top.document.getElementById("picker").farbtastic.setColor(a)},drawCanvasImage:function(a){var b=document.getElementById("canvasPicker").getContext("2d"),c=new Image;c.src=a.src;c.onload=function(){document.getElementById("canvasPicker").width=a.width;document.getElementById("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height)};document.getElementById("canvasPicker").onmousemove=function(a){var c=b.getImageData(a.pageX-this.offsetLeft,a.pageY-this.offsetTop,
1,1).data;a=c[0];var f=c[1],g=c[2],c=a+","+f+","+g;a=top.ICEcoder.rgbToHex(a,f,g);document.getElementById("rgbMouseXY").value=c;document.getElementById("hexMouseXY").value="#"+a;document.getElementById("hexMouseXY").style.backgroundColor=document.getElementById("rgbMouseXY").style.backgroundColor="#"+a};document.getElementById("canvasPicker").onclick=function(){document.getElementById("rgb").value=document.getElementById("rgbMouseXY").value;document.getElementById("hex").value=document.getElementById("hexMouseXY").value;
a}},serverMessage:function(a){var b;b=document.getElementById("serverMessage");a?(b.innerHTML=a,b.style.left="0"):setTimeout(function(){b.style.left="2000px"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=a.getLine(a.getCursor().line);for(c=/(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi;(d=c.exec(b))&&a.getCursor().ch>d.index+d[0].length;);(b=top.get("content").contentWindow.document.getElementById("cssColor"))&&b.parentNode.removeChild(b);
top.ICEcoder.codeAssist&&"CSS"==top.ICEcoder.caretLocType&&(b=top.document.createElement("div"),b.id="cssColor",b.style.position="absolute",b.style.display="block",b.style.width=b.style.height="20px",b.style.zIndex="1000",b.style.background=d?d[0]:"",b.style.cursor="pointer",b.onclick=function(){top.ICEcoder.showColorPicker(d[0])},""==b.style.backgroundColor&&(b.style.display="none"),top.get("header").appendChild(b),a.addWidget(a.getCursor(),top.get("cssColor"),!0))},showColorPicker:function(a){top.get("blackMask").style.visibility=
"visible";top.get("mediaContainer").innerHTML='<div id="picker" class="picker"></div><br><br><input type="text" id="color" name="color" value="#000" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'color\').value)" value="insert &gt;" class="insertColorValue"><br><input type="text" id="colorRGB" name="colorRGB" value="rgb(0,0,0)" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'colorRGB\').value)" value="insert &gt;" class="insertColorValue">';
farbtastic("picker","color");a&&top.get("picker").farbtastic.setColor(a)},drawCanvasImage:function(a){var b=document.getElementById("canvasPicker").getContext("2d"),c=new Image;c.src=a.src;c.onload=function(){document.getElementById("canvasPicker").width=a.width;document.getElementById("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height)};document.getElementById("canvasPicker").onmousemove=function(a){var c=b.getImageData(a.pageX-this.offsetLeft,a.pageY-this.offsetTop,1,1).data;a=c[0];
var f=c[1],g=c[2],c=a+","+f+","+g;a=top.ICEcoder.rgbToHex(a,f,g);document.getElementById("rgbMouseXY").value=c;document.getElementById("hexMouseXY").value="#"+a;document.getElementById("hexMouseXY").style.backgroundColor=document.getElementById("rgbMouseXY").style.backgroundColor="#"+a};document.getElementById("canvasPicker").onclick=function(){document.getElementById("rgb").value=document.getElementById("rgbMouseXY").value;document.getElementById("hex").value=document.getElementById("hexMouseXY").value;
document.getElementById("hex").style.backgroundColor=document.getElementById("rgb").style.backgroundColor=document.getElementById("hex").value}},rgbToHex:function(a,b,c){return top.ICEcoder.toHex(a)+top.ICEcoder.toHex(b)+top.ICEcoder.toHex(c)},toHex:function(a){a=parseInt(a,10);if(isNaN(a))return"00";a=Math.max(0,Math.min(a,255));return"0123456789abcdef".charAt((a-a%16)/16)+"0123456789abcdef".charAt(a%16)},insertColorValue:function(a){var b,c;b=ICEcoder.getcMInstance();c=b.getTokenAt(b.getCursor());
b.replaceRange(a,{line:b.getCursor().line,ch:c.start},{line:b.getCursor().line,ch:c.end})},fMIconVis:function(a,b){var c;if(c=top.document.getElementById(a))c.style.opacity=b},isOpen:function(a){a=a.replace(/\|/g,"/").replace(top.docRoot+top.iceRoot,"");a=top.ICEcoder.openFiles.indexOf(a);return-1!=a?a:!1},updateHints:function(){var a;if("undefined"!=typeof JSHINT&&-1<top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1].indexOf(".js")){a=ICEcoder.getcMInstance();a.operation(function(){for(var b=top.ICEcoder["cM"+
top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]+"widgets"],c=0;c<b.length;++c)a.removeLineWidget(b[c]);b.length=0;JSHINT(a.getValue());for(c=0;c<JSHINT.errors.length;++c){var f=JSHINT.errors[c];if(f){var g=document.createElement("div"),l=g.appendChild(document.createElement("span"));l.innerHTML="!!";l.className="lint-error-icon";g.appendChild(document.createTextNode(f.reason));g.className="lint-error";b.push(a.addLineWidget(f.line-1,g,{coverGutter:!1,noHScroll:!0}))}}});var b=a.getScrollInfo(),
c=a.charCoords({line:a.getCursor().line+1,ch:0},"local").top;b.top+b.clientHeight<c&&a.scrollTo(null,c-b.clientHeight+3)}},startPluginIntervals:function(a,b,c,d){top.ICEcoder["plugTimer"+a]=-1<["_parent","_top","_self",""].indexOf(c)?top.ICEcoder["plugTimer"+a]=setInterval("window.location='"+b+"'",6E4*d):0==c.indexOf("fileControl")?top.ICEcoder["plugTimer"+a]=setInterval(function(){top.ICEcoder.serverQueue("add",b);top.ICEcoder.serverMessage(c.split(":")[1])},6E4*d):top.ICEcoder["plugTimer"+a]=setInterval("window.open('"+
b+"','"+c+"')",6E4*d);top.ICEcoder.pluginIntervalRefs.push(a)},codeAssistToggle:function(){var a;a=ICEcoder.getcMInstance();top.ICEcoder.codeAssist=!top.ICEcoder.codeAssist;top.ICEcoder.cssColorPreview();a.focus();if(top.ICEcoder.codeAssist)top.ICEcoder.updateHints();else for(i=0;i<top.ICEcoder.cMInstances.length;i++)a=top.ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[i]],a.operation(function(){for(var b=top.ICEcoder["cM"+top.ICEcoder.cMInstances[i]+"widgets"],c=0;c<b.length;++c)a.removeLineWidget(b[c]);
b.replaceRange(a,{line:b.getCursor().line,ch:c.start},{line:b.getCursor().line,ch:c.end})},fMIconVis:function(a,b){var c;if(c=top.get(a))c.style.opacity=b},isOpen:function(a){a=a.replace(/\|/g,"/").replace(top.docRoot+top.iceRoot,"");a=top.ICEcoder.openFiles.indexOf(a);return-1!=a?a:!1},updateHints:function(){var a;if("undefined"!=typeof JSHINT&&-1<top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1].indexOf(".js")){a=ICEcoder.getcMInstance();a.operation(function(){for(var b=top.ICEcoder["cM"+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-
1]+"widgets"],c=0;c<b.length;++c)a.removeLineWidget(b[c]);b.length=0;JSHINT(a.getValue());for(c=0;c<JSHINT.errors.length;++c){var f=JSHINT.errors[c];if(f){var g=document.createElement("div"),l=g.appendChild(document.createElement("span"));l.innerHTML="!!";l.className="lint-error-icon";g.appendChild(document.createTextNode(f.reason));g.className="lint-error";b.push(a.addLineWidget(f.line-1,g,{coverGutter:!1,noHScroll:!0}))}}});var b=a.getScrollInfo(),c=a.charCoords({line:a.getCursor().line+1,ch:0},
"local").top;b.top+b.clientHeight<c&&a.scrollTo(null,c-b.clientHeight+3)}},startPluginIntervals:function(a,b,c,d){top.ICEcoder["plugTimer"+a]=-1<["_parent","_top","_self",""].indexOf(c)?top.ICEcoder["plugTimer"+a]=setInterval("window.location='"+b+"'",6E4*d):0==c.indexOf("fileControl")?top.ICEcoder["plugTimer"+a]=setInterval(function(){top.ICEcoder.serverQueue("add",b);top.ICEcoder.serverMessage(c.split(":")[1])},6E4*d):top.ICEcoder["plugTimer"+a]=setInterval("window.open('"+b+"','"+c+"')",6E4*d);
top.ICEcoder.pluginIntervalRefs.push(a)},codeAssistToggle:function(){var a;a=ICEcoder.getcMInstance();top.ICEcoder.codeAssist=!top.ICEcoder.codeAssist;top.ICEcoder.cssColorPreview();a.focus();if(top.ICEcoder.codeAssist)top.ICEcoder.updateHints();else for(i=0;i<top.ICEcoder.cMInstances.length;i++)a=top.ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[i]],a.operation(function(){for(var b=top.ICEcoder["cM"+top.ICEcoder.cMInstances[i]+"widgets"],c=0;c<b.length;++c)a.removeLineWidget(b[c]);
b.length=0})},serverQueue:function(a,b){var c,d,e;c=ICEcoder.getcMInstance();for(e=d=0;e<ICEcoder.serverQueueItems.length;e++)0<ICEcoder.serverQueueItems[e].indexOf("action=save")&&d++;d++;if("add"==a)ICEcoder.serverQueueItems.push(b),0<b.indexOf("action=save")&&(e=document.createElement("textarea"),e.setAttribute("id","saveTemp"+d),document.body.appendChild(e),document.getElementById("saveTemp"+d).value=c.getValue());else if("del"==a){if(ICEcoder.serverQueueItems[0]&&0<ICEcoder.serverQueueItems[0].indexOf("action=save")){c=
d-1;for(e=1;e<c;e++)document.getElementById("saveTemp"+e).value=document.getElementById("saveTemp"+(e+1)).value;c=document.getElementById("saveTemp"+c);c.parentNode.removeChild(c)}ICEcoder.serverQueueItems.splice(0,1)}("del"==a&&1<=ICEcoder.serverQueueItems.length||1==ICEcoder.serverQueueItems.length)&&setTimeout(function(){top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=ICEcoder.serverQueueItems[0]},1)},cancelAllActions:function(){window.stop();0<ICEcoder.serverQueueItems.length&&
ICEcoder.serverQueueItems.splice(1,ICEcoder.serverQueueItems.length);top.ICEcoder.showHide("hide",top.document.getElementById("loadingMask"));top.ICEcoder.serverMessage('<b style="color: #d00">Cancelled tasks</b>');setTimeout(function(){top.ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a;a=top.ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,"");""==a&&(a="CLEAR");top.ICEcoder.serverQueue("add","lib/settings.php?saveFiles="+
a)},autoOpenFiles:function(){if(0<top.ICEcoder.previousFiles.length&&top.ICEcoder.ask("Open previous files?\n\n"+top.ICEcoder.previousFiles.length+" files:\n"+top.ICEcoder.previousFiles.join("\n").replace(/\|/g,"/").replace(RegExp(top.docRoot+top.iceRoot,"gi"),"")))for(var a=0;a<top.ICEcoder.previousFiles.length;a++)top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=top.ICEcoder.previousFiles[a].replace("|","/"),top.ICEcoder.thisFileFolderType="file",top.ICEcoder.openFile()},settingsScreen:function(a){a||
(top.document.getElementById("mediaContainer").innerHTML='<iframe src="lib/settings-screen.php" class="whiteGlow" style="width: 970px; height: 600px"></iframe>');top.ICEcoder.showHide(a?"hide":"show",top.document.getElementById("blackMask"))},helpScreen:function(){top.document.getElementById("mediaContainer").innerHTML='<iframe src="lib/help.php" class="whiteGlow" style="width: 800px; height: 470px"></iframe>';top.ICEcoder.showHide("show",top.document.getElementById("blackMask"))},showManual:function(a){top.document.getElementById("mediaContainer").innerHTML=
'<iframe src="http://icecoder.net/manual?version='+a+'" class="whiteGlow" style="width: 500px; height: 500px"></iframe>';top.ICEcoder.showHide("show",top.document.getElementById("blackMask"))},propertiesScreen:function(a){top.document.getElementById("mediaContainer").innerHTML='<iframe src="lib/properties.php?fileName='+a.replace(/\//g,"|")+'" class="whiteGlow" style="width: 660px; height: 330px"></iframe>';top.ICEcoder.showHide("show",top.document.getElementById("blackMask"))},useNewSettings:function(a,
b,c,d,e,f,g,l,h){var j;top.ICEcoder.theme=a.slice(a.lastIndexOf("/")+1,a.lastIndexOf("."));"editor"==top.ICEcoder.theme&&(top.ICEcoder.theme="icecoder");j=document.createElement("link");j.setAttribute("rel","stylesheet");j.setAttribute("type","text/css");j.setAttribute("href",a);top.ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(j);a=-1<["eclipse","elegant","neat"].indexOf(top.ICEcoder.theme)?"#ccc":"#000";top.ICEcoder.switchTab(top.ICEcoder.selectedTab);top.document.getElementById("codeAssist").checked=
b;c!=top.ICEcoder.lockedNav&&top.ICEcoder.lockUnlockNav();c||(ICEcoder.changeFilesW("contract"),top.document.getElementById("fileMenu").style.display="none");c=ICEcoder.content.contentWindow.document.styleSheets[3];b=c.rules?"rules":"cssRules";c[b][0].style.fontSize=e;c[b][5].style.content=d?'"\\21e5"':'" "';c[b][2].style.cssText="background: "+a+" !important";top.ICEcoder.lineWrapping=f;top.ICEcoder.indentWithTabs=g;top.ICEcoder.indentSize=l;for(d=0;d<ICEcoder.cMInstances.length;d++)ICEcoder.content.contentWindow["cM"+
ICEcoder.cMInstances[d]].setOption("lineWrapping",top.ICEcoder.lineWrapping),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("indentWithTabs",top.ICEcoder.indentWithTabs),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("indentUnit",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("tabSize",top.ICEcoder.indentSize);h&&top.ICEcoder.refreshFileManager()},updateResultsDisplay:function(a){ICEcoder.findReplace(top.document.getElementById("find").value,
!0,!1);document.getElementById("results").style.display="show"==a?"inline-block":"none"},fullScreenSwitcher:function(){"undefined"!=typeof document.cancelFullScreen?document.fullScreen?document.cancelFullScreen():document.body.requestFullScreen():"undefined"!=typeof document.mozCancelFullScreen?document.mozFullScreen?document.mozCancelFullScreen():document.body.mozRequestFullScreen():"undefined"!=typeof document.webkitCancelFullScreen&&(document.webkitIsFullScreen?document.webkitCancelFullScreen():
document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT))},zipIt:function(a){a=a.replace(/\//g,"|");top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="plugins/zip-it/index.php?zip="+a},chmod:function(a,b){top.ICEcoder.showHide("hide",top.document.getElementById("blackMask"));top.ICEcoder.serverQueue("add","lib/file-control.php?action=perms&file="+a.replace(top.iceRoot,"")+"&perms="+b);top.ICEcoder.serverMessage("<b>chMod "+b+" on </b><br>"+a.replace(top.iceRoot,""))},
openPreviewWindow:function(){if(0<top.ICEcoder.openFiles.length){var a,b,c;b=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];c=b.substr(b.lastIndexOf("/")+1);c=c.substr(c.lastIndexOf(".")+1);a=ICEcoder.getcMInstance();top.ICEcoder.previewWindow=window.open(b,"previewWindow");-1<["md"].indexOf(c)&&(top.ICEcoder.previewWindow.onload=function(){top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())})}},openTerminal:function(){top.ICEcoder.demoMode?top.ICEcoder.message("Sorry, you need to be logged in to use the terminal"):
window.open("terminal")},logout:function(){window.location+="?logout"},message:function(a){alert(a)},ask:function(a){return confirm(a)},getInput:function(a,b){return prompt(a,b)},dataMessage:function(a){var b;b=top.ICEcoder.content.contentWindow.document.getElementById("dataMessage");b.style.display="block";b.innerHTML=a},switchTab:function(a,b){var c;ICEcoder.selectedTab=a;if(c=ICEcoder.getcMInstance()){ICEcoder.switchMode();for(var d=0;d<ICEcoder.cMInstances.length;d++)ICEcoder.content.contentWindow["cM"+
ICEcoder.cMInstances[d]].getWrapperElement().style.display="none";c.setOption("theme",top.ICEcoder.theme);c.getWrapperElement().style.display="block";b||setTimeout(function(){c.focus()},4);c.refresh();ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.findMode=!1;ICEcoder.findReplace(top.document.getElementById("find").value,!0,!1);top.ICEcoder.codeAssist&&top.ICEcoder.updateHints();top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay()}},newTab:function(){var a;
ICEcoder.cMInstances.push(ICEcoder.nextcMInstance);ICEcoder.selectedTab=ICEcoder.cMInstances.length;ICEcoder.showHide("show",ICEcoder.content);ICEcoder.content.contentWindow.createNewCMInstance(ICEcoder.nextcMInstance);ICEcoder.setLayout();ICEcoder.thisFileFolderType="file";ICEcoder.thisFileFolderLink="/[NEW]";ICEcoder.openFile();a=ICEcoder.getcMInstance("new");ICEcoder.switchTab(ICEcoder.openFiles.length);a.removeLineClass(ICEcoder["cMActiveLine"+ICEcoder.selectedTab],"background");ICEcoder["cMActiveLine"+
ICEcoder.selectedTab]=a.addLineClass(0,"background","cm-s-activeLine");ICEcoder.nextcMInstance++},createNewTab:function(){var a;top.ICEcoder.openFiles.push(top.ICEcoder.shortURL);top.document.getElementById("tab"+top.ICEcoder.openFiles.length).style.display="inline-block";a=top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1];top.document.getElementById("tab"+top.ICEcoder.openFiles.length).innerHTML='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+
a.slice(a.lastIndexOf("/")).replace(/\//,"");top.document.getElementById("tab"+top.ICEcoder.openFiles.length).title="/"+top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//,"");top.ICEcoder.setTabWidths();top.ICEcoder.redoTabHighlight(top.ICEcoder.openFiles.length);top.ICEcoder.selectedTab=top.ICEcoder.openFiles.length;top.ICEcoder.changedContent.push(0);top.ICEcoder.setPreviousFiles()},nextTab:function(){top.ICEcoder.switchTab(top.ICEcoder.selectedTab+1<=top.ICEcoder.openFiles.length?
top.ICEcoder.selectedTab+1:1,"noFocus")},previousTab:function(){top.ICEcoder.switchTab(1<=top.ICEcoder.selectedTab-1?top.ICEcoder.selectedTab-1:top.ICEcoder.openFiles.length,"noFocus")},renameTab:function(a,b){var c;top.ICEcoder.openFiles[a-1]=b;c=top.ICEcoder.openFiles[a-1];top.document.getElementById("tab"+a).innerHTML='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+
c.slice(c.lastIndexOf("/")).replace(/\//,"");top.document.getElementById("tab"+a).title="/"+top.ICEcoder.openFiles[a-1].replace(/\//,"")},redoTabHighlight:function(a){for(var b,c,d=1;d<=ICEcoder.changedContent.length;d++){document.getElementById("tab"+d).childNodes[0]&&(document.getElementById("tab"+d).childNodes[0].childNodes[0].style.backgroundColor=1==ICEcoder.changedContent[d-1]?"#b00":"transparent");b=d==a?top.ICEcoder.tabFGselected:top.ICEcoder.tabFGnormalTab;if("undefined"!=typeof top.ICEcoder.openFiles[d-
1]&&"/[NEW]"!=top.ICEcoder.openFiles[d-1]&&(c=top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[d-1].replace(/\//g,"|"))))c.style.backgroundColor=d==a?top.ICEcoder.tabBGcurrent:top.ICEcoder.tabBGopen;document.getElementById("tab"+d).style.color=b;b=d==a?-22:0;document.getElementById("tab"+d).style.backgroundPosition="0 "+b+"px"}top.ICEcoder.fMIconVis("fMSave",1==ICEcoder.changedContent[a-1]?1:0.3)},closeTab:function(a,b){var c;ICEcoder.getcMInstance();c=!0;1==ICEcoder.changedContent[a-
1]&&(c=top.ICEcoder.ask("You have made changes.\n\nAre you sure you want to close without saving?"));if(c){c=top.ICEcoder.openFiles[a-1];for(var d=a;d<ICEcoder.openFiles.length;d++)top.document.getElementById("tab"+d).innerHTML=top.document.getElementById("tab"+(d+1)).innerHTML,top.document.getElementById("tab"+d).title=top.document.getElementById("tab"+(d+1)).title,ICEcoder.openFiles[d-1]=ICEcoder.openFiles[d],ICEcoder.openFileMDTs[d-1]=ICEcoder.openFileMDTs[d];ICEcoder.content.contentWindow["cM"+
top.ICEcoder.cMInstances[a-1]].getWrapperElement().style.display="none";top.ICEcoder.cMInstances.splice(a-1,1);top.document.getElementById("tab"+ICEcoder.openFiles.length).style.display="none";top.document.getElementById("tab"+ICEcoder.openFiles.length).innerHTML="";top.document.getElementById("tab"+ICEcoder.openFiles.length).title="";ICEcoder.openFiles.pop();ICEcoder.openFileMDTs.pop();ICEcoder.selectedTab==a&&(0<ICEcoder.openFiles.length?ICEcoder.selectedTab-=1:ICEcoder.selectedTab=0);0<ICEcoder.openFiles.length&&
0==ICEcoder.selectedTab&&(ICEcoder.selectedTab=1);0==ICEcoder.openFiles.length?top.ICEcoder.fMIconVis("fMView",0.3):(ICEcoder.switchMode(),ICEcoder.switchTab(ICEcoder.selectedTab));top.ICEcoder.changedContent.splice(a-1,1);top.ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.getNestLocation("update");top.ICEcoder.selectDeselectFile("deselect",top.ICEcoder.filesFrame.contentWindow.document.getElementById(c.replace(/\//g,"|")));b||top.ICEcoder.setPreviousFiles()}top.ICEcoder.canSwitchTabs=
!1;top.ICEcoder.setTabWidths("posOnlyNewTab");setTimeout(function(){top.ICEcoder.canSwitchTabs=!0},100)},closeAllTabs:function(){if(0<top.ICEcoder.cMInstances.length&&ICEcoder.ask("Close all tabs?"))for(var a=top.ICEcoder.cMInstances.length;0<a;a--)top.ICEcoder.closeTab(a,1<a?!0:!1)},setTabWidths:function(a){var b,c,d,e,f;b=parseInt(top.ICEcoder.content.style.width,10)-41-24-10;c=b/top.ICEcoder.openFiles.length-18;d=-18;e=41;f=0;top.ICEcoder.tabLeftPos=[];for(var g=0;g<top.ICEcoder.openFiles.length;g++)a&&
(g=top.ICEcoder.openFiles.length),d=168*top.ICEcoder.openFiles.length>b?parseInt(c*g,10)-parseInt(c*(g-1),10):150,e=0==g?41:parseInt(top.document.getElementById("tab"+g).style.left,10),f=0==g?0:parseInt(top.document.getElementById("tab"+g).style.width,10)+18,a?d=-18:(top.document.getElementById("tab"+(g+1)).style.left=e+f+"px",top.document.getElementById("tab"+(g+1)).style.width=d+"px"),top.ICEcoder.tabLeftPos.push(e+f);top.document.getElementById("newTab").style.left=e+f+d+18+"px"},tabDragStart:function(a){top.ICEcoder.draggingTab=
a;top.ICEcoder.diffStartX=top.ICEcoder.mouseX;top.ICEcoder.tabDragMouseXStart=(top.ICEcoder.mouseX-(parseInt(top.ICEcoder.files.style.width,10)+41+18))%150;top.document.getElementById("tab"+a).style.zIndex=2;for(var b=1;b<=top.ICEcoder.openFiles.length;b++)top.document.getElementById("tab"+b).className=b!==a?"tab tabSlide":"tab tabDrag"},tabDragMove:function(){var a,b;a=parseInt(top.document.getElementById("tab"+top.ICEcoder.openFiles.length).style.width,10)+18;top.ICEcoder.thisLeft=a=41<=top.ICEcoder.tabDragMouseX?
top.ICEcoder.tabDragMouseX<=parseInt(top.document.getElementById("newTab").style.left,10)-a?top.ICEcoder.tabDragMouseX:parseInt(top.document.getElementById("newTab").style.left,10)-a:41;top.document.getElementById("tab"+top.ICEcoder.draggingTab).style.left=a+"px";top.ICEcoder.dragTabNo=top.ICEcoder.draggingTab;for(var c=1;c<=top.ICEcoder.openFiles.length;c++)top.document.getElementById("tab"+c).style.opacity=c==top.ICEcoder.draggingTab?1:0.5,b=top.ICEcoder.tabLeftPos[c]?top.ICEcoder.tabLeftPos[c]-
top.ICEcoder.tabLeftPos[c-1]:b,c!=top.ICEcoder.draggingTab&&(c<top.ICEcoder.draggingTab?top.document.getElementById("tab"+c).style.left=a<=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]+b:top.ICEcoder.tabLeftPos[c-1]:top.document.getElementById("tab"+c).style.left=a>=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]-b:top.ICEcoder.tabLeftPos[c-1])},tabDragEnd:function(){var a,b;top.ICEcoder.setTabWidths();for(var c=1;c<=top.ICEcoder.openFiles.length;c++)top.ICEcoder.thisLeft>=top.ICEcoder.tabLeftPos[c-
1]&&(a=top.ICEcoder.thisLeft==top.ICEcoder.tabLeftPos[0]?1:top.ICEcoder.dragTabNo>c?c+1:c),top.document.getElementById("tab"+c).className="tab",top.document.getElementById("tab"+c).style.opacity=1,c!=top.ICEcoder.dragTabNo?top.document.getElementById("tab"+c).style.zIndex=1:setTimeout(function(){top.document.getElementById("tab"+c).style.zIndex=1},150);if(top.ICEcoder.thisLeft&&!1!==top.ICEcoder.thisLeft){b=[];for(c=1;c<=top.ICEcoder.openFiles.length;c++)b.push(c);b.splice(top.ICEcoder.dragTabNo-
1,1);b.splice(a-1,0,top.ICEcoder.dragTabNo);ICEcoder.sortTabs(b)}top.ICEcoder.setTabWidths();top.ICEcoder.draggingTab=!1;top.ICEcoder.thisLeft=!1},sortTabs:function(a){var b,c,d;b=[ICEcoder.changedContent,ICEcoder.openFiles,ICEcoder.openFileMDTs,ICEcoder.cMInstances];c=[[],[],[],[]];for(var e=0;e<b.length;e++){for(var f=0;f<b[e].length;f++)c[e].push(b[e][a[f]-1]);b[e]=c[e]}for(e=0;e<a.length;e++)document.getElementById("tab"+a[e]).id="tab"+(e+1)+".temp",top.ICEcoder.selectedTab==a[e]&&(d=e+1);for(e=
0;e<a.length;e++)document.getElementById("tab"+(e+1)+".temp").id="tab"+(e+1);top.document.getElementById("tab"+d)&&(top.document.getElementById("tab"+d).className="tab tabSlide");ICEcoder.changedContent=b[0];ICEcoder.openFiles=b[1];ICEcoder.openFileMDTs=b[2];ICEcoder.cMInstances=b[3];top.ICEcoder.setTabWidths();top.ICEcoder.switchTab(d)},alphaTabs:function(){if(0<top.ICEcoder.openFiles.length){var a,b,c,d,e;a=[];b=[];c=[];for(var f=0;f<top.ICEcoder.openFiles.length;f++)a.push(top.ICEcoder.openFiles[f].slice(top.ICEcoder.openFiles[f].lastIndexOf("/")+
1)),b.push(top.ICEcoder.openFiles[f]),top.document.getElementById("tab"+(f+1)).className="tab tabSlide";for(;0<a.length;){d=a[0];nextValueFull=b[0];for(f=e=0;f<a.length;f++)a[f]<d&&(d=a[f],nextValueFull=top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(b[f])],e=f);c.push(top.ICEcoder.openFiles.indexOf(nextValueFull)+1);a.splice(e,1);b.splice(e,1)}top.ICEcoder.sortTabs(c)}},interceptKeys:function(a,b){var c;c=b.keyCode?b.keyCode:b.which?b.which:b.charCode;if(46==c&&"files"==a)return top.ICEcoder.deleteFile(),
!1;if(b.altKey){if(b.ctrlKey&&"content"==a){if(68==c)return top.ICEcoder.tagWrapper("div"),!1;if(83==c)return top.ICEcoder.tagWrapper("span"),!1;if(80==c)return top.ICEcoder.tagWrapper("p"),!1;if(65==c)return top.ICEcoder.tagWrapper("a"),!1;if(66==c)return top.ICEcoder.tagWrapper("b"),!1;if(73==c)return top.ICEcoder.tagWrapper("i"),!1;if(71==c)return top.ICEcoder.tagWrapper("strong"),!1;if(69==c)return top.ICEcoder.tagWrapper("em"),!1;if(49==c)return top.ICEcoder.tagWrapper("h1"),!1;if(50==c)return top.ICEcoder.tagWrapper("h2"),
!1;if(51==c)return top.ICEcoder.tagWrapper("h3"),!1;if(52==c)return top.ICEcoder.tagWrapper("h4"),!1;if(53==c)return top.ICEcoder.tagWrapper("h5"),!1;if(54==c)return top.ICEcoder.tagWrapper("h6"),!1;if(55==c)return top.ICEcoder.tagWrapper("h7"),!1;if(13==c)return top.ICEcoder.addLineBreakAtEnd(),!1}return c}return 70==c&&b.ctrlKey?(top.document.getElementById("find").focus(),!1):71==c&&b.ctrlKey?(top.document.getElementById("goToLineNo").focus(),!1):73==c&&b.ctrlKey&&"content"==a?(c=top.ICEcoder.caretLocType.toLowerCase()+
" ","CSS"==top.ICEcoder.caretLocType||"PHP"==top.ICEcoder.caretLocType?window.open("http://voke.fm/"+c+top.ICEcoder.getcMInstance().getSelection()):("Content"==top.ICEcoder.caretLocType&&(c=""),window.open("http://www.google.com/#output=search&q="+c+top.ICEcoder.getcMInstance().getSelection())),!1):39==c&&b.ctrlKey&&"content"!=a?(top.ICEcoder.nextTab(),!1):37==c&&b.ctrlKey&&"content"!=a?(top.ICEcoder.previousTab(),!1):38==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.moveLine("up"),!1):40==c&&b.ctrlKey&&
"content"==a?(top.ICEcoder.moveLine("down"),!1):107==c&&b.ctrlKey?("content"==a?top.ICEcoder.duplicateLine():top.ICEcoder.newTab(),!1):109==c&&b.ctrlKey?("content"==a?top.ICEcoder.removeLine():top.ICEcoder.closeTab(top.ICEcoder.selectedTab),!1):83==c&&b.ctrlKey?(b.shiftKey?top.ICEcoder.saveFile("saveAs"):top.ICEcoder.saveFile(),!1):13==c&&b.ctrlKey&&"/[NEW]"!=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]?(window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]),!1):79==c&&b.ctrlKey?(top.ICEcoder.openPrompt(),
!1):32==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.addSnippet(),!1):32==c&&"content"!=a?(top.ICEcoder.getcMInstance().focus(),!1):74==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.jumpToDefinition(),!1):27==c&&"content"==a?(top.ICEcoder.lineCommentToggle(),!1):27==c&&"content"!=a?(top.ICEcoder.cancelAllActions(),!1):c},resetKeys:function(){},addSnippet:function(){var a,b,c;a=ICEcoder.getcMInstance();b=a.getCursor().line;c=a.getLine(b).length-a.getLine(b).replace(/^\s\s*/,"").length;a=a.getLine(b).slice(c);
"function"==a.slice(0,8)?top.ICEcoder.doSnippet("function","function VAR() {\nINDENT\tCURSOR\nINDENT}"):"if"==a.slice(0,2)?top.ICEcoder.doSnippet("if","if (CURSOR) {\nINDENT\t\nINDENT}"):"for"==a.slice(0,3)&&top.ICEcoder.doSnippet("for","for (var i=0; i<CURSOR; i++) {\nINDENT\t\nINDENT}")},doSnippet:function(a,b){var c,d,e,f,g,l;c=top.ICEcoder.getcMInstance();d=c.getCursor().line;if(-1<c.getLine(d).indexOf(a)){e=c.getLine(d);f=e.indexOf(a);e=e.slice(e.indexOf(a)+a.length);b=b.replace(/VAR/g,e);e=
c.getLine(d).slice(0,f);f=c.getLine(d).length-c.getLine(d).replace(/^\s\s*/,"").length;f=c.getLine(d).slice(0,f);b=b.replace(/INDENT/g,f);e+=b;f=e.indexOf("CURSOR");g=0;l=d;for(i=0;i<e.length;i++)e.indexOf("\n",g)<e.indexOf("CURSOR")&&(g=e.indexOf("\n",g)+1,l+=1);c.setLine(d,e.replace("CURSOR",""));c.setCursor(l,f);c.focus()}}};
ICEcoder.serverQueueItems.splice(1,ICEcoder.serverQueueItems.length);top.ICEcoder.showHide("hide",top.get("loadingMask"));top.ICEcoder.serverMessage('<b style="color: #d00">Cancelled tasks</b>');setTimeout(function(){top.ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a;a=top.ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,"");""==a&&(a="CLEAR");top.ICEcoder.serverQueue("add","lib/settings.php?saveFiles="+a)},autoOpenFiles:function(){if(0<
top.ICEcoder.previousFiles.length&&top.ICEcoder.ask("Open previous files?\n\n"+top.ICEcoder.previousFiles.length+" files:\n"+top.ICEcoder.previousFiles.join("\n").replace(/\|/g,"/").replace(RegExp(top.docRoot+top.iceRoot,"gi"),"")))for(var a=0;a<top.ICEcoder.previousFiles.length;a++)top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=top.ICEcoder.previousFiles[a].replace("|","/"),top.ICEcoder.thisFileFolderType="file",top.ICEcoder.openFile()},settingsScreen:function(a){a||(top.get("mediaContainer").innerHTML=
'<iframe src="lib/settings-screen.php" class="whiteGlow" style="width: 970px; height: 600px"></iframe>');top.ICEcoder.showHide(a?"hide":"show",top.get("blackMask"))},helpScreen:function(){top.get("mediaContainer").innerHTML='<iframe src="lib/help.php" class="whiteGlow" style="width: 800px; height: 470px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},showManual:function(a){top.get("mediaContainer").innerHTML='<iframe src="http://icecoder.net/manual?version='+a+'" class="whiteGlow" style="width: 500px; height: 500px"></iframe>';
top.ICEcoder.showHide("show",top.get("blackMask"))},propertiesScreen:function(a){top.get("mediaContainer").innerHTML='<iframe src="lib/properties.php?fileName='+a.replace(/\//g,"|")+'" class="whiteGlow" style="width: 660px; height: 330px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},useNewSettings:function(a,b,c,d,e,f,g,l,h){var j;top.ICEcoder.theme=a.slice(a.lastIndexOf("/")+1,a.lastIndexOf("."));"editor"==top.ICEcoder.theme&&(top.ICEcoder.theme="icecoder");j=document.createElement("link");
j.setAttribute("rel","stylesheet");j.setAttribute("type","text/css");j.setAttribute("href",a);top.ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(j);a=-1<["eclipse","elegant","neat"].indexOf(top.ICEcoder.theme)?"#ccc":"#000";top.ICEcoder.switchTab(top.ICEcoder.selectedTab);top.get("codeAssist").checked=b;c!=top.ICEcoder.lockedNav&&top.ICEcoder.lockUnlockNav();c||(ICEcoder.changeFilesW("contract"),top.ICEcoder.hideFileMenu());c=ICEcoder.content.contentWindow.document.styleSheets[3];
b=c.rules?"rules":"cssRules";c[b][0].style.fontSize=e;c[b][5].style.content=d?'"\\21e5"':'" "';c[b][2].style.cssText="background: "+a+" !important";top.ICEcoder.lineWrapping=f;top.ICEcoder.indentWithTabs=g;top.ICEcoder.indentSize=l;for(d=0;d<ICEcoder.cMInstances.length;d++)ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("lineWrapping",top.ICEcoder.lineWrapping),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("indentWithTabs",top.ICEcoder.indentWithTabs),
ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("indentUnit",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].setOption("tabSize",top.ICEcoder.indentSize);h&&top.ICEcoder.refreshFileManager()},updateResultsDisplay:function(a){ICEcoder.findReplace(top.get("find").value,!0,!1);document.getElementById("results").style.display="show"==a?"inline-block":"none"},fullScreenSwitcher:function(){"undefined"!=typeof document.cancelFullScreen?document.fullScreen?
document.cancelFullScreen():document.body.requestFullScreen():"undefined"!=typeof document.mozCancelFullScreen?document.mozFullScreen?document.mozCancelFullScreen():document.body.mozRequestFullScreen():"undefined"!=typeof document.webkitCancelFullScreen&&(document.webkitIsFullScreen?document.webkitCancelFullScreen():document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT))},zipIt:function(a){a=a.replace(/\//g,"|");top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="plugins/zip-it/index.php?zip="+
a},chmod:function(a,b){top.ICEcoder.showHide("hide",top.get("blackMask"));top.ICEcoder.serverQueue("add","lib/file-control.php?action=perms&file="+a.replace(top.iceRoot,"")+"&perms="+b);top.ICEcoder.serverMessage("<b>chMod "+b+" on </b><br>"+a.replace(top.iceRoot,""))},openPreviewWindow:function(){if(0<top.ICEcoder.openFiles.length){var a,b,c;b=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];c=b.substr(b.lastIndexOf("/")+1);c=c.substr(c.lastIndexOf(".")+1);a=ICEcoder.getcMInstance();top.ICEcoder.previewWindow=
window.open(b,"previewWindow");-1<["md"].indexOf(c)&&(top.ICEcoder.previewWindow.onload=function(){top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())})}},openTerminal:function(){top.ICEcoder.demoMode?top.ICEcoder.message("Sorry, you need to be logged in to use the terminal"):window.open("terminal")},logout:function(){window.location+="?logout"},message:function(a){alert(a)},ask:function(a){return confirm(a)},getInput:function(a,b){return prompt(a,b)},dataMessage:function(a){var b;
b=top.ICEcoder.content.contentWindow.document.getElementById("dataMessage");b.style.display="block";b.innerHTML=a},switchTab:function(a,b){var c;ICEcoder.selectedTab=a;if(c=ICEcoder.getcMInstance()){ICEcoder.switchMode();for(var d=0;d<ICEcoder.cMInstances.length;d++)ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[d]].getWrapperElement().style.display="none";c.setOption("theme",top.ICEcoder.theme);c.getWrapperElement().style.display="block";b||setTimeout(function(){c.focus()},4);c.refresh();
ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.findMode=!1;ICEcoder.findReplace(top.get("find").value,!0,!1);top.ICEcoder.codeAssist&&top.ICEcoder.updateHints();top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay()}},newTab:function(){var a;ICEcoder.cMInstances.push(ICEcoder.nextcMInstance);ICEcoder.selectedTab=ICEcoder.cMInstances.length;ICEcoder.showHide("show",ICEcoder.content);ICEcoder.content.contentWindow.createNewCMInstance(ICEcoder.nextcMInstance);
ICEcoder.setLayout();ICEcoder.thisFileFolderType="file";ICEcoder.thisFileFolderLink="/[NEW]";ICEcoder.openFile();a=ICEcoder.getcMInstance("new");ICEcoder.switchTab(ICEcoder.openFiles.length);a.removeLineClass(ICEcoder["cMActiveLine"+ICEcoder.selectedTab],"background");ICEcoder["cMActiveLine"+ICEcoder.selectedTab]=a.addLineClass(0,"background","cm-s-activeLine");ICEcoder.nextcMInstance++},createNewTab:function(){var a;top.ICEcoder.openFiles.push(top.ICEcoder.shortURL);top.get("tab"+top.ICEcoder.openFiles.length).style.display=
"inline-block";a=top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1];top.get("tab"+top.ICEcoder.openFiles.length).innerHTML='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+a.slice(a.lastIndexOf("/")).replace(/\//,
"");top.get("tab"+top.ICEcoder.openFiles.length).title="/"+top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//,"");top.ICEcoder.setTabWidths();top.ICEcoder.redoTabHighlight(top.ICEcoder.openFiles.length);top.ICEcoder.selectedTab=top.ICEcoder.openFiles.length;top.ICEcoder.changedContent.push(0);top.ICEcoder.setPreviousFiles()},nextTab:function(){top.ICEcoder.switchTab(top.ICEcoder.selectedTab+1<=top.ICEcoder.openFiles.length?top.ICEcoder.selectedTab+1:1,"noFocus")},previousTab:function(){top.ICEcoder.switchTab(1<=
top.ICEcoder.selectedTab-1?top.ICEcoder.selectedTab-1:top.ICEcoder.openFiles.length,"noFocus")},renameTab:function(a,b){var c;top.ICEcoder.openFiles[a-1]=b;c=top.ICEcoder.openFiles[a-1];top.get("tab"+a).innerHTML='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+
c.slice(c.lastIndexOf("/")).replace(/\//,"");top.get("tab"+a).title="/"+top.ICEcoder.openFiles[a-1].replace(/\//,"")},redoTabHighlight:function(a){for(var b,c,d=1;d<=ICEcoder.changedContent.length;d++){document.getElementById("tab"+d).childNodes[0]&&(document.getElementById("tab"+d).childNodes[0].childNodes[0].style.backgroundColor=1==ICEcoder.changedContent[d-1]?"#b00":"transparent");b=d==a?top.ICEcoder.tabFGselected:top.ICEcoder.tabFGnormalTab;if("undefined"!=typeof top.ICEcoder.openFiles[d-1]&&
"/[NEW]"!=top.ICEcoder.openFiles[d-1]&&(c=top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[d-1].replace(/\//g,"|"))))c.style.backgroundColor=d==a?top.ICEcoder.tabBGcurrent:top.ICEcoder.tabBGopen,c.style.color=d==a?top.ICEcoder.tabFGcurrent:top.ICEcoder.tabFGopenFile;document.getElementById("tab"+d).style.color=b;document.getElementById("tab"+d).style.background=d==a?top.ICEcoder.tabBGcurrent:top.ICEcoder.tabBGopen}top.ICEcoder.fMIconVis("fMSave",1==ICEcoder.changedContent[a-
1]?1:0.3)},closeTab:function(a,b){var c;ICEcoder.getcMInstance();c=!0;1==ICEcoder.changedContent[a-1]&&(c=top.ICEcoder.ask("You have made changes.\n\nAre you sure you want to close without saving?"));if(c){c=top.ICEcoder.openFiles[a-1];for(var d=a;d<ICEcoder.openFiles.length;d++)top.get("tab"+d).innerHTML=top.get("tab"+(d+1)).innerHTML,top.get("tab"+d).title=top.get("tab"+(d+1)).title,ICEcoder.openFiles[d-1]=ICEcoder.openFiles[d],ICEcoder.openFileMDTs[d-1]=ICEcoder.openFileMDTs[d];ICEcoder.content.contentWindow["cM"+
top.ICEcoder.cMInstances[a-1]].getWrapperElement().style.display="none";top.ICEcoder.cMInstances.splice(a-1,1);top.get("tab"+ICEcoder.openFiles.length).style.display="none";top.get("tab"+ICEcoder.openFiles.length).innerHTML="";top.get("tab"+ICEcoder.openFiles.length).title="";ICEcoder.openFiles.pop();ICEcoder.openFileMDTs.pop();ICEcoder.selectedTab==a&&(0<ICEcoder.openFiles.length?ICEcoder.selectedTab-=1:ICEcoder.selectedTab=0);0<ICEcoder.openFiles.length&&0==ICEcoder.selectedTab&&(ICEcoder.selectedTab=
1);0==ICEcoder.openFiles.length?top.ICEcoder.fMIconVis("fMView",0.3):(ICEcoder.switchMode(),ICEcoder.switchTab(ICEcoder.selectedTab));top.ICEcoder.changedContent.splice(a-1,1);top.ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.getNestLocation("update");top.ICEcoder.selectDeselectFile("deselect",top.ICEcoder.filesFrame.contentWindow.document.getElementById(c.replace(/\//g,"|")));b||top.ICEcoder.setPreviousFiles()}top.ICEcoder.canSwitchTabs=!1;top.ICEcoder.setTabWidths("posOnlyNewTab");
setTimeout(function(){top.ICEcoder.canSwitchTabs=!0},100)},closeAllTabs:function(){if(0<top.ICEcoder.cMInstances.length&&ICEcoder.ask("Close all tabs?"))for(var a=top.ICEcoder.cMInstances.length;0<a;a--)top.ICEcoder.closeTab(a,1<a?!0:!1)},setTabWidths:function(a){var b,c,d,e,f;if(top.ICEcoder.ready){b=parseInt(top.ICEcoder.content.style.width,10)-41-24-10;c=b/top.ICEcoder.openFiles.length-18;d=-18;e=41;f=0;top.ICEcoder.tabLeftPos=[];for(var g=0;g<top.ICEcoder.openFiles.length;g++)a&&(g=top.ICEcoder.openFiles.length),
d=168*top.ICEcoder.openFiles.length>b?parseInt(c*g,10)-parseInt(c*(g-1),10):150,e=0==g?41:parseInt(top.get("tab"+g).style.left,10),f=0==g?0:parseInt(top.get("tab"+g).style.width,10)+18,a?d=-18:(top.get("tab"+(g+1)).style.left=e+f+"px",top.get("tab"+(g+1)).style.width=d+"px"),top.ICEcoder.tabLeftPos.push(e+f);top.get("newTab").style.left=e+f+d+18+"px"}},tabDragStart:function(a){top.ICEcoder.draggingTab=a;top.ICEcoder.diffStartX=top.ICEcoder.mouseX;top.ICEcoder.tabDragMouseXStart=(top.ICEcoder.mouseX-
(parseInt(top.ICEcoder.files.style.width,10)+41+18))%150;top.get("tab"+a).style.zIndex=2;for(var b=1;b<=top.ICEcoder.openFiles.length;b++)top.get("tab"+b).className=b!==a?"tab tabSlide":"tab tabDrag"},tabDragMove:function(){var a,b;a=parseInt(top.get("tab"+top.ICEcoder.openFiles.length).style.width,10)+18;top.ICEcoder.thisLeft=a=41<=top.ICEcoder.tabDragMouseX?top.ICEcoder.tabDragMouseX<=parseInt(top.get("newTab").style.left,10)-a?top.ICEcoder.tabDragMouseX:parseInt(top.get("newTab").style.left,10)-
a:41;top.get("tab"+top.ICEcoder.draggingTab).style.left=a+"px";top.ICEcoder.dragTabNo=top.ICEcoder.draggingTab;for(var c=1;c<=top.ICEcoder.openFiles.length;c++)top.get("tab"+c).style.opacity=c==top.ICEcoder.draggingTab?1:0.5,b=top.ICEcoder.tabLeftPos[c]?top.ICEcoder.tabLeftPos[c]-top.ICEcoder.tabLeftPos[c-1]:b,c!=top.ICEcoder.draggingTab&&(c<top.ICEcoder.draggingTab?top.get("tab"+c).style.left=a<=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]+b:top.ICEcoder.tabLeftPos[c-1]:top.get("tab"+
c).style.left=a>=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]-b:top.ICEcoder.tabLeftPos[c-1])},tabDragEnd:function(){var a,b;top.ICEcoder.setTabWidths();for(var c=1;c<=top.ICEcoder.openFiles.length;c++)top.ICEcoder.thisLeft>=top.ICEcoder.tabLeftPos[c-1]&&(a=top.ICEcoder.thisLeft==top.ICEcoder.tabLeftPos[0]?1:top.ICEcoder.dragTabNo>c?c+1:c),top.get("tab"+c).className="tab",top.get("tab"+c).style.opacity=1,c!=top.ICEcoder.dragTabNo?top.get("tab"+c).style.zIndex=1:setTimeout(function(){top.get("tab"+
c).style.zIndex=1},150);if(top.ICEcoder.thisLeft&&!1!==top.ICEcoder.thisLeft){b=[];for(c=1;c<=top.ICEcoder.openFiles.length;c++)b.push(c);b.splice(top.ICEcoder.dragTabNo-1,1);b.splice(a-1,0,top.ICEcoder.dragTabNo);ICEcoder.sortTabs(b)}top.ICEcoder.setTabWidths();top.ICEcoder.draggingTab=!1;top.ICEcoder.thisLeft=!1},sortTabs:function(a){var b,c,d;b=[ICEcoder.changedContent,ICEcoder.openFiles,ICEcoder.openFileMDTs,ICEcoder.cMInstances];c=[[],[],[],[]];for(var e=0;e<b.length;e++){for(var f=0;f<b[e].length;f++)c[e].push(b[e][a[f]-
1]);b[e]=c[e]}for(e=0;e<a.length;e++)document.getElementById("tab"+a[e]).id="tab"+(e+1)+".temp",top.ICEcoder.selectedTab==a[e]&&(d=e+1);for(e=0;e<a.length;e++)document.getElementById("tab"+(e+1)+".temp").id="tab"+(e+1);top.get("tab"+d)&&(top.get("tab"+d).className="tab tabSlide");ICEcoder.changedContent=b[0];ICEcoder.openFiles=b[1];ICEcoder.openFileMDTs=b[2];ICEcoder.cMInstances=b[3];top.ICEcoder.setTabWidths();top.ICEcoder.switchTab(d)},alphaTabs:function(){if(0<top.ICEcoder.openFiles.length){var a,
b,c,d,e;a=[];b=[];c=[];for(var f=0;f<top.ICEcoder.openFiles.length;f++)a.push(top.ICEcoder.openFiles[f].slice(top.ICEcoder.openFiles[f].lastIndexOf("/")+1)),b.push(top.ICEcoder.openFiles[f]),top.get("tab"+(f+1)).className="tab tabSlide";for(;0<a.length;){d=a[0];nextValueFull=b[0];for(f=e=0;f<a.length;f++)a[f]<d&&(d=a[f],nextValueFull=top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(b[f])],e=f);c.push(top.ICEcoder.openFiles.indexOf(nextValueFull)+1);a.splice(e,1);b.splice(e,1)}top.ICEcoder.sortTabs(c)}},
interceptKeys:function(a,b){var c;c=b.keyCode?b.keyCode:b.which?b.which:b.charCode;if(46==c&&"files"==a)return top.ICEcoder.deleteFile(),!1;if(b.altKey){if(b.ctrlKey&&"content"==a){if(68==c)return top.ICEcoder.tagWrapper("div"),!1;if(83==c)return top.ICEcoder.tagWrapper("span"),!1;if(80==c)return top.ICEcoder.tagWrapper("p"),!1;if(65==c)return top.ICEcoder.tagWrapper("a"),!1;if(66==c)return top.ICEcoder.tagWrapper("b"),!1;if(73==c)return top.ICEcoder.tagWrapper("i"),!1;if(71==c)return top.ICEcoder.tagWrapper("strong"),
!1;if(69==c)return top.ICEcoder.tagWrapper("em"),!1;if(49==c)return top.ICEcoder.tagWrapper("h1"),!1;if(50==c)return top.ICEcoder.tagWrapper("h2"),!1;if(51==c)return top.ICEcoder.tagWrapper("h3"),!1;if(52==c)return top.ICEcoder.tagWrapper("h4"),!1;if(53==c)return top.ICEcoder.tagWrapper("h5"),!1;if(54==c)return top.ICEcoder.tagWrapper("h6"),!1;if(55==c)return top.ICEcoder.tagWrapper("h7"),!1;if(13==c)return top.ICEcoder.addLineBreakAtEnd(),!1}return c}return 70==c&&b.ctrlKey?(top.get("find").focus(),
!1):71==c&&b.ctrlKey?(top.get("goToLineNo").focus(),!1):73==c&&b.ctrlKey&&"content"==a?(c=top.ICEcoder.caretLocType.toLowerCase()+" ","CSS"==top.ICEcoder.caretLocType||"PHP"==top.ICEcoder.caretLocType?window.open("http://voke.fm/"+c+top.ICEcoder.getcMInstance().getSelection()):("Content"==top.ICEcoder.caretLocType&&(c=""),window.open("http://www.google.com/#output=search&q="+c+top.ICEcoder.getcMInstance().getSelection())),!1):39==c&&b.ctrlKey&&"content"!=a?(top.ICEcoder.nextTab(),!1):37==c&&b.ctrlKey&&
"content"!=a?(top.ICEcoder.previousTab(),!1):38==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.moveLine("up"),!1):40==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.moveLine("down"),!1):107==c&&b.ctrlKey?("content"==a?top.ICEcoder.duplicateLine():top.ICEcoder.newTab(),!1):109==c&&b.ctrlKey?("content"==a?top.ICEcoder.removeLine():top.ICEcoder.closeTab(top.ICEcoder.selectedTab),!1):83==c&&b.ctrlKey?(b.shiftKey?top.ICEcoder.saveFile("saveAs"):top.ICEcoder.saveFile(),!1):13==c&&b.ctrlKey&&"/[NEW]"!=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-
1]?(window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]),!1):79==c&&b.ctrlKey?(top.ICEcoder.openPrompt(),!1):32==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.addSnippet(),!1):32==c&&"content"!=a?(top.ICEcoder.getcMInstance().focus(),!1):74==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.jumpToDefinition(),!1):27==c&&"content"==a?(top.ICEcoder.lineCommentToggle(),!1):27==c&&"content"!=a?(top.ICEcoder.cancelAllActions(),!1):c},resetKeys:function(){},addSnippet:function(){var a,b,c;a=ICEcoder.getcMInstance();
b=a.getCursor().line;c=a.getLine(b).length-a.getLine(b).replace(/^\s\s*/,"").length;a=a.getLine(b).slice(c);"function"==a.slice(0,8)?top.ICEcoder.doSnippet("function","function VAR() {\nINDENT\tCURSOR\nINDENT}"):"if"==a.slice(0,2)?top.ICEcoder.doSnippet("if","if (CURSOR) {\nINDENT\t\nINDENT}"):"for"==a.slice(0,3)&&top.ICEcoder.doSnippet("for","for (var i=0; i<CURSOR; i++) {\nINDENT\t\nINDENT}")},doSnippet:function(a,b){var c,d,e,f,g,l;c=top.ICEcoder.getcMInstance();d=c.getCursor().line;if(-1<c.getLine(d).indexOf(a)){e=
c.getLine(d);f=e.indexOf(a);e=e.slice(e.indexOf(a)+a.length);b=b.replace(/VAR/g,e);e=c.getLine(d).slice(0,f);f=c.getLine(d).length-c.getLine(d).replace(/^\s\s*/,"").length;f=c.getLine(d).slice(0,f);b=b.replace(/INDENT/g,f);e+=b;f=e.indexOf("CURSOR");g=0;l=d;for(i=0;i<e.length;i++)e.indexOf("\n",g)<e.indexOf("CURSOR")&&(g=e.indexOf("\n",g)+1,l+=1);c.setLine(d,e.replace("CURSOR",""));c.setCursor(l,f);c.focus()}}};

View File

@@ -37,9 +37,13 @@ for ($i=0;$i<count($themeArray);$i++) {
<div class="infoPane">
<a href="http://icecoder.net" target="_blank"><img src="../images/ice-coder.png" class="logo"></a>
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div>
<p>
<br><br>
version:<br>
v <?php echo $ICEcoder["versionNo"];?>
<br><br>
website:<br>
<a href="http://icecoder.net" target="_blank">http://icecoder.net</a>
<br><br>
@@ -101,9 +105,9 @@ when finding in files, exclude:<br>
<h2>security</h2>
new password <span style="font-size: 10px; color: #888">8 chars</span><br>
<input type="password" name="accountPassword" onkeydown="showButton()"><br>
<input type="password" name="password" onkeydown="showButton()"><br>
confirm password<br>
<input type="password" name="confirmPassword" onkeydown="showButton()"><br>
<input type="password" name="passwordConfirm" onkeydown="showButton()"><br>
<br>
banned files/folders<br>
<input type="text" onkeydown="document.settings.changedFileSettings.value='true';showButton()" name="bannedFiles" value="<?php for($i=0;$i<=count($ICEcoder["bannedFiles"])-1;$i++) {echo $ICEcoder["bannedFiles"][$i]; if ($i<count($ICEcoder["bannedFiles"])-1) {echo ', ';};}; ?>"><br>
@@ -227,10 +231,10 @@ var showHideTabs = function() {
}
var validatePasswords = function() {
if (document.settings.accountPassword.value != 0 && document.settings.accountPassword.value.length<8) {
if (document.settings.password.value != 0 && document.settings.password.value.length<8) {
top.ICEcoder.message('Please use at least 8 chars in the password');
} else {
if (document.settings.accountPassword.value != document.settings.confirmPassword.value) {
if (document.settings.password.value != document.settings.passwordConfirm.value) {
top.ICEcoder.message('Sorry, your passwords don\'t match')
} else {
document.settings.submit();

View File

@@ -20,8 +20,9 @@ if(!isset($_SESSION)) {session_start();}
// Logout if that's the action we're taking
if (isset($_GET['logout'])) {
include(dirname(__FILE__)."/../processes/on-user-logout.php");
$_SESSION['loggedIn']=false;
$_SESSION['accountUsername']=false;
$_SESSION['username']=false;
session_destroy();
header("Location: dirname(__FILE__)./?loggedOut");
}
@@ -79,30 +80,32 @@ function toUTF8noBOM($string,$message) {
return $string;
}
// Load system settings
$configSettings = 'config___settings.php';
include(dirname(__FILE__)."/".$configSettings);
// Settings are stored in this file
$settingsTemplate = 'config-template.php';
$settingsFile = 'config-'.str_replace(".","_",$_SERVER['SERVER_NAME']).'.php';
$configUsersTemplate = 'config___users-template.php';
$username = "";
if (isset($_POST['username']) && $_POST['username'] != "") {$username = strClean($_POST['username']."-");};
if (isset($_SESSION['username']) && $_SESSION['username'] != "") {$username = strClean($_SESSION['username']."-");};
$settingsFile = 'config-'.$username.str_replace(".","_",$_SERVER['SERVER_NAME']).'.php';
$setPWorLogin = "login";
if (!file_exists(dirname(__FILE__)."/".$settingsFile)) {
if (!copy(dirname(__FILE__)."/".$settingsTemplate, dirname(__FILE__)."/".$settingsFile)) {
if (!copy(dirname(__FILE__)."/".$configUsersTemplate, dirname(__FILE__)."/".$settingsFile)) {
die("Couldn't create $settingsFile. Maybe you need write permissions on the lib folder?");
}
$setPWorLogin = "set password";
}
include(dirname(__FILE__)."/".$settingsFile);
// Add ICEcoder settings to beginning of $ICEcoder array
$ICEcoder = array(
"versionNo" => "2.5",
"codeMirrorDir" => "CodeMirror-3.13",
"demoMode" => false,
"devMode" => false,
"multiUser" => false,
"lineEnding" => "\n"
)+$ICEcoder;
// Join ICEcoder settings and user settings together to make our final ICEcoder array
$ICEcoder = $ICEcoderSettings + $ICEcoderUserSettings;
$onLoadExtras = "";
$pluginsDisplay = "";
if ($ICEcoder['demoMode'] && $ICEcoder['accountPassword']!="") {$_SESSION['loggedIn']=true;};
if ($ICEcoder['demoMode'] && $ICEcoder['password']!="") {$_SESSION['loggedIn']=true;};
$demoMode = $ICEcoder['demoMode'];
// Update this config file?
@@ -120,7 +123,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
$ICEcoder["codeAssist"] = isset($_POST['codeAssist']) && $_POST['codeAssist'] ? "true" : "false";
$ICEcoder["visibleTabs"] = isset($_POST['visibleTabs']) && $_POST['visibleTabs'] ? "true" : "false";
$ICEcoder["lockedNav"] = isset($_POST['lockedNav']) && $_POST['lockedNav'] ? "true" : "false";
if ($_POST['accountPassword']!="") {$ICEcoder["accountPassword"] = generateHash(strClean($_POST['accountPassword']));};
if ($_POST['password']!="") {$ICEcoder["password"] = generateHash(strClean($_POST['password']));};
$ICEcoder["bannedFiles"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['bannedFiles']))).'")';
$ICEcoder["bannedPaths"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['bannedPaths']))).'")';
$ICEcoder["allowedIPs"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['allowedIPs']))).'")';
@@ -131,11 +134,11 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
$ICEcoder["indentWithTabs"] = strClean($_POST['indentWithTabs']);
$ICEcoder["indentSize"] = numClean($_POST['indentSize']);
$settingsArray = array("root","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","accountPassword","bannedFiles","bannedPaths","allowedIPs","plugins","theme","fontSize","lineWrapping","indentWithTabs","indentSize");
$settingsArray = array("root","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","password","bannedFiles","bannedPaths","allowedIPs","plugins","theme","fontSize","lineWrapping","indentWithTabs","indentSize");
$settingsNew = "";
for ($i=0;$i<count($settingsArray);$i++) {
$settingsNew .= '"'.$settingsArray[$i].'"'.PHP_EOL.' => ';
$settingWrap = $settingsArray[$i]=="root"||$settingsArray[$i]=="accountPassword"||$settingsArray[$i]=="theme"||$settingsArray[$i]=="fontSize" ? '"' : '';
$settingWrap = $settingsArray[$i]=="root"||$settingsArray[$i]=="password"||$settingsArray[$i]=="theme"||$settingsArray[$i]=="fontSize" ? '"' : '';
$settingsNew .= $settingWrap.$ICEcoder[$settingsArray[$i]].$settingWrap.','.PHP_EOL.PHP_EOL;
}
@@ -165,12 +168,25 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Establish our user level
if (!isset($_SESSION['loggedIn'])) {$_SESSION['loggedIn'] = false;};
if(isset($_POST['loginPassword']) && generateHash(strClean($_POST['loginPassword']),$ICEcoder["accountPassword"])==$ICEcoder["accountPassword"]) {$_SESSION['loggedIn'] = true; header('Location: ../');};
if (!isset($_SESSION['username'])) {$_SESSION['username'] = false;};
if(isset($_POST['submit']) && $setPWorLogin=="login") {
if (generateHash(strClean($_POST['password']),$ICEcoder["password"])==$ICEcoder["password"]) {
if ($ICEcoder["multiUser"]) {
$_SESSION['username'] = $_POST['username'];
}
$_SESSION['loggedIn'] = true;
include(dirname(__FILE__)."/../processes/on-user-login.php");
header('Location: ../');
} else {
include(dirname(__FILE__)."/../processes/on-user-login-fail.php");
}
};
$_SESSION['loggedIn'] = $_SESSION['loggedIn'];
$_SESSION['username'] = $_SESSION['username'];
// Define the serverType, docRoot & iceRoot
$serverType = stristr($_SERVER['SERVER_SOFTWARE'], "win") ? "Windows" : "Linux";
$docRoot = rtrim(str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']));
$docRoot = rtrim(str_replace("\\","/",$ICEcoder['docRoot']));
$iceRoot = rtrim(str_replace("\\","/",$ICEcoder["root"]));
if ($_SESSION['loggedIn']) {
echo "<script>top.docRoot='".$docRoot."';top.iceRoot='".$iceRoot."'</script>";
@@ -295,17 +311,17 @@ if ($_SESSION['loggedIn']) {
$onLoadExtras .= ";top.ICEcoder.content.style.visibility='visible'";
}
if ((!$_SESSION['loggedIn'] || $ICEcoder["accountPassword"] == "") && !strpos($_SERVER['SCRIPT_NAME'],"lib/settings.php")) {
if ((!$_SESSION['loggedIn'] || $ICEcoder["password"] == "") && !strpos($_SERVER['SCRIPT_NAME'],"lib/settings.php")) {
header('Location: lib/settings.php');
// If we're due to show the settings screen
} elseif (!$_SESSION['loggedIn']) {
// If the password hasn't been set and we're setting it
if ($ICEcoder["accountPassword"] == "" && isset($_POST['accountPassword'])) {
$password = generateHash(strClean($_POST['accountPassword']));
if ($ICEcoder["password"] == "" && isset($_POST['submit']) && (strpos($_POST['submit'],"set password")>-1)) {
$password = generateHash(strClean($_POST['password']));
$settingsFile = $settingsFile;
$settingsContents = file_get_contents($settingsFile,false,$context);
// Replace our empty password with the one submitted by user
$settingsContents = str_replace('"accountPassword" => "",','"accountPassword" => "'.$password.'",',$settingsContents);
$settingsContents = str_replace('"password" => "",','"password" => "'.$password.'",',$settingsContents);
// Also set the update checker preference
$checkUpdates = $_POST['checkUpdates']=="true" ? "true" : "false";
// once to cover the true setting, once to cover false
@@ -316,7 +332,11 @@ if ((!$_SESSION['loggedIn'] || $ICEcoder["accountPassword"] == "") && !strpos($_
fwrite($fh, $settingsContents);
fclose($fh);
// Set the session user level
if ($ICEcoder["multiUser"]) {
$_SESSION['username']=$_POST['username'];
}
$_SESSION['loggedIn'] = true;
include(dirname(__FILE__)."/../processes/on-user-new.php");
// Finally, load again as now this file has changed and auto login
header('Location: ../');
}
@@ -327,7 +347,7 @@ if ((!$_SESSION['loggedIn'] || $ICEcoder["accountPassword"] == "") && !strpos($_
<head>
<title>ICEcoder <?php
echo $ICEcoder["versionNo"]." : ";
echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
echo $ICEcoder["password"] == "" && !$ICEcoder["multiUser"] ? "Setup" : "Login";
?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
@@ -335,22 +355,22 @@ echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
<link rel="icon" type="image/png" href="../favicon.png">
</head>
<body onLoad="document.settingsUpdate.<?php echo $ICEcoder["accountPassword"] == "" ? "account" : "login"; ?>Password.focus()">
<body onLoad="document.settingsUpdate.<?php echo $ICEcoder["multiUser"] ? "username" : "password";?>.focus()">
<div class="screenContainer" style="background-color: #141414">
<div class="screenVCenter">
<div class="screenCenter">
<img src="../images/ice-coder.png">
<img src="../images/ice-coder.png" style="margin-right: 22px">
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div>
<form name="settingsUpdate" action="settings.php" method="POST">
<?php if ($ICEcoder["multiUser"]) { echo '<input type="text" name="'.($ICEcoder["accountPassword"] == "" ? "account" : "login").'Username" class="accountPassword"><br><br>';};?>
<input type="password" name="<?php echo $ICEcoder["accountPassword"] == "" ? "account" : "login"; ?>Password" class="accountPassword"><br><br>
<input type="submit" name="submit" value="<?php echo $ICEcoder["accountPassword"] == "" ? "set password" : "login"; ?>" class="button">
<?php if ($ICEcoder["multiUser"]) {echo '<input type="text" name="username" class="password"><br><br>';};?>
<input type="password" name="password" class="password"><br><br>
<input type="submit" name="submit" value="<?php if ($ICEcoder["multiUser"]) {echo "set password / login";} else {echo $ICEcoder["password"] == "" ? "set password" : "login";}; ?>" class="button">
<?php
if ($ICEcoder["accountPassword"] == "") {
if ($ICEcoder["password"] == "" || $ICEcoder["multiUser"]) {
echo '<div class="text"><input type="checkbox" name="checkUpdates" value="true" checked> auto-check for updates</div>';
}
if (!$ICEcoder["multiUser"] && 1==2) { echo '<div class="text"><a href="javascript:alert(\'To put into multi-user mode, open lib/settings.php and change multiUser to true then reload this page\')">multi-user?</a></div>';};
if (!$ICEcoder["multiUser"]) { echo '<div class="text"><a href="javascript:alert(\'To put into multi-user mode, open lib/settings.php and change multiUser to true then reload this page\')">multi-user?</a></div>';};
?>
</form>
</div>
@@ -361,7 +381,7 @@ echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
</html>
<?php
} elseif ($_SESSION['loggedIn'] && $ICEcoder["accountPassword"]=="") {
} elseif ($_SESSION['loggedIn'] && $ICEcoder["password"]=="") {
header("Location: ../?logout");
}
?>

9
processes/on-load.php Normal file
View File

@@ -0,0 +1,9 @@
<!--
Purpose: This file is run when ICEcoder has loaded
Langs: Anything - PHP, JS etc
Example:
//-->
<script>
// top.ICEcoder.openFile('/index.html');
// alert('Thanks for using ICEcoder');
</script>

View File

@@ -0,0 +1,8 @@
<?php
// Purpose: This file is run when a login fail occurs
// Langs: PHP only
// Example:
// $fh = fopen(dirname(__FILE__)."/../user-access.log", 'a');
// fwrite($fh, "FAIL ".date("D dS M Y h:i:sa").": ".$_POST['username']."\n");
// fclose($fh);
?>

View File

@@ -0,0 +1,8 @@
<?php
// Purpose: This file is run when a user logs in
// Langs: PHP only
// Example:
// $fh = fopen(dirname(__FILE__)."/../user-access.log", 'a');
// fwrite($fh, "login ".date("D dS M Y h:i:sa").": ".$_SESSION['username']."\n");
// fclose($fh);
?>

View File

@@ -0,0 +1,8 @@
<?php
// Purpose: This file is run when a user logs out
// Langs: PHP only
// Example:
// $fh = fopen(dirname(__FILE__)."/../user-access.log", 'a');
// fwrite($fh, "logout ".date("D dS M Y h:i:sa").": ".$_SESSION['username']."\n");
// fclose($fh);
?>

View File

@@ -0,0 +1,8 @@
<?php
// Purpose: This file is run when a new user sets up
// Langs: PHP only
// Example:
// $fh = fopen(dirname(__FILE__)."/../user-access.log", 'a');
// fwrite($fh, "NEW >>> ".date("D dS M Y h:i:sa").": ".$_SESSION['username']."\n");
// fclose($fh);
?>

View File

@@ -9,9 +9,9 @@ error_reporting(E_ALL);
if (isset($_SERVER['PHP_AUTH_USER'])) {
$_SESSION['user'] = $_SERVER['PHP_AUTH_USER'];
$_SESSION['pass'] = generateHash(strClean($_SERVER['PHP_AUTH_PW']),$ICEcoder["accountPassword"]);
$_SESSION['pass'] = generateHash(strClean($_SERVER['PHP_AUTH_PW']),$ICEcoder["password"]);
}
$passwd = array($_SESSION['user'] => $ICEcoder["accountPassword"]);
$passwd = array($_SESSION['user'] => $ICEcoder["password"]);
$aliases = array('la' => 'ls -la',
'll' => 'ls -lvhF',
'dir' => 'ls' );