Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a user to set a custom element #529

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "At.js",
"version": "1.5.4",
"version": "1.5.5",
"main": [
"dist/js/jquery.atwho.js",
"dist/css/jquery.atwho.css"
Expand Down
43 changes: 16 additions & 27 deletions dist/js/jquery.atwho.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
/**
* at.js - 1.5.4
* Copyright (c) 2017 chord.luo <[email protected]>;
* Homepage: http://ichord.github.com/At.js
* License: MIT
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define(["jquery"], function (a0) {
return (factory(a0));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
}
}(this, function ($) {
var DEFAULT_CALLBACKS, KEY_CODE;

KEY_CODE = {
Expand Down Expand Up @@ -88,7 +67,7 @@ DEFAULT_CALLBACKS = {
});
},
tplEval: function(tpl, map) {
var error, error1, template;
var error, template;
template = tpl;
try {
if (typeof tpl !== 'string') {
Expand Down Expand Up @@ -142,7 +121,7 @@ App = (function() {
};

App.prototype.setupRootElement = function(iframe, asRoot) {
var error, error1;
var error;
if (asRoot == null) {
asRoot = false;
}
Expand All @@ -166,6 +145,14 @@ App = (function() {
return this.createContainer((this.iframeAsRoot = asRoot) ? this.document : document);
};

App.prototype.customRootElement = function(doc) {
var ref;
if ((ref = this.$el) != null) {
ref.remove();
}
return $(doc).append(this.$el = $("<div class='atwho-container'></div>"));
};

App.prototype.controller = function(at) {
var c, current, currentFlag, ref;
if (this.aliasMaps[at]) {
Expand Down Expand Up @@ -408,7 +395,7 @@ Controller = (function() {
};

Controller.prototype.callDefault = function() {
var args, error, error1, funcName;
var args, error, funcName;
funcName = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
try {
return DEFAULT_CALLBACKS[funcName].apply(this, args);
Expand All @@ -434,7 +421,7 @@ Controller = (function() {
};

Controller.prototype.getOpt = function(at, default_value) {
var e, error1;
var e;
try {
return this.setting[at];
} catch (error1) {
Expand Down Expand Up @@ -1152,6 +1139,10 @@ Api = {
destroy: function() {
this.shutdown();
return this.$inputor.data('atwho', null);
},
customRootElement: function(doc) {
this.customRootElement(doc);
return null;
}
};

Expand Down Expand Up @@ -1208,5 +1199,3 @@ $.fn.atwho["default"] = {
};

$.fn.atwho.debug = false;

}));
Loading