|
|
发表于 2013-9-23 14:06:20
|
显示全部楼层
sample code
本帖最后由 MySense 于 2013-9-23 14:13 编辑
This codes decoded from canadadebtsupport.com
It will pop up a farewell window when viewer palns leaving the webpage without click the submit buttom.- var Move = {
- browserHeight: function () {
- if (typeof window.innerWidth == 'number') {
- return window.innerHeight - 2
- } else {
- if (document.documentElement && document.documentElement.clientHeight) {
- return document.documentElement.clientHeight
- } else {
- if (document.body && document.body.clientHeight) {
- return document.body.clientHeight
- }
- }
- }
- },
- browserWidth: function () {
- if (typeof window.innerWidth == 'number') {
- return window.innerWidth - 2
- } else {
- if (document.documentElement && document.documentElement.clientWidth) {
- return document.documentElement.clientWidth
- } else {
- if (document.body && document.body.clientWidth) {
- return document.body.clientWidth
- }
- }
- }
- }
- };
- var actionTemplate;
- var actionWidth, actionHeight, actionLeft, actionTop, actionColor, actionEffect, actionTimeout, actionLimit, actionDelay;
- var actionThanks, actionRedirect;
- var actionAffiliate;
- var actionShowClose;
- (function () {
- var _jQuery = window.jQuery,
- _$ = window.$;
- var jQuery = window.jQuery = window.$ = function (selector, context) {
- return new jQuery.fn.init(selector, context)
- };
- var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
- isSimple = /^.[^:#\[\.]*$/,
- undefined;
- jQuery.fn = jQuery.prototype = {
- init: function (selector, context) {
- selector = selector || document;
- if (selector.nodeType) {
- this[0] = selector;
- this.length = 1;
- return this
- }
- if (typeof selector == "string") {
- var match = quickExpr.exec(selector);
- if (match && (match[1] || !context)) {
- if (match[1]) selector = jQuery.clean([match[1]], context);
- else {
- var elem = document.getElementById(match[3]);
- if (elem) {
- if (elem.id != match[3]) return jQuery().find(selector);
- return jQuery(elem)
- }
- selector = []
- }
- } else return jQuery(context).find(selector)
- } else if (jQuery.isFunction(selector)) return jQuery(document)[jQuery.fn.ready ? "ready" : "load"](selector);
- return this.setArray(jQuery.makeArray(selector))
- },
- jquery: "1.2.6",
- size: function () {
- return this.length
- },
- length: 0,
- get: function (num) {
- return num == undefined ? jQuery.makeArray(this) : this[num]
- },
- pushStack: function (elems) {
- var ret = jQuery(elems);
- ret.prevObject = this;
- return ret
- },
- setArray: function (elems) {
- this.length = 0;
- Array.prototype.push.apply(this, elems);
- return this
- },
- each: function (callback, args) {
- return jQuery.each(this, callback, args)
- },
- index: function (elem) {
- var ret = -1;
- return jQuery.inArray(elem && elem.jquery ? elem[0] : elem, this)
- },
- attr: function (name, value, type) {
- var options = name;
- if (name.constructor == String)
- if (value === undefined) return this[0] && jQuery[type || "attr"](this[0], name);
- else {
- options = {};
- options[name] = value
- }
- return this.each(function (i) {
- for (name in options) jQuery.attr(type ? this.style : this, name, jQuery.prop(this, options[name], type, i, name))
- })
- },
- css: function (key, value) {
- if ((key == 'width' || key == 'height') && parseFloat(value) < 0) value = undefined;
- return this.attr(key, value, "curCSS")
- },
- text: function (text) {
- if (typeof text != "object" && text != null) return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(text));
- var ret = "";
- jQuery.each(text || this, function () {
- jQuery.each(this.childNodes, function () {
- if (this.nodeType != 8) ret += this.nodeType != 1 ? this.nodeValue : jQuery.fn.text([this])
- })
- });
- return ret
- },
- wrapAll: function (html) {
- if (this[0]) jQuery(html, this[0].ownerDocument).clone().insertBefore(this[0]).map(function () {
- var elem = this;
- while (elem.firstChild) elem = elem.firstChild;
- return elem
- }).append(this);
- return this
- },
- wrapInner: function (html) {
- return this.each(function () {
- jQuery(this).contents().wrapAll(html)
- })
- },
- wrap: function (html) {
- return this.each(function () {
- jQuery(this).wrapAll(html)
- })
- },
- append: function () {
- return this.domManip(arguments, true, false, function (elem) {
- if (this.nodeType == 1) this.appendChild(elem)
- })
- },
- prepend: function () {
- return this.domManip(arguments, true, true, function (elem) {
- if (this.nodeType == 1) this.insertBefore(elem, this.firstChild)
- })
- },
- before: function () {
- return this.domManip(arguments, false, false, function (elem) {
- this.parentNode.insertBefore(elem, this)
- })
- },
- after: function () {
- return this.domManip(arguments, false, true, function (elem) {
- this.parentNode.insertBefore(elem, this.nextSibling)
- })
- },
- end: function () {
- return this.prevObject || jQuery([])
- },
- find: function (selector) {
- var elems = jQuery.map(this, function (elem) {
- return jQuery.find(selector, elem)
- });
- return this.pushStack(/[^+>] [^+>]/.test(selector) || selector.indexOf("..") > -1 ? jQuery.unique(elems) : elems)
- },
- clone: function (events) {
- var ret = this.map(function () {
- if (jQuery.browser.msie && !jQuery.isXMLDoc(this)) {
- var clone = this.cloneNode(true),
- container = document.createElement("div");
- container.appendChild(clone);
- return jQuery.clean([container.innerHTML])[0]
- } else return this.cloneNode(true)
- });
- var clone = ret.find("*").andSelf().each(function () {
- if (this[expando] != undefined) this[expando] = null
- });
- if (events === true) this.find("*").andSelf().each(function (i) {
- if (this.nodeType == 3) return;
- var events = jQuery.data(this, "events");
- for (var type in events)
- for (var handler in events[type]) jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data)
- });
- return ret
- },
- ......(see the attachment for whole code)
- jQuery(function () {
- actionpopup_start()
- });
复制代码 Complete code: |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
|