Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 8b4436d

Browse files
author
mattpass
committed
Reverse & fix top 10 list order, remove 2 x test console.logs
1 parent 36188c6 commit 8b4436d

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

assets/js/icecoder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3417,9 +3417,9 @@ var ICEcoder = {
34173417
// If the innerHTML of that doesn't contain our new item, we can insert it
34183418
if(last10Files.innerHTML.indexOf(newFile) == -1) {
34193419
// Get the last 10 files list, pop the last one off and add newFile at start
3420-
last10FilesList = last10Files.innerHTML.split("\n");
3420+
last10FilesList = last10Files.innerHTML.split("\n");;
34213421
if (
3422-
last10FilesList.length >= 10 || // No more than 10
3422+
last10FilesList.length > 8 || // No more than 8 + 1 we're about to add
34233423
last10FilesList[0] == '<div style="display: inline-block; margin-left: -39px; margin-top: -4px">[none]</div><br><br>' || // Clear out placeholder
34243424
last10FilesList[last10FilesList.length-1] == "" // No empty array items
34253425
) {

editor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@
134134
if (empty($ICEcoder["last10Files"])) {
135135
echo '<div style="display: inline-block; margin-left: -39px; margin-top: -4px">' . $t['none'] . '</div><br>';
136136
} else {
137-
for ($i = 0; $i < count($ICEcoder["last10Files"]); $i++) {
137+
for ($i = count($ICEcoder["last10Files"]) - 1; $i >= 0; $i--) {
138138
$fileFolderName = str_replace("\\", "/", $ICEcoder["last10Files"][$i]);
139139
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
140140
$ext = "ext-" . pathinfo($docRoot . $iceRoot . $fileFolderName, PATHINFO_EXTENSION);
141141
echo '<li class="pft-file ' . strtolower($ext) . '" style="margin-left: -21px">';
142142
echo '<a style="cursor:pointer" onClick="parent.ICEcoder.openFile(\'' . str_replace($docRoot, "", str_replace("|", "/", $ICEcoder["last10Files"][$i])) . '\')">';
143143
echo str_replace($docRoot, "", str_replace("|", "/", $ICEcoder["last10Files"][$i]));
144144
echo '</a></li>';
145-
if ($i < count($ICEcoder["last10Files"]) - 1) {
145+
if ($i > 0) {
146146
echo PHP_EOL;
147147
};
148148
}

lib/settings-save-current-files.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@
2626
$inLast10Files = in_array($saveFilesArray[$i], $ICEcoder["last10Files"]);
2727
if (false === $inLast10Files && "" !== $saveFilesArray[$i]) {
2828
$ICEcoder["last10Files"][] = $saveFilesArray[$i];
29-
echo "<script>console.log(".count($saveFilesArray).count($ICEcoder["last10Files"]).");</script>";
3029
if (10 <= count($ICEcoder["last10Files"])) {
31-
$ICEcoder["last10Files"] = array_slice($ICEcoder["last10Files"], 0, 10);
30+
$ICEcoder["last10Files"] = array_slice($ICEcoder["last10Files"], -10, 10);
3231
};
3332
// Now update the config file
3433
if (false === $settingsClass->saveLast10Files($settingsFile, $ICEcoder["last10Files"])) {
3534
echo "<script>parent.parent.ICEcoder.message('".$t['Cannot update config...']." data/".$settingsFile." ".$t['and try again']."');</script>";
36-
} else {
37-
echo "<script>console.log(".$ICEcoder["last10Files"][$i].");</script>";
38-
}
35+
}
3936
}
4037
}
4138
}

0 commit comments

Comments
 (0)