forked from wendux/fly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.Modify domo and readme.md 3.Use webpack as module bundler
- Loading branch information
wen.du
committed
Dec 10, 2016
1 parent
b4ad653
commit 5c4ef10
Showing
13 changed files
with
206 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.idea | ||
.idea | ||
.DS_Store | ||
/node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head lang="zh-cmn-Hans"> | ||
<meta charset="UTF-8"> | ||
<title>Ajax hook Demo</title> | ||
<meta name="renderer" content="webkit"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> | ||
<meta name="viewport" content="width=device-width,initial-scale=0.5,user-scalable=no"/> | ||
<meta name="keywords" content="Ajax hook Demo"> | ||
<script src="http://cdn.bootcss.com/jquery/3.1.0/jquery.min.js"></script> | ||
<script src="../dist/test.min.js"></script> | ||
|
||
</head> | ||
<style> | ||
html { | ||
font-size: 20px; | ||
-webkit-user-select: none; | ||
} | ||
</style> | ||
<body> | ||
<div style="background: #000; font-size: 38px; color: #ffef68; text-shadow: 2px 2px 10px #ffef68; width: 400px; height: 400px; text-align: center"> | ||
<div style="padding-top: 100px"> Ajax Hook !</div> | ||
</div> | ||
open console panel to view log. | ||
<script> | ||
// $.get().done(function(d){ | ||
// console.log(d.substr(0,30)+"...") | ||
// //use original XMLHttpRequest | ||
// console.log("unhook") | ||
// $.get().done(function(d){ | ||
// console.log(d.substr(0,10)) | ||
// }) | ||
// }) | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Created by du on 16/12/10. | ||
*/ | ||
|
||
const ah=require("ajax-hook") | ||
|
||
ah.hookAjax({ | ||
onreadystatechange:function(xhr){ | ||
console.log("onreadystatechange called: %O",xhr) | ||
//return true | ||
|
||
}, | ||
onload:function(xhr){ | ||
console.log("onload called: %O",xhr) | ||
xhr.responseText="hook"+xhr.responseText; | ||
//return true; | ||
}, | ||
open:function(arg,xhr){ | ||
console.log("open called: method:%s,url:%s,async:%s",arg[0],arg[1],arg[2],xhr) | ||
arg[1]+="?hook_tag=1"; | ||
//统一添加请求头 | ||
|
||
}, | ||
send:function(arg,xhr){ | ||
console.log("send called: %O",arg[0]) | ||
xhr.setRequestHeader("_custom_header_","ajaxhook") | ||
}, | ||
setRequestHeader:function(arg,xhr){ | ||
console.log("setRequestHeader called!",arg) | ||
} | ||
}) | ||
|
||
$.get().done(function(d){ | ||
console.log(d.substr(0,30)+"...") | ||
//use original XMLHttpRequest | ||
console.log("unhook") | ||
ah.unHookAjax() | ||
$.get().done(function(d){ | ||
console.log(d.substr(0,10)) | ||
}) | ||
|
||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "ajax-hooks", | ||
"version": "1.0.0", | ||
"author": { | ||
"name": "wendux", | ||
"email": "[email protected]", | ||
"url": "https://github.com/wendux" | ||
}, | ||
"description": "Hook Javascript global XMLHttpRequest object。 And change the default AJAX request and response .", | ||
"keywords": [ | ||
"ajax hook", | ||
"hook ajax", | ||
"ajax-hook", | ||
"wendux" | ||
], | ||
"respository": { | ||
"type": "git", | ||
"url": "https://github.com/wendux/Neat/Ajax-hook" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/wendux/Ajax-hook/issues" | ||
}, | ||
"scripts": { | ||
"build": "webpack" | ||
}, | ||
"devDependencies": { | ||
"ajax-hook": "^1.0.0", | ||
"webpack": "^1.13.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/extend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "ajax-hook", | ||
"version": "1.0.0", | ||
"main":"ajaxhook.js", | ||
"description": "Hook Javascript global XMLHttpRequest object。 And change the default AJAX request and response.", | ||
|
||
"keywords": [ | ||
"ajax hook", | ||
"hook ajax", | ||
"ajax-hook", | ||
"wendux" | ||
], | ||
"license": "MIT", | ||
|
||
"author": { | ||
"name":"wendux", | ||
"email":"[email protected]", | ||
"url":"https://github.com/wendux" | ||
}, | ||
"respository": { | ||
"type": "git", | ||
"url": "https://github.com/wendux/Neat/Ajax-hook" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/wendux/Ajax-hook/issues" | ||
}, | ||
"homepage": "https://github.com/wendux" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Created by du on 16/9/24. | ||
*/ | ||
var path = require('path'); | ||
var fs = require("fs"); | ||
var webpack = require('webpack'); | ||
module.exports = { | ||
entry: { | ||
"wendu.ajaxhook": "./src/ajaxhook.js", | ||
"test" :["./demon/test.js"] | ||
}, | ||
output: { | ||
path: "./dist", | ||
filename: "[name].min.js" | ||
}, | ||
|
||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: true | ||
} | ||
}), | ||
] | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.