Chrome plugin

   There are many good articles on CSDN, but it is inconvenient to save as HTML. I want to use Chrome to print and save as PDF, but there are too many irrelevant content on the page. I thought of a way to remove the useless content through the chrome plug-in and call printing, but I haven't found it yet. The method of automatic saving is still manual, please advise.
1. Configuration
{
  "name": "Flutter",
  "manifest_version": 2,
  "version": "1.0",
  "description": "I Love Flutter ~~!",
  "browser_action": {
    "default_icon": "1.png"
  },
  "content_scripts": [
    {
      "matches": ["http://blog.csdn.net/aqi00/*"],
      "js": [" jquery-3.2.1.min.js","script.js"]
    }
  ]
}
refers to the jquery

2.js script script.js

alert(" Google Export PDF");
var $articleDiv = $("#article_details");
var $cloneDiv = $articleDiv.clone(true, true);
var $bodyDiv = $("body");
var $mainDiv = $(".main");
var $side = $("#side");
/ / debugger;
$bodyDiv.empty();
$bodyDiv.append($cloneDiv);
var $digg = $("#digg");
$digg.remove();
$bodyDiv.prop("style", "padding: 20px;");

$("a[title='expand'").attr("title", "collapse").html("[-]").parent().next().show()
window.print();

can be modified according to the characteristics of each webpage, this is CSDN

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326218323&siteId=291194637