CARVIEW |
Select Language
HTTP/2 301
location: https://raw.githubusercontent.com/nbubna/trigger/master/dist/trigger.js
accept-ranges: bytes
age: 0
date: Mon, 21 Jul 2025 18:43:07 GMT
via: 1.1 varnish
x-served-by: cache-bom4744-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753123387.243970,VS0,VE312
vary: Accept-Encoding
x-fastly-request-id: b4f28051e08e11bfe5695eae278e2c250a1867d1
content-length: 0
HTTP/2 200
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: W/"c15f57ac81a3183f4b54b9a7126deb46fd729b2a33f9e51ec236d3728e4b0ebd"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: 3BAD:84313:33990:84481:687E8A3B
content-encoding: gzip
accept-ranges: bytes
date: Mon, 21 Jul 2025 18:43:07 GMT
via: 1.1 varnish
x-served-by: cache-bom4736-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753123388.606835,VS0,VE359
vary: Authorization,Accept-Encoding
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: 9c43753ff45e58e1283d50440dd79a112fb9ddf2
expires: Mon, 21 Jul 2025 18:48:07 GMT
source-age: 0
content-length: 2068
/*! trigger - v1.1.1 - 2013-05-22
* Copyright (c) 2013 ESHA Research; Licensed MIT, GPL */
;(function(window, document, $) {
function trigger(){ return _.manual.apply(this, arguments); }
trigger.add = function(){ return _.add.apply(this, arguments); };
var _ = trigger._ = {
version: "1.1.1",
prefix: 'data-',// will change to '' if !
splitRE: / (?![^\[\]]*\])+/g,
noClickRE: /^(select|textarea)$/,
noEnterRE: /^(textarea|button)$/,
buttonRE: /^(submit|button|reset)$/,
boxRE: /^(checkbox|radio)$/,
// custom event stuff
all: function(target, sequence, t) {//t==trigger (usually a 'click'ish event)
sequence = sequence.split(_.splitRE);
for (var i=0, e, props; i 0) {
e.tags = type.substring(pound+1).split('#');
type = type.substring(0, pound);
for (var i=0,m=e.tags.length; i 0) {
e.constants = JSON.parse(type.substring(bracket).replace(/'/g,'"'));
type = type.substring(0, bracket);
}
if ((colon = type.indexOf(':')) > 0) {
e.category = type.substring(0, colon);
type = type.substring(colon+1);
}
e.type = type;
return e;
},
event: function(target, props) {
var e = document.createEvent('HTMLEvents');
e.initEvent(props.type, true, true);
for (var key in props) {// copy props w/ext hook
e[_.prop(key)] = props[key];
}
target.dispatchEvent(e);
return e;
},
// native DOM and event stuff
listen: function(e) {
var el = e.target, attr,
type = e.type,
key = type.indexOf('key') === 0 ? e.which || e.keyCode || '' : '',
special = _.special[type+key];
if (el && special) {
type = special(e, el, el.nodeName.toLowerCase());
if (!type){ return; }// special said to ignore it!
}
el = _.find(el, type),
attr = _.attr(el, type);
if (attr) {
_.all(el, attr, e);
if (type === 'click' && !_.boxRE.test(el.type)) {
e.preventDefault();
}
}
},
on: function(type, fn) {
if (!_.on[type]) {// no dupes!
_.on[type] = fn;
if ($ && $.event){ $(document).on(type, fn); }// allows non-native triggers
else { document.addEventListener(type, fn); }
}
},
attr: function(el, type) {
return (el && el.getAttribute && el.getAttribute(_.prefix+type))||'';
},
find: function(el, type) {
return !el || _.attr(el, type) ? el : _.find(el.parentNode, type);
},
// special event handlers
special: {
click: function(e, el, name) {// if click attr or not editable (i.e. not focusing click)
return (_.attr(el, e.type) ||
(!el.isContentEditable && !_.noClickRE.test(name) &&
(name !== 'input' || _.buttonRE.test(el.type)))) &&
'click';
},
keyup13: function(e, el, name) {// if fitting attr or not already accessible (i.e. enter !== click)
return (_.attr(el, 'key-enter') && 'key-enter') ||// enter sometimes fits better than click
(_.attr(el, e.type) && e.type) ||// return keyup type for keyup attr
(!el.isContentEditable && !_.noEnterRE.test(name) &&
!(name === 'a' && el.getAttribute('href')) && _.buttonRE.test(el.type)) &&
'click';// convert to a click
}
},
// extension hooks
manual: function(el, sequence) {
if (typeof el === "string"){ sequence = el; el = document; }
return _.all(el, sequence || _.attr(el, 'click'));
},
add: function() {
for (var i=0,m=arguments.length; i