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Vc6OS79udT2ENywEK+h0E9JajZ318yHD0LGeGVfmPEs6tdBYZOgdjTz1EPeZJmLxW30au0fP7mKW7t919LKMLDXVJB+46GhrXkxqwMF3Ph5mq8L5KeLhkkgSukZ/l2lyQH9/y2c5bF06BuKMxZBj9ES7s+nY33Q46dkTGtfFkYPQAKeciLPcOnZb4slA6DJkFiEqydJyatw4fQ0096niX78mn1zNfULbGsmPU5i2WlmW19fYvJurw7i1mLlZd4Dp6Qiwfo2FKyRh4/hna+8PMvcoM+HSEOxZN09oLMsKNiZI5yOEx6QON3ZdxbPdtwtVNNklbk0xWa9Jbz/WqquPYAF69IVkvKQzlOYQ8nAnL+opifycOhWJHc7x8V49jttdauQ/KagU834+LXRkJ+N4lN5cmFIT55XiLXXVpL+bd4SS3NLgMmfBs0qGmffmqJZ/3ZKIFmnTiZdAlXgagUiAJRKRAFolIgCkSlQBSISoGoFIgCUSkQBaJSIApEpUAUiEqBqBSIAlEpEAWiUiAKRKVAFIhKgagUiAJRKZDnW/8BIFBvxKlrCgkAAAAASUVORK5CYII=";
  
      let helper = {};
  
      helper.fixHTMLHead = function(){
          let head = document.getElementsByTagName("head")[0];
          head.innerHTML = head.innerHTML + `
          <meta charset=utf-8>
          <meta http-equiv=X-UA-Compatible content="IE=edge">
          <meta name=viewport content="width=device-width,initial-scale=1,user-scalable=no">
          <style>
          
          body{
              line-height: 1.6;
              font-family: -apple-system-font,BlinkMacSystemFont,"Helvetica Neue","PingFang SC","Hiragino Sans GB","Microsoft YaHei UI","Microsoft YaHei",Arial,sans-serif;
              font-size: 16px;
          }
  
          .x-article-main-container {
              width: 100%;
          }
  
          .x-title-container{
              font-weight: bold;
          }
  
          @media screen and (min-width: 1024px){
              .x-article-main-container {
                  max-width: 677px;
                  margin-left: auto;
                  margin-right: auto;
              }
          }
  
          </style>
          `;
          return 0;
      };
  
      helper.addHTML = function(articleMeta, imageListDownloaded, HTMLData){
  
          document.title = HTMLData.title;
          let body = document.getElementsByTagName("body")[0];
          body.innerHTML = `
          <div class="x-save-time-container">保存时间：<div id="x-save-time-id"></div></div>
          <div class="x-save-url-container">地址：<div id="x-save-url-id"></div></div>
          <div><hr /></div>
          <div class="x-article-main-container">
              <div class="x-title-container"><div id="x-title-id"></div></div>
              <div class="x-author-container"></div>
              <div><hr /></div>
              <div class="x-content-container"></div>
          </div>
          `;
  
          document.getElementById("x-title-id").innerText = HTMLData.title;
          document.getElementById("x-save-url-id").innerText = articleMeta.url;
          document.getElementById("x-save-time-id").innerText = articleMeta.save_date + " " + articleMeta.save_time;
          document.getElementById("x-save-time-id").innerText = articleMeta.save_date + " " + articleMeta.save_time;
          document.querySelector(".x-author-container").innerHTML = HTMLData.authorHtml;
          document.querySelector(".x-content-container").innerHTML = HTMLData.contentHtml;
  
          try{
              helper.replaceAllImages(imageListDownloaded);
          }catch(e){
              console.error(e);
          }
          
  
          return 0;
      };
  
  
      helper.replaceAllImages = function(imageListDownloaded){
          for(let i=0; i<imageListDownloaded.length; i++){
              let row = imageListDownloaded[i];
  
              let imgSelected = document.querySelector("img[data-x-replace-token='" + row["unique-id"] + "']");
              if(imgSelected == null){
                  continue;
              }
  
              if(imgSelected.hasAttribute("crossorigin")){
                  imgSelected.removeAttribute("crossorigin");
              }
              
              if(row.success){
                  imgSelected.setAttribute("src", row.saveurl);
                  imgSelected.setAttribute("data-x-download-success", 1);
                  imgSelected.setAttribute("data-x-download-filename", row.filename);
              }else{
                  imgSelected.setAttribute("src", downloadFailedImage);
                  imgSelected.setAttribute("data-x-download-success", 0);
                  imgSelected.setAttribute("data-x-download-filename", row.name);
              }
  
  
  
          }
      };
  
      helper.clearScripts = function(){
          let allScripts = document.querySelectorAll("script");
  
          for(let i = 0 ; i < allScripts.length; i++){
              allScripts[i].remove();
          }
      };
  
      helper.getWholeHTML = function(){
          return document.getElementsByTagName("html")[0].outerHTML;
      };
  
      helper.replaceAllImgToFilename = function(){
          helper.replaceAllSuccessImgToFilename();
          helper.replaceAllFailedImgToFilename();
      };
  
      helper.replaceAllSuccessImgToFilename = function(){
  
          let imglist = document.querySelectorAll("img[data-x-download-success='1']");
  
          for(let i = 0 ; i < imglist.length; i++){
              let img = imglist[i];
              let filename = img.getAttribute("data-x-download-filename");
  
              let newDom = document.createElement("span");
              newDom.setAttribute("data-x-was-img", 1);
              newDom.setAttribute("data-x-img-file-name", filename);
              newDom.style.backgroundColor = "green";
              newDom.style.color = "white";
              newDom.style.fontWeight="bold";
              newDom.style.margin = "30px 0";
              newDom.style.padding = "30px 0";
              newDom.innerText = filename;
  
              img.replaceWith(newDom);
  
          }
      };
  
      helper.replaceAllFailedImgToFilename = function(){
  
          let imglist = document.querySelectorAll("img[data-x-download-success='0']");
  
          for(let i = 0 ; i < imglist.length; i++){
              let img = imglist[i];
              let filename = img.getAttribute("data-x-download-filename");
              
              let newDom = document.createElement("span");
              newDom.setAttribute("data-x-was-img", 1);
              newDom.setAttribute("data-x-img-file-name", "[FAILED!]" + filename);
              newDom.style.backgroundColor = "red";
              newDom.style.color = "white";
              newDom.style.fontWeight="bold";
              newDom.style.margin = "30px 0";
              newDom.style.padding = "30px 0";
              newDom.innerText = filename;
  
              img.replaceWith(newDom);
  
          }
      };
  
  
      helper.replaceAllImgToBlankImg = function(){
          helper.replaceAllSuccessImgToBlankImg();
          helper.replaceAllFailedImgToBlankImg();
      };
  
      helper.replaceAllSuccessImgToBlankImg = function(){
  
          let imglist = document.querySelectorAll("img[data-x-download-success='1']");
  
          for(let i = 0 ; i < imglist.length; i++){
              let img = imglist[i];
              let filename = img.getAttribute("data-x-download-filename");
  
              img.src = helper.drawCanvasAndExportToImage(filename, 30, "green", "white");
  
          }
      };
  
      helper.replaceAllFailedImgToBlankImg = function(){
  
          let imglist = document.querySelectorAll("img[data-x-download-success='0']");
  
          for(let i = 0 ; i < imglist.length; i++){
              let img = imglist[i];
              let filename = img.getAttribute("data-x-download-filename");
              
              img.src = helper.drawCanvasAndExportToImage("[FAILED!]" + filename, 30, "red", "white");
  
          }
      };
  
  
      helper.drawCanvasAndExportToImage = function(text, fontsize, fillcolor, fontcolor){
          text = text || "default";
          fontsize = fontsize || 30;
          fillcolor = fillcolor || "white";
          fontcolor = fontcolor || "black";
  
          text = "" + text;
  
          let canvas = document.createElement("canvas");
          let ctx = canvas.getContext("2d");
  
          ctx.font = 'bold ' + fontsize + 'px';
  
          //https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript
          let metrics = ctx.measureText(text);
  
          let width = parseInt(metrics.width) + 8;
          let height = parseInt(fontsize) + 8;
  
          //设置宽高
          canvas.width = width;
          canvas.height = height;
          ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
  
          //设置背景色
          ctx.fillStyle = fillcolor;
          ctx.fillRect(0, 0, canvas.width, canvas.height);
  
          //设置文字
          ctx.font =  'bold ' + fontsize + 'px';
          ctx.fillStyle = fontcolor;
          ctx.textAlign = "center";
          ctx.fillText(text, canvas.width/2, canvas.height/2);
  
          return canvas.toDataURL();
  
      };
  
  
      window[name] = helper;
  
  })("FetchServiceBlankPageEvaluateHandleHelper");