The main function is to open any Web page plug-in will automatically determine whether the URL is form.php end, if it is the rules automatically fill out the Web form, if not skip.
Manifest.json
{ "name": "Smart Form Assistant", "description": "AutoFill Application Link Form", "version": "1.0", "Permissions": [ "Tabs "," http://*/plus/flink_add.php "," https://*/plus/flink_add.php " ], " background ": { " scripts ": [" Background.js "], " persistent ": false }, " Browser_action ": { " default_title ":" AutoFill Application link Form ", "Default_icon": "Bird.png" }, "Manifest_version": 2}
Background.js
Copyright (c) the Chromium Authors. All rights reserved.//Use of this source code are governed by a Bsd-style license, can be//found in the license file. Called when the user clicks on the browser action.function check*** (URL) {console.log (' URL: ' +url); var flag = false; if (typeof url = = "undefined" | | | null = = URL) url = window.location.href; var regex =/.*\:\/\/.*\/form.php/; var match = Url.match (regex); if (typeof match! = "undefined" && null! = match) flag = true; return flag;} function Autoaddvalue () {Chrome.tabs.executeScript (null, {code: "var inputs = Document.queryselectorall (' Input '); Inputs[1].value= ' http://www.xxx.com.cn/'; inputs[2].value= ' xxxx '; inputs[3].value= ' http://www.xx.com.cn/xxx '; Inputs[4].value= ' [email protected] '; var textareas = Document.queryselectorall (' textarea '); textareas[0].value = ' xxxx '; "}); } Chrome.browserAction.onClicked.addListener (function (tab) {if (check***(Tab.url)) {Autoaddvalue (); Chrome.tabs.executeScript ({code: ' document.body.style.backgroundcolor= ' #f2d649 "'}); Console.log ( ' * * * Form Fill success! ');} Else{console.log (' not * * * website! '); Chrome.tabs.executeScript ({code: ' document.body.style.backgroundcolor= ' #f24182 "'});}); Chrome.tabs.onUpdated.addListener (function (tabid,changeinfo,tab) {if (check*** (Tab.url)) {autoaddvalue (); Chrome.tabs.executeScript ({code: ' document.body.style.backgroundcolor= ' #f2d649 '}); Console.log (' * * * form completed successfully!) ');} Else{console.log (' not * * * website! '); Chrome.tabs.executeScript ({code: ' document.body.style.backgroundcolor= ' #f24182 "'});});
Full code Download: http://download.csdn.net/detail/nerslegmail/8308589
Chrome Auto Fill Form Plugin