Compare commits

..

118 Commits
v2.2 ... v2.5

Author SHA1 Message Date
Matt Pass
b52f0cd112 Version 2.5 screenshot 2013-05-29 15:08:51 +01:00
Matt Pass
4865f6c87b Version 2.5 2013-05-29 14:49:47 +01:00
Matt Pass
b2ceca3a8f Range fix & check fold type by file extension
Revert back to the 'from' > 'from' range as we may not always have a
'from' > 'to' object here
Determine fold type by filename extension, also includes CSS and LESS
2013-05-29 14:49:39 +01:00
Matt Pass
2c4ee9370c Escape quotes and full release > beta
Escape quotes in message so we can have quoted URLs in links etc
If our version is beta, the current not and we have matching numbers,
take 0.1 off our version number so it's seen as a lesser version
2013-05-29 13:57:43 +01:00
Matt Pass
1f10cad45b Clearer to use from - to
Was actually OK going from -> from line, but makes more sense to go from
-> to.
2013-05-29 12:42:32 +01:00
Matt Pass
c2e92fa355 Brace folding on applicable filetypes
On both load and change we need to use braceRangeFinder or
tagRangeFinder depending on filetype
Also get rid of old, commented foldStyle marker CSS historical reference
as we're now using that
2013-05-29 08:57:37 +01:00
Matt Pass
2f85371738 Need to global context to be usable 2013-05-29 08:54:45 +01:00
Matt Pass
a48c9f5a77 Set gutter to be min-width not width
This is so the gutter width expands for bigger line numbers, was
overlapping due to fixed width
2013-05-29 08:25:39 +01:00
Matt Pass
61728cfa07 Seperate fold gutter, CSS tweaks & for count fix
Seperate gutter & class added for folds
Change to class names - now fold, foldOn and foldOff
Tweaks to coloring on fold markers
For loop needs to redo fold markers for both the start line and for the
length of the text. This means we now get fold markers when pasting
lines of text
2013-05-29 08:24:46 +01:00
Matt Pass
1643e74758 CSS class name changes
fold is now the classname for the guttermarkers, foldOn for the on
variant, foldOff for off
We have a seperate gutter now for folds, called folds and no longer
dropping markers into the linenumbers gutter
2013-05-29 08:16:33 +01:00
Matt Pass
33a354688a Begin setting up multiUser
For now tho this is hidden from view until the rest is set up
2013-05-28 19:07:51 +01:00
Matt Pass
7c2d6f6fb5 Organise alpha tabs on openFiles.length
Don't run this process based on cMInstances.length but openFiles.length
which represents the tabs open
2013-05-28 18:41:16 +01:00
Matt Pass
ea959248ca onChange redo markers
Redo the markers for the changed range
2013-05-28 08:39:08 +01:00
Matt Pass
2665a3be40 initMarks is now dontCollapse, clear non folds
initMarks was used for the intial setup of a doc with (-) marks but this
idea can be extended to cover not wanting to collapse and only mark
lines
If a line isn't collapsable now it clears the markers for it (used when
we delete text, replace with something else etc)
2013-05-28 08:38:33 +01:00
Matt Pass
d240cf0a53 Compressed file no longer contains foldcode.js
This is because we have a modified foldcode.js file now in ICEcoders own
lib folder
2013-05-25 18:36:30 +01:00
Matt Pass
c02e7cd0b5 foldcode.js loaded and guttermarks set
A modified version of foldcode.js is now loaded to show guttermarks
New classes added for foldmarker, guttermarker plus the on and off BG
colors
Remove temp measure of showing a guttermarker then 1 second later
removing
Instead now pass new params to the new codefold system to show
guttermarks
2013-05-25 18:30:54 +01:00
Matt Pass
6a3e15aabf On load also set the gutter marks
Using tagRangeFinder for now, need to also handle braceRangeFinder and
put into a function within ICEcoder
2013-05-25 18:26:24 +01:00
Matt Pass
e4bae8cdc5 Now shows guttermarks
Takes new params for markOn, markOff and initMarks
Creates new span DOM elems for markOn and markOff
Determin if a line is foldable by there being a range with chars in
between (ie, start & end line's & ch's not the same)
If it's foldable and we're clearing or setting up the initMarks, show
markOff marker, otherwise markOn marker (as cloned nodes)
Also set to the markOff marker when clicking the inline widget
2013-05-25 18:24:47 +01:00
Matt Pass
e0e679d436 foldcode.js added
Original foldcode.js from CodeMirror addon lib added
This is because I want to make changes to this to show guttermarks too
Added as a start point, so we can see changes in a diff view
2013-05-25 18:18:55 +01:00
Matt Pass
0f3050521d Titles added to Preview Window and Terminal 2013-05-24 09:18:38 +01:00
Matt Pass
db5a10bb96 Update file to match main JS 2013-05-24 09:12:50 +01:00
Matt Pass
b05954eccd Error catching when no tabs are open
Look to openFiles.length on if statements within openPreviewWindow,
closeAllTabs and alphaTabs functions so we only do these processes if we
have 1 or more tabs open
2013-05-24 09:10:37 +01:00
Matt Pass
d2504dac64 New classes for colorValue and insertColorValue
To stop using inline styles on the preview/value boxes and insert
buttons
2013-05-23 17:50:15 +01:00
Matt Pass
a95e4124a8 RGB background, color and value set
Same BG and color as hex elem, but value is set the hex BG value with
whitespace removed
2013-05-23 17:49:31 +01:00
Matt Pass
c18630b0a5 RGB color value added to picker
Farbtastic color picker now setting RGB value and BG color in colorRGB
elem
insertColorValue function adjusted to receive any value and replace
2013-05-23 17:46:44 +01:00
Matt Pass
f436aa835d Set a stream context timeout for file reading
Add a context array to all instances of file_get_contents(). This is so
we don't end up with a timeout too early if the system is set to
something short (ie, 15 secs) and we try to open a large file that takes
longer than this short limit.
2013-05-23 17:45:00 +01:00
Matt Pass
7409c89a87 Updated file to reflect main JS file 2013-05-23 10:08:45 +01:00
Matt Pass
0de8405906 Remove old highlight & save dialog now filename
If we have a new filename and our file is not [NEW], we must be
peforming a Save As.
In this case, establish the old filename and if it's visible, change its
BG & FG colors to the default
Also now set previousFiles when any save happens to avoid previousFiles
still having old filenames
The dialog now wants only a filename in both Save As and New File cases
Condensed code a little here
2013-05-23 10:08:11 +01:00
Matt Pass
39d4bfe858 If our file is |[NEW], prefix selectedFiles[0]
This is so we can pick up where we are saving the new file.
2013-05-23 09:56:56 +01:00
Matt Pass
0677cb2a90 Line height added to previously opened files list
Icons and text previously looked out of line
2013-05-23 09:55:09 +01:00
Matt Pass
2dd2e64f43 Ignoring config*.php except config-template.php
To avoid any of the config files ending up in your Git repo
2013-05-23 09:54:30 +01:00
Matt Pass
3d45172991 Config now includes server name
Config filename now also includes server name (domain and subdomains).
This means you can end up with different config files depending on where
ICEcoder is being used, such as config-localhost.php,
config-mydomain_com.php, config-dev_mydomain_com.php etc.
Also now using CodeMirror 3.13
2013-05-23 09:53:24 +01:00
Matt Pass
979fb791ac Upgrade to CodeMirror v3.13
From v3.12
2013-05-23 09:43:17 +01:00
Matt Pass
1fcc2d996c Detect encoding and use that in if statement
Try to detect encoding type and check on it not being ASCII in if
statement too
2013-05-22 17:21:17 +01:00
Matt Pass
e1d1891de8 Don't set innerHTML to false
Mistakenly setting the innerHTML to false, so went back to classic
if/else if statements to only set on these 2 cases
2013-05-22 17:19:20 +01:00
Matt Pass
fabfcbd742 Test against converted UTF8 no BOM content
Convert content to UTF8 with no BOM before testing matches against it
2013-05-22 13:00:19 +01:00
Matt Pass
3710fa9e79 Convert content to UTF8 no BOM
Detect bad chars and BOMs in loaded content and convert plus show
message to inform user
Affects: Loaded files, remote loaded files, replacing text in files,
saving files
2013-05-22 12:58:33 +01:00
Matt Pass
b059261065 Function to convert strings to UTF with no BOM
Remove BOM, test broken and converted string lengths, encode if needed
and also show a message if required.
2013-05-22 12:55:27 +01:00
Matt Pass
7b1b91ca14 lineEnding setting added
Now replacing \r\n, \r and \n with whatever we chose to be the
lineEnding setting
lineEnding is \n by default
2013-05-22 08:40:38 +01:00
Matt Pass
098127c287 New min file to reflect changes 2013-05-21 17:05:21 +01:00
Matt Pass
83c99f34a3 Lowercase hex used
Use lowercase hex values to be consistent with rest of ICEcoder
2013-05-21 17:05:04 +01:00
Matt Pass
a9ae141838 Selected tab color is now very dark grey
This is to go with new color scheme, where black is current and is same
color as findBar to better indicate which tab you're on. Looks more
refined too!
2013-05-21 16:57:08 +01:00
Matt Pass
c783416054 Use tabFGselected instead of hardcoded value 2013-05-21 16:55:51 +01:00
Matt Pass
59e1bc3c56 New settings to style highlights
Formatted settings to make them easier to read
Added new settings tabBGselected to tabFGnormalTab. This is so you can
change styling of ICEcoder itself a bit easier, as these colors are used
in a few places
Extra ternary conditions added to handle things better.
Black is now current, selected is blue, open is grey and normal is
transparent. Also set the FG text colour on these things too, to go with
new color scheme.
2013-05-21 16:55:09 +01:00
Matt Pass
f4cdff0c2c Show icons for last 10 files
Load in seperate CSS file file-types.css
Show the last 10 files in a UL, with icons next to LI's as per file
manager tree
2013-05-21 16:46:23 +01:00
Matt Pass
5bd99480f1 Redo highlights on opening branch
When we open a new branch, redo the tab highlights which also redoes the
file manager highlights
2013-05-21 16:44:21 +01:00
Matt Pass
a86e7e4182 Using file-types.css too 2013-05-21 16:42:33 +01:00
Matt Pass
c3477264b3 file-types.css added
Everything related to the file tree display, icons etc moved to it's own
file
This is so we can use this CSS file too, without having an additional
CSS reset and body applied
Main reason for doing this is so we can show icons from editor.php
2013-05-21 16:42:16 +01:00
Matt Pass
9c4c33aa76 Increase the variations on definition matching
Covers a few more variations here, will one day integrate Tern to better
handle this.
2013-05-16 16:57:05 +01:00
Matt Pass
9b5aea5aec Shortcut for mobile open file added 2013-05-16 08:43:37 +01:00
Matt Pass
614ee50262 Open file on clicking on a mobile 2013-05-16 08:31:18 +01:00
Matt Pass
f1b7c973d3 Update min file to match main JS 2013-05-14 18:41:06 +01:00
Matt Pass
0c7fad798c updateByte Display and showDisplay functions
byteDisplay added as DOM elem ref
updateByteDisplay added which sets the inner HTML to be the length of
the content spilt by commas on thousands
showDisplay function added to toggle between the 2 displays
Call updateByteDisplay on switching tabs
2013-05-14 18:40:41 +01:00
Matt Pass
e4ed3cf978 Call updateByteDisplay on events
To match updates on updateCharDisplay
2013-05-14 18:38:45 +01:00
Matt Pass
63687b7f48 Byte Display container added
Get rid of span inside of charDisplay, not used at all
Add byteDisplay much like charDisplay, both have a display set and
onClick call the new showDisplay toggle function passing the others name
as a param
CSS made simpler by aligning right with a margin plus cursor now pointer
2013-05-14 18:38:08 +01:00
Matt Pass
20454a21ed devMode setting displayed
Test suite now floated left with 50px right margin
If devMode is true, float another DIV to the left of this stating that
demo mode is on and we are using ice-coder.js
Maybe don't need the DIV to clear the float, but worthwhile having
incase of browser layout issues
2013-05-14 08:56:51 +01:00
Matt Pass
eb30cb0cb6 Version 2.4 screenshot 2013-05-13 09:12:51 +01:00
Matt Pass
b211fae85c Version 2.4 2013-05-13 08:58:21 +01:00
Matt Pass
93b4774903 Take ICEcoder back out of devMode 2013-05-13 08:57:57 +01:00
Matt Pass
236b55fce6 Updated min file to match dev JS file 2013-05-13 08:57:44 +01:00
Matt Pass
c34bf50c39 Info & version in msg, form near upload option
Show update version info after version no in message
Move form next to upload option it relates to for clarity
2013-05-13 08:55:31 +01:00
Matt Pass
b8f921dab2 CTRL+o can now get remote URL
You can enter an absolute URL path (ie, anything that has :// in it) and
it will trigger a different function to get the remote URL by sending
that action to the server queue
2013-05-12 17:13:44 +01:00
Matt Pass
fc79be3010 getRemote file function added
Firstly, avoid establishing a full path if we have a getRemoteFile
action as it will be a URL
If we want to get a remote URL, attempt to get remote contents,
standardise all line endings to be Linux based, create a new tab, new
textarea and finally set the value of the new tab. If we don't manage to
get the file, show an error message
2013-05-12 17:12:14 +01:00
Matt Pass
63d08eeed2 Clarify write perms to be either 757 or 775
Depends on system
2013-05-12 17:09:22 +01:00
Matt Pass
7fa39f645d Space shortcut to refocus on document
Hit space when outside of document to refocus on it
2013-05-12 16:06:55 +01:00
Matt Pass
535677fc8e onclick needs if check and simpler title updating
onclick function needed is statement plus passing of event on anon
function to solve repeated CTRL+click issue
Update title not by adjusting hardcoded values but by looking to ID of
targetElem
We're able to get rid of a lot of code here as the onmouseover function
is now looking to a child node item in get-branch.php, so no need to
mess with updating hardcoded string values.
2013-05-12 13:56:30 +01:00
Matt Pass
2dfff50031 Set 2nd param to this.childNodes[1].id
Rather than a hardcoded string which we need to update later, make it
relate to the inner node items ID
2013-05-12 13:53:28 +01:00
Matt Pass
c335b6b7fb Check htmlState also plus put into dev mode
Extra CodeMirror object child level needs to be checked too plus put
into dev mode until I resolve 2nd eval issue on renaming file (occurs in
.min.js file)
2013-05-10 18:50:14 +01:00
Matt Pass
a81c4c7a75 Also need write perms on test-file1.txt
A temp measure till I do something better here
2013-05-10 17:50:48 +01:00
Matt Pass
e2ada5e6b2 Setup point changed to include perms on test dir 2013-05-10 17:46:27 +01:00
Matt Pass
43ae4ac317 Dropping eval for function closure and slashes
Stop using eval here in favor of a function that returns the value, also
replacing pipes with slashes to display correctly on mouse hover
2013-05-10 17:45:11 +01:00
Matt Pass
5f0ee6d95e Trim + and space from end of file
Not something that should/could be used consistently across enviro's so
am trimming these chars off
2013-05-10 17:41:37 +01:00
Matt Pass
0947172391 Copying of multiple items
Celecting copy will now store an array of the selected items and when
pasting, add each to the server queue for pasting.
2013-05-09 09:10:16 +01:00
Matt Pass
0fb9680f72 devMode setting added, swapped menu item order
New setting for devMode. If true it will use the unminified ice-coder.js
file, otherwise the min.js version
Copy option now available for multple file copying, outside of single
menu items. Paste option moved next to it.
2013-05-09 09:06:23 +01:00
Matt Pass
ba94a3bba0 Add system as a DOM elem
Not used as yet but available as a hook
2013-05-08 08:59:13 +01:00
Matt Pass
11963e263d No need to have font weight, size or color
No text inside this anymore
2013-05-08 08:58:47 +01:00
Matt Pass
3f15cb8fff Python now supported as a language
Also minor fixes to Ruby's usage
2013-05-08 08:51:50 +01:00
Matt Pass
eca4f8e06d Version 2.3 2013-05-06 17:59:51 +01:00
Matt Pass
358be2ee92 Updated to v2.3 & changed text to Linux Terminal 2013-05-06 17:59:44 +01:00
Matt Pass
acd8f949e7 Updated file 2013-05-06 17:42:58 +01:00
Matt Pass
a1574af5e0 Working with previewWindow, plus new sys tools
stickyTab now previewWindow in all places
nestDisplay text now gone, was just clutter
nestValid and nestDisplay now move to be under editor when resizing file
manager
Now setting nesting OK/broken on title on new look nesting indicator
new functions for openPreviewWindow and openTerminal, tidied up code a
little
stickyTabMaybe now removed as a flag
2013-05-06 17:40:02 +01:00
Matt Pass
525e73e179 stickyTab now previewWindow 2013-05-06 17:33:42 +01:00
Matt Pass
abe1745642 Terminal plugin removed
Now part of the ICEcoder system
2013-05-06 17:33:21 +01:00
Matt Pass
eda925e617 Icons for preview window and terminal added 2013-05-06 17:33:04 +01:00
Matt Pass
5ab3f7ba16 All stickyTab refs now previewWindow 2013-05-06 17:32:45 +01:00
Matt Pass
cb12bdad2d Removed sticky tab shortcut, added live edits 2013-05-06 17:32:11 +01:00
Matt Pass
2a6c2fc273 Jump to definition shortcut added
Shortcut re stickyTab now gone as we click icon to open preview window
now
2013-05-06 17:31:48 +01:00
Matt Pass
216c04b3f1 Terminal moved to system & icon gone
Terminal is now no longer a plugin but part of the ICEcoder system. In
doing this, the icon was removed, plus the path to the settings.php file
altered
2013-05-06 17:29:12 +01:00
Matt Pass
0ecb6ea1aa system, preview, terminal & nest display changes
New class added for new system tools area below file manager, contains 2
child divs to display preview window and terminal icons
nesting class is now a small circle, placed near nestDisplay which
contains the breadcrumbs
nestDisplay class is moved along by 12px to accomodate the new smaller
nesting OK/broken indicator
2013-05-06 17:25:59 +01:00
Matt Pass
f3fff8543d Icons for preview and terminal, add demoMode var
demoMode var now available to make use of in JS
New system DIV in footer along with 2 child divs which trigger new
functions to open the preview window or terminal
Get rid of nest display text, it's just clutter
2013-05-06 17:22:36 +01:00
Matt Pass
2d75b57195 Using minified JS file
40% byte saving so loads that bit faster.
2013-05-06 16:00:01 +01:00
Matt Pass
7ebd73916e Added a minified version of ice-coder.js
This saves about 40% of the load time on this file now.
2013-05-06 16:00:00 +01:00
Matt Pass
cafa9d521a Making JS Google Compiler compatible
Needed to alter a few things to make it Compiler compatible. These
include stop using </textarea> even if it's in a comment, escape it when
using it as a string, comment tag openings need to be escaped too, plus
we cannot use char as a var, so renamed many references to ch instead.
Finally, needed to escape the &#39; apos ref to avoid issues there.
2013-05-06 15:59:59 +01:00
mattpass
a5b395d888 3rd param should be false
The 3rd param is to define buttonClick, which isn't true in this case.
2013-05-05 19:52:25 +02:00
Matt Pass
c214640bb1 Jump to Definition variations setup
If something is selected and we have an orig cursor pos, set it back to
that. If not, we set the orig cursor pos, define an array of possible
definition matches and attempt to find them one after another in a for
loop, escaping when we do. Altered findReplace function to provide a
return of true or false depending on if anything is found.
2013-05-05 13:35:38 +01:00
Matt Pass
d7a8b35ded Jump to Definition, opening up findReplace func
New function jumptToDefinition. This takes token at the current cursor
position and then looks for that function definition as a set piece of
text 'function '+tokenString. This is triggered from CTRL+J so you can
hit this whenever you're on a function call and it will jump to it's
declaration.
In doing this I have repurposed the 1st param in findReplace function to
now accept a string to find. Previously we had this set to action, but
this variable was never used, must have just been a placeholder. In the
couple of places we call this function now we are passing the find input
box value.
2013-05-04 15:19:31 +01:00
Matt Pass
bcc86e160f Pass find value to function as 1st param
Instead of passing thru a string that never gets used (the 1st param
here is put under the action variable, but then never used), now the 1st
param is the string to consider as the find. In these cases, it's
obviously whatever is in the find input box.
2013-05-04 15:14:38 +01:00
Matt Pass
5b14389c6e Only hide mask if not over popup elems
Determined by a overPopup flag
2013-05-04 13:52:28 +01:00
Matt Pass
0ba4803154 Canvas elem plus 4 x input boxes added
Canvas element added to drop a dup of our image into
4 input boxes also added to show current mouse XY hex & RGB values and
similar values when clicking the canvas image.
New flags added to stop closing the popup unless we click outside of
these elems
Finally, split everything onto multiple lines for readability
2013-05-04 13:51:51 +01:00
Matt Pass
e58f9cae28 overPopup flag, canvas display & hex/RGB convert
New flag to determin if we are over a popup or not, won't hide popup on
click if we are
drawCanvasImage function added, takes img node, creates a new canvas and
on load of a JS img object, puts the same image into the canvas, scaled
to same size. This then has 2 functions applied to update RGB and Hex
values and BG colors as the mouse moves and also on click sets another
set
rgbToHex and toHex functions added to help return hex values on demand
2013-05-04 13:48:33 +01:00
Matt Pass
1d5c049c01 Don't reload MD files
Stick with the Markdown parsed version shown via editing.
2013-05-02 17:19:04 +01:00
Matt Pass
0d01b4a2ea Only update current doc & CSS append once
Now only updates the innerHTML value of the stickyTab doc if the browser
location is the same as the doc we're editing (HTML & MD files). Also
now adding an ID to the style and if it exists, remove that child DOM
elem before adding another so we only ever have 1 child for this, ie, it
gets updated by removing & adding.
2013-05-02 17:18:15 +01:00
Matt Pass
d43a758a37 Markdown mode added, fix to tag display
Markdown added as a mode
CodeMirror changed their object structure to include another child -
htmlState
If it's a markdown file we're editing, after loading our file into the
stickyTab, onload of this parse our content through mmd to this window
2013-04-30 17:54:19 +01:00
Matt Pass
d886372f11 Load mmd.js lib for markdown parsing to stickyTab 2013-04-30 17:51:51 +01:00
Matt Pass
838d44bd5c Load and use Markdown parser
If the file we are editing is a markdown file and we have a stickyTab
open, send the parsed editor content to the document DOM for display
2013-04-30 17:51:26 +01:00
Matt Pass
8f997eb4f3 Markdown parser added 2013-04-30 17:48:54 +01:00
Matt Pass
65b3fc56ef Markdown icon added, others shift along 2013-04-30 17:48:16 +01:00
Matt Pass
6e061cbc30 Markdown (md) files can now be opened in editor 2013-04-30 17:47:58 +01:00
Matt Pass
9e44b76214 Markdown icon added 2013-04-30 17:47:28 +01:00
Matt Pass
d1e928e068 Note on Markdown mode being included 2013-04-30 17:47:19 +01:00
Matt Pass
2c2249d96b Markdown mode included 2013-04-30 17:46:55 +01:00
Matt Pass
d87e932030 Live editing of CSS files
Tries to find CSS files in the stickyTab shown window. If it does it
appends a new stylesheet to it as you type.
2013-04-30 08:07:03 +01:00
Matt Pass
44cac8a7e1 Live editing of HTML files
Now when you have a stickyTab open and edit HTML files, it shows the
live edits as you type
2013-04-29 08:32:49 +01:00
Matt Pass
736d3c8744 If ctrlKey, don't openCloseDir
We are selecting files/folders if the control key is down, so no need to
open or close dirs
2013-04-21 15:48:04 +01:00
Matt Pass
3104065437 Dimensions now shown under image
The natural image dimensions are now shown next to the image name (now
in bold) along with a note that it's displayed at a reduced size, if it
is.
2013-04-21 15:47:15 +01:00
Matt Pass
444695a908 CTRL, Alt & Shift keys now established natively
Instead of having toggle variables for CTRL, Alt and Shift we are now
establishing if these keys are up/down from the event object passed in.

This means we don't need these flags, it's less code, and more reliable
too as we query if these keys are down from the event hooks.

delKeyDown is also removed though was never really used.
2013-04-21 15:42:55 +01:00
Matt Pass
eba6f4eaf2 Pass event to showMenu on context menu
This is used as a hook to establish if CTRL, shift and Alt keys are down
2013-04-21 15:16:40 +01:00
Matt Pass
e3b4f0b159 v2.2 screenshot shown 2013-04-20 18:30:47 +01:00
49 changed files with 796 additions and 299 deletions

3
.gitignore vendored
View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -19,7 +19,7 @@
padding: 0 4px; /* Horizontal padding of content */ padding: 0 4px; /* Horizontal padding of content */
} }
.CodeMirror-scrollbar-filler { .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white; /* The little square between H and V scrollbars */ background-color: white; /* The little square between H and V scrollbars */
} }
@@ -28,6 +28,7 @@
.CodeMirror-gutters { .CodeMirror-gutters {
border-right: 1px solid #ddd; border-right: 1px solid #ddd;
background-color: #f7f7f7; background-color: #f7f7f7;
white-space: nowrap;
} }
.CodeMirror-linenumbers {} .CodeMirror-linenumbers {}
.CodeMirror-linenumber { .CodeMirror-linenumber {
@@ -124,7 +125,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
/* The fake, visible scrollbars. Used to force redraw during scrolling /* The fake, visible scrollbars. Used to force redraw during scrolling
before actuall scrolling happens, thus preventing shaking and before actuall scrolling happens, thus preventing shaking and
flickering artifacts. */ flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler { .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute; position: absolute;
z-index: 6; z-index: 6;
display: none; display: none;
@@ -141,16 +142,18 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
} }
.CodeMirror-scrollbar-filler { .CodeMirror-scrollbar-filler {
right: 0; bottom: 0; right: 0; bottom: 0;
z-index: 6; }
.CodeMirror-gutter-filler {
left: 0; bottom: 0;
} }
.CodeMirror-gutters { .CodeMirror-gutters {
position: absolute; left: 0; top: 0; position: absolute; left: 0; top: 0;
height: 100%;
padding-bottom: 30px; padding-bottom: 30px;
z-index: 3; z-index: 3;
} }
.CodeMirror-gutter { .CodeMirror-gutter {
white-space: normal;
height: 100%; height: 100%;
padding-bottom: 30px; padding-bottom: 30px;
margin-bottom: -32px; margin-bottom: -32px;

View File

@@ -3,14 +3,14 @@
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. 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-browser-code-editor.png" alt="ICEcoder web IDE"> <img src="http://icecoder.net/images/icecoder-v2-5-browser-code-editor.png" alt="ICEcoder web IDE">
###Requirements ###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). 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 ###Features you'd expect
* Context aware code highlighting * Context aware code highlighting
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP & Ruby * Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP, Python, Ruby, Markdown & more
* Smart tab key system (selected text indents line) * Smart tab key system (selected text indents line)
* File manager * File manager
* Find & replace/replace all * Find & replace/replace all
@@ -34,14 +34,14 @@ You can run ICEcoder either online or locally, on Linux, Windows or Mac based pl
* Adds end tags as you type and in a context aware way * Adds end tags as you type and in a context aware way
* Can rename open files (whoaah!) * Can rename open files (whoaah!)
* CTRL+Enter open current webpage in new tab * CTRL+Enter open current webpage in new tab
* CTRL+S+Enter opens a sticky tab to show live edits * Window to view live edits
* ESC = Comment/Uncomment line, incl partial lines * ESC = Comment/Uncomment line, incl partial lines
* Image viewer * Image viewer
* Colour preview block on CSS colours, ie red, #f00 or RGBA(255,0,0,0.5) * Colour preview block on CSS colours, ie red, #f00 or RGBA(255,0,0,0.5)
* MySQL Database management via Adminer plugin * MySQL Database management via Adminer plugin
* Backs up files every 30 mins or on click of backup plugin icon * Backs up files every 30 mins or on click of backup plugin icon
* Github repo syncing with ICErepo plugin * Github repo syncing with ICErepo plugin
* Shell terminal * Linux terminal
* JS Hint validation as you type * JS Hint validation as you type
* Emmet snippet typing booster * Emmet snippet typing booster
* HTML & JavaScript code hinting * HTML & JavaScript code hinting
@@ -61,7 +61,7 @@ $ git clone git@github:mattpass/ICEcoder
####Step 2: Place in your document root (online or local) ####Step 2: Place in your document root (online or local)
``` ```
Put in a new sub-dir URL such as yourdomain.com/_coder or localhost/_coder Put in a new sub-dir URL such as yourdomain.com/_coder or localhost/_coder
Set public write permissions (757 recommended) on the 'backups' and 'lib' folders Set write permissions (757 or 775 depending on your system) on the 'backups', 'lib' and 'test' folders plus 'test/test-file1.txt'
``` ```
####Step 3: Start coding ####Step 3: Start coding

View File

@@ -11,10 +11,12 @@
<!-- <!--
codemirror-compressed.js codemirror-compressed.js
incls: codemirror incls: codemirror
modes: clike, coffeescript, css, htmlmixed, javascript, less, php, ruby & xml modes: clike, coffeescript, css, htmlmixed, javascript, less, markdown, php, python, ruby & xml
utils: closetag, foldcode, xml-fold, brace-fold, show-hint, javascript-hint, html-hint, searchcursor, match-highlighter utils: closetag, xml-fold, brace-fold, show-hint, javascript-hint, html-hint, searchcursor, match-highlighter
//--> //-->
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script> <script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
<script src="lib/mmd.js"></script>
<script src="lib/foldcode.js"></script>
<?php <?php
if (file_exists(dirname(__FILE__)."/plugins/emmet/emmet.min.js")) { if (file_exists(dirname(__FILE__)."/plugins/emmet/emmet.min.js")) {
echo '<script src="plugins/emmet/emmet.min.js"></script>'; echo '<script src="plugins/emmet/emmet.min.js"></script>';
@@ -23,6 +25,7 @@ if (file_exists(dirname(__FILE__)."/plugins/emmet/emmet.min.js")) {
if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';}; if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';};
$activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat")) !== false ? "#ccc" : "#000"; $activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat")) !== false ? "#ccc" : "#000";
?>"> ?>">
<style type="text/css"> <style type="text/css">
/* Make sure this next one remains the 1st item, updated with JS */ /* Make sure this next one remains the 1st item, updated with JS */
.CodeMirror {position: absolute; top: 0px; width: 100%; font-size: <?php echo $ICEcoder["fontSize"];?>; z-index: 1} .CodeMirror {position: absolute; top: 0px; width: 100%; font-size: <?php echo $ICEcoder["fontSize"];?>; z-index: 1}
@@ -34,7 +37,16 @@ $activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat"
.cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\\21e5';};?>";} .cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\\21e5';};?>";}
.lint-error {font-family: arial; font-size: 80%; background: #ccc; color: #b00; padding: 3px 5px} .lint-error {font-family: arial; font-size: 80%; background: #ccc; color: #b00; padding: 3px 5px}
.lint-error-icon {background: #b00; color: #fff; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 5px} .lint-error-icon {background: #b00; color: #fff; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 5px}
.CodeMirror-foldmarker {font-family: arial; line-height: .3; color: #b00; cursor: pointer;
text-shadow: #fff 1px 1px 2px, #fff -1px -1px 2px, #fff 1px -1px 2px, #fff -1px 1px 2px;
}
.folds {display: inline-block; width: 13px}
.fold {position: absolute; display: inline-block; width: 13px; height: 13px; font-size: 14px; text-align: center; cursor: pointer}
.foldOn {background: #800; color: #ddd}
.foldOff {background: #383838; color: #666}
</style> </style>
<link rel="stylesheet" href="lib/file-types.css">
</head> </head>
<body style="color: #fff; margin: 0" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);"> <body style="color: #fff; margin: 0" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
@@ -63,19 +75,26 @@ $activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat"
<div style="float: left"> <div style="float: left">
<h2 style="color: rgba(0,198,255,0.7)">files</h2> <h2 style="color: rgba(0,198,255,0.7)">files</h2>
<span style="color:#888">Last 10 files opened:</span><br> <span style="color:#888">Last 10 files opened:</span><br>
<ul class="fileManager" style="margin-left: 0; line-height: 20px">
<?php <?php
$last10FilesArray = explode(",",$ICEcoder["last10Files"]); $last10FilesArray = explode(",",$ICEcoder["last10Files"]);
for ($i=0;$i<count($last10FilesArray);$i++) { for ($i=0;$i<count($last10FilesArray);$i++) {
if ($ICEcoder["last10Files"]=="") { if ($ICEcoder["last10Files"]=="") {
echo '[none]<br><br>'; echo '[none]<br><br>';
} else { } else {
$fileFolderName = str_replace("\\","/",$last10FilesArray[$i]);
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-".pathinfo($docRoot.$iceRoot.$fileFolderName, PATHINFO_EXTENSION);
$class = 'pft-file '.strtolower($ext);
echo '<li class="'.$class.'" style="margin-left: -16px">';
echo '<a style="cursor:pointer" onClick="top.ICEcoder.openFile(\''.str_replace("|","/",$last10FilesArray[$i]).'\')">'; echo '<a style="cursor:pointer" onClick="top.ICEcoder.openFile(\''.str_replace("|","/",$last10FilesArray[$i]).'\')">';
echo str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i])); echo str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i]));
echo '</a><br>'.PHP_EOL; echo '</a></li>'.PHP_EOL;
if ($i==count($last10FilesArray)-1) {echo '<br>'.PHP_EOL;}; if ($i==count($last10FilesArray)-1) {echo '<br>'.PHP_EOL;};
} }
} }
;?> ;?>
</ul>
</div> </div>
<div style="clear: both"> <div style="clear: both">
@@ -100,13 +119,22 @@ $activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat"
},1000); },1000);
</script> </script>
<?php if(is_dir('test') && !$ICEcoder['demoMode']) {?> <?php if(is_dir('test') && !$ICEcoder['demoMode']) {?>
<div style="clear: both"> <div style="float: left; margin-right: 50px">
<br><br> <br><br>
<h2 style="color: rgba(0,198,255,0.7)">test suite</h2> <h2 style="color: rgba(0,198,255,0.7)">test suite</h2>
<span style="color:#888">Run unit tests:</span><br> <span style="color:#888">Run unit tests:</span><br>
<a href="javascript:top.ICEcoder.filesFrame.contentWindow.frames['testControl'].location.href = 'test'" style="color: #fff">Run unit tests</a><div id="unitTestResults"></div> <a href="javascript:top.ICEcoder.filesFrame.contentWindow.frames['testControl'].location.href = 'test'" style="color: #fff">Run unit tests</a><div id="unitTestResults"></div>
</div> </div>
<?php ;};?> <?php ;};?>
<?php if($ICEcoder['devMode']) {?>
<div style="float: left">
<br><br>
<h2 style="color: rgba(0,198,255,0.7)">dev mode on</h2>
<span style="color:#888">Status:</span><br>
Using ice-coder.js
</div>
<?php ;};?>
<div style="clear: both"></div>
</div> </div>
<script> <script>
@@ -132,6 +160,7 @@ function createNewCMInstance(num) {
window['cM'+num] = CodeMirror(document.body, { window['cM'+num] = CodeMirror(document.body, {
mode: "application/x-httpd-php", mode: "application/x-httpd-php",
lineNumbers: true, lineNumbers: true,
gutters: ["folds","CodeMirror-linenumbers"],
lineWrapping: top.ICEcoder.lineWrapping, lineWrapping: top.ICEcoder.lineWrapping,
indentWithTabs: top.ICEcoder.indentWithTabs, indentWithTabs: top.ICEcoder.indentWithTabs,
indentUnit: top.ICEcoder.indentSize, indentUnit: top.ICEcoder.indentSize,
@@ -142,9 +171,10 @@ function createNewCMInstance(num) {
keyMap: "ICEcoder", keyMap: "ICEcoder",
onKeyEvent: function(thisCM, e) { onKeyEvent: function(thisCM, e) {
top.ICEcoder.redoChangedContent(e); top.ICEcoder.redoChangedContent(e);
top.ICEcoder.findReplace('find',true,false); top.ICEcoder.findReplace(top.document.getElementById('find').value,true,false);
top.ICEcoder.getCaretPosition(); top.ICEcoder.getCaretPosition();
top.ICEcoder.updateCharDisplay(); top.ICEcoder.updateCharDisplay();
top.ICEcoder.updateByteDisplay();
tok = thisCM.getTokenAt(thisCM.getCursor()); tok = thisCM.getTokenAt(thisCM.getCursor());
} }
}); });
@@ -152,6 +182,7 @@ function createNewCMInstance(num) {
window['cM'+num].on("cursorActivity", function(thisCM) { window['cM'+num].on("cursorActivity", function(thisCM) {
top.ICEcoder.getCaretPosition(); top.ICEcoder.getCaretPosition();
top.ICEcoder.updateCharDisplay(); top.ICEcoder.updateCharDisplay();
top.ICEcoder.updateByteDisplay();
window['cM'+num].removeLineClass(top.ICEcoder['cMActiveLine'+num], "background"); window['cM'+num].removeLineClass(top.ICEcoder['cMActiveLine'+num], "background");
if(window['cM'+num].getCursor('start').line == window['cM'+num].getCursor().line) { if(window['cM'+num].getCursor('start').line == window['cM'+num].getCursor().line) {
top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(window['cM'+num].getCursor().line, "background","cm-s-activeLine"); top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(window['cM'+num].getCursor().line, "background","cm-s-activeLine");
@@ -169,6 +200,7 @@ function createNewCMInstance(num) {
top.ICEcoder.getCaretPosition(); top.ICEcoder.getCaretPosition();
top.ICEcoder.dontUpdateNest = false; top.ICEcoder.dontUpdateNest = false;
top.ICEcoder.updateCharDisplay(); top.ICEcoder.updateCharDisplay();
top.ICEcoder.updateByteDisplay();
top.ICEcoder.updateNestingIndicator(); top.ICEcoder.updateNestingIndicator();
if (top.ICEcoder.findMode) { if (top.ICEcoder.findMode) {
top.ICEcoder.results.splice(top.ICEcoder.findResult,1); top.ICEcoder.results.splice(top.ICEcoder.findResult,1);
@@ -179,6 +211,38 @@ function createNewCMInstance(num) {
clearTimeout(window['cM'+num+'waiting']); clearTimeout(window['cM'+num+'waiting']);
window['cM'+num+'waiting'] = setTimeout(top.ICEcoder.updateHints, 100); window['cM'+num+'waiting'] = setTimeout(top.ICEcoder.updateHints, 100);
} }
var filepath = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
var filename = filepath.substr(filepath.lastIndexOf("/")+1);
var fileExt = filename.substr(filename.lastIndexOf(".")+1);
for (var i=changeObj.from.line; i<changeObj.from.line+changeObj.text.length; i++) {
top.ICEcoder.content.contentWindow.CodeMirror.newFoldFunction(top.ICEcoder.content.contentWindow.CodeMirror[["coffee","css","js","less","php","py","rb","ruby"].indexOf(fileExt) > -1 ? "braceRangeFinder" : "tagRangeFinder"],null,"+","-",true)(thisCM, i);
}
// Update HTML edited files live
if (top.ICEcoder.previewWindow.location) {
if (top.ICEcoder.previewWindow.location.pathname==filepath) {
if (["htm","html","txt"].indexOf(fileExt) > -1) {
top.ICEcoder.previewWindow.document.documentElement.innerHTML = window['cM'+num].getValue();
} else if (["md"].indexOf(fileExt) > -1) {
top.ICEcoder.previewWindow.document.documentElement.innerHTML = mmd(window['cM'+num].getValue());
}
} else if (["css"].indexOf(fileExt) > -1) {
if (top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(filename) > -1) {
var css = window['cM'+num].getValue();
var style = document.createElement('style');
style.type = 'text/css';
style.id = "ICEcoder"+filepath.replace(/\//g,"_");
if (style.styleSheet){
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
if (top.ICEcoder.previewWindow.document.getElementById(style.id)) {
top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(style.id));
}
top.ICEcoder.previewWindow.document.documentElement.appendChild(style);
}
}
}
} }
); );
@@ -188,12 +252,11 @@ function createNewCMInstance(num) {
); );
window['cM'+num].on("gutterClick", function(thisCM, line, gutter, clickEvent) { window['cM'+num].on("gutterClick", function(thisCM, line, gutter, clickEvent) {
["JavaScript","CoffeeScript","PHP","Ruby"].indexOf(top.ICEcoder.caretLocType) > -1 var filepath = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
var filename = filepath.substr(filepath.lastIndexOf("/")+1);
var fileExt = filename.substr(filename.lastIndexOf(".")+1);
["coffee","css","js","less","php","py","rb","ruby"].indexOf(fileExt) > -1
? codeFoldBrace(window['cM'+num], line) : codeFoldTag(window['cM'+num], line); ? codeFoldBrace(window['cM'+num], line) : codeFoldTag(window['cM'+num], line);
window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", document.createTextNode("+ "+(line+1)));
setTimeout(function() {
window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", null);
},1000);
} }
); );
@@ -201,9 +264,8 @@ function createNewCMInstance(num) {
top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(0, "background", "cm-s-activeLine"); top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(0, "background", "cm-s-activeLine");
}; };
// var top.ICEcoder.foldStyle = '<span style="position: absolute; display: inline-block; width: 13px; height: 13px; left: 0; background-color: #b00; color: #fff; text-align: center; cursor: pointer"><span style="position: relative; left: -1px">+</span></span> %N%'; var codeFoldTag = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder,null,"+","-",false);
var codeFoldTag = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder); var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder,null,"+","-",false);
var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder);
</script> </script>
</body> </body>

View File

@@ -33,4 +33,17 @@
overflow: hidden; overflow: hidden;
background: url(marker.png) no-repeat; background: url(marker.png) no-repeat;
} }
.colorValue {
border: 0;
width: 105px;
padding-left: 5px
}
.insertColorValue {
background: #888;
color: #fff;
height: 18px;
width: 60px;
border: 0;
margin-left: 5px;
cursor: pointer
}

View File

@@ -164,8 +164,9 @@ _farbtastic = function (container, callback) {
// Linked elements or callback // Linked elements or callback
if (typeof fb.callback == 'object') { if (typeof fb.callback == 'object') {
// Set background/foreground color // Set background/foreground color
document.getElementById(fb.callback.id).style.backgroundColor = fb.color; document.getElementById(fb.callback.id).style.backgroundColor = document.getElementById(fb.callback.id + 'RGB').style.backgroundColor = fb.color;
document.getElementById(fb.callback.id).style.color = fb.hsl[2] > 0.5 ? '#000' : '#fff'; document.getElementById(fb.callback.id).style.color = document.getElementById(fb.callback.id + 'RGB').style.color = fb.hsl[2] > 0.5 ? '#000' : '#fff';
document.getElementById('colorRGB').value = document.getElementById(fb.callback.id).style.backgroundColor.replace(/\s/g,'');
// Change linked value // Change linked value
if (callback.value && callback.value != fb.color) { if (callback.value && callback.value != fb.color) {

View File

@@ -1,12 +1,13 @@
<?php include("lib/settings.php");?> <?php include("lib/settings.php");?>
<!DOCTYPE html> <!DOCTYPE html>
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false; if (!top.ICEcoder.overCloseLink) {top.ICEcoder.tabDragEnd()}" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'files');top.ICEcoder.canResizeFilesW()}" onContextMenu="top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink; return top.ICEcoder.showMenu()" onClick="top.ICEcoder.selectFileFolder()"> <html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false; if (!top.ICEcoder.overCloseLink) {top.ICEcoder.tabDragEnd()}" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'files');top.ICEcoder.canResizeFilesW()}" onContextMenu="top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink; return top.ICEcoder.showMenu(event)" onClick="top.ICEcoder.selectFileFolder(event)">
<head> <head>
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager</title> <title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager</title>
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="lib/files.css"> <link rel="stylesheet" type="text/css" href="lib/files.css">
<script src="lib/ice-coder.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="lib/file-types.css">
<script src="lib/ice-coder<?php if (!$ICEcoder['devMode']) {echo '.min';};?>.js" type="text/javascript"></script>
</head> </head>
<body onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);"> <body onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -10,15 +10,18 @@ $updateMsg = '';
if ($ICEcoder["checkUpdates"]) { if ($ICEcoder["checkUpdates"]) {
$icv_url = "http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"]; $icv_url = "http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"];
if (ini_get('allow_url_fopen')) { if (ini_get('allow_url_fopen')) {
$icv = explode("\n",file_get_contents($icv_url)); $icvInfo = explode("\n",file_get_contents($icv_url,false,$context));
} elseif (function_exists('curl_init')) { } elseif (function_exists('curl_init')) {
$ch = curl_init($icv_url); $ch = curl_init($icv_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$icv = explode("\n", curl_exec($ch)); $icvInfo = explode("\n", curl_exec($ch));
} }
$icv = $icv[0]; $icv = $icvInfo[0];
if ($ICEcoder["versionNo"]<$icv) { $icvI = str_replace('"','\\\'',$icvInfo[1]);
$updateMsg = ";top.ICEcoder.dataMessage('<b>UPDATE INFO:</b> ICEcoder v ".$icv." now available. (Your version is v ".$ICEcoder["versionNo"]."). Get it free from <a href=\\'http://icecoder.net\\' target=\\'_blank\\' style=\\'color:#ddd\\'>icecoder.net</a>');"; $thisV = $ICEcoder["versionNo"];
if (strpos($thisV,"beta")>-1 && !strpos($icv,"beta") && str_replace(" beta","",$thisV) == $icv) {$thisV-=0.1;};
if ($thisV<$icv) {
$updateMsg = ";top.ICEcoder.dataMessage('<b>UPDATE INFO:</b> ICEcoder v ".$icv." now available. (Your version is v ".$ICEcoder["versionNo"]."). Get it free from <a href=\\'http://icecoder.net\\' target=\\'_blank\\' style=\\'color:#ddd\\'>icecoder.net</a><br>".$icvI."');";
} }
} }
?> ?>
@@ -39,7 +42,8 @@ window.onbeforeunload = function() {
} }
} }
</script> </script>
<script language="JavaScript" src="lib/ice-coder.js"></script> <script language="JavaScript" src="lib/ice-coder<?php if (!$ICEcoder['devMode']) {echo '.min';};?>.js"></script>
<script src="lib/mmd.js"></script>
<?php <?php
if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) { if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
echo '<script src="plugins/jshint/jshint.js"></script>'; echo '<script src="plugins/jshint/jshint.js"></script>';
@@ -69,9 +73,11 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
echo $ICEcoder["indentWithTabs"] ? 'true' : 'false'; echo $ICEcoder["indentWithTabs"] ? 'true' : 'false';
echo ';top.ICEcoder.indentSize = '; echo ';top.ICEcoder.indentSize = ';
echo $ICEcoder["indentSize"]; 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;?>" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
<div id="blackMask" class="blackMask" onClick="ICEcoder.showHide('hide',this)" onContextMenu="return false"> <div id="blackMask" class="blackMask" onClick="if (!ICEcoder.overPopup) {ICEcoder.showHide('hide',this)}" onContextMenu="return false">
<div class="popupVCenter"> <div class="popupVCenter">
<div class="popup" id="mediaContainer"></div> <div class="popup" id="mediaContainer"></div>
</div> </div>
@@ -92,7 +98,6 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
<span id="folderMenuItems"> <span id="folderMenuItems">
<a href="javascript:top.ICEcoder.newFile()" onMouseOver="ICEcoder.showFileMenu()">New File</a> <a href="javascript:top.ICEcoder.newFile()" onMouseOver="ICEcoder.showFileMenu()">New File</a>
<a href="javascript:top.ICEcoder.newFolder()" onMouseOver="ICEcoder.showFileMenu()">New Folder</a> <a href="javascript:top.ICEcoder.newFolder()" onMouseOver="ICEcoder.showFileMenu()">New Folder</a>
<a href="javascript:top.ICEcoder.pasteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()" id="fmMenuPasteOption" style="display: none">Paste</a>
<a href="javascript:top.ICEcoder.uploadFilesSelect(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Upload File(s)</a> <a href="javascript:top.ICEcoder.uploadFilesSelect(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Upload File(s)</a>
<div style="display: none"> <div style="display: none">
<form enctype="multipart/form-data" id="uploadFilesForm" action="lib/file-control.php?action=upload&file=/uploaded" method="POST" target="fileControl"> <form enctype="multipart/form-data" id="uploadFilesForm" action="lib/file-control.php?action=upload&file=/uploaded" method="POST" target="fileControl">
@@ -101,10 +106,11 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
<input type="submit" value="Upload File"> <input type="submit" value="Upload File">
</form> </form>
</div> </div>
<a href="javascript:top.ICEcoder.pasteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()" id="fmMenuPasteOption" style="display: none">Paste</a>
</span> </span>
<a href="javascript:top.ICEcoder.copyFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Copy</a>
<a href="javascript:top.ICEcoder.deleteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Delete</a> <a href="javascript:top.ICEcoder.deleteFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Delete</a>
<span id="singleFileMenuItems"> <span id="singleFileMenuItems">
<a href="javascript:top.ICEcoder.copyFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Copy</a>
<a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Rename</a> <a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile)" onMouseOver="ICEcoder.showFileMenu()">Rename</a>
<a href="javascript:window.open(top.ICEcoder.rightClickedFile.replace(/\|/g,'/'))" onMouseOver="ICEcoder.showFileMenu()">View Webpage</a> <a href="javascript:window.open(top.ICEcoder.rightClickedFile.replace(/\|/g,'/'))" onMouseOver="ICEcoder.showFileMenu()">View Webpage</a>
</span> </span>
@@ -147,15 +153,15 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
<a nohref onClick="top.ICEcoder.alphaTabs()"><img src="images/nav-alpha.png" class="alphaTabs" title="Alphabetize tabs"></a> <a nohref onClick="top.ICEcoder.alphaTabs()"><img src="images/nav-alpha.png" class="alphaTabs" title="Alphabetize tabs"></a>
<?php <?php
for ($i=1;$i<=100;$i++) { for ($i=1;$i<=100;$i++) {
echo '<div id="tab'.$i.'" class="tab" onMouseDown="ICEcoder.canSwitchTabs ? ICEcoder.switchTab(parseInt(this.id.slice(3),10)) : ICEcoder.canSwitchTabs=true; thisColor=\'#000\'; if (!top.ICEcoder.overCloseLink) {ICEcoder.tabDragStart(parseInt(this.id.slice(3),10))}" onMouseOver="thisColor=this.style.color;this.style.color=\'#000\'" onMouseOut="this.style.color=thisColor"></div>'; echo '<div id="tab'.$i.'" class="tab" onMouseDown="ICEcoder.canSwitchTabs ? ICEcoder.switchTab(parseInt(this.id.slice(3),10)) : ICEcoder.canSwitchTabs=true; thisColor=top.ICEcoder.tabFGselected; if (!top.ICEcoder.overCloseLink) {ICEcoder.tabDragStart(parseInt(this.id.slice(3),10))}" onMouseOver="thisColor=this.style.color;this.style.color=top.ICEcoder.tabFGselected" onMouseOut="this.style.color=thisColor"></div>';
} }
?><div class="newTab" onClick="ICEcoder.newTab()" id="newTab"><img src="images/nav-new.png"></div> ?><div class="newTab" onClick="ICEcoder.newTab()" id="newTab"><img src="images/nav-new.png"></div>
</div> </div>
<div id="findBar" class="findBar" onContextMenu="return false"> <div id="findBar" class="findBar" onContextMenu="return false">
<form name="findAndReplace" onSubmit="ICEcoder.findReplace('findReplace',false,true);return false"> <form name="findAndReplace" onSubmit="ICEcoder.findReplace(top.document.getElementById('find').value,false,true);return false">
<div class="findReplace"> <div class="findReplace">
<div class="findText">Find</div> <div class="findText">Find</div>
<input type="text" name="find" value="" id="find" class="textbox find" onKeyUp="ICEcoder.findReplace('find',true,false)"> <input type="text" name="find" value="" id="find" class="textbox find" onKeyUp="ICEcoder.findReplace(top.document.getElementById('find').value,true,false)">
<select name="connector" onChange="ICEcoder.findReplaceOptions()"> <select name="connector" onChange="ICEcoder.findReplaceOptions()">
<option>in</option> <option>in</option>
@@ -189,10 +195,14 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
</div> </div>
<div class="footer" id="footer" onContextMenu="return false"> <div class="footer" id="footer" onContextMenu="return false">
<div class="system" id="system">
<div onClick="top.ICEcoder.openPreviewWindow()" class="preview" title="Preview Window"></div>
<div onClick="top.ICEcoder.openTerminal()" class="terminal" title="Terminal"></div>
</div>
<div class="nesting" id="nestValid"></div> <div class="nesting" id="nestValid"></div>
<div class="nestLoc" id="nestDisplayText"></div>
<div class="nestDisplay" id="nestDisplay"></div> <div class="nestDisplay" id="nestDisplay"></div>
<div class="charDisplay" id="charDisplay"><span id="char"></span></div> <div class="byteDisplay" id="byteDisplay" style="display: none" onClick="top.ICEcoder.showDisplay('char')"></div>
<div class="charDisplay" id="charDisplay" style="display: inline-block" onClick="top.ICEcoder.showDisplay('byte')"></div>
</div> </div>
<script> <script>

View File

@@ -12,7 +12,6 @@ $ICEcoder = array(
"bannedPaths" => array("/var/www/.git","/var/www/sites/all/modules","/var/www/sites/default/files"), "bannedPaths" => array("/var/www/.git","/var/www/sites/all/modules","/var/www/sites/default/files"),
"allowedIPs" => array("*"), "allowedIPs" => array("*"),
"plugins" => array( "plugins" => array(
array("Terminal","plugins/terminal/icon.gif","margin-top: 3px","plugins/terminal","_blank",""),
array("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.6.3-mysql-en.php","_blank",""), array("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.6.3-mysql-en.php","_blank",""),
array("JS Hint","plugins/jshint/icon.png","margin-top: 3px","http://www.jshint.com","_blank",""), array("JS Hint","plugins/jshint/icon.png","margin-top: 3px","http://www.jshint.com","_blank",""),
array("Emmet","plugins/emmet/icon.png","margin-top: 3px","http://docs.emmet.io","_blank",""), array("Emmet","plugins/emmet/icon.png","margin-top: 3px","http://docs.emmet.io","_blank",""),

View File

@@ -35,6 +35,6 @@
.cm-s-icecoder .CodeMirror-cursor {border-left: 1px solid white !important} .cm-s-icecoder .CodeMirror-cursor {border-left: 1px solid white !important}
.cm-s-icecoder .CodeMirror-selected {color: #fff !important; background: #037 !important} .cm-s-icecoder .CodeMirror-selected {color: #fff !important; background: #037 !important}
.cm-s-icecoder .CodeMirror-gutters {background: #333; width: 41px; text-align: right; border-right: 1px solid #ccc} .cm-s-icecoder .CodeMirror-gutters {background: #333; min-width: 41px; text-align: right; border-right: 1px solid #ccc}
.cm-s-icecoder .CodeMirror-linenumber {color: #999; cursor: default} .cm-s-icecoder .CodeMirror-linenumber {color: #999; cursor: default}
.cm-s-icecoder .CodeMirror-matchingbracket {border: 1px solid grey; color: black !important} .cm-s-icecoder .CodeMirror-matchingbracket {border: 1px solid grey; color: black !important}

View File

@@ -1,4 +1,4 @@
<?php include("settings.php");?> <?php include("settings.php");?>
<?php <?php
// Get the save type if any // Get the save type if any
$saveType = isset($_GET['saveType']) ? strClean($_GET['saveType']) : ""; $saveType = isset($_GET['saveType']) ? strClean($_GET['saveType']) : "";
@@ -10,8 +10,11 @@ $file = str_replace("|","/",strClean(
: $_GET['file'] : $_GET['file']
)); ));
// Trim any +'s or spaces from the end of file
$file = rtrim(rtrim($file,'+'),' ');
// Make $file a full path and establish the $fileLoc and $fileName // Make $file a full path and establish the $fileLoc and $fileName
if (strpos($file,$docRoot)===false) {$file=str_replace("|","/",$docRoot.$iceRoot.$file);}; if (strpos($file,$docRoot)===false && $_GET['action']!="getRemoteFile") {$file=str_replace("|","/",$docRoot.$iceRoot.$file);};
$fileLoc = substr(str_replace($docRoot,"",$file),0,strrpos(str_replace($docRoot,"",$file),"/")); $fileLoc = substr(str_replace($docRoot,"",$file),0,strrpos(str_replace($docRoot,"",$file),"/"));
$fileName = basename($file); $fileName = basename($file);
@@ -28,14 +31,14 @@ if ($_GET['action']=="load") {
finfo_close($finfoMIME); finfo_close($finfoMIME);
} else { } else {
$fileExt = pathinfo($file, PATHINFO_EXTENSION); $fileExt = pathinfo($file, PATHINFO_EXTENSION);
if (array_search($fileExt,array("coffee","css","htm","html","js","less","php","rb","ruby","txt","xml"))!==false) {$finfo = "text";}; 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";}; if (array_search($fileExt,array("gif","jpg","jpeg","png"))!==false) {$finfo = "image";};
} }
if (strpos($finfo,"text")===0 || strpos($finfo,"empty")!==false) { if (strpos($finfo,"text")===0 || strpos($finfo,"empty")!==false) {
echo '<script>fileType="text";'; echo '<script>fileType="text";';
echo 'top.ICEcoder.shortURL = top.ICEcoder.rightClickedFile = top.ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";'; echo 'top.ICEcoder.shortURL = top.ICEcoder.rightClickedFile = top.ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";';
echo '</script>'; echo '</script>';
$loadedFile = file_get_contents($file); $loadedFile = toUTF8noBOM(file_get_contents($file,false,$context),true);
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",str_replace("&","&amp;",$loadedFile)).'</textarea>'; echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",str_replace("&","&amp;",$loadedFile)).'</textarea>';
} else if (strpos($finfo,"image")===0) { } else if (strpos($finfo,"image")===0) {
echo '<script>fileType="image";fileName=\''.$fileLoc."/".$fileName.'\'</script>'; echo '<script>fileType="image";fileName=\''.$fileLoc."/".$fileName.'\'</script>';
@@ -48,6 +51,22 @@ if ($_GET['action']=="load") {
}; };
// Get the contents of a remote URL
if ($_GET['action']=="getRemoteFile") {
if ($remoteFile = toUTF8noBOM(file_get_contents($file,false,$context),true)) {
// replace \r\n (Windows), \r (old Mac) and \n (Linux) line endings with whatever we chose to be lineEnding
$remoteFile = str_replace("\r\n", $ICEcoder["lineEnding"], $remoteFile);
$remoteFile = str_replace("\r", $ICEcoder["lineEnding"], $remoteFile);
$remoteFile = str_replace("\n", $ICEcoder["lineEnding"], $remoteFile);
echo '<script>top.ICEcoder.newTab();</script>';
echo '<textarea name="remoteFile" id="remoteFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",str_replace("&","&amp;",$remoteFile)).'</textarea>';
echo '<script>top.ICEcoder.getcMInstance().setValue(document.getElementById("remoteFile").value);action="getRemoteFile";</script>';
} else {
echo '<script>action="nothing"; top.ICEcoder.message(\'Sorry, could\\\'t get contents of '.$file.'\');</script>';
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
}
// If we're due to add a new folder... // If we're due to add a new folder...
if ($_GET['action']=="newFolder") { if ($_GET['action']=="newFolder") {
if (!$demoMode && is_writable($docRoot.$fileLoc)) { if (!$demoMode && is_writable($docRoot.$fileLoc)) {
@@ -178,7 +197,7 @@ if ($_GET['action']=="rename") {
if ($_GET['action']=="replaceText") { if ($_GET['action']=="replaceText") {
if (!$demoMode && is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) { if (!$demoMode && is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {
$file = str_replace("|","/",strClean($_GET['fileRef'])); $file = str_replace("|","/",strClean($_GET['fileRef']));
$loadedFile = file_get_contents($file); $loadedFile = toUTF8noBOM(file_get_contents($file,false,$context),true);
$newContent = str_replace(strClean($_GET['find']),strClean($_GET['replace']),$loadedFile); $newContent = str_replace(strClean($_GET['find']),strClean($_GET['replace']),$loadedFile);
$fh = fopen($file, 'w') or die("Sorry, cannot save"); $fh = fopen($file, 'w') or die("Sorry, cannot save");
fwrite($fh, $newContent); fwrite($fh, $newContent);
@@ -252,25 +271,32 @@ if ($_GET['action']=="save") {
$filemtime = $serverType=="Linux" ? filemtime($file) : "1000000"; $filemtime = $serverType=="Linux" ? filemtime($file) : "1000000";
if (!(isset($_GET['fileMDT']))||$filemtime==$_GET['fileMDT']) { if (!(isset($_GET['fileMDT']))||$filemtime==$_GET['fileMDT']) {
$fh = fopen($file, 'w') or die("Sorry, cannot save"); $fh = fopen($file, 'w') or die("Sorry, cannot save");
// replace \r\n (Windows) and \r (old Mac) line endings with \n (Linux) // replace \r\n (Windows), \r (old Mac) and \n (Linux) line endings with whatever we chose to be lineEnding
$contents = $_POST['contents']; $contents = $_POST['contents'];
$contents = str_replace("\r\n", "\n", $contents); $contents = str_replace("\r\n", $ICEcoder["lineEnding"], $contents);
$contents = str_replace("\r", "\n", $contents); $contents = str_replace("\r", $ICEcoder["lineEnding"], $contents);
$contents = str_replace("\n", $ICEcoder["lineEnding"], $contents);
// Now write that content, close the file and clear the statcache // Now write that content, close the file and clear the statcache
fwrite($fh, $contents); fwrite($fh, $contents);
fclose($fh); fclose($fh);
clearstatcache(); clearstatcache();
$filemtime = $serverType=="Linux" ? filemtime($file) : "1000000"; $filemtime = $serverType=="Linux" ? filemtime($file) : "1000000";
echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.$filemtime.'";</script>'; echo '<script>top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.$filemtime.'";</script>';
// Reload file manager & rename tab if it was a new file // Reload file manager, rename tab & remove old file highlighting if it was a new file
if (isset($_POST['newFileName']) && $_POST['newFileName']!="") { if (isset($_POST['newFileName']) && $_POST['newFileName']!="") {
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');'; echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');';
echo 'top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');</script>'; echo 'top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');</script>';
if (!strpos($_GET['file'],"[NEW]")) {
// We're saving as a new file, so unhighlight the old name in the file manager if visible
echo "<script>fileLink = top.ICEcoder.filesFrame.contentWindow.document.getElementById('".str_replace("/","|",$fileLoc)."|".basename($_GET['file'])."');</script>";
echo "<script>if (fileLink) {fileLink.style.backgroundColor = top.ICEcoder.tabBGnormal; fileLink.style.color = top.ICEcoder.tabFGnormalFile};</script>";
}
} }
// Reload stickytab window // Reload previewWindow window if not a Markdown file
echo '<script>if (top.ICEcoder.stickyTab.location) {top.ICEcoder.stickyTab.location.reload()};action="doneSave";</script>'; echo '<script>if (top.ICEcoder.previewWindow.location && top.ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) {top.ICEcoder.previewWindow.location.reload()};</script>';
echo '<script>top.ICEcoder.setPreviousFiles();action="doneSave";</script>';
} else { } else {
$loadedFile = file_get_contents($file); $loadedFile = toUTF8noBOM(file_get_contents($file,false,$context),true);
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>'; echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",htmlentities($loadedFile)).'</textarea>';
echo '<textarea name="userVersionFile" id="userVersionFile"></textarea>'; echo '<textarea name="userVersionFile" id="userVersionFile"></textarea>';
?> ?>
@@ -339,6 +365,9 @@ if (action=="load") {
top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].addLineClass(0, "background", "cm-s-activeLine"); top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].addLineClass(0, "background", "cm-s-activeLine");
top.ICEcoder.nextcMInstance++; top.ICEcoder.nextcMInstance++;
top.ICEcoder.openFileMDTs.push('<?php echo $serverType=="Linux" ? filemtime($file) : "1000000"; ?>'); top.ICEcoder.openFileMDTs.push('<?php echo $serverType=="Linux" ? filemtime($file) : "1000000"; ?>');
for (var i=0; i<cM.lineCount(); i++) {
top.ICEcoder.content.contentWindow.CodeMirror.newFoldFunction(top.ICEcoder.content.contentWindow.CodeMirror[["coffee","css","js","less","php","py","rb","ruby"].indexOf('<?php echo pathinfo($file, PATHINFO_EXTENSION);?>') > -1 ? "braceRangeFinder" : "tagRangeFinder"],null,"+","-",true)(cM, i);
}
top.ICEcoder.loadingFile = false; top.ICEcoder.loadingFile = false;
<?php <?php
;}; ;};
@@ -349,7 +378,16 @@ if (action=="load") {
if (fileType=="image") { if (fileType=="image") {
top.document.getElementById('blackMask').style.visibility = "visible"; top.document.getElementById('blackMask').style.visibility = "visible";
top.document.getElementById('mediaContainer').innerHTML = "<img src=\"<?php echo $fileLoc."/".$fileName;?>\" class=\"whiteGlow\" style=\"border: solid 10px #fff; max-width: 700px; max-height: 500px; background-color: #000; background-image: url('images/checkerboard.png')\" onClick=\"return false\"><br><span class=\"whiteGlow\" style=\"border: solid 10px #fff; color: #000; background-color: #fff\" onClick=\"return false\"><?php echo $fileLoc."/".$fileName;?></span>"; top.document.getElementById('mediaContainer').innerHTML =
"<canvas id=\"canvasPicker\" width=\"1\" height=\"1\" style=\"position: absolute; margin: 10px 0 0 10px; cursor: crosshair\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></canvas>" +
"<img src=\"<?php echo $fileLoc."/".$fileName;?>\" class=\"whiteGlow\" style=\"border: solid 10px #fff; max-width: 700px; max-height: 500px; background-color: #000; background-image: url('images/checkerboard.png')\" onLoad=\"reducedImgMsg = (this.naturalWidth > 700 || this.naturalHeight > 500) ? ', displayed at ' + this.width + ' x ' + this.height : ''; document.getElementById('imgInfo').innerHTML += ' (' + this.naturalWidth + ' x ' + this.naturalHeight + reducedImgMsg + ')'; top.ICEcoder.drawCanvasImage(this)\"><br>" +
"<div class=\"whiteGlow\" style=\"display: inline-block; margin-top: -10px; border: solid 10px #fff; color: #000; background-color: #fff\" id=\"imgInfo\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\">" +
"<b><?php echo $fileLoc."/".$fileName;?></b>" +
"</div><br>" +
"<input type=\"text\" id=\"hexMouseXY\" style=\"border: 1px solid #888; border-right: 0; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" +
"<input type=\"text\" id=\"rgbMouseXY\" style=\"border: 1px solid #888; margin-right: 10px; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" +
"<input type=\"text\" id=\"hex\" style=\"border: 1px solid #888; border-right: 0; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" +
"<input type=\"text\" id=\"rgb\" style=\"border: 1px solid #888; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>";
} }
top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0); top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);
@@ -365,18 +403,15 @@ if (action=="load") {
if (action=="save") { if (action=="save") {
<?php <?php
if (strpos($file,"[NEW]")>0||$saveType=="saveAs") { if (strpos($file,"[NEW]")>0||$saveType=="saveAs") {
if (strpos($fileName,"[NEW]")>0) {echo "fileLoc = '".$fileLoc."';";} else {echo "fileLoc = '';";};
?> ?>
newFileName = top.ICEcoder.getInput(fileLoc != "" fileLoc = '<?php echo $fileLoc;?>';
? 'Enter filename to save at '+fileLoc newFileName = top.ICEcoder.getInput('Enter filename to save at '+fileLoc,'');
: 'Enter filename (including path, prefixed with /)'
,'');
if (newFileName && newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}
if (newFileName) { if (newFileName) {
newFileName = fileLoc == "" ? newFileName : fileLoc + "/" + fileName; if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}
} newFileName = fileLoc + newFileName;
if (newFileName && top.document.getElementById('filesFrame').contentWindow.document.getElementById(newFileName.replace(/\//g,"|"))) { if (top.document.getElementById('filesFrame').contentWindow.document.getElementById(newFileName.replace(/\//g,"|"))) {
overwriteOK = top.ICEcoder.ask('That file exists already, overwrite?'); overwriteOK = top.ICEcoder.ask('That file exists already, overwrite?');
}
} }
document.saveFile.newFileName.value = '<?php echo $docRoot; ?>' + newFileName; document.saveFile.newFileName.value = '<?php echo $docRoot; ?>' + newFileName;
<?php ;};?> <?php ;};?>

41
lib/file-types.css Normal file
View File

@@ -0,0 +1,41 @@
.fileManager {
margin: 15px 0 15px 22px;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
.fileManager span {font-family: helvetica, arial, swiss, verdana}
.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;
}
.fileManager LI.dirOpen:before {background-position: -16px 0}
@media screen and (-webkit-min-device-pixel-ratio:0) { /* hacked for chrome and safari */
.fileManager LI.pft-directory:before, .fileManager LI.pft-file:before {
margin-top: -19px;
}
}
.fileManager LI.pft-file:before {background-position: -32px 0}
/* Additional file types */
.fileManager LI.ext-coffee:before {background-position: -48px 0}
.fileManager LI.ext-css:before {background-position: -64px 0}
.fileManager LI.ext-gif:before {background-position: -80px 0}
.fileManager LI.ext-htm:before, .fileManager LI.ext-html:before {background-position: -96px 0}
.fileManager LI.ext-jpg:before, .fileManager LI.ext-jpeg:before {background-position: -112px 0}
.fileManager LI.ext-js:before {background-position: -128px 0}
.fileManager LI.ext-less:before {background-position: -144px 0}
.fileManager LI.ext-md:before {background-position: -160px 0}
.fileManager LI.ext-php:before {background-position: -176px 0}
.fileManager LI.ext-png:before {background-position: -192px 0}
.fileManager LI.ext-py:before {background-position: -208px 0}
.fileManager LI.ext-rb:before, .fileManager LI.ext-ruby:before {background-position: -224px 0}
.fileManager LI.ext-txt:before {background-position: -240px 0}
.fileManager LI.ext-zip:before {background-position: -256px 0}

View File

@@ -20,43 +20,3 @@ table, caption, tbody, tfoot, thead, tr, th, td {
body {margin: 0; overflow: auto} body {margin: 0; overflow: auto}
.refresh {position: fixed; display: inline-block; width: 14px; height: 14px; background: url('../images/file-manager-icons.png') -100px -16px no-repeat; right: 0; margin-right: 15px; cursor: pointer} .refresh {position: fixed; display: inline-block; width: 14px; height: 14px; background: url('../images/file-manager-icons.png') -100px -16px no-repeat; right: 0; margin-right: 15px; cursor: pointer}
.fileManager {
margin: 15px 0 15px 22px;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
.fileManager span {font-family: helvetica, arial, swiss, verdana}
.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;
}
.fileManager LI.dirOpen:before {background-position: -16px 0}
@media screen and (-webkit-min-device-pixel-ratio:0) { /* hacked for chrome and safari */
.fileManager LI.pft-directory:before, .fileManager LI.pft-file:before {
margin-top: -19px;
}
}
.fileManager LI.pft-file:before {background-position: -32px 0}
/* Additional file types */
.fileManager LI.ext-coffee:before {background-position: -48px 0}
.fileManager LI.ext-css:before {background-position: -64px 0}
.fileManager LI.ext-gif:before {background-position: -80px 0}
.fileManager LI.ext-htm:before, .fileManager LI.ext-html:before {background-position: -96px 0}
.fileManager LI.ext-jpg:before, .fileManager LI.ext-jpeg:before {background-position: -112px 0}
.fileManager LI.ext-js:before {background-position: -128px 0}
.fileManager LI.ext-less:before {background-position: -144px 0}
.fileManager LI.ext-php:before {background-position: -160px 0}
.fileManager LI.ext-png:before {background-position: -176px 0}
.fileManager LI.ext-rb:before, .fileManager LI.ext-ruby:before {background-position: -192px 0}
.fileManager LI.ext-txt:before {background-position: -208px 0}
.fileManager LI.ext-zip:before {background-position: -224px 0}

54
lib/foldcode.js Normal file
View File

@@ -0,0 +1,54 @@
// Modified version of CodeMirror's codefold.js to show guttermarkers
CodeMirror.newFoldFunction = function(rangeFinder, widget, markOn, markOff, dontCollapse) {
if (widget == null) widget = "\u2194";
if (typeof widget == "string") {
var text = document.createTextNode(widget);
widget = document.createElement("span");
widget.appendChild(text);
widget.className = "CodeMirror-foldmarker";
}
if (markOn == null) markOn = "+";
if (typeof markOn == "string") {
var text = document.createTextNode(markOn);
markOn = document.createElement("span");
markOn.appendChild(text);
markOn.className = "fold foldOn";
}
if (markOff == null) markOff = "-";
if (typeof markOff == "string") {
var text = document.createTextNode(markOff);
markOff = document.createElement("span");
markOff.appendChild(text);
markOff.className = "fold foldOff";
}
return function(cm, pos) {
if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
var range = rangeFinder(cm, pos);
foldable = range && (range.from.line != range.to.line || range.from.ch != range.to.ch) ? true : false;
if (!foldable) cm.setGutterMarker(pos.line, "folds", null);
if (!range) return;
var present = cm.findMarksAt(range.from), cleared = 0;
for (var i = 0; i < present.length; ++i) {
if (present[i].__isFold) {
++cleared;
present[i].clear();
}
}
if (foldable) {
cm.setGutterMarker(pos.line, "folds", cleared || dontCollapse ? markOff.cloneNode(true) : markOn.cloneNode(true));
}
if (cleared || dontCollapse) return;
var myWidget = widget.cloneNode(true);
CodeMirror.on(myWidget, "mousedown", function() {myRange.clear();cm.setGutterMarker(pos.line, "folds", markOff.cloneNode(true));});
var myRange = cm.markText(range.from, range.to, {
replacedWith: myWidget,
clearOnEnter: true,
__isFold: true
});
};
};

View File

@@ -45,7 +45,7 @@ for ($i=0;$i<count($finalArray);$i++) {
} }
$type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext); $type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext);
$loadParam = $type == "folder" ? "true" : "false"; $loadParam = $type == "folder" ? "true" : "false";
echo "<li class=\"".$class."\"><a nohref title=\"$fileFolderName\" onMouseOver=\"top.ICEcoder.overFileFolder('$type','".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."')\" onMouseOut=\"top.ICEcoder.overFileFolder('$type','')\" onClick=\"top.ICEcoder.openCloseDir(this,$loadParam)\" style=\"position: relative; left:-22px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id=\"".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."\">".basename($fileFolderName)."</span> "; echo "<li class=\"".$class."\"><a nohref title=\"$fileFolderName\" onMouseOver=\"top.ICEcoder.overFileFolder('$type',this.childNodes[1].id)\" onMouseOut=\"top.ICEcoder.overFileFolder('$type','')\" onClick=\"if(!event.ctrlKey) {top.ICEcoder.openCloseDir(this,$loadParam); if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {top.ICEcoder.openFile()}}\" style=\"position: relative; left:-22px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id=\"".str_replace($docRoot,"",str_replace("/","|",$fileFolderName))."\">".basename($fileFolderName)."</span> ";
echo '<span style="color: #888; font-size: 8px" id="'.str_replace($docRoot,"",str_replace("/","|",$fileFolderName)).'_perms">'; echo '<span style="color: #888; font-size: 8px" id="'.str_replace($docRoot,"",str_replace("/","|",$fileFolderName)).'_perms">';
echo $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3) : ''; echo $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3) : '';
echo "</span></a></li>\n"; echo "</span></a></li>\n";
@@ -65,6 +65,7 @@ if (isset($_GET['location'])) {
} }
newUL.innerHTML = document.getElementById('branch').innerHTML.slice(28).slice(0,-7); newUL.innerHTML = document.getElementById('branch').innerHTML.slice(28).slice(0,-7);
locNest.parentNode.insertBefore(newUL,locNest.nextSibling); locNest.parentNode.insertBefore(newUL,locNest.nextSibling);
top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
</script> </script>
<?php <?php
;}; ;};

View File

@@ -22,6 +22,7 @@
<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">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> -</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> 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">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">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> d</span> <span class="shortcut">Wrap selected in &lt;div&gt;</span><br>
@@ -43,7 +44,7 @@
<h2>Within file manager</h2> <h2>Within file manager</h2>
<span class="key">Left click</span> <span class="shortcut">Select file / folder</span><br> <span class="key">Left click</span> <span class="shortcut">Select file / folder</span><br>
<span class="key">Double click</span> <span class="shortcut">Open file</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">Right click</span> <span class="shortcut">Options for selected</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> <span class="key">Delete</span> <span class="shortcut">Delete selected</span><br><br>
@@ -59,7 +60,7 @@
<span class="key">CTRL <span class="plus">+</span> s</span> <span class="shortcut">Save</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> 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> Enter</span> <span class="shortcut">View webpage</span><br>
<span class="key">CTRL <span class="plus">+</span> s <span class="plus">+</span> Enter</span> <span class="shortcut">Save & create sticky tab</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> <span class="key">Esc</span> <span class="shortcut">Cancel tasks</span><br>
</div> </div>

View File

@@ -150,10 +150,13 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.editor .code {position: relative; display: inline-block; top: 28px; width: 600px; height: 600px; visibility: hidden} .editor .code {position: relative; display: inline-block; top: 28px; width: 600px; height: 600px; visibility: hidden}
.footer {position: fixed; display: inline-block; width: 100%; height: 30px; bottom: 0; background-color: rgba(0,0,0,0.7); left: 0; z-index: 2} .footer {position: fixed; display: inline-block; width: 100%; height: 30px; bottom: 0; background-color: rgba(0,0,0,0.7); left: 0; z-index: 2}
.footer .nesting {display: inline-block; padding: 5px 8px; margin: 4px 0 0 15px; font-weight: bold; font-size: 10px; color: #fff; background-color: #0b0; cursor: default} .footer .system {position: absolute; display: inline-block; padding: 10px 0 0 15px}
.footer .nestLoc {position: absolute; display: inline-block; width: 120px; padding: 5px 0 0 8px; margin-top: 2px; left: 112px; font-weight: bold; font-size: 12px; color: #fff; text-align: right; cursor: default} .footer .system div {position: relative; display: inline-block; margin-right: 10px; width: 11px; height: 11px; cursor: pointer}
.footer .nestDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 0px; left: 255px; font-size: 12px; color: #fff; text-align: right} .footer .system .preview {background: url('../images/file-manager-icons.png') no-repeat -116px -16px}
.footer .charDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; left: 100%; font-weight: bold; font-size: 12px; color: #fff; text-align: right; width: 200px; text-align: right; margin-left: -220px; cursor: default} .footer .system .terminal {background: url('../images/file-manager-icons.png') no-repeat -132px -16px}
.footer .nesting {position: absolute; display: inline-block; padding: 5px; margin-top: 10px; left: 260px; border-radius: 5px; background-color: #0b0; cursor: default}
.footer .nestDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 0px; left: 267px; font-size: 12px; color: #fff; text-align: right}
.footer .charDisplay, .footer .byteDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; margin-right: 10px; right: 0; font-weight: bold; font-size: 12px; color: #fff; text-align: right; text-align: right; cursor: pointer}
.textbox {box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.4)} .textbox {box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.4)}
@@ -167,6 +170,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.screenCenter .version {position: relative; display: block; margin: 5px 0 15px 0; font-size: 10px; color: #bbb} .screenCenter .version {position: relative; display: block; margin: 5px 0 15px 0; font-size: 10px; color: #bbb}
.screenCenter .text {position: relative; display: block; margin-top: 15px; font-size: 10px; color: #888} .screenCenter .text {position: relative; display: block; margin-top: 15px; font-size: 10px; color: #888}
.screenCenter .text input {margin-top: 1px} .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 .accountPassword {border: 0; background-color: #333; color: #fff; height: 20px}
.screenCenter .button {border: 0; background: #444; color: #eee; height: 22px; cursor: pointer} .screenCenter .button {border: 0; background: #444; color: #eee; height: 22px; cursor: pointer}
.screenCenter .button:hover {background: #2187e7; color: #eee} .screenCenter .button:hover {background: #2187e7; color: #eee}

View File

@@ -5,37 +5,41 @@ var ICEcoder = {
// ============== // ==============
// Define settings // Define settings
filesW: 250, // Width of the files pane filesW: 250, // Width of the files pane
minFilesW: 14, // Min width of the files pane minFilesW: 14, // Min width of the files pane
maxFilesW: 250, // Max width of the files pane maxFilesW: 250, // Max width of the files pane
selectedTab: 0, // The tab that's currently selected selectedTab: 0, // The tab that's currently selected
changedContent: [], // Binary array to indicate which tabs have changed changedContent: [], // Binary array to indicate which tabs have changed
ctrlKeyDown: false, // Indicates if CTRL keydown canSwitchTabs: true, // Stops switching of tabs when trying to close
altKeyDown: false, // Indicates if Alt keydown openFiles: [], // Array of open file URLs
shiftKeyDown: false, // Indicates if Shift keydown openFileMDTs: [], // Array of open file modification datetimes
delKeyDown: false, // Indicates if Del keydown cMInstances: [], // List of CodeMirror instance no's
canSwitchTabs: true, // Stops switching of tabs when trying to close nextcMInstance: 1, // Next available CodeMirror instance no
openFiles: [], // Array of open file URLs selectedFiles: [], // Array of selected files
openFileMDTs: [], // Array of open file modification datetimes findMode: false, // States if we're in find/replace mode
cMInstances: [], // List of CodeMirror instance no's lockedNav: true, // Nav is locked or not
nextcMInstance: 1, // Next available CodeMirror instance no htmlTagArray: [], // Array storing the nest of tags
selectedFiles: [], // Array of selected files codeAssist: true, // Assist user with their coding
findMode: false, // States if we're in find/replace mode mouseDown: false, // If the mouse is down or not
lockedNav: true, // Nav is locked or not draggingFilesW: false, // If we're dragging the file manager width or not
htmlTagArray: [], // Array storing the nest of tags draggingTab: false, // If we're dragging a tab
codeAssist: true, // Assist user with their coding tabLeftPos: [], // Left position of tabs inside content area
mouseDown: false, // If the mouse is down or not tabBGcurrent: '#141414', // BG of current tab
draggingFilesW: false, // If we're dragging the file manager width or not tabBGselected: '#49d', // BG of selected tab
draggingTab: false, // If we're dragging a tab tabBGopen: '#888', // BG of open tab
tabLeftPos: [], // Left position of tabs inside content area tabBGnormal: 'transparent', // BG of normal tab
serverQueueItems: [], // Array of URLs to call in order tabFGselected: '#fff', // FG of selected tab
stickyTab: false, // Target variable for the sticky tab window tabFGnormalFile: '#eee', // FG of normal file
pluginIntervalRefs: [], // Array of plugin interval refs tabFGnormalTab: '#000', // FG of normal tab
ready: false, // Indicates if ICEcoder is ready for action serverQueueItems: [], // Array of URLs to call in order
previewWindow: false, // Target variable for the preview window
pluginIntervalRefs: [], // Array of plugin interval refs
overPopup: false, // Indicates if we're over a popup or not
ready: false, // Indicates if ICEcoder is ready for action
// Set our aliases // Set our aliases
initAliases: function() { initAliases: function() {
var aliasArray = ["header","files","account","fmLock","filesFrame","editor","tabsBar","findBar","content","footer","nestValid","nestDisplayText","nestDisplay","charDisplay"]; var aliasArray = ["header","files","account","fmLock","filesFrame","editor","tabsBar","findBar","content","footer","system","nestValid","nestDisplay","charDisplay","byteDisplay"];
// Create our ID aliases // Create our ID aliases
for (var i=0;i<aliasArray.length;i++) { for (var i=0;i<aliasArray.length;i++) {
@@ -85,6 +89,8 @@ var ICEcoder = {
this.account.style.height = this.accountH + "px"; this.account.style.height = this.accountH + "px";
this.fmLock.style.marginLeft = (this.filesW-42) + "px"; this.fmLock.style.marginLeft = (this.filesW-42) + "px";
this.filesFrame.style.height = (winH-headerH-accountH-footerH) + "px"; this.filesFrame.style.height = (winH-headerH-accountH-footerH) + "px";
this.nestValid.style.left = (this.filesW+10) + "px";
this.nestDisplay.style.left = (this.filesW+17) + "px";
top.ICEcoder.setTabWidths(); top.ICEcoder.setTabWidths();
// If we need to set the editor sizes // If we need to set the editor sizes
@@ -158,12 +164,12 @@ var ICEcoder = {
contentCleanUp: function() { contentCleanUp: function() {
var fileName, cM, content; var fileName, cM, content;
// If it's not a JS, CoffeeScript Ruby, CSS or LESS file, replace our temp </textarea> value // If it's not a JS, CoffeeScript, CSS or LESS file, replace our temp /textarea value
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1]; fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
if (["js","coffee","rb","css","less"].indexOf(fileName.split(".")[1])<0) { if (["js","coffee","css","less"].indexOf(fileName.split(".")[1])<0) {
cM = ICEcoder.getcMInstance(); cM = ICEcoder.getcMInstance();
content = cM.getValue(); content = cM.getValue();
content = content.replace(/<ICEcoder:\/:textarea>/g,'</textarea>'); content = content.replace(/<ICEcoder:\/:textarea>/g,'<\/textarea>');
// Then set the content in the editor & clear the history // Then set the content in the editor & clear the history
cM.setValue(content); cM.setValue(content);
@@ -217,8 +223,10 @@ var ICEcoder = {
fileName.indexOf('.js')>0 ? cM.setOption("mode","javascript") fileName.indexOf('.js')>0 ? cM.setOption("mode","javascript")
: fileName.indexOf('.coffee')>0 ? cM.setOption("mode","coffeescript") : fileName.indexOf('.coffee')>0 ? cM.setOption("mode","coffeescript")
: fileName.indexOf('.rb')>0 ? cM.setOption("mode","ruby") : fileName.indexOf('.rb')>0 ? cM.setOption("mode","ruby")
: fileName.indexOf('.py')>0 ? cM.setOption("mode","python")
: fileName.indexOf('.css')>0 ? cM.setOption("mode","css") : fileName.indexOf('.css')>0 ? cM.setOption("mode","css")
: fileName.indexOf('.less')>0 ? cM.setOption("mode","less") : fileName.indexOf('.less')>0 ? cM.setOption("mode","less")
: fileName.indexOf('.md')>0 ? cM.setOption("mode","markdown")
: cM.setOption("mode","application/x-httpd-php"); : cM.setOption("mode","application/x-httpd-php");
} }
}, },
@@ -234,9 +242,9 @@ var ICEcoder = {
lCLen = lineContent.length; lCLen = lineContent.length;
adjustCursor = 2; adjustCursor = 2;
if (["JavaScript","CoffeeScript","PHP","Ruby","CSS"].indexOf(ICEcoder.caretLocType)>-1) { if (["JavaScript","CoffeeScript","PHP","Python","Ruby","CSS"].indexOf(ICEcoder.caretLocType)>-1) {
if (cM.somethingSelected()) { if (cM.somethingSelected()) {
if (ICEcoder.caretLocType=="Ruby") { if (ICEcoder.caretLocType=="Ruby"||ICEcoder.caretLocType=="Python") {
startLine = cM.getCursor(true).line; startLine = cM.getCursor(true).line;
endLine = cM.getCursor().line; endLine = cM.getCursor().line;
for (var i=startLine; i<=endLine; i++) { for (var i=startLine; i<=endLine; i++) {
@@ -269,14 +277,14 @@ var ICEcoder = {
} }
} else { } else {
if (cM.somethingSelected()) { if (cM.somethingSelected()) {
cM.replaceSelection(cM.getSelection().slice(0,4)!="<!--" cM.replaceSelection(cM.getSelection().slice(0,4)!="<\!--"
? "<!--" + cM.getSelection() + "//-->" ? "<\!--" + cM.getSelection() + "//-->"
: cM.getSelection().slice(4,cM.getSelection().length-5)); : cM.getSelection().slice(4,cM.getSelection().length-5));
} else { } else {
cM.setLine(linePos, lineContent.slice(0,4)!="<!--" cM.setLine(linePos, lineContent.slice(0,4)!="<\!--"
? "<!--" + lineContent + "//-->" ? "<\!--" + lineContent + "//-->"
: lineContent.slice(4,lCLen).slice(0,lCLen-9)); : lineContent.slice(4,lCLen).slice(0,lCLen-9));
adjustCursor = lineContent.slice(0,4)=="<!--" ? -4 : 4; adjustCursor = lineContent.slice(0,4)=="<\!--" ? -4 : 4;
} }
} }
if (!cM.somethingSelected()) {cM.setCursor(linePos, cursorPos+adjustCursor)}; if (!cM.somethingSelected()) {cM.setCursor(linePos, cursorPos+adjustCursor)};
@@ -336,22 +344,21 @@ var ICEcoder = {
} }
} }
}, },
// Set our cursor position upon mouse click of the nest position // Set our cursor position upon mouse click of the nest position
setPosition: function(nestPos,line,tag) { setPosition: function(nestPos,line,tag) {
var cM, char, charPos; var cM, ch, chPos;
cM = ICEcoder.getcMInstance(); cM = ICEcoder.getcMInstance();
// Set our char position just after the tag, and refocus on the editor // Set our ch position just after the tag, and refocus on the editor
char = cM.getLine(line).indexOf(">",cM.getLine(line).indexOf("<"+tag))+1; ch = cM.getLine(line).indexOf(">",cM.getLine(line).indexOf("<"+tag))+1;
cM.setCursor(line,char); cM.setCursor(line,ch);
cM.focus(); cM.focus();
// Now update nest display to this nest depth & without any HTML tags to kill further interactivity // Now update nest display to this nest depth & without any HTML tags to kill further interactivity
charPos = 0; chPos = 0;
for (var i=0;i<=nestPos;i++) { for (var i=0;i<=nestPos;i++) {
charPos = ICEcoder.nestDisplay.innerHTML.indexOf("&gt;",charPos+1); chPos = ICEcoder.nestDisplay.innerHTML.indexOf("&gt;",chPos+1);
} }
ICEcoder.nestDisplay.innerHTML = ICEcoder.nestDisplay.innerHTML.substr(0,charPos).replace(/<(?:.|\n)*?>/gm, ''); ICEcoder.nestDisplay.innerHTML = ICEcoder.nestDisplay.innerHTML.substr(0,chPos).replace(/<(?:.|\n)*?>/gm, '');
top.ICEcoder.dontUpdateNest = false; top.ICEcoder.dontUpdateNest = false;
top.ICEcoder.dontSelect = true; top.ICEcoder.dontSelect = true;
}, },
@@ -412,6 +419,35 @@ var ICEcoder = {
cM.setCursor(line-1,ch); cM.setCursor(line-1,ch);
}, },
// Jump to and highlight the function definition current token
jumpToDefinition: function() {
var cM, tokenString, defVars;
cM = ICEcoder.getcMInstance();
tokenString = cM.getTokenAt(cM.getCursor()).string;
if (cM.somethingSelected() && top.ICEcoder.origCurorPos) {
cM.setCursor(top.ICEcoder.origCurorPos);
} else {
top.ICEcoder.origCurorPos = cM.getCursor();
defVars = [
"var "+tokenString,
"function "+tokenString,
tokenString+"=function", tokenString+"= function", tokenString+" =function", tokenString+" = function",
tokenString+"=new function", tokenString+"= new function", tokenString+" =new function", tokenString+" = new function",
"window['"+tokenString+"']", "window[\""+tokenString+"\"]",
"this['"+tokenString+"']", "this[\""+tokenString+"\"]",
tokenString+":", tokenString+" :",
"def "+tokenString,
"class "+tokenString];
for (var i=0; i<defVars.length; i++) {
if (top.ICEcoder.findReplace(defVars[i],false,false)) {
i=defVars.length;
}
}
}
},
// ============== // ==============
// FILES // FILES
// ============== // ==============
@@ -420,7 +456,11 @@ var ICEcoder = {
openCloseDir: function(dir,load) { openCloseDir: function(dir,load) {
var node, d; var node, d;
dir.onclick = function() {top.ICEcoder.openCloseDir(this,false)}; dir.onclick = function(event) {
if(!event.ctrlKey) {
top.ICEcoder.openCloseDir(this,false);
}
};
node = dir.parentNode; node = dir.parentNode;
if (node.nextSibling) {node = node.nextSibling}; if (node.nextSibling) {node = node.nextSibling};
if (node && node.tagName=="UL") { if (node && node.tagName=="UL") {
@@ -441,12 +481,12 @@ var ICEcoder = {
}, },
// Select file or folder on demand // Select file or folder on demand
selectFileFolder: function() { selectFileFolder: function(evt) {
var tgtFile, shortURL; var tgtFile, shortURL;
// If we've clicked somewhere other than a file/folder // If we've clicked somewhere other than a file/folder
if (top.ICEcoder.thisFileFolderLink=="") { if (top.ICEcoder.thisFileFolderLink=="") {
if (!top.ICEcoder.ctrlKeyDown) { if (!evt.ctrlKey) {
top.ICEcoder.deselectAllFiles(); top.ICEcoder.deselectAllFiles();
} }
} else if (top.ICEcoder.thisFileFolderLink) { } else if (top.ICEcoder.thisFileFolderLink) {
@@ -455,7 +495,7 @@ var ICEcoder = {
tgtFile = ICEcoder.filesFrame.contentWindow.document.getElementById(shortURL); tgtFile = ICEcoder.filesFrame.contentWindow.document.getElementById(shortURL);
// If we have the CTRL key down // If we have the CTRL key down
if (top.ICEcoder.ctrlKeyDown) { if (evt.ctrlKey) {
// Deselect or select file // Deselect or select file
if (top.ICEcoder.selectedFiles.indexOf(shortURL)>-1) { if (top.ICEcoder.selectedFiles.indexOf(shortURL)>-1) {
ICEcoder.selectDeselectFile('deselect',tgtFile); ICEcoder.selectDeselectFile('deselect',tgtFile);
@@ -506,13 +546,14 @@ var ICEcoder = {
isOpen = top.ICEcoder.openFiles.indexOf(file.id.replace(/\|/g,"/")) > -1 ? true : false; isOpen = top.ICEcoder.openFiles.indexOf(file.id.replace(/\|/g,"/")) > -1 ? true : false;
if (top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] == file.id.replace(/\|/g,"/")) { if (top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] == file.id.replace(/\|/g,"/")) {
file.style.backgroundColor="#49d"; file.style.backgroundColor = action=="select"
? top.ICEcoder.tabBGselected : top.ICEcoder.tabBGcurrent;
} else { } else {
file.style.backgroundColor = action=="select" file.style.backgroundColor = action=="select"
? "#888" : file.style.backgroundColor = isOpen ? top.ICEcoder.tabBGselected : file.style.backgroundColor = isOpen
? "rgba(255,255,255,0.15)" : "transparent"; ? top.ICEcoder.tabBGopen : top.ICEcoder.tabBGnormal;
} }
file.style.color= action=="select" ? "#fff" : "#eee"; file.style.color= action=="select" ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalFile;
} }
}, },
@@ -585,17 +626,29 @@ var ICEcoder = {
openPrompt: function() { openPrompt: function() {
var fileLink; var fileLink;
if(fileLink = top.ICEcoder.getInput('Enter relative file path prefixed with /','')) { if(fileLink = top.ICEcoder.getInput('Enter relative file path (prefixed with /) or remote URL','')) {
top.ICEcoder.openFile(fileLink); fileLink.indexOf("://")>-1
? top.ICEcoder.getRemoteFile(fileLink)
: top.ICEcoder.openFile(fileLink);
} }
}, },
// Get remote file contents
getRemoteFile: function(remoteFile) {
top.ICEcoder.serverQueue("add","lib/file-control.php?action=getRemoteFile&file="+remoteFile);
top.ICEcoder.serverMessage('<b>Getting</b><br>'+remoteFile);
},
// Save a file // Save a file
saveFile: function(saveAs) { saveFile: function(saveAs) {
var saveType; var saveType, filePath;
saveType = saveAs ? "saveAs" : "save"; saveType = saveAs ? "saveAs" : "save";
top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|")+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+saveType); filePath = ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|");
if (filePath=="|[NEW]") {
filePath = top.ICEcoder.selectedFiles[0]+filePath;
}
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,"")); top.ICEcoder.serverMessage('<b>Saving</b><br>'+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,""));
}, },
@@ -649,16 +702,21 @@ var ICEcoder = {
// Copy a file // Copy a file
copyFile: function(selFile) { copyFile: function(selFile) {
top.ICEcoder.copiedFile = selFile; top.ICEcoder.copiedFiles = [];
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.document.getElementById('fmMenuPasteOption').style.display = "block";
top.ICEcoder.hideFileMenu(); top.ICEcoder.hideFileMenu();
}, },
// Paste a file // Paste a file
pasteFile: function(location) { pasteFile: function(location) {
if (top.ICEcoder.copiedFile) { if (top.ICEcoder.copiedFiles) {
top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+top.ICEcoder.copiedFile+"&location="+location); for (var i=0; i<top.ICEcoder.copiedFiles.length; i++) {
top.ICEcoder.serverMessage('<b>Pasting File</b><br>'+top.ICEcoder.copiedFile.toString().replace(/\|/g,"/").replace(/,/g,"\n")); top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+top.ICEcoder.copiedFiles[i]+"&location="+location);
top.ICEcoder.serverMessage('<b>Pasting File</b><br>'+top.ICEcoder.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n"));
}
} else { } else {
top.ICEcoder.message("Nothing to paste, copy a file/folder first!"); top.ICEcoder.message("Nothing to paste, copy a file/folder first!");
} }
@@ -678,12 +736,12 @@ var ICEcoder = {
}, },
// Show menu on right clicking in file manager // Show menu on right clicking in file manager
showMenu: function() { showMenu: function(evt) {
var menuType, folderMenuItems; var menuType, folderMenuItems;
if ( top.ICEcoder.selectedFiles.length == 0 || if ( top.ICEcoder.selectedFiles.length == 0 ||
top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.rightClickedFile.replace(/\//g,"|")) == -1) { top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.rightClickedFile.replace(/\//g,"|")) == -1) {
top.ICEcoder.selectFileFolder(); top.ICEcoder.selectFileFolder(evt);
} }
if ("undefined" != typeof top.ICEcoder.thisFileFolderLink && top.ICEcoder.thisFileFolderLink!="") { if ("undefined" != typeof top.ICEcoder.thisFileFolderLink && top.ICEcoder.thisFileFolderLink!="") {
@@ -782,11 +840,9 @@ var ICEcoder = {
targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL); targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL);
// Set the name to be as per our new file/folder name // Set the name to be as per our new file/folder name
targetElem.innerHTML = file; targetElem.innerHTML = file;
// Finally, update the ID of the target & set a new mouseover function for the parent too // Finally, update the ID of the target & set a new title and perms ID
targetElem.id = location.replace(/\//g,"|") + "|" + file; targetElem.id = location.replace(/\//g,"|") + "|" + file;
newMouseOver = targetElem.parentNode.onmouseover.toString().replace(shortURL.substring(shortURL.lastIndexOf("|")+1),file).split('\''); targetElem.parentNode.title = targetElem.id.replace(/\|/g,"/");
eval("targetElem.parentNode.onmouseover = function() { top.ICEcoder.overFileFolder('"+newMouseOver[1]+"','"+newMouseOver[3]+"');}");
eval("targetElem.parentNode.title = newMouseOver[3];");
targetElemPerms = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL+"_perms"); targetElemPerms = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL+"_perms");
targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms"; targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms";
} }
@@ -869,11 +925,11 @@ var ICEcoder = {
}, },
// Find & replace text according to user selections // Find & replace text according to user selections
findReplace: function(action,resultsOnly,buttonClick) { findReplace: function(findString,resultsOnly,buttonClick) {
var find, replace, results, cM, content, lineCount, numChars, charsToCursor, charCount, cursor, replaceQS, targetQS; var find, replace, results, cM, content, lineCount, numChars, charsToCursor, charCount, cursor, replaceQS, targetQS;
// Determine our find & replace strings and the length of them // Determine our find & replace strings and the length of them
find = top.document.getElementById('find').value.toLowerCase(); find = findString.toLowerCase();
replace = top.document.getElementById('replace').value; replace = top.document.getElementById('replace').value;
results = top.document.getElementById('results'); results = top.document.getElementById('results');
@@ -881,7 +937,6 @@ var ICEcoder = {
cM = ICEcoder.getcMInstance(); cM = ICEcoder.getcMInstance();
if (cM && find.length>0 && document.findAndReplace.target.value=="this document") { if (cM && find.length>0 && document.findAndReplace.target.value=="this document") {
content = cM.getValue().toLowerCase(); content = cM.getValue().toLowerCase();
// Find & replace the next instance, or all? // Find & replace the next instance, or all?
if (document.findAndReplace.connector.value=="and") { if (document.findAndReplace.connector.value=="and") {
if (document.findAndReplace.replaceAction.value=="replace" && cM.getSelection().toLowerCase()==find) { if (document.findAndReplace.replaceAction.value=="replace" && cM.getSelection().toLowerCase()==find) {
@@ -960,8 +1015,10 @@ var ICEcoder = {
cM.focus(); cM.focus();
top.ICEcoder.findMode = true; top.ICEcoder.findMode = true;
} }
return true;
} else { } else {
results.innerHTML = "No results"; results.innerHTML = "No results";
return false;
} }
} else { } else {
// Show the relevant multiple results popup // Show the relevant multiple results popup
@@ -982,7 +1039,7 @@ var ICEcoder = {
} }
filesQS = filesQS.replace(/\:$/,""); filesQS = filesQS.replace(/\:$/,"");
} }
find = find.replace(/\'/g, '&#39;'); find = find.replace(/\'/g, '\&#39;');
find != encodeURIComponent(find) ? find = 'ICEcoder:'+encodeURIComponent(find) : find; find != encodeURIComponent(find) ? find = 'ICEcoder:'+encodeURIComponent(find) : find;
top.ICEcoder.showHide('show',top.document.getElementById('loadingMask')); 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.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/multiple-results.php?find='+find+replaceQS+targetQS+filesQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>';
@@ -1010,9 +1067,9 @@ var ICEcoder = {
// Set up array to store nest data // Set up array to store nest data
state = cM.getTokenAt(cM.getCursor()).state; state = cM.getTokenAt(cM.getCursor()).state;
if ("undefined" != typeof state.curState) { if ("undefined" != typeof state.curState && "undefined" != typeof state.curState.htmlState) {
ICEcoder.htmlTagArray = []; ICEcoder.htmlTagArray = [];
for (cx = state.curState.context; cx; cx = cx.prev) { for (cx = state.curState.htmlState.context; cx; cx = cx.prev) {
if ("undefined" != typeof cx.tagName) { if ("undefined" != typeof cx.tagName) {
ICEcoder.htmlTagArray.unshift(cx.tagName); ICEcoder.htmlTagArray.unshift(cx.tagName);
} }
@@ -1026,15 +1083,13 @@ var ICEcoder = {
// Now we've built up our nest depth array, if we're due to show it in the display // Now we've built up our nest depth array, if we're due to show it in the display
if (updateNestDisplay && !top.ICEcoder.dontUpdateNest) { if (updateNestDisplay && !top.ICEcoder.dontUpdateNest) {
// Clear the display // Clear the display
ICEcoder.nestDisplayText.innerHTML = "";
ICEcoder.nestDisplay.innerHTML = ""; ICEcoder.nestDisplay.innerHTML = "";
if ("undefined" != typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]) { if ("undefined" != typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]) {
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1]; fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
if (["js","coffee","rb","css","less"].indexOf(fileName.split(".")[1])<0 && if (["js","coffee","css","less"].indexOf(fileName.split(".")[1])<0 &&
(nestCheck.indexOf("include(")==-1)&&(nestCheck.indexOf("include_once(")==-1)&& (nestCheck.indexOf("include(")==-1)&&(nestCheck.indexOf("include_once(")==-1)&&
(nestCheck.indexOf("<html")>-1||nestCheck.indexOf("<body")>-1)) { (nestCheck.indexOf("<html")>-1||nestCheck.indexOf("<body")>-1)) {
ICEcoder.nestDisplayText.innerHTML = ICEcoder.htmlTagArray.length > 0 ? "Cursor Position" : "";
// Then for all the array items, output as the nest display // Then for all the array items, output as the nest display
for (var i=0;i<ICEcoder.htmlTagArray.length;i++) { for (var i=0;i<ICEcoder.htmlTagArray.length;i++) {
events = 'onMouseover="top.ICEcoder.highlightBlock('+i+')" onMouseout="top.ICEcoder.highlightBlock('+i+',\'hide\')" onClick="top.ICEcoder.setPosition('+i+',top.ICEcoder.startPosLine,\''+ICEcoder.htmlTagArray[i]+'\')"'; events = 'onMouseover="top.ICEcoder.highlightBlock('+i+')" onMouseout="top.ICEcoder.highlightBlock('+i+',\'hide\')" onClick="top.ICEcoder.setPosition('+i+',top.ICEcoder.startPosLine,\''+ICEcoder.htmlTagArray[i]+'\')"';
@@ -1060,27 +1115,27 @@ var ICEcoder = {
cM = ICEcoder.getcMInstance(); cM = ICEcoder.getcMInstance();
nestOK = true; nestOK = true;
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1]; fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
if (cM && fileName && ["js","coffee","rb","css","less"].indexOf(fileName.split(".")[1])==-1) { if (cM && fileName && ["js","coffee","css","less"].indexOf(fileName.split(".")[1])==-1) {
nestOK = cM.getTokenAt({line:cM.lineCount(),ch:cM.lineInfo(cM.lineCount()-1).text.length}).className != "error" ? true : false; nestOK = cM.getTokenAt({line:cM.lineCount(),ch:cM.lineInfo(cM.lineCount()-1).text.length}).className != "error" ? true : false;
} }
ICEcoder.nestValid.style.background = nestOK ? "#0b0" : "#f00"; ICEcoder.nestValid.style.background = nestOK ? "#0b0" : "#f00";
ICEcoder.nestValid.innerHTML = nestOK ? "Nesting OK" : "Nesting Broken"; ICEcoder.nestValid.title = nestOK ? "Nesting OK" : "Nesting Broken";
}, },
// Get the caret position // Get the caret position
getCaretPosition: function() { getCaretPosition: function() {
var cM, content, line, char, charPos, charCount; var cM, content, line, ch, chPos, chCount;
cM = ICEcoder.getcMInstance(); cM = ICEcoder.getcMInstance();
content = cM.getValue(); content = cM.getValue();
line = cM.getCursor().line; line = cM.getCursor().line;
char = cM.getCursor().ch; ch = cM.getCursor().ch;
charPos = 0; chPos = 0;
for (var i=0;i<line;i++) { for (var i=0;i<line;i++) {
charCount = content.indexOf("\n",charPos); chCount = content.indexOf("\n",chPos);
charPos=charCount+1; chPos=chCount+1;
} }
ICEcoder.caretPos=(charPos+char-1); ICEcoder.caretPos=(chPos+ch-1);
ICEcoder.getNestLocation('yes'); ICEcoder.getNestLocation('yes');
}, },
@@ -1093,6 +1148,17 @@ var ICEcoder = {
ICEcoder.charDisplay.innerHTML = ICEcoder.caretLocType + ", Line: " + (cM.getCursor().line+1) + ", Char: " + cM.getCursor().ch; ICEcoder.charDisplay.innerHTML = ICEcoder.caretLocType + ", Line: " + (cM.getCursor().line+1) + ", Char: " + cM.getCursor().ch;
}, },
// Update the byte display
updateByteDisplay: function() {
ICEcoder.byteDisplay.innerHTML = ICEcoder.getcMInstance().getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " bytes";
},
// Toggle the char/byte display
showDisplay: function(show) {
top.ICEcoder.byteDisplay.style.display = show == "byte" ? "inline-block" : "none";
top.ICEcoder.charDisplay.style.display = show == "char" ? "inline-block" : "none";
},
// Determine which area of the document we're in // Determine which area of the document we're in
caretLocationType: function() { caretLocationType: function() {
var cM, caretLocType, caretChunk, fileName; var cM, caretLocType, caretChunk, fileName;
@@ -1109,9 +1175,11 @@ var ICEcoder = {
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1]; fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
if (fileName.indexOf(".js")>0) {caretLocType="JavaScript"} if (fileName.indexOf(".js")>0) {caretLocType="JavaScript"}
else if (fileName.indexOf(".coffee")>0) {caretLocType="CoffeeScript"} else if (fileName.indexOf(".coffee")>0) {caretLocType="CoffeeScript"}
else if (fileName.indexOf(".py")>0) {caretLocType="Python"}
else if (fileName.indexOf(".rb")>0) {caretLocType="Ruby"} else if (fileName.indexOf(".rb")>0) {caretLocType="Ruby"}
else if (fileName.indexOf(".css")>0) {caretLocType="CSS"} else if (fileName.indexOf(".css")>0) {caretLocType="CSS"}
else if (fileName.indexOf(".less")>0) {caretLocType="LESS"}; else if (fileName.indexOf(".less")>0) {caretLocType="LESS"}
else if (fileName.indexOf(".md")>0) {caretLocType="Markdown"};
ICEcoder.caretLocType = caretLocType; ICEcoder.caretLocType = caretLocType;
}, },
@@ -1125,7 +1193,7 @@ var ICEcoder = {
// Exclude a few keys... // Exclude a few keys...
// Escape (27), Caps Lock (20), Shift, CTRL, Alt, Pause/Break (16-19), Left, Up, Right, Down (37-40), Num Lock, Scroll Lock (144-145), // Escape (27), Caps Lock (20), Shift, CTRL, Alt, Pause/Break (16-19), Left, Up, Right, Down (37-40), Num Lock, Scroll Lock (144-145),
// Insert, Delete (45,46), Page Up, Page Down, End, Home (33-36), Left Win Key, Right Win Key (91-92), F1-F12 (112-123) // Insert, Delete (45,46), Page Up, Page Down, End, Home (33-36), Left Win Key, Right Win Key (91-92), F1-F12 (112-123)
if (!top.ICEcoder.ctrlKeyDown && key!=27 && key!=20 && (key<16||key>19) && (key<37||key>40) && (key!=144||key!=145) && (key!=45||key!=46) && (key<33||key>36) && (key!=91||key!=92) && (key<112||key>123)) { if (!evt.ctrlKey && key!=27 && key!=20 && (key<16||key>19) && (key<37||key>40) && (key!=144||key!=145) && (key!=45||key!=46) && (key<33||key>36) && (key!=91||key!=92) && (key<112||key>123)) {
ICEcoder.changedContent[ICEcoder.selectedTab-1] = cM.historySize().undo > 0 ? 1 : 0; ICEcoder.changedContent[ICEcoder.selectedTab-1] = cM.historySize().undo > 0 ? 1 : 0;
ICEcoder.redoTabHighlight(ICEcoder.selectedTab); ICEcoder.redoTabHighlight(ICEcoder.selectedTab);
} }
@@ -1235,20 +1303,74 @@ var ICEcoder = {
// Show color picker // Show color picker
showColorPicker: function(color) { showColorPicker: function(color) {
top.document.getElementById('blackMask').style.visibility = "visible"; 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="#123456" style="border: 0; width: 70px; padding-left: 5px"><input type="button" onClick="top.ICEcoder.insertColorValue()" value="insert &gt;" style="background: #888; color: #fff; height: 18px; width: 70px; border: 0; margin-left: 5px; cursor: pointer">'; 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'); farbtastic('picker','color');
if (color) { if (color) {
top.document.getElementById('picker').farbtastic.setColor(color); top.document.getElementById('picker').farbtastic.setColor(color);
} }
}, },
// Draw a canvas image based on actual img node image src
drawCanvasImage: function (imgThis) {
var canvas = document.getElementById('canvasPicker').getContext('2d');
var img = new Image();
img.src = imgThis.src;
img.onload = function() {
document.getElementById('canvasPicker').width = imgThis.width;
document.getElementById('canvasPicker').height = imgThis.height;
canvas.drawImage(img,0,0,imgThis.width,imgThis.height);
}
// Show pointer colors on mouse move over canvas
document.getElementById('canvasPicker').onmousemove = function(event) {
// get mouse x & y
var x = event.pageX - this.offsetLeft;
var y = event.pageY - this.offsetTop;
// get image data & then RGB values
var imgData = canvas.getImageData(x, y, 1, 1).data;
var R = imgData[0];
var G = imgData[1];
var B = imgData[2];
var rgb = R+','+G+','+B;
// Get hex from RGB value
var hex = top.ICEcoder.rgbToHex(R,G,B);
// set the values & BG colours of the input boxes
document.getElementById('rgbMouseXY').value = rgb;
document.getElementById('hexMouseXY').value = '#' + hex;
document.getElementById('hexMouseXY').style.backgroundColor = document.getElementById('rgbMouseXY').style.backgroundColor = '#' + hex;
};
// Set pointer colors on clicking canvas
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;
}
},
// Convert RGB values to Hex
rgbToHex: function(R,G,B) {
return top.ICEcoder.toHex(R)+top.ICEcoder.toHex(G)+top.ICEcoder.toHex(B);
},
// Return numbers as hex equivalent
toHex: function(n) {
n = parseInt(n,10);
if (isNaN(n)) return "00";
n = Math.max(0,Math.min(n,255));
return "0123456789abcdef".charAt((n-n%16)/16) + "0123456789abcdef".charAt(n%16);
},
// Insert new color value // Insert new color value
insertColorValue: function(color) { insertColorValue: function(color) {
var cM, cursor; var cM, cursor;
cM = ICEcoder.getcMInstance(); cM = ICEcoder.getcMInstance();
cursor = cM.getTokenAt(cM.getCursor()); cursor = cM.getTokenAt(cM.getCursor());
cM.replaceRange(top.document.getElementById('color').value,{line:cM.getCursor().line,ch:cursor.start},{line:cM.getCursor().line,ch:cursor.end}); cM.replaceRange(color,{line:cM.getCursor().line,ch:cursor.start},{line:cM.getCursor().line,ch:cursor.end});
}, },
// Change opacity of the file manager icons // Change opacity of the file manager icons
@@ -1498,7 +1620,7 @@ var ICEcoder = {
// Update and show/hide found results display? // Update and show/hide found results display?
updateResultsDisplay: function(showHide) { updateResultsDisplay: function(showHide) {
ICEcoder.findReplace('find',true,false); ICEcoder.findReplace(top.document.getElementById('find').value,true,false);
document.getElementById('results').style.display = showHide=="show" ? 'inline-block' : 'none'; document.getElementById('results').style.display = showHide=="show" ? 'inline-block' : 'none';
}, },
@@ -1529,6 +1651,28 @@ var ICEcoder = {
top.ICEcoder.serverMessage('<b>chMod '+perms+' on </b><br>'+file.replace(top.iceRoot,"")); top.ICEcoder.serverMessage('<b>chMod '+perms+' on </b><br>'+file.replace(top.iceRoot,""));
}, },
// Open/show the preview window
openPreviewWindow: function() {
if (top.ICEcoder.openFiles.length>0) {
var cM, filepath, filename, fileExt;
filepath = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
filename = filepath.substr(filepath.lastIndexOf("/")+1);
fileExt = filename.substr(filename.lastIndexOf(".")+1);
cM = ICEcoder.getcMInstance();
top.ICEcoder.previewWindow = window.open(filepath,"previewWindow");
if (["md"].indexOf(fileExt) > -1) {
top.ICEcoder.previewWindow.onload = function() {top.ICEcoder.previewWindow.document.documentElement.innerHTML = mmd(cM.getValue())};
}
}
},
// Open a new terminal window
openTerminal: function() {
top.ICEcoder.demoMode ? top.ICEcoder.message('Sorry, you need to be logged in to use the terminal') : window.open('terminal');
},
// Logout of ICEcoder // Logout of ICEcoder
logout: function() { logout: function() {
window.location = window.location + "?logout"; window.location = window.location + "?logout";
@@ -1590,7 +1734,7 @@ var ICEcoder = {
// Redo our find display // Redo our find display
top.ICEcoder.findMode = false; top.ICEcoder.findMode = false;
ICEcoder.findReplace('find',true,false); ICEcoder.findReplace(top.document.getElementById('find').value,true,false);
// Rerun JS Hint // Rerun JS Hint
if (top.ICEcoder.codeAssist) {top.ICEcoder.updateHints()}; if (top.ICEcoder.codeAssist) {top.ICEcoder.updateHints()};
@@ -1598,6 +1742,7 @@ var ICEcoder = {
// Finally, update the cursor display // Finally, update the cursor display
top.ICEcoder.getCaretPosition(); top.ICEcoder.getCaretPosition();
top.ICEcoder.updateCharDisplay(); top.ICEcoder.updateCharDisplay();
top.ICEcoder.updateByteDisplay();
} }
}, },
@@ -1689,10 +1834,10 @@ var ICEcoder = {
document.getElementById('tab'+i).childNodes[0].childNodes[0].style.backgroundColor = ICEcoder.changedContent[i-1]==1 document.getElementById('tab'+i).childNodes[0].childNodes[0].style.backgroundColor = ICEcoder.changedContent[i-1]==1
? "#b00" : "transparent"; ? "#b00" : "transparent";
} }
tColor = i==selectedTab ? "#000" : "#fff"; tColor = i==selectedTab ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalTab;
if ("undefined" != typeof top.ICEcoder.openFiles[i-1] && top.ICEcoder.openFiles[i-1] != "/[NEW]") { 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,"|")); fileLink = top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[i-1].replace(/\//g,"|"));
if (fileLink) {fileLink.style.backgroundColor = i==selectedTab ? "#49d" : "rgba(255,255,255,0.15)";}; if (fileLink) {fileLink.style.backgroundColor = i==selectedTab ? top.ICEcoder.tabBGcurrent : top.ICEcoder.tabBGopen;};
} }
document.getElementById('tab'+i).style.color = tColor; document.getElementById('tab'+i).style.color = tColor;
bgVPos = i==selectedTab ? -22 : 0; bgVPos = i==selectedTab ? -22 : 0;
@@ -1768,7 +1913,7 @@ var ICEcoder = {
// Close all tabs // Close all tabs
closeAllTabs: function() { closeAllTabs: function() {
if (ICEcoder.ask("Close all tabs?")) { if (top.ICEcoder.cMInstances.length>0 && ICEcoder.ask("Close all tabs?")) {
for (var i=top.ICEcoder.cMInstances.length; i>0; i--) { for (var i=top.ICEcoder.cMInstances.length; i>0; i--) {
top.ICEcoder.closeTab(i, i>1? true:false); top.ICEcoder.closeTab(i, i>1? true:false);
} }
@@ -1911,32 +2056,34 @@ var ICEcoder = {
// Alphabetize tabs // Alphabetize tabs
alphaTabs: function() { alphaTabs: function() {
var currentArray, currentArrayFull, alphaArray, nextValue, nextPos; if (top.ICEcoder.openFiles.length>0) {
var currentArray, currentArrayFull, alphaArray, nextValue, nextPos;
currentArray = []; currentArray = [];
currentArrayFull = []; currentArrayFull = [];
alphaArray = []; alphaArray = [];
for (var i=0;i<top.ICEcoder.openFiles.length;i++) { for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
currentArray.push(top.ICEcoder.openFiles[i].slice(top.ICEcoder.openFiles[i].lastIndexOf('/')+1)); currentArray.push(top.ICEcoder.openFiles[i].slice(top.ICEcoder.openFiles[i].lastIndexOf('/')+1));
currentArrayFull.push(top.ICEcoder.openFiles[i]); currentArrayFull.push(top.ICEcoder.openFiles[i]);
top.document.getElementById('tab'+(i+1)).className = "tab tabSlide"; top.document.getElementById('tab'+(i+1)).className = "tab tabSlide";
}
while (currentArray.length>0) {
nextValue = currentArray[0];
nextValueFull = currentArrayFull[0];
nextPos = 0;
for (var i=0;i<currentArray.length;i++) {
if (currentArray[i] < nextValue) {
nextValue = currentArray[i];
nextValueFull = top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(currentArrayFull[i])];
nextPos = i;
}
} }
alphaArray.push((top.ICEcoder.openFiles.indexOf(nextValueFull)+1)); while (currentArray.length>0) {
currentArray.splice(nextPos,1); nextValue = currentArray[0];
currentArrayFull.splice(nextPos,1); nextValueFull = currentArrayFull[0];
nextPos = 0;
for (var i=0;i<currentArray.length;i++) {
if (currentArray[i] < nextValue) {
nextValue = currentArray[i];
nextValueFull = top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(currentArrayFull[i])];
nextPos = i;
}
}
alphaArray.push((top.ICEcoder.openFiles.indexOf(nextValueFull)+1));
currentArray.splice(nextPos,1);
currentArrayFull.splice(nextPos,1);
}
top.ICEcoder.sortTabs(alphaArray);
} }
top.ICEcoder.sortTabs(alphaArray);
}, },
// ============== // ==============
@@ -1951,31 +2098,15 @@ var ICEcoder = {
// DEL (Delete file) // DEL (Delete file)
if (key==46 && area == "files") { if (key==46 && area == "files") {
top.ICEcoder.delKeyDown = true;
top.ICEcoder.deleteFile(); top.ICEcoder.deleteFile();
return false; return false;
// CTRL key down
} else if(key==17) {
top.ICEcoder.ctrlKeyDown = true;
return false;
// Alt key down
} else if(key==18) {
top.ICEcoder.altKeyDown = true;
return false;
// Shift key down
} else if(key==16) {
top.ICEcoder.shiftKeyDown = true;
return false;
}; };
// Alt key down? // Alt key down?
if (top.ICEcoder.altKeyDown==true) { if (evt.altKey) {
// + CTRL + key (tag wrapper or add line break at end) // + CTRL + key (tag wrapper or add line break at end)
if (ICEcoder.ctrlKeyDown==true && area == "content") { if (evt.ctrlKey && area == "content") {
if (key==68) {top.ICEcoder.tagWrapper('div'); return false;} if (key==68) {top.ICEcoder.tagWrapper('div'); return false;}
else if (key==83) {top.ICEcoder.tagWrapper('span'); return false;} else if (key==83) {top.ICEcoder.tagWrapper('span'); return false;}
else if (key==80) {top.ICEcoder.tagWrapper('p'); return false;} else if (key==80) {top.ICEcoder.tagWrapper('p'); return false;}
@@ -1998,19 +2129,17 @@ var ICEcoder = {
} else { } else {
// CTRL+F (Find) // CTRL+F (Find)
if(key==70 && top.ICEcoder.ctrlKeyDown==true) { if(key==70 && evt.ctrlKey) {
top.document.getElementById('find').focus(); top.document.getElementById('find').focus();
top.ICEcoder.ctrlKeyDown = false;
return false; return false;
// CTRL+G (Go to line) // CTRL+G (Go to line)
} else if(key==71 && top.ICEcoder.ctrlKeyDown==true) { } else if(key==71 && evt.ctrlKey) {
top.document.getElementById('goToLineNo').focus(); top.document.getElementById('goToLineNo').focus();
top.ICEcoder.ctrlKeyDown = false;
return false; return false;
// CTRL+I (Get info) // CTRL+I (Get info)
} else if(key==73 && top.ICEcoder.ctrlKeyDown==true && area == "content") { } else if(key==73 && evt.ctrlKey && area == "content") {
var searchPrefix = top.ICEcoder.caretLocType.toLowerCase()+" "; var searchPrefix = top.ICEcoder.caretLocType.toLowerCase()+" ";
if (top.ICEcoder.caretLocType=="CSS"||top.ICEcoder.caretLocType=="PHP") { if (top.ICEcoder.caretLocType=="CSS"||top.ICEcoder.caretLocType=="PHP") {
window.open("http://voke.fm/"+searchPrefix+top.ICEcoder.getcMInstance().getSelection()); window.open("http://voke.fm/"+searchPrefix+top.ICEcoder.getcMInstance().getSelection());
@@ -2020,75 +2149,76 @@ var ICEcoder = {
} }
window.open("http://www.google.com/#output=search&q="+searchPrefix+top.ICEcoder.getcMInstance().getSelection()); window.open("http://www.google.com/#output=search&q="+searchPrefix+top.ICEcoder.getcMInstance().getSelection());
} }
top.ICEcoder.ctrlKeyDown = false;
return false; return false;
// CTRL+right arrow (Next tab) // CTRL+right arrow (Next tab)
} else if(key==39 && top.ICEcoder.ctrlKeyDown==true && area!="content") { } else if(key==39 && evt.ctrlKey && area!="content") {
top.ICEcoder.nextTab(); top.ICEcoder.nextTab();
return false; return false;
// CTRL+left arrow (Previous tab) // CTRL+left arrow (Previous tab)
} else if(key==37 && top.ICEcoder.ctrlKeyDown==true && area!="content") { } else if(key==37 && evt.ctrlKey && area!="content") {
top.ICEcoder.previousTab(); top.ICEcoder.previousTab();
return false; return false;
// CTRL+up arrow (Move line up) // CTRL+up arrow (Move line up)
} else if(key==38 && top.ICEcoder.ctrlKeyDown==true && area=="content") { } else if(key==38 && evt.ctrlKey && area=="content") {
top.ICEcoder.moveLine('up'); top.ICEcoder.moveLine('up');
return false; return false;
// CTRL+down arrow (Move line down) // CTRL+down arrow (Move line down)
} else if(key==40 && top.ICEcoder.ctrlKeyDown==true && area=="content") { } else if(key==40 && evt.ctrlKey && area=="content") {
top.ICEcoder.moveLine('down'); top.ICEcoder.moveLine('down');
return false; return false;
// CTRL+numeric plus (New tab) // CTRL+numeric plus (New tab)
} else if(key==107 && top.ICEcoder.ctrlKeyDown==true) { } else if(key==107 && evt.ctrlKey) {
area=="content" area=="content"
? top.ICEcoder.duplicateLine() ? top.ICEcoder.duplicateLine()
: top.ICEcoder.newTab(); : top.ICEcoder.newTab();
return false; return false;
// CTRL+numeric minus (Close tab) // CTRL+numeric minus (Close tab)
} else if(key==109 && top.ICEcoder.ctrlKeyDown==true) { } else if(key==109 && evt.ctrlKey) {
area=="content" area=="content"
? top.ICEcoder.removeLine() ? top.ICEcoder.removeLine()
: top.ICEcoder.closeTab(top.ICEcoder.selectedTab); : top.ICEcoder.closeTab(top.ICEcoder.selectedTab);
return false; return false;
// CTRL+S (Save), CTRL+Shift+S (Save As) // CTRL+S (Save), CTRL+Shift+S (Save As)
} else if(key==83 && top.ICEcoder.ctrlKeyDown==true) { } else if(key==83 && evt.ctrlKey) {
if(top.ICEcoder.shiftKeyDown==true) { if(evt.shiftKey) {
top.ICEcoder.saveFile('saveAs'); top.ICEcoder.saveFile('saveAs');
top.ICEcoder.shiftKeyDown = false;
} else { } else {
top.ICEcoder.saveFile(); top.ICEcoder.saveFile();
} }
top.ICEcoder.stickyTabMaybe = true;
return false; return false;
// CTRL+Enter (Open Webpage) // CTRL+Enter (Open Webpage)
} else if(key==13 && top.ICEcoder.ctrlKeyDown==true && top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] != "/[NEW]") { } else if(key==13 && evt.ctrlKey && top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] != "/[NEW]") {
if (top.ICEcoder.stickyTabMaybe) { window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]);
top.ICEcoder.stickyTab = window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1],"stickyTab");
} else {
window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]);
}
top.ICEcoder.ctrlKeyDown = false;
return false; return false;
// CTRL+O (Open Prompt) // CTRL+O (Open Prompt)
} else if(key==79 && top.ICEcoder.ctrlKeyDown==true) { } else if(key==79 && evt.ctrlKey) {
top.ICEcoder.openPrompt(); top.ICEcoder.openPrompt();
top.ICEcoder.ctrlKeyDown = false;
return false; return false;
// CTRL+Space (Show snippet) // CTRL+Space (Show snippet)
} else if(key==32 && top.ICEcoder.ctrlKeyDown==true && area=="content") { } else if(key==32 && evt.ctrlKey && area=="content") {
top.ICEcoder.addSnippet(); top.ICEcoder.addSnippet();
return false; return false;
// Space outisde of editor (Focus on editor)
} else if(key==32 && area!="content") {
top.ICEcoder.getcMInstance().focus();
return false;
// CTRL+J (Jump to definition)
} else if(key==74 && evt.ctrlKey && area=="content") {
top.ICEcoder.jumpToDefinition();
return false;
// ESC in content area (Comment/Uncomment line) // ESC in content area (Comment/Uncomment line)
} else if(key==27 && area == "content") { } else if(key==27 && area == "content") {
top.ICEcoder.lineCommentToggle(); top.ICEcoder.lineCommentToggle();
@@ -2111,11 +2241,6 @@ var ICEcoder = {
var key; var key;
key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode; key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
if (key==17) {top.ICEcoder.ctrlKeyDown = false; top.ICEcoder.stickyTabMaybe = false}
else if (key==16) {top.ICEcoder.shiftKeyDown = false}
else if (key==18) {top.ICEcoder.altKeyDown = false}
else if (key==46) {top.ICEcoder.delKeyDown = false}
}, },
// Add snippet panel below line // Add snippet panel below line

108
lib/ice-coder.min.js vendored Normal file
View File

@@ -0,0 +1,108 @@
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=
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=
"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;
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.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()}}};

44
lib/mmd.js Normal file
View File

@@ -0,0 +1,44 @@
;function mmd(src)
{
var h='';
function escape(t)
{
return new Option(t).innerHTML;
}
function inlineEscape(s)
{
return escape(s)
.replace(/!\[([^\]]*)]\(([^(]+)\)/g, '<img alt="$1" src="$2">')
.replace(/\[([^\]]+)]\(([^(]+)\)/g, '$1'.link('$2'))
.replace(/`([^`]+)`/g, '<code>$1</code>')
.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
.replace(/\*([^*]+)\*/g, '<em>$1</em>');
}
src
.replace(/^\s+|\r|\s+$/g, '')
.replace(/\t/g, ' ')
.split(/\n\n+/)
.forEach(function(b, f, R)
{
f=b[0];
R=
{
'*':[/\n\* /,'<ul><li>','</li></ul>'],
'1':[/\n[1-9]\d*\.? /,'<ol><li>','</li></ol>'],
' ':[/\n /,'<pre><code>','</pre></code>','\n'],
'>':[/\n> /,'<blockquote>','</blockquote>','\n']
}[f];
h+=
R?R[1]+('\n'+b)
.split(R[0])
.slice(1)
.map(R[3]?escape:inlineEscape)
.join(R[3]||'</li>\n<li>')+R[2]:
f=='#'?'<h'+(f=b.indexOf(' '))+'>'+inlineEscape(b.slice(f+1))+'</h'+f+'>':
f=='<'?b:
'<p>'+inlineEscape(b)+'</p>';
});
return h;
};

View File

@@ -113,7 +113,7 @@ if (startTab!=top.ICEcoder.selectedTab) {
$r = 0; $r = 0;
function phpGrep($q, $path, $base) { function phpGrep($q, $path, $base) {
$fp = opendir($path); $fp = opendir($path);
global $r, $ICEcoder, $serverType, $selectedFiles; global $r, $ICEcoder, $serverType, $selectedFiles, $context;
if (!isset($ret)) {$ret="";}; if (!isset($ret)) {$ret="";};
$slash = $serverType == strpos($path,"\\")>-1 ? "\\" : "/"; $slash = $serverType == strpos($path,"\\")>-1 ? "\\" : "/";
while($f = readdir($fp)) { while($f = readdir($fp)) {
@@ -121,7 +121,7 @@ if (startTab!=top.ICEcoder.selectedTab) {
$fullPath = $path.$slash.$f; $fullPath = $path.$slash.$f;
if(is_dir($fullPath)) { if(is_dir($fullPath)) {
$ret .= phpGrep($q, $fullPath, $base); $ret .= phpGrep($q, $fullPath, $base);
} else if(stristr(file_get_contents($fullPath), $q)) { } else if(stristr(toUTF8noBOM(file_get_contents($fullPath,false,$context),false), $q)) {
$bFile = false; $bFile = false;
$foundInSelFile = false; $foundInSelFile = false;
for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) { for ($i=0;$i<count($ICEcoder['bannedFiles']);$i++) {
@@ -136,7 +136,7 @@ if (startTab!=top.ICEcoder.selectedTab) {
} }
if (!$bFile && (count($selectedFiles)==0 || count($selectedFiles)>0 && $foundInSelFile)) { if (!$bFile && (count($selectedFiles)==0 || count($selectedFiles)>0 && $foundInSelFile)) {
$ret .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'))\\\">"; $ret .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'))\\\">";
$ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">Found ".substr_count(strtolower(file_get_contents($fullPath)),$q)." times</div>"; $ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">Found ".substr_count(strtolower(toUTF8noBOM(file_get_contents($fullPath,false,$context),false)),$q)." times</div>";
if (isset($_GET['replace'])) { if (isset($_GET['replace'])) {
$ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle('".$fullPath."');this.style.display=\'none\'\\\">replace</div>"; $ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle('".$fullPath."');this.style.display=\'none\'\\\">replace</div>";
}; };

View File

@@ -8,12 +8,20 @@ error_reporting(-1);
// Set our default timezone and supress warning with @ // Set our default timezone and supress warning with @
@date_default_timezone_set(date_default_timezone_get()); @date_default_timezone_set(date_default_timezone_get());
// Set a stream context timeout for file reading
$context = stream_context_create(array('http'=>
array(
'timeout' => 60 // secs
)
));
// Start a session if we haven't already // Start a session if we haven't already
if(!isset($_SESSION)) {session_start();} if(!isset($_SESSION)) {session_start();}
// Logout if that's the action we're taking // Logout if that's the action we're taking
if (isset($_GET['logout'])) { if (isset($_GET['logout'])) {
$_SESSION['loggedIn']=false; $_SESSION['loggedIn']=false;
$_SESSION['accountUsername']=false;
session_destroy(); session_destroy();
header("Location: dirname(__FILE__)./?loggedOut"); header("Location: dirname(__FILE__)./?loggedOut");
} }
@@ -51,9 +59,29 @@ function numClean($var) {
return is_numeric($var) ? floatval($var) : false; return is_numeric($var) ? floatval($var) : false;
} }
// returns a UTF8 based string with any UFT8 BOM removed
function toUTF8noBOM($string,$message) {
// Attempt to detect encoding
$encType = mb_detect_encoding($string);
// Get rid of any UTF-8 BOM
$string = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$string);
// Test for any bad characters
$teststring = $string;
$teststringBroken = utf8_decode($teststring);
$teststringConverted = iconv("UTF-8", "UTF-8//IGNORE", $teststringBroken);
// If we have a matching length, UTF8 encode it
if ($encType != "ASCII" && strlen($teststringConverted) == strlen($teststringBroken)) {
$string = utf8_encode($string);
if ($message) {
echo "<script>top.ICEcoder.message('Your document doesn\'t appear to be in UTF-8 encoding so has been converted.');</script>";
}
}
return $string;
}
// Settings are stored in this file // Settings are stored in this file
$settingsTemplate = 'config-template.php'; $settingsTemplate = 'config-template.php';
$settingsFile = 'config.php'; $settingsFile = 'config-'.str_replace(".","_",$_SERVER['SERVER_NAME']).'.php';
if (!file_exists(dirname(__FILE__)."/".$settingsFile)) { if (!file_exists(dirname(__FILE__)."/".$settingsFile)) {
if (!copy(dirname(__FILE__)."/".$settingsTemplate, dirname(__FILE__)."/".$settingsFile)) { if (!copy(dirname(__FILE__)."/".$settingsTemplate, dirname(__FILE__)."/".$settingsFile)) {
die("Couldn't create $settingsFile. Maybe you need write permissions on the lib folder?"); die("Couldn't create $settingsFile. Maybe you need write permissions on the lib folder?");
@@ -63,9 +91,12 @@ include(dirname(__FILE__)."/".$settingsFile);
// Add ICEcoder settings to beginning of $ICEcoder array // Add ICEcoder settings to beginning of $ICEcoder array
$ICEcoder = array( $ICEcoder = array(
"versionNo" => "2.2", "versionNo" => "2.5",
"codeMirrorDir" => "CodeMirror-3.12", "codeMirrorDir" => "CodeMirror-3.13",
"demoMode" => false "demoMode" => false,
"devMode" => false,
"multiUser" => false,
"lineEnding" => "\n"
)+$ICEcoder; )+$ICEcoder;
$onLoadExtras = ""; $onLoadExtras = "";
@@ -76,7 +107,7 @@ $demoMode = $ICEcoder['demoMode'];
// Update this config file? // Update this config file?
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) { if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) {
$settingsContents = file_get_contents($settingsFile); $settingsContents = file_get_contents($settingsFile,false,$context);
// Replace our settings vars // Replace our settings vars
$repPosStart = strpos($settingsContents,'"root"'); $repPosStart = strpos($settingsContents,'"root"');
$repPosEnd = strpos($settingsContents,'"previousFiles"'); $repPosEnd = strpos($settingsContents,'"previousFiles"');
@@ -165,7 +196,7 @@ if (!$allowedIP) {
// Save the currently opened files for next time // Save the currently opened files for next time
if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) { if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
$settingsContents = file_get_contents($settingsFile); $settingsContents = file_get_contents($settingsFile,false,$context);
// Replace our previousFiles var with the the current // Replace our previousFiles var with the the current
$repPosStart = strpos($settingsContents,'previousFiles" => "')+20; $repPosStart = strpos($settingsContents,'previousFiles" => "')+20;
@@ -272,7 +303,7 @@ if ((!$_SESSION['loggedIn'] || $ICEcoder["accountPassword"] == "") && !strpos($_
if ($ICEcoder["accountPassword"] == "" && isset($_POST['accountPassword'])) { if ($ICEcoder["accountPassword"] == "" && isset($_POST['accountPassword'])) {
$password = generateHash(strClean($_POST['accountPassword'])); $password = generateHash(strClean($_POST['accountPassword']));
$settingsFile = $settingsFile; $settingsFile = $settingsFile;
$settingsContents = file_get_contents($settingsFile); $settingsContents = file_get_contents($settingsFile,false,$context);
// Replace our empty password with the one submitted by user // Replace our empty password with the one submitted by user
$settingsContents = str_replace('"accountPassword" => "",','"accountPassword" => "'.$password.'",',$settingsContents); $settingsContents = str_replace('"accountPassword" => "",','"accountPassword" => "'.$password.'",',$settingsContents);
// Also set the update checker preference // Also set the update checker preference
@@ -312,12 +343,14 @@ echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
<img src="../images/ice-coder.png"> <img src="../images/ice-coder.png">
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div> <div class="version">v <?php echo $ICEcoder["versionNo"];?></div>
<form name="settingsUpdate" action="settings.php" method="POST"> <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="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"> <input type="submit" name="submit" value="<?php echo $ICEcoder["accountPassword"] == "" ? "set password" : "login"; ?>" class="button">
<?php <?php
if ($ICEcoder["accountPassword"] == "") { if ($ICEcoder["accountPassword"] == "") {
echo '<div class="text"><input type="checkbox" name="checkUpdates" value="true" checked> auto-check for updates</div>'; 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>';};
?> ?>
</form> </form>
</div> </div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

View File

@@ -1,5 +1,5 @@
<?php <?php
include("../../lib/settings.php"); include("../lib/settings.php");
if ($demoMode || !$_SESSION['loggedIn']) { if ($demoMode || !$_SESSION['loggedIn']) {
die("You must be logged in to access Terminal"); die("You must be logged in to access Terminal");
} }