You need to set a default timezone for PHP 5.3.0 and onwards. Using
functions such as date without that throws up a warning. However,
getting it from the server causes a warning too. So, I'm getting and
setting it whilst also supressing the warning with @.
mouseDown = false being set now on scoll on iFrame (of File Manager) and
via CM instance for editor, so old method removed
Set serverMessages' display to inline-block when showing, none in 0.2s
when hiding
Clicking on scrollbar to scroll content set the mouseDown state to true
This wasn't being reset on mouse up and moving mouse pointer towards the
edge of the file manager enabled resizing of width
Now on going beyond editor width (-scrollbar of 20px), sets mouseDown to
false
When redoing changedContent values, no longer consider if these keys are
being pressed:
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) <<-- mistake, Page Up, Page Down, End, Home (33-36), Left
Win Key, Right Win Key (91-92), F1-F12 (112-123)
This is because CM's changed event will not be triggered with these keys
and I'm not calling onkeypress anymore
Also, rather than now just setting and ending up being stuck at 1 (ie,
changed), we're now detecting if we have at least 1 undo level, if so
set to 1, otherwise 0
(This means you can make changes and undo back to the start and it
doesn't count as a change)
Because this is being handled on changedContent array, no longer need to
consider undo level size when figuring out close button BG colour
openFileMDTs were not being shuffled along when closing tabs but are now
Fixed issue with string replacing closeTabButtonX() - brackets not
needed
This is now being established using .version, which also indicates extra
info
(Such as '+' for post version updates included, 'beta' to signify that,
etc)
theme, tabsIndent, openLastFiles, tabWidth, previousFiles, showFileMenu
& foldStyle all now contained within ICEcoder object
showFileMenu is a function to ensure file manager menu continues to show
The few instances of i now have scope
Initing the var fileName
This is to reduce the number of global vars
The only global vars should now be ICEcoder, docRoot & iceRoot
pB var setup to avoid repeating long DOM elem refs again
Removed end point from substr, not necessary
Put 3 x themes into an array and test using indexOf instead
Syntax spacing in a couple of areas
use showHide function where possible
Check file and fileName are available before using them
Shorten code by setting in vars and reusing
Syntax & comment simplification
Use regex to work out previousFiles (also fixed comma prefix on string)
Slight adjustment to for loop using less chars
newTab isn't a tab at all, it's inner contents of an LI, so now called
innerLI
2nd insertBefore should be inserting newText not newLI again
New code to get CSS values via regex
Now only showing the preview if the caretLocType is CSS
No need to return cM in getcMInstance, just return the ternary value
Shortened a few comments for clarity & byte saving
No need to add length as 2nd param on substrs in a couple of places
newTab setup as string to be used in a couple of places
Ternary shortening on elemType
Converted ternary statement back to if else to byte save on 2 ternaries
Reversing bool on codeAssist var by using ! instead
break is shorter & better too, than increasing i's value to escape
Now just usage anonymous objects inline instead of creating for single
use
(saves adding extra vars and is less code)
Removed findLen and replaceLen as only findLen was being used twice
Replaced how we find & replace by using CM's searchcursor
Fix to the selection on hover over nest items, doesn't need -1
(This is because I fixed CM's tagRangeFinder to include last line)
moveLine(dir) func added as combo of moveLineUp and moveLineDown funcs
Move initialising vars to start of func
Used indexOf to check array for shortURL instead of for loop in 2 places
Improving/removing a few comments
Condensed code to now check if selectedFiles is empty or contains right
clicked file and also condensed code to use indexOf on array instead of
for loop
Don't need foundFile because of this condensing
Using ICEcoder ref for filesFrame and also showing dropdown higher up
(next to mouse pointer/inline with file/folder name)
Syntax format improvements on fileManager function
selectFileFolder improvements:
- Removed a load of vars we no longer need & new tgtFile var added
- 2 x areas where we deselect files/folders now done via new function
- tgtFile now avail to avoid duplicate setup
- Other much more efficient and clearer processes setup to achieve same
result
New function added to deselect all files
Ternary shortening on colouring of selected/deselected files & folders
Swapped var order around
Checking state.curState.context can cause issues is state.curState
doesn't exist so just check state.curState instead
Swapped a couple of vars round to match order of usage in func
updateNestingIndicator now setup on a setInterval every 30 ms
(This is due to timing issues and solves this without being noticable)
Only if we have a context for the given tag build up the array
If so, reset htmlTagArray and build up the array again
This means we stick with the old array if we're in a script or style
block (for example)
Set the tagString to be the last item in the array
If caretLocType is JS, set the tagString to script
(This is because CodeMirror doesn't recognise this as a tag)
updateNestingIndicator now works by:
- checking if we have a cM instance and not in JS, Coffee etc filetypes
- gets token information for the very end of the document
- detects if it's className is an error or not to determin if the
nesting is broken
Fix to detecting the code type we're in as without -1, JavaScript is
ignored as it's array item 0
Uses a method from Marijn Haverbeke to establish an array of nested
tokens
This means chars in the document don't need to be scanned and the array
worked out in a more complex way
It means quite a few lines can be condensed down to just 3
Also means it's far less expensive on the CPU, meaning there is no
sluggishness onCursorActivity on large documents (ie typing etc)
No longer setting the cursor ch position on moving line up/down
Instead now highlighting the line that has been moved
This is done via the new function highlightLine
Clear iceRoot from the beginning of location (needed for when you set
your own ICEroot), so it doesn't cause DOM ID issues/mismatches
Also remove it from the file path passed through to file-control when
changing perms when you have your own ICEroot and don't show in server
message either
Reworked detecting if it's a JS, CoffeeScript, Ruby, CSS or LESS file by
switching the indexOf around
Also performed indexOf on an array rather than looking at each array
item in a for loop
Ternary shortening of code in a few areas