Skip to content

Commit

Permalink
支持 module.export 导出,支持npm包引用
Browse files Browse the repository at this point in the history
  • Loading branch information
rowthan committed Mar 1, 2018
1 parent 479455b commit 77815ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/whatsElement.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whats-element",
"version": "1.0.2",
"version": "1.0.3",
"description": "a tool can compute a unique string identity id to location everyone element in web page.",
"main": "index.js",
"scripts": {
Expand Down
9 changes: 9 additions & 0 deletions src/whatsElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@
return el;
}

if (typeof window !== "undefined" && window !== null) {
window.whatsElement = whatsElement;
}
if (typeof window === "undefined" || window === null) {
this.whatsElement = whatsElement;
}
if (typeof module !== 'undefined' && module.exports) module.exports = whatsElement;
if (typeof define === 'function') define(function() { return whatsElement; });

var style = createElement("style"),
styleString = "#"+containerID+"{position:absolute;color:#8ed3fb;font-size:14px;z-index:1000;background-color:rgba(255, 255, 255,0.9);box-sizing:border-box;box-shadow:rgba(0, 0, 0, 0.2) 0px 1px 10px 3px;padding: 10px 20px;border-radius: 36px;}"
styleString += "#"+deleteID+"{cursor:pointer;position:absolute;top:-10px;width:20px;height: 20px;left:calc(50% - 8px);clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%);background:#fff;}";
Expand Down

0 comments on commit 77815ab

Please sign in to comment.