{"id":88192,"date":"2024-12-14T08:56:48","date_gmt":"2024-12-14T05:26:48","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/adding-new-files-29kn\/"},"modified":"2024-12-14T08:56:48","modified_gmt":"2024-12-14T05:26:48","slug":"adding-new-files-29kn","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/adding-new-files-29kn\/","title":{"rendered":"\u0627\u0641\u0632\u0648\u062f\u0646 \u0641\u0627\u06cc\u0644 \u0647\u0627\u06cc \u062c\u062f\u06cc\u062f"},"content":{"rendered":"<p>Summarize this content to 400 words in Persian Lang <\/p>\n<p>  public\/index.html<\/p>\n<p>&lt;!DOCTYPE html&gt;<br \/>\n&lt;html lang=&#8221;en&#8221;&gt;<br \/>\n&lt;head&gt;<br \/>\n  &lt;meta charset=&#8221;UTF-8&#8243;&gt;<br \/>\n  &lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1.0&#8243;&gt;<br \/>\n  &lt;title&gt;Example .myext Editor&lt;\/title&gt;<br \/>\n  &lt;style&gt;<br \/>\n    body {<br \/>\n      font-family: Arial, sans-serif;<br \/>\n      position: relative;<br \/>\n    }<br \/>\n    #fileContent {<br \/>\n      width: 100%;<br \/>\n      height: 300px;<br \/>\n    }<br \/>\n    button {<br \/>\n      margin-top: 10px;<br \/>\n    }<br \/>\n    .popup {<br \/>\n      display: none;<br \/>\n      position: fixed;<br \/>\n      left: 50%;<br \/>\n      top: 50%;<br \/>\n      transform: translate(-50%, -50%);<br \/>\n      padding: 20px;<br \/>\n      background: #fff;<br \/>\n      border: 1px solid #ccc;<br \/>\n      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);<br \/>\n    }<br \/>\n    .popup .close {<br \/>\n      display: block;<br \/>\n      text-align: right;<br \/>\n      cursor: pointer;<br \/>\n    }<br \/>\n    \/* New tab styling *\/<br \/>\n    .tab {<br \/>\n      display: inline-block;<br \/>\n      padding: 10px;<br \/>\n      background: #f1f1f1;<br \/>\n      border: 1px solid #ccc;<br \/>\n      margin-right: 5px;<br \/>\n      cursor: pointer;<br \/>\n    }<br \/>\n    .tab.active {<br \/>\n      background: #ddd;<br \/>\n    }<br \/>\n    .new-file-btn {<br \/>\n      position: absolute;<br \/>\n      right: 10px;<br \/>\n      top: 10px;<br \/>\n      background: #007bff;<br \/>\n      color: white;<br \/>\n      padding: 10px;<br \/>\n      border: none;<br \/>\n      cursor: pointer;<br \/>\n    }<br \/>\n  &lt;\/style&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\n  &lt;h1&gt;Edit .myext Files&lt;\/h1&gt;<br \/>\n  &lt;div id=&#8221;tabs&#8221;&gt;&lt;\/div&gt;<br \/>\n  &lt;textarea id=&#8221;fileContent&#8221;&gt;&lt;\/textarea&gt;<br \/>\n  &lt;button onclick=&#8221;saveChanges()&#8221;&gt;Save Changes&lt;\/button&gt;<br \/>\n  &lt;button onclick=&#8221;showPopup()&#8221;&gt;Show Function Result&lt;\/button&gt;<br \/>\n  &lt;button class=&#8221;new-file-btn&#8221; onclick=&#8221;createNewFile()&#8221;&gt;New File&lt;\/button&gt;<\/p>\n<p>  &lt;div id=&#8221;popup&#8221; class=&#8221;popup&#8221;&gt;<br \/>\n    &lt;div class=&#8221;close&#8221; onclick=&#8221;closePopup()&#8221;&gt;\u2716&lt;\/div&gt;<br \/>\n    &lt;div id=&#8221;popupContent&#8221;&gt;&lt;\/div&gt;<br \/>\n  &lt;\/div&gt;<\/p>\n<p>  &lt;script&gt;<br \/>\n    let currentFile=&#8221;example.myext&#8221;;<\/p>\n<p>    \/\/ Function to create and activate a new tab<br \/>\n    function createTab(filename) {<br \/>\n      const tabs = document.getElementById(&#8216;tabs&#8217;);<br \/>\n      const newTab = document.createElement(&#8216;div&#8217;);<br \/>\n      newTab.className=&#8221;tab&#8221;;<br \/>\n      newTab.textContent = filename;<br \/>\n      newTab.onclick = () =&gt; {<br \/>\n        currentFile = filename;<br \/>\n        fetchFileContent(currentFile);<br \/>\n        setActiveTab(newTab);<br \/>\n      };<br \/>\n      tabs.appendChild(newTab);<br \/>\n      setActiveTab(newTab);<br \/>\n    }<\/p>\n<p>    \/\/ Fetch and display the current file content<br \/>\n    fetchFileContent(currentFile);<br \/>\n    createTab(currentFile);<\/p>\n<p>    function fetchFileContent(filename) {<br \/>\n      fetch(`\/${filename}`)<br \/>\n        .then(response =&gt; response.text())<br \/>\n        .then(data =&gt; {<br \/>\n          document.getElementById(&#8216;fileContent&#8217;).value = data;<br \/>\n        });<br \/>\n    }<\/p>\n<p>    function saveChanges() {<br \/>\n      const content = document.getElementById(&#8216;fileContent&#8217;).value;<br \/>\n      fetch(`\/${currentFile}`, {<br \/>\n        method: &#8216;POST&#8217;,<br \/>\n        headers: {<br \/>\n          &#8216;Content-Type&#8217;: &#8216;application\/json&#8217;<br \/>\n        },<br \/>\n        body: JSON.stringify({ content: content })<br \/>\n      })<br \/>\n      .then(response =&gt; response.text())<br \/>\n      .then(data =&gt; {<br \/>\n        alert(&#8216;File saved successfully&#8217;);<br \/>\n      })<br \/>\n      .catch(err =&gt; {<br \/>\n        alert(&#8216;Error saving file&#8217;);<br \/>\n      });<br \/>\n    }<\/p>\n<p>    function showPopup() {<br \/>\n      const result = myCustomFunction();<br \/>\n      document.getElementById(&#8216;popupContent&#8217;).textContent = result;<br \/>\n      document.getElementById(&#8216;popup&#8217;).style.display = &#8216;block&#8217;;<br \/>\n    }<\/p>\n<p>    function closePopup() {<br \/>\n      document.getElementById(&#8216;popup&#8217;).style.display = &#8216;none&#8217;;<br \/>\n    }<\/p>\n<p>    function myCustomFunction() {<br \/>\n      return &#8216;Custom function executed!&#8217;;<br \/>\n    }<\/p>\n<p>    function createNewFile() {<br \/>\n      const newFileName = prompt(&#8216;Enter the name for the new file:&#8217;, &#8216;example1.myext&#8217;);<br \/>\n      if (newFileName) {<br \/>\n        currentFile = newFileName;<br \/>\n        createTab(newFileName);<br \/>\n        fetchFileContent(newFileName);<br \/>\n      }<br \/>\n    }<\/p>\n<p>    function setActiveTab(tab) {<br \/>\n      const tabs = document.querySelectorAll(&#8216;.tab&#8217;);<br \/>\n      tabs.forEach(t =&gt; t.classList.remove(&#8216;active&#8217;));<br \/>\n      tab.classList.add(&#8216;active&#8217;);<br \/>\n    }<br \/>\n  &lt;\/script&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<p>  server.js<\/p>\n<p>&lt;!DOCTYPE html&gt;<br \/>\n&lt;html lang=&#8221;en&#8221;&gt;<br \/>\n&lt;head&gt;<br \/>\n  &lt;meta charset=&#8221;UTF-8&#8243;&gt;<br \/>\n  &lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1.0&#8243;&gt;<br \/>\n  &lt;title&gt;Example .myext Editor&lt;\/title&gt;<br \/>\n  &lt;style&gt;<br \/>\n    body {<br \/>\n      font-family: Arial, sans-serif;<br \/>\n      position: relative;<br \/>\n    }<br \/>\n    #fileContent {<br \/>\n      width: 100%;<br \/>\n      height: 300px;<br \/>\n    }<br \/>\n    button {<br \/>\n      margin-top: 10px;<br \/>\n    }<br \/>\n    .popup {<br \/>\n      display: none;<br \/>\n      position: fixed;<br \/>\n      left: 50%;<br \/>\n      top: 50%;<br \/>\n      transform: translate(-50%, -50%);<br \/>\n      padding: 20px;<br \/>\n      background: #fff;<br \/>\n      border: 1px solid #ccc;<br \/>\n      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);<br \/>\n    }<br \/>\n    .popup .close {<br \/>\n      display: block;<br \/>\n      text-align: right;<br \/>\n      cursor: pointer;<br \/>\n    }<br \/>\n    \/* New tab styling *\/<br \/>\n    .tab {<br \/>\n      display: inline-block;<br \/>\n      padding: 10px;<br \/>\n      background: #f1f1f1;<br \/>\n      border: 1px solid #ccc;<br \/>\n      margin-right: 5px;<br \/>\n      cursor: pointer;<br \/>\n    }<br \/>\n    .tab.active {<br \/>\n      background: #ddd;<br \/>\n    }<br \/>\n    .new-file-btn {<br \/>\n      position: absolute;<br \/>\n      right: 10px;<br \/>\n      top: 10px;<br \/>\n      background: #007bff;<br \/>\n      color: white;<br \/>\n      padding: 10px;<br \/>\n      border: none;<br \/>\n      cursor: pointer;<br \/>\n    }<br \/>\n  &lt;\/style&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\n  &lt;h1&gt;Edit .myext Files&lt;\/h1&gt;<br \/>\n  &lt;div id=&#8221;tabs&#8221;&gt;&lt;\/div&gt;<br \/>\n  &lt;textarea id=&#8221;fileContent&#8221;&gt;&lt;\/textarea&gt;<br \/>\n  &lt;button onclick=&#8221;saveChanges()&#8221;&gt;Save Changes&lt;\/button&gt;<br \/>\n  &lt;button onclick=&#8221;showPopup()&#8221;&gt;Show Function Result&lt;\/button&gt;<br \/>\n  &lt;button class=&#8221;new-file-btn&#8221; onclick=&#8221;createNewFile()&#8221;&gt;New File&lt;\/button&gt;<\/p>\n<p>  &lt;div id=&#8221;popup&#8221; class=&#8221;popup&#8221;&gt;<br \/>\n    &lt;div class=&#8221;close&#8221; onclick=&#8221;closePopup()&#8221;&gt;\u2716&lt;\/div&gt;<br \/>\n    &lt;div id=&#8221;popupContent&#8221;&gt;&lt;\/div&gt;<br \/>\n  &lt;\/div&gt;<\/p>\n<p>  &lt;script&gt;<br \/>\n    let currentFile=&#8221;example.myext&#8221;;<\/p>\n<p>    \/\/ Function to create and activate a new tab<br \/>\n    function createTab(filename) {<br \/>\n      const tabs = document.getElementById(&#8216;tabs&#8217;);<br \/>\n      const newTab = document.createElement(&#8216;div&#8217;);<br \/>\n      newTab.className=&#8221;tab&#8221;;<br \/>\n      newTab.textContent = filename;<br \/>\n      newTab.onclick = () =&gt; {<br \/>\n        currentFile = filename;<br \/>\n        fetchFileContent(currentFile);<br \/>\n        setActiveTab(newTab);<br \/>\n      };<br \/>\n      tabs.appendChild(newTab);<br \/>\n      setActiveTab(newTab);<br \/>\n    }<\/p>\n<p>    \/\/ Fetch and display the current file content<br \/>\n    fetchFileContent(currentFile);<br \/>\n    createTab(currentFile);<\/p>\n<p>    function fetchFileContent(filename) {<br \/>\n      fetch(`\/${filename}`)<br \/>\n        .then(response =&gt; response.text())<br \/>\n        .then(data =&gt; {<br \/>\n          document.getElementById(&#8216;fileContent&#8217;).value = data;<br \/>\n        });<br \/>\n    }<\/p>\n<p>    function saveChanges() {<br \/>\n      const content = document.getElementById(&#8216;fileContent&#8217;).value;<br \/>\n      fetch(`\/${currentFile}`, {<br \/>\n        method: &#8216;POST&#8217;,<br \/>\n        headers: {<br \/>\n          &#8216;Content-Type&#8217;: &#8216;application\/json&#8217;<br \/>\n        },<br \/>\n        body: JSON.stringify({ content: content })<br \/>\n      })<br \/>\n      .then(response =&gt; response.text())<br \/>\n      .then(data =&gt; {<br \/>\n        alert(&#8216;File saved successfully&#8217;);<br \/>\n      })<br \/>\n      .catch(err =&gt; {<br \/>\n        alert(&#8216;Error saving file&#8217;);<br \/>\n      });<br \/>\n    }<\/p>\n<p>    function showPopup() {<br \/>\n      const result = myCustomFunction();<br \/>\n      document.getElementById(&#8216;popupContent&#8217;).textContent = result;<br \/>\n      document.getElementById(&#8216;popup&#8217;).style.display = &#8216;block&#8217;;<br \/>\n    }<\/p>\n<p>    function closePopup() {<br \/>\n      document.getElementById(&#8216;popup&#8217;).style.display = &#8216;none&#8217;;<br \/>\n    }<\/p>\n<p>    function myCustomFunction() {<br \/>\n      return &#8216;Custom function executed!&#8217;;<br \/>\n    }<\/p>\n<p>    function createNewFile() {<br \/>\n      const newFileName = prompt(&#8216;Enter the name for the new file:&#8217;, &#8216;example1.myext&#8217;);<br \/>\n      if (newFileName) {<br \/>\n        currentFile = newFileName;<br \/>\n        createTab(newFileName);<br \/>\n        fetchFileContent(newFileName);<br \/>\n      }<br \/>\n    }<\/p>\n<p>    function setActiveTab(tab) {<br \/>\n      const tabs = document.querySelectorAll(&#8216;.tab&#8217;);<br \/>\n      tabs.forEach(t =&gt; t.classList.remove(&#8216;active&#8217;));<br \/>\n      tab.classList.add(&#8216;active&#8217;);<br \/>\n    }<br \/>\n  &lt;\/script&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter-rtl ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u0641\u0647\u0631\u0633\u062a \u0645\u0637\u0627\u0644\u0628<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"\u062a\u063a\u06cc\u06cc\u0631 \u0648\u0636\u0639\u06cc\u062a \u0641\u0647\u0631\u0633\u062a \u0645\u0637\u0627\u0644\u0628\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/nabfollower.com\/blog\/adding-new-files-29kn\/#publicindexhtml\" >public\/index.html<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/nabfollower.com\/blog\/adding-new-files-29kn\/#serverjs\" >server.js<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"publicindexhtml\"><\/span>\n<p>  public\/index.html<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n  &lt;meta charset=\"UTF-8\"&gt;\n  &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n  &lt;title&gt;Example .myext Editor&lt;\/title&gt;\n  &lt;style&gt;\n    body {\n      font-family: Arial, sans-serif;\n      position: relative;\n    }\n    #fileContent {\n      width: 100%;\n      height: 300px;\n    }\n    button {\n      margin-top: 10px;\n    }\n    .popup {\n      display: none;\n      position: fixed;\n      left: 50%;\n      top: 50%;\n      transform: translate(-50%, -50%);\n      padding: 20px;\n      background: #fff;\n      border: 1px solid #ccc;\n      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n    }\n    .popup .close {\n      display: block;\n      text-align: right;\n      cursor: pointer;\n    }\n    \/* New tab styling *\/\n    .tab {\n      display: inline-block;\n      padding: 10px;\n      background: #f1f1f1;\n      border: 1px solid #ccc;\n      margin-right: 5px;\n      cursor: pointer;\n    }\n    .tab.active {\n      background: #ddd;\n    }\n    .new-file-btn {\n      position: absolute;\n      right: 10px;\n      top: 10px;\n      background: #007bff;\n      color: white;\n      padding: 10px;\n      border: none;\n      cursor: pointer;\n    }\n  &lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  &lt;h1&gt;Edit .myext Files&lt;\/h1&gt;\n  &lt;div id=\"tabs\"&gt;&lt;\/div&gt;\n  &lt;textarea id=\"fileContent\"&gt;&lt;\/textarea&gt;\n  &lt;button onclick=\"saveChanges()\"&gt;Save Changes&lt;\/button&gt;\n  &lt;button onclick=\"showPopup()\"&gt;Show Function Result&lt;\/button&gt;\n  &lt;button class=\"new-file-btn\" onclick=\"createNewFile()\"&gt;New File&lt;\/button&gt;\n\n  &lt;div id=\"popup\" class=\"popup\"&gt;\n    &lt;div class=\"close\" onclick=\"closePopup()\"&gt;\u2716&lt;\/div&gt;\n    &lt;div id=\"popupContent\"&gt;&lt;\/div&gt;\n  &lt;\/div&gt;\n\n  &lt;script&gt;\n    let currentFile=\"example.myext\";\n\n    \/\/ Function to create and activate a new tab\n    function createTab(filename) {\n      const tabs = document.getElementById('tabs');\n      const newTab = document.createElement('div');\n      newTab.className=\"tab\";\n      newTab.textContent = filename;\n      newTab.onclick = () =&gt; {\n        currentFile = filename;\n        fetchFileContent(currentFile);\n        setActiveTab(newTab);\n      };\n      tabs.appendChild(newTab);\n      setActiveTab(newTab);\n    }\n\n    \/\/ Fetch and display the current file content\n    fetchFileContent(currentFile);\n    createTab(currentFile);\n\n    function fetchFileContent(filename) {\n      fetch(`\/${filename}`)\n        .then(response =&gt; response.text())\n        .then(data =&gt; {\n          document.getElementById('fileContent').value = data;\n        });\n    }\n\n    function saveChanges() {\n      const content = document.getElementById('fileContent').value;\n      fetch(`\/${currentFile}`, {\n        method: 'POST',\n        headers: {\n          'Content-Type': 'application\/json'\n        },\n        body: JSON.stringify({ content: content })\n      })\n      .then(response =&gt; response.text())\n      .then(data =&gt; {\n        alert('File saved successfully');\n      })\n      .catch(err =&gt; {\n        alert('Error saving file');\n      });\n    }\n\n    function showPopup() {\n      const result = myCustomFunction();\n      document.getElementById('popupContent').textContent = result;\n      document.getElementById('popup').style.display = 'block';\n    }\n\n    function closePopup() {\n      document.getElementById('popup').style.display = 'none';\n    }\n\n    function myCustomFunction() {\n      return 'Custom function executed!';\n    }\n\n    function createNewFile() {\n      const newFileName = prompt('Enter the name for the new file:', 'example1.myext');\n      if (newFileName) {\n        currentFile = newFileName;\n        createTab(newFileName);\n        fetchFileContent(newFileName);\n      }\n    }\n\n    function setActiveTab(tab) {\n      const tabs = document.querySelectorAll('.tab');\n      tabs.forEach(t =&gt; t.classList.remove('active'));\n      tab.classList.add('active');\n    }\n  &lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n\n<\/code><\/pre>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"serverjs\"><\/span>\n<p>  server.js<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n  &lt;meta charset=\"UTF-8\"&gt;\n  &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n  &lt;title&gt;Example .myext Editor&lt;\/title&gt;\n  &lt;style&gt;\n    body {\n      font-family: Arial, sans-serif;\n      position: relative;\n    }\n    #fileContent {\n      width: 100%;\n      height: 300px;\n    }\n    button {\n      margin-top: 10px;\n    }\n    .popup {\n      display: none;\n      position: fixed;\n      left: 50%;\n      top: 50%;\n      transform: translate(-50%, -50%);\n      padding: 20px;\n      background: #fff;\n      border: 1px solid #ccc;\n      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n    }\n    .popup .close {\n      display: block;\n      text-align: right;\n      cursor: pointer;\n    }\n    \/* New tab styling *\/\n    .tab {\n      display: inline-block;\n      padding: 10px;\n      background: #f1f1f1;\n      border: 1px solid #ccc;\n      margin-right: 5px;\n      cursor: pointer;\n    }\n    .tab.active {\n      background: #ddd;\n    }\n    .new-file-btn {\n      position: absolute;\n      right: 10px;\n      top: 10px;\n      background: #007bff;\n      color: white;\n      padding: 10px;\n      border: none;\n      cursor: pointer;\n    }\n  &lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  &lt;h1&gt;Edit .myext Files&lt;\/h1&gt;\n  &lt;div id=\"tabs\"&gt;&lt;\/div&gt;\n  &lt;textarea id=\"fileContent\"&gt;&lt;\/textarea&gt;\n  &lt;button onclick=\"saveChanges()\"&gt;Save Changes&lt;\/button&gt;\n  &lt;button onclick=\"showPopup()\"&gt;Show Function Result&lt;\/button&gt;\n  &lt;button class=\"new-file-btn\" onclick=\"createNewFile()\"&gt;New File&lt;\/button&gt;\n\n  &lt;div id=\"popup\" class=\"popup\"&gt;\n    &lt;div class=\"close\" onclick=\"closePopup()\"&gt;\u2716&lt;\/div&gt;\n    &lt;div id=\"popupContent\"&gt;&lt;\/div&gt;\n  &lt;\/div&gt;\n\n  &lt;script&gt;\n    let currentFile=\"example.myext\";\n\n    \/\/ Function to create and activate a new tab\n    function createTab(filename) {\n      const tabs = document.getElementById('tabs');\n      const newTab = document.createElement('div');\n      newTab.className=\"tab\";\n      newTab.textContent = filename;\n      newTab.onclick = () =&gt; {\n        currentFile = filename;\n        fetchFileContent(currentFile);\n        setActiveTab(newTab);\n      };\n      tabs.appendChild(newTab);\n      setActiveTab(newTab);\n    }\n\n    \/\/ Fetch and display the current file content\n    fetchFileContent(currentFile);\n    createTab(currentFile);\n\n    function fetchFileContent(filename) {\n      fetch(`\/${filename}`)\n        .then(response =&gt; response.text())\n        .then(data =&gt; {\n          document.getElementById('fileContent').value = data;\n        });\n    }\n\n    function saveChanges() {\n      const content = document.getElementById('fileContent').value;\n      fetch(`\/${currentFile}`, {\n        method: 'POST',\n        headers: {\n          'Content-Type': 'application\/json'\n        },\n        body: JSON.stringify({ content: content })\n      })\n      .then(response =&gt; response.text())\n      .then(data =&gt; {\n        alert('File saved successfully');\n      })\n      .catch(err =&gt; {\n        alert('Error saving file');\n      });\n    }\n\n    function showPopup() {\n      const result = myCustomFunction();\n      document.getElementById('popupContent').textContent = result;\n      document.getElementById('popup').style.display = 'block';\n    }\n\n    function closePopup() {\n      document.getElementById('popup').style.display = 'none';\n    }\n\n    function myCustomFunction() {\n      return 'Custom function executed!';\n    }\n\n    function createNewFile() {\n      const newFileName = prompt('Enter the name for the new file:', 'example1.myext');\n      if (newFileName) {\n        currentFile = newFileName;\n        createTab(newFileName);\n        fetchFileContent(newFileName);\n      }\n    }\n\n    function setActiveTab(tab) {\n      const tabs = document.querySelectorAll('.tab');\n      tabs.forEach(t =&gt; t.classList.remove('active'));\n      tab.classList.add('active');\n    }\n  &lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n\n<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summarize this content to 400 words in Persian Lang public\/index.html &lt;!DOCTYPE html&gt; &lt;html lang=&#8221;en&#8221;&gt; &lt;head&gt; &lt;meta charset=&#8221;UTF-8&#8243;&gt; &lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1.0&#8243;&gt; &lt;title&gt;Example .myext Editor&lt;\/title&gt; &lt;style&gt; body { font-family: Arial, sans-serif; position: relative; } #fileContent { width: 100%; height: 300px; } button { margin-top: 10px; } .popup { display: none; position: fixed; left: 50%; top: 50%; &hellip;<\/p>\n","protected":false},"author":2,"featured_media":88193,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-88192","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/88192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=88192"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/88192\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/88193"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=88192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=88192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=88192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}