mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-15 12:57:10 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2bf52e5a3 | ||
|
|
f39b8e2a35 | ||
|
|
8c97be00dc | ||
|
|
83085c4c1f | ||
|
|
8adec9a48b | ||
|
|
c177374d23 | ||
|
|
334ced8627 | ||
|
|
d8229d79a5 | ||
|
|
c8665584e9 |
@@ -23,7 +23,7 @@
|
||||
function markDocument(cm, className, minChars) {
|
||||
clearMarks(cm);
|
||||
minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);
|
||||
if (cm.somethingSelected() && cm.getSelection().length >= minChars) {
|
||||
if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) {
|
||||
var state = getMatchHighlightState(cm);
|
||||
var query = cm.getSelection();
|
||||
cm.operation(function() {
|
||||
|
||||
@@ -79,7 +79,7 @@ function createNewCMInstance(num) {
|
||||
},
|
||||
onKeyEvent: function(instance, e) {
|
||||
top.ICEcoder.redoChangedContent(event);
|
||||
top.ICEcoder.findReplace('find',true);
|
||||
top.ICEcoder.findReplace('find',true,false);
|
||||
top.ICEcoder.getCaretPosition();
|
||||
top.ICEcoder.updateCharDisplay();
|
||||
tok = window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].getTokenAt(window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].getCursor());
|
||||
|
||||
14
index.php
14
index.php
@@ -132,22 +132,28 @@ lastOpenFiles = [<?php
|
||||
<form name="findAndReplace">
|
||||
<div class="findReplace">
|
||||
<div class="findText">Find</div>
|
||||
<input type="text" name="find" value="" id="find" class="textbox find" onKeyUp="ICEcoder.findReplace('find',true)">
|
||||
<input type="text" name="find" value="" id="find" class="textbox find" onKeyUp="ICEcoder.findReplace('find',true,false)">
|
||||
<div class="findTextPlural">'s</div>
|
||||
<select name="connector" onChange="ICEcoder.findReplaceOptions()">
|
||||
<option>in</option>
|
||||
<option>and</option>
|
||||
</select>
|
||||
<div class="replaceText" id="rText" style="display: none">replace with</div>
|
||||
<div class="replaceText" id="rText" style="display: none">
|
||||
<select name="replaceAction" class="replaceAction">
|
||||
<option>replace</option>
|
||||
<option>replace all</option>
|
||||
</select>
|
||||
with
|
||||
</div>
|
||||
<input type="text" name="replace" value="" id="replace" class="textbox replace" style="display: none">
|
||||
<div class="targetText" id="rTarget" style="display: none">in</div>
|
||||
<select name="target">
|
||||
<select name="target" onChange="ICEcoder.updateResultsDisplay(this.value=='this document' ? 'show' : 'hide')">
|
||||
<option>this document</option>
|
||||
<option>open documents</option>
|
||||
<option>all files</option>
|
||||
<option>all filenames</option>
|
||||
</select>
|
||||
<input type="button" name="submit" value=">>" class="submit" onClick="ICEcoder.findReplace('findReplace',false)">
|
||||
<input type="button" name="submit" value=">>" class="submit" onClick="ICEcoder.findReplace('findReplace',false,true)">
|
||||
<div class="results" id="results"></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -127,6 +127,7 @@ h2 {font-size: 18px; font-weight: normal; color: #ffffff}
|
||||
.findReplace .findText {display: inline-block; height: 21px; font-size: 10px; margin: 8px 2px 0px 2px; margin-left: 43px}
|
||||
.findReplace .find {position: relative; width: 120px; height: 16px; border: 0; top: -2px; font-size: 10px; padding-left: 5px}
|
||||
.findReplace .findTextPlural {display: inline-block; height: 21px; font-size: 10px; margin: 8px 2px 0px 0px}
|
||||
.findReplace .replaceAction {margin: 0px 2px 0px 0px; top: -2px}
|
||||
.findReplace .replaceText {height: 21px; font-size: 10px; margin: 8px 2px 0px 2px}
|
||||
.findReplace .replace {position: relative; width: 120px; height: 16px; border: 0; top: -2px; font-size: 10px; padding-left: 5px}
|
||||
.findReplace .targetText {height: 21px; font-size: 10px; margin: 8px 2px 0px 2px}
|
||||
|
||||
66
lib/coder.js
66
lib/coder.js
@@ -93,7 +93,6 @@ var ICEcoder = {
|
||||
if (fileName.indexOf(".js")<0&&fileName.indexOf(".rb")&&fileName.indexOf(".css")<0) {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
content = cM.getValue();
|
||||
if (top.ICEcoder.codeAssist) {content = content.replace(/ & /g,' & ');};
|
||||
content = content.replace(/<ICEcoder:\/:textarea>/g,'</textarea>');
|
||||
|
||||
// Then set the content in the editor & clear the history
|
||||
@@ -178,12 +177,13 @@ var ICEcoder = {
|
||||
|
||||
// Now we've built up our nest depth array, if we're due to show it in the display
|
||||
if (updateNestDisplay && !top.ICEcoder.dontUpdateNest) {
|
||||
|
||||
// Clear the display
|
||||
ICEcoder.nestDisplay.innerHTML = "";
|
||||
if ("undefined" != typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]) {
|
||||
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
|
||||
if (fileName.indexOf(".js")<0&&fileName.indexOf(".rb")<0&&fileName.indexOf(".css")<0) {
|
||||
if (fileName.indexOf(".js")<0&&fileName.indexOf(".rb")<0&&fileName.indexOf(".css")<0&&
|
||||
(nestCheck.indexOf("include(")==-1)&&(nestCheck.indexOf("include_once(")==-1)&&
|
||||
(nestCheck.indexOf("<html")>-1||nestCheck.indexOf("<body")>-1)) {
|
||||
|
||||
// Then for all the array items, output as the nest display
|
||||
for (var i=0;i<ICEcoder.htmlTagArray.length;i++) {
|
||||
@@ -360,7 +360,8 @@ var ICEcoder = {
|
||||
ICEcoder.redoTabHighlight(ICEcoder.selectedTab);
|
||||
|
||||
// Redo our find display
|
||||
ICEcoder.findReplace('find',true);
|
||||
top.ICEcoder.findMode = false;
|
||||
ICEcoder.findReplace('find',true,false);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -845,30 +846,42 @@ var ICEcoder = {
|
||||
},
|
||||
|
||||
// Find & replace text according to user selections
|
||||
findReplace: function(action,resultsOnly) {
|
||||
var find, findLen, cM, content, lineCount, numChars, charsToCursor, charCount, startPos, endPos;
|
||||
findReplace: function(action,resultsOnly,buttonClick) {
|
||||
var find, findLen, replaceLen, cM, content, lineCount, numChars, charsToCursor, charCount, startPos, endPos, replaceQS;
|
||||
|
||||
// Determine our find string, in lowercase and the length of that
|
||||
find = parent.parent.document.getElementById('find').value.toLowerCase();
|
||||
find = top.document.getElementById('find').value;
|
||||
findLen = find.length;
|
||||
replaceLen = top.document.getElementById('replace').value.length;
|
||||
|
||||
// If we have something to find
|
||||
if (findLen>0) {
|
||||
// If we have something to find in currrent document
|
||||
if (findLen>0 && document.findAndReplace.target.value=="this document") {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
content = cM.getValue().toLowerCase();
|
||||
content = cM.getValue();
|
||||
|
||||
// Find & replace the next instance?
|
||||
if (document.findAndReplace.connector.value=="and" && cM.getSelection()==find) {
|
||||
cM.replaceSelection(document.getElementById('replace').value);
|
||||
// Find & replace the next instance, or all?
|
||||
if (document.findAndReplace.connector.value=="and") {
|
||||
if (document.findAndReplace.replaceAction.value=="replace" && cM.getSelection()==find) {
|
||||
cM.replaceSelection(document.getElementById('replace').value);
|
||||
}
|
||||
if (document.findAndReplace.replaceAction.value=="replace all" && buttonClick) {
|
||||
var rExp = new RegExp(find,"g");
|
||||
cM.setValue(cM.getValue().replace(rExp,document.getElementById('replace').value));
|
||||
}
|
||||
}
|
||||
|
||||
// Get the content again, as it might of changed
|
||||
content = cM.getValue();
|
||||
if (!top.ICEcoder.findMode||parent.parent.document.getElementById('find').value!=ICEcoder.lastsearch) {
|
||||
ICEcoder.results = [];
|
||||
|
||||
for (var i=0;i<content.length;i++) {
|
||||
if (content.substr(i,findLen)==find) {
|
||||
if (content.substr(i,findLen)==find && i!= ICEcoder.findResult) {
|
||||
ICEcoder.results.push(i);
|
||||
i+=findLen-1;
|
||||
}
|
||||
}
|
||||
|
||||
// Also remember the last search term made
|
||||
ICEcoder.lastsearch = find;
|
||||
}
|
||||
@@ -893,7 +906,7 @@ var ICEcoder = {
|
||||
charsToCursor = numChars+cM.getCursor().ch;
|
||||
ICEcoder.findResult = 0;
|
||||
for (var i=0;i<ICEcoder.results.length;i++) {
|
||||
if (ICEcoder.results[i]<=charsToCursor) {
|
||||
if (ICEcoder.results[i]<charsToCursor) {
|
||||
ICEcoder.findResult++;
|
||||
}
|
||||
}
|
||||
@@ -908,13 +921,17 @@ var ICEcoder = {
|
||||
}
|
||||
}
|
||||
|
||||
charCount = ICEcoder.results[ICEcoder.findResult]-content.lastIndexOf('\n',ICEcoder.results[ICEcoder.findResult])-1;
|
||||
charCount = ICEcoder.results[ICEcoder.findResult];
|
||||
startPos = new Object();
|
||||
startPos.line = lineCount;
|
||||
startPos.ch = charCount;
|
||||
endPos = new Object();
|
||||
endPos.line = lineCount;
|
||||
endPos.ch = charCount+findLen;
|
||||
if (document.findAndReplace.connector.value=="and" && document.findAndReplace.replaceAction.value=="replace all" && buttonClick) {
|
||||
endPos.ch = charCount+replaceLen;
|
||||
} else {
|
||||
endPos.ch = charCount+findLen;
|
||||
}
|
||||
|
||||
// Finally, highlight our selection
|
||||
cM = ICEcoder.getcMInstance();
|
||||
@@ -926,7 +943,14 @@ var ICEcoder = {
|
||||
parent.parent.document.getElementById('results').innerHTML = "No results";
|
||||
}
|
||||
} else {
|
||||
parent.parent.document.getElementById('results').innerHTML = "";
|
||||
// Show the relevant multiple results popup
|
||||
if (find != "" && buttonClick) {
|
||||
replaceQS = "";
|
||||
if (document.findAndReplace.connector.value=="and") {
|
||||
replaceQS = "&replace="+document.getElementById('replace').value;
|
||||
}
|
||||
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/multiple-results.php?find='+find+replaceQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1447,5 +1471,11 @@ var ICEcoder = {
|
||||
|
||||
// Finally, refresh the file manager if we need to
|
||||
if (refreshFM) {top.ICEcoder.refreshFileManager()};
|
||||
},
|
||||
|
||||
// Update and show/hide found results display?
|
||||
updateResultsDisplay: function(showHide) {
|
||||
ICEcoder.findReplace('find',true,false);
|
||||
document.getElementById('results').style.display = showHide == "show" ? 'inline-block' : 'none';
|
||||
}
|
||||
};
|
||||
35
lib/multiple-results.css
Normal file
35
lib/multiple-results.css
Normal file
@@ -0,0 +1,35 @@
|
||||
/* First, reset everything to a standard */
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td {
|
||||
border: 0px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
outline: 0px;
|
||||
font-size: 12px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
body {overflow: hidden;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-o-user-select:none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
h1 {font-size: 36px; font-weight: normal; color: #888888; margin-bottom: 20px}
|
||||
h2 {font-size: 18px; font-weight: normal; color: #ffffff}
|
||||
hr {border: 0; height: 1px; background-color: #888888}
|
||||
|
||||
.results {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #ffffff}
|
||||
.results .resultsPane {position: relative; width: 660px; height: 560px; font-size: 10px; padding: 20px; float: left}
|
||||
.results .resultsPane a {color: rgba(0,198,255,0.7); text-decoration: none}
|
||||
.results .resultsPane a:hover {text-decoration: underline}
|
||||
.replace {position: absolute; margin-top: -28px; right: 20px; padding: 5px 10px; font-size: 14px; background-color: rgba(0,198,255,0.7); cursor: pointer}
|
||||
.replaceAll {position: absolute; bottom: 0px; right: 20px; padding: 5px 10px; font-size: 18px; background-color: rgba(0,198,255,0.7); cursor: pointer}
|
||||
75
lib/multiple-results.php
Normal file
75
lib/multiple-results.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php include("settings.php");?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>ICE Coder - <?php echo $versionNo;?> :: Multiple Results Screen</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="multiple-results.css">
|
||||
</head>
|
||||
|
||||
<body class="results">
|
||||
|
||||
<div class="resultsPane">
|
||||
<h1 id="title"></h1>
|
||||
<div id="results"></div>
|
||||
</div>
|
||||
<?php if (isset($_GET['replace'])) { ?>
|
||||
<div class="replaceAll" id="replaceAll" onClick="replaceAll()" style="opacity: 0.1">replace all</div>
|
||||
<?php ;}; ?>
|
||||
|
||||
<script>
|
||||
var resultsDisplay = "";
|
||||
var foundTabArray = [];
|
||||
var startTab = top.ICEcoder.selectedTab;
|
||||
var rExp = new RegExp("<?php echo $_GET['find']; ?>","g");
|
||||
for (var i=1;i<=top.ICEcoder.openFiles.length;i++) {
|
||||
top.ICEcoder.switchTab(i);
|
||||
var cM = top.ICEcoder.getcMInstance();
|
||||
var content = cM.getValue();
|
||||
if (content.match(rExp)) {
|
||||
resultsDisplay += '<a href="javascript:gotoTab('+i+')">'+ top.ICEcoder.openFiles[i-1]+ '</a><br><div id="foundCount'+i+'">Found '+content.match(rExp).length+' times</div>';
|
||||
<?php if (isset($_GET['replace'])) { ?>
|
||||
resultsDisplay += '<div class="replace" id="replace" onClick="replaceSingle('+i+');this.style.display=\'none\'">replace</div>';
|
||||
<?php ;}; ?>
|
||||
resultsDisplay += '<hr>';
|
||||
foundTabArray.push(i);
|
||||
}
|
||||
}
|
||||
if (startTab!=top.ICEcoder.selectedTab) {
|
||||
top.ICEcoder.switchTab(startTab);
|
||||
}
|
||||
foundTabArray.length==0 ? showHide = "hide" : showHide = "show";
|
||||
top.ICEcoder.showHide(showHide,top.document.getElementById('blackMask'));
|
||||
if (foundTabArray.length==0) {alert('No matches found')};
|
||||
<?php if (isset($_GET['replace'])) { ?>
|
||||
if (foundTabArray.length!=0) {document.getElementById('replaceAll').style.opacity = 1};
|
||||
<?php ;}; ?>
|
||||
foundTabArray.length >= 2 ? plural = "s" : plural = "";
|
||||
document.getElementById('title').innerHTML = "'<?php echo $_GET['find']; ?>' found in "+foundTabArray.length+" file"+plural;
|
||||
document.getElementById('results').innerHTML = resultsDisplay;
|
||||
|
||||
var gotoTab = function(tab) {
|
||||
top.ICEcoder.switchTab(tab);
|
||||
top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));
|
||||
}
|
||||
|
||||
var replaceSingle = function(tab) {
|
||||
top.ICEcoder.switchTab(tab);
|
||||
cM = top.ICEcoder.getcMInstance();
|
||||
content = cM.getValue();
|
||||
cM.setValue(cM.getValue().replace(rExp,top.document.getElementById('replace').value));
|
||||
document.getElementById('foundCount'+tab).innerHTML = document.getElementById('foundCount'+tab).innerHTML.replace('Found','Replaced');
|
||||
}
|
||||
|
||||
var replaceAll = function() {
|
||||
for (var i=0;i<=foundTabArray.length-1;i++) {
|
||||
replaceSingle(foundTabArray[i]);
|
||||
}
|
||||
top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -16,7 +16,7 @@ function generateHash($plainText,$salt=null) {
|
||||
// Start of settings
|
||||
// -----------------
|
||||
|
||||
$versionNo = "v 0.6.5";
|
||||
$versionNo = "v 0.6.6";
|
||||
$codeMirrorDir = "CodeMirror-2.24";
|
||||
$cMThisVer = 2.24;
|
||||
$tabsIndent = true;
|
||||
|
||||
@@ -74,9 +74,14 @@ Class zipIt {
|
||||
// Trigger the class
|
||||
$zipItDoZip = new zipIt();
|
||||
$zipItAddToZip = $zipItDoZip->zipFilesUp($zipItSaveLocation.$zipItFileName);
|
||||
if ($zipItAddToZip) {echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';};
|
||||
if (!$zipItAddToZip) {echo '<script>alert("Could not zip files up!");</script>';};
|
||||
;};
|
||||
?>
|
||||
|
||||
<script>
|
||||
top.ICEcoder.serverMessage();
|
||||
top.ICEcoder.serverQueue("del",0);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user