Angry, railing, raining rain rest. Look up, look up to the sky long roar, zhuang Huai intense. Thirty fame and dust, eight thousand li cloud and moon. Mo, white young head, empty sad. Jingkang shame, still not snow. I hate, when out? Drive long break, lack of Helan Mountain. Ambition hunger meal Hurupp meat, thirsty drink xiongnu blood. Stay at the beginning, clean up the old rivers and mountains, towards the sky! All Over the River

High school back over 30 fame and dust and soil, eight thousand li yun and moon and mo, white young head, empty sad these two sentences, are only know its sentence, I do not know its meaning. Now rereading this poem, only one word can be used to describe ——.

About browser Plugins

Browser plug-in development should theoretically be for Chorme only, and it’s easy to document a plug-in. This is basically a manifest.json configuration file.

{
  "manifest_version": 2."name": "Mailbox assistant"."description": "Mailbox assistant."."version": "1.0"."devtools_page": "devtools.html"."browser_action": {
    "default_icon": "./imgs/logo.png"."default_popup": "popup.html"
  },
  
  "options_page": "pop.html"."content_scripts": [{"matches": ["https://mail.**.com/*"]."js": ["./js/style.js"]."css": ["./css/style.css"]."run_at":"document_idle"}}]Copy the code

Wait until the feature development is complete, through the browseradd-inoptionsLoad a new extensionThat’s it.

A brief explanation of the configuration item information, not to mention the version number.

  • browser actions

You can add an icon to the right of the address bar in chrome’s main toolbar. As an extension of this icon, a Browser Action icon can also have tooltip, Badge, and popup.

  • options_page

To allow users to set your extension functionality, you may need to provide an options page. If you provide the options page, a link will be provided on the extension management page chrome:// Extensions. Click the options link to open your options page.

Of course, if you want to open the options_page directly in popup.html, you need the following code

  chrome.runtime.openOptionsPage(function callback(res) {
    console.log(res)
  })
Copy the code
  • content_scripts

Content scripts are javascript scripts that run inside a Web page. Using the standard DOM, they can get detailed information about the pages the browser visits and modify that information.

These three configurations should be common, but if you want to develop more complex plug-ins, you will need more configurations, as documented below:

Browser Extension documentation

Email assistant

One reason for this is that I need to send weekly reports in my daily work. The rich text editor of my mailbox is ugly, and the format of the content written can not be controlled.

Then think about creating a plugin, write a weekly report or journal in the plugin, and complete the two buttons to create a new email, generate a subject, add a recipient, add a cc, and send the email.

Of course, the main content editing. The content editor turns the Markdown into HTML and places it directly in the content of the message. This section uses codemirror and marked directly to connect the NPM package. Codemirror is responsible for creating the Markdown edit area, but marked is responsible for converting the Markdowm text to HTML. Of course, we can do this conversion ourselves, and then we can customize a set of skins.

The effect is as follows:

Everything seemed so perfect…

The main point is that most browser plugins are done directly with native JS or JQUERY+ HTML. I have always had a question that if I use WebPack +vue development it seems to be possible to configure packaged static files directly. The top screen is actually a static build page. When I configured the manifest.json file and reloaded the plug-in, something magical happened…

Dom

disappeared…

The console gave a few alerts…

DevTools failed to load SourceMap: Could not load content for chrome-extension://jngnfehmjaphcbodabiadlldoolclbfl/static/js/manifest.2ae2e69a05c33dfc65f8.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

And then looked for a long time the reason also did not find, and then this thing first so that I have time in a new bai…

About the ticket-snatching software

This year’s ticket seems to be really bad to buy, and then I also pondered whether he also write a grab a ticket software, grab a train ticket for himself?

Say dry, the theory is the same, log in 12306- > capture packet -> get the interface, analyze parameters -> send a request – ticket success.

The query interface returns 99 items of data as follows:

// aYt2cLvmWFQv%2BDF7gJq62EkyOi7Gj6z1ootJ5UW2OwcxdTo1ncevHsINM83Ks0%2BqCS%2BjZEntIPEZ%0A%2FdKAiiY%2F9iCLsTyAPPtBvv3wy9Zy4CN 3ayIWTVl%2FwGNjrI9c5hNqNDMMuzukNna5MH0hzuXiJBjB%0Am%2BBFteNYIh6HUBXEuOfHuASw80qJKgg%2BTvtn8mNXy0LV%2FRc8F3V9tAFQxSGITi6y UQWf161uwXuu % 0 ahovlh0ye5cxju4azaqmlpsmggwwiuatmxqezsq % 2 fcvbohezefbfvgyikvfk9ubewxrjgucjhaol0u % 0 anxjrknrsroqt2nz8 | | 3300 reservation 00K59818|K599|BTC|GZQ|BXP|ZZF|05:14|13:53|08:39|Y|DiCNDjGKyG9I9PM5DXLmzup6ISCgORBTA4w%2FA3pbUPljHatqi5LkY5hFeRY%3D|20210610|3|C1|10|18|1|0||||12No | | | | | have | | | | | | 103040 w0 |1341|1|0||1009300021301630002140251000121009303000|0|||||1| #0#0|
Copy the code

Then you can analyze the number of trains, departure time and other information from inside

["AYt2cLvmWFQv % 2 bdf7gjq62ekyoi7gj6z1ootj5uw2owcxdto1... efbFvGyIKVFK9UbeWXRjGUCJhAoL0U%0AnXjRKnRsRoqt2NZ8"."Reservation"."330000K59818"."K599"."BTC"."GZQ"."BXP"."ZZF"."05:14"."13:53"."Long"."Y"."DiCNDjGKyG9I9PM5DXLmzup6ISCgORBTA4w%2FA3pbUPljHatqi5LkY5hFeRY%3D"."20210610"."3"."C1"."10"."18"."1"."0".""."".""."12"."".""."No".""."有"."有"."".""."".""."103040W0"."1341"."1"."0".""."1009300021301630002140251000121009303000"."0"."".""."".""."1"."# 0 # 0".""]
Copy the code

Then I have an interest in the encryption of the string, the general encryption is a variety of encryption algorithm in turn several times, some need to key, this I tried, the results certainly try not to solve, but finally found a SM4.js —- state secret algorithm, along with this understanding of the following. The concept is as follows:

SM4.0 (formerly SMS4.0) is a block cipher standard adopted by the Government of the People’s Republic of China and released by the National Cryptography Administration on March 21, 2012. The related standard is GM/T 0002-2012 SM4 Block Cipher Algorithm (original SMS4 Block Cipher Algorithm).

First, getPassengerDTOs returns, by passengerdtos, the id number of a common ticket buyer that fails to pass verification.

This is a bit 🐕.

I sometimes think that ticket-snatching apps actually charge an IQ tax. Call the interface is not their own, make an interface to write a is accelerating… “And then naively pay and wait for the ticket to be collected, do you know THAT I really help you to grab the ticket? Or did I just write a fake interface and put it there as a distraction?

I don’t have time to write a ticket-snatching plugin while I’m working on that encrypted string.

conclusion

Browser plug-in development is generally simple, except for complex functions.

One last word

  1. Move your rich little hands and “like it.”
  2. Move your rich little hands, “click here”
  3. All see here, might as well “add a follow”
  4. Might as well “forward”, good things to remember to share