From 195ba788bb82f169fa0f8a9ef8ccbb53b703dec3 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Thu, 21 Aug 2014 14:25:57 +0100 Subject: [PATCH] JS lang items used and print pre wrap fix --- lib/ice-coder.js | 64 +++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 092b201..04bba70 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -115,7 +115,7 @@ var ICEcoder = { if (!dontSetEditor) { this.editor.style.width = ICEcoder.content.style.width = (winW-this.filesW) + "px"; ICEcoder.content.style.height = (winH-headerH-tabsBarH-findBarH-26) + "px"; - + // Resize the CodeMirror instances to match the window size setTimeout(function(){ for (var i=0;iCreating Folder
'+newFolder); + top.ICEcoder.serverMessage(''+top.t['Creating Folder']+'
'+newFolder); } }, @@ -724,7 +724,7 @@ var ICEcoder = { canOpenFile = true; // Limit to 100 files open at a time if (top.ICEcoder.openFiles.length>=100) { - top.ICEcoder.message('Sorry, you can only have 100 files open at a time!'); + top.ICEcoder.message(top.t['Sorry you can...']); canOpenFile = false; } @@ -735,7 +735,7 @@ var ICEcoder = { if (shortURL!="/[NEW]") { top.ICEcoder.thisFileFolderLink = top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"); top.ICEcoder.serverQueue("add","lib/file-control.php?action=load&file="+top.ICEcoder.thisFileFolderLink+"&csrf="+top.ICEcoder.csrf); - top.ICEcoder.serverMessage('Opening File
'+top.ICEcoder.shortURL); + top.ICEcoder.serverMessage(''+top.t['Opening File']+'
'+top.ICEcoder.shortURL); } else { top.ICEcoder.createNewTab(); } @@ -757,7 +757,7 @@ var ICEcoder = { openPrompt: function() { var fileLink; - if(fileLink = top.ICEcoder.getInput('Enter relative file path (prefixed with /) or remote URL','')) { + if(fileLink = top.ICEcoder.getInput(top.t['Enter relative file...'],'')) { fileLink.indexOf("://")>-1 ? top.ICEcoder.getRemoteFile(fileLink) : top.ICEcoder.openFile(fileLink); @@ -767,7 +767,7 @@ var ICEcoder = { // Get remote file contents getRemoteFile: function(remoteFile) { top.ICEcoder.serverQueue("add","lib/file-control.php?action=getRemoteFile&file="+remoteFile+"&csrf="+top.ICEcoder.csrf); - top.ICEcoder.serverMessage('Getting
'+remoteFile); + top.ICEcoder.serverMessage(''+top.t['Getting']+'
'+remoteFile); }, // Save a file @@ -784,7 +784,7 @@ var ICEcoder = { } filePath = filePath.replace("||","|"); top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+filePath+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+saveType+"&csrf="+top.ICEcoder.csrf); - top.ICEcoder.serverMessage('Saving
'+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"")); + top.ICEcoder.serverMessage(''+top.t['Saving']+'
'+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"")); }, // Prompt a rename dialog @@ -798,7 +798,7 @@ var ICEcoder = { shortURL = oldName.replace(/\|/g,"/"); } if (!newName) { - newName = top.ICEcoder.getInput('Please enter the new name for',shortURL); + newName = top.ICEcoder.getInput(top.t['Please enter the...'],shortURL); } if (newName) { i = top.ICEcoder.openFiles.indexOf(shortURL.replace(/\|/g,"/")); @@ -811,7 +811,7 @@ var ICEcoder = { top.get('tab'+(i+1)).title = newName; } top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+newName+"&oldFileName="+oldName.replace(/\|/g,"/")+"&csrf="+top.ICEcoder.csrf); - top.ICEcoder.serverMessage('Renaming to
'+newName); + top.ICEcoder.serverMessage(''+top.t['Renaming to']+'
'+newName); top.ICEcoder.setPreviousFiles(); } @@ -832,7 +832,7 @@ var ICEcoder = { top.get('tab'+(i+1)).title = newName; } top.ICEcoder.serverQueue("add","lib/file-control.php?action=move&file="+newName+"&oldFileName="+oldName.replace(/\|/g,"/")+"&csrf="+top.ICEcoder.csrf); - top.ICEcoder.serverMessage('Moving to
'+newName); + top.ICEcoder.serverMessage(''+top.t['Moving to']+'
'+newName); top.ICEcoder.setPreviousFiles(); } @@ -846,7 +846,7 @@ var ICEcoder = { tgtListDisplay = tgtFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"); if (tgtFiles.length>0 && top.ICEcoder.ask('Delete:\n\n'+tgtListDisplay+'?')) { top.ICEcoder.serverQueue("add","lib/file-control.php?action=delete&file="+tgtFiles.join(";")+"&csrf="+top.ICEcoder.csrf); - top.ICEcoder.serverMessage('Deleting File
'+tgtListDisplay); + top.ICEcoder.serverMessage(''+top.t['Deleting File']+'
'+tgtListDisplay); }; }, @@ -870,13 +870,13 @@ var ICEcoder = { for (var i=0; iPasting File
'+top.ICEcoder.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n")); + top.ICEcoder.serverMessage(''+top.t['Pasting File']+'
'+top.ICEcoder.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n")); } else { - top.ICEcoder.message("Sorry, cannot paste a whole root"); + top.ICEcoder.message(top.t['Sorry cannot paste...']); } } } else { - top.ICEcoder.message("Nothing to paste, copy a file/folder first!"); + top.ICEcoder.message(top.t['Nothing to paste...']); } }, @@ -1029,7 +1029,7 @@ var ICEcoder = { if (locNest.childNodes[i].className) { // Identify if the item we're considering is a file or folder elemType = locNest.childNodes[i].className.indexOf('directory')>0 ? "folder" : "file"; - + // Get the name of the item nameLI = locNest.childNodes[i].getElementsByTagName('span')[0].innerHTML; @@ -1290,7 +1290,7 @@ var ICEcoder = { // Replace text in a file replaceInFile: function(fileRef,find,replace) { top.ICEcoder.serverQueue("add","lib/file-control.php?action=replaceText&fileRef="+fileRef.replace(/\//g,"|")+"&find="+find+"&replace="+replace+"&csrf="+top.ICEcoder.csrf); - top.ICEcoder.serverMessage('Replacing text in
'+fileRef); + top.ICEcoder.serverMessage(''+top.t['Replacing text in']+'
'+fileRef); }, // ============== @@ -1686,7 +1686,7 @@ var ICEcoder = { ICEcoder.serverQueueItems.splice(1,ICEcoder.serverQueueItems.length); } top.ICEcoder.showHide('hide',top.get('loadingMask')); - top.ICEcoder.serverMessage('Cancelled tasks'); + top.ICEcoder.serverMessage(''+top.t['Cancelled tasks']+''); setTimeout(function() {top.ICEcoder.serverMessage();},2000); }, @@ -1702,7 +1702,7 @@ var ICEcoder = { // Opens the last files we had open autoOpenFiles: function() { - if (top.ICEcoder.previousFiles.length>0 && top.ICEcoder.ask('Open previous files?\n\n'+top.ICEcoder.previousFiles.length+' files:\n'+top.ICEcoder.previousFiles.join('\n').replace(/\|/g,"/").replace(new RegExp(top.docRoot+top.iceRoot,'gi'),""))) { + if (top.ICEcoder.previousFiles.length>0 && top.ICEcoder.ask(top.t['Open previous files']+'\n\n'+top.ICEcoder.previousFiles.length+' files:\n'+top.ICEcoder.previousFiles.join('\n').replace(/\|/g,"/").replace(new RegExp(top.docRoot+top.iceRoot,'gi'),""))) { for (var i=0;i Settings screen for more info','')) { + if (githubAuthToken = top.ICEcoder.getInput(top.t['Please enter your...'],'')) { top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+goNext+"&csrf="+top.ICEcoder.csrf; // Clear the token from the var for security githubAuthToken = ""; @@ -1774,7 +1774,7 @@ var ICEcoder = { if (!top.ICEcoder.githubAuthTokenSet) { top.ICEcoder.githubTokenAsk('loadFiles'); - } else if (top.ICEcoder.githubDiff || top.ICEcoder.ask("This will compare and show a diff view between your local dir and the repo. OK?")) { + } else if (top.ICEcoder.githubDiff || top.ICEcoder.ask(top.t['This will compare...'])) { top.ICEcoder.githubDiff = !top.ICEcoder.githubDiff; gHDiff = top.ICEcoder.githubDiff ? "true" : "false"; @@ -1953,11 +1953,7 @@ var ICEcoder = { update: function() { var autoUpdate; - autoUpdate = confirm( "Updating is currently an experimental feature. While it should work fine, please note there may be issues here, plus the following isn't yet part of this:\n\n" - +"- Settings not ported to new version\n- Plugins not ported to new version\n- Any mods you've made not ported to new version\n\n" - +"If you have write access on the whole of ICEcoder (ie, running locally) it should work fine. If tho you need to recover ICEcoder for any reason, you'll find this current version in its tmp dir.\n\n" - +"Click OK to proceed with an auto-update or cancel to visit the ICEcoder site so you can grab the zip and update manually" - ); + autoUpdate = confirm(top.t['Please note for...']); if (autoUpdate) { top.ICEcoder.showHide('show',top.get('loadingMask')); window.location = "lib/updater.php"; @@ -1982,13 +1978,13 @@ var ICEcoder = { var bugReportOpenFilePos; if(top.ICEcoder.bugReportStatus=="off") { - top.ICEcoder.message('You can start bug reporting in Help > Settings'); + top.ICEcoder.message(top.t['You can start...']); } if(top.ICEcoder.bugReportStatus=="error") { - top.ICEcoder.message('Error: can\'t find/access the error file paths'); + top.ICEcoder.message(top.t['Error cannot find...']); } if(top.ICEcoder.bugReportStatus=="ok") { - top.ICEcoder.message('No new errors found'); + top.ICEcoder.message(top.t['No new errors...']); } if(top.ICEcoder.bugReportStatus=="bugs") { // Close bug-report without saving previousFiles and without confirming close if we made changes on the bug report @@ -2045,13 +2041,13 @@ var ICEcoder = { } top.ICEcoder.bugFilesSizesActual = statusArray['filesSizesSeen']; top.ICEcoder.bugReportPath = statusArray['bugReportPath']; - + } }; // console.log('Calling '+bugCheckURL+' via XHR'); xhr.open("GET",bugCheckURL,true); xhr.send(); - + },parseInt(top.ICEcoder.bugFileCheckTimer*1000,10)); // State that we're checking for bugs top.ICEcoder.bugReportStatus = "ok"; @@ -2079,7 +2075,7 @@ var ICEcoder = { cM = top.ICEcoder.getcMInstance(); printIFrame = top.ICEcoder.filesFrame.contentWindow.frames['fileControl']; // Print page content injected into iFrame, escaped with pre and xssClean - printIFrame.window.document.body.innerHTML = 'ICEcoder code output
'+top.ICEcoder.xssClean(cM.getValue())+'
'; + printIFrame.window.document.body.innerHTML = 'ICEcoder code output
'+top.ICEcoder.xssClean(cM.getValue())+'
'; printIFrame.focus(); printIFrame.print(); // Focus back on code @@ -2256,7 +2252,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); okToRemove = true; if (!dontAsk && ICEcoder.savedPoints[closeTabNum-1]!=top.ICEcoder.getcMInstance(closeTabNum).changeGeneration()) { - okToRemove = top.ICEcoder.ask('You have made changes.\n\nAre you sure you want to close without saving?'); + okToRemove = top.ICEcoder.ask(top.t['You have made...']); } if (okToRemove) { @@ -2319,7 +2315,7 @@ var ICEcoder = { // Close all tabs closeAllTabs: function() { - if (top.ICEcoder.cMInstances.length>0 && ICEcoder.ask("Close all tabs?")) { + if (top.ICEcoder.cMInstances.length>0 && ICEcoder.ask(top.t['Close all tabs'])) { for (var i=top.ICEcoder.cMInstances.length; i>0; i--) { top.ICEcoder.closeTab(i, i>1? true:false); }