diff --git a/MC.repo b/MC.repo new file mode 100644 index 0000000..dd37c8e --- /dev/null +++ b/MC.repo @@ -0,0 +1,108 @@ +# CentOS-Base.repo +# +# The mirror system uses the connecting IP address of the client and the +# update status of each mirror to pick mirrors that are updated to and +# geographically close to the client. You should use this for CentOS updates +# unless you are manually picking other mirrors. +# +# If the mirrorlist= does not work for you, as a fall back you can try the +# remarked out baseurl= line instead. +# +# + +[base] +name=CentOS-$releasever - Base - mirrors.aliyun.com +failovermethod=priority +baseurl=http://mirrors.pubyun.com/centos/$releasever/os/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os +gpgcheck=1 +gpgkey=http://mirrors.pubyun.com/centos/RPM-GPG-KEY-CentOS-6 + +#released updates +[updates] +name=CentOS-$releasever - Updates - mirrors.aliyun.com +failovermethod=priority +baseurl=http://mirrors.pubyun.com/centos/$releasever/updates/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates +gpgcheck=1 +gpgkey=http://mirrors.pubyun.com/centos/RPM-GPG-KEY-CentOS-6 + +#additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras - mirrors.aliyun.com +failovermethod=priority +baseurl=http://mirrors.pubyun.com/centos/$releasever/extras/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras +gpgcheck=1 +gpgkey=http://mirrors.pubyun.com/centos/RPM-GPG-KEY-CentOS-6 + +#additional packages that extend functionality of existing packages +[centosplus] +name=CentOS-$releasever - Plus - mirrors.aliyun.com +failovermethod=priority +baseurl=http://mirrors.pubyun.com/centos/$releasever/centosplus/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus +gpgcheck=1 +enabled=0 +gpgkey=http://mirrors.pubyun.com/centos/RPM-GPG-KEY-CentOS-6 + +#contrib - packages by Centos Users +[contrib] +name=CentOS-$releasever - Contrib - mirrors.aliyun.com +failovermethod=priority +baseurl=http://mirrors.pubyun.com/centos/$releasever/contrib/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib +gpgcheck=1 +enabled=0 +gpgkey=http://mirrors.pubyun.com/centos/RPM-GPG-KEY-CentOS-6[epel] +name=Extra Packages for Enterprise Linux 6 - $basearch +baseurl=http://mirrors.pubyun.com/epel/6/$basearch +#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch +failovermethod=priority +enabled=1 +gpgcheck=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 + +[epel-debuginfo] +name=Extra Packages for Enterprise Linux 6 - $basearch - Debug +baseurl=http://mirrors.pubyun.com/epel/6/$basearch/debug +#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch +failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 +gpgcheck=0 + +[epel-source] +name=Extra Packages for Enterprise Linux 6 - $basearch - Source +baseurl=http://mirrors.pubyun.com/epel/6/SRPMS +#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch +failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 +gpgcheck=0 +[epel-testing] +name=Extra Packages for Enterprise Linux 6 - Testing - $basearch +baseurl=http://mirrors.pubyun.com/epel/testing/6/$basearch +#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel6&arch=$basearch +failovermethod=priority +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 + +[epel-testing-debuginfo] +name=Extra Packages for Enterprise Linux 6 - Testing - $basearch - Debug +baseurl=http://mirrors.pubyun.com/epel/testing/6/$basearch/debug +#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel6&arch=$basearch +failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 +gpgcheck=1 + +[epel-testing-source] +name=Extra Packages for Enterprise Linux 6 - Testing - $basearch - Source +baseurl=http://mirrors.pubyun.com/epel/testing/6/SRPMS +#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel6&arch=$basearch +failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 +gpgcheck=1 \ No newline at end of file diff --git a/PerfectSSL.conf b/PerfectSSL.conf new file mode 100644 index 0000000..d2971ba --- /dev/null +++ b/PerfectSSL.conf @@ -0,0 +1,53 @@ +## +## 本配置评分可以达到 A+,评分地址: https://www.ssllabs.com/ssltest/ +## 更多配置信息可以看: https://mozilla.github.io/server-side-tls/ssl-config-generator/ +## + +# Nginx 1.9+ 才支持 HTTP2 协议 +# listen 443 ssl http2; +listen 443 ssl; + +# 开启 SSL 功能 +ssl on; + +# 修改这里,SSL 证书文件路径,由证书签发机构提供 +ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; + +# 修改这里,SSL 密钥文件路径,由证书签发机构提供 +ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; + +# 修改这里,CA 根证书文件路径,由证书签发机构提供 +ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem; + +# 修改这里,Diffie-Hellman 密钥文件路径,建议定期更改 +# 生成方法: openssl dhparam -out dhparam.pem 4096 +ssl_dhparam /etc/nginx/ssl/dhparam.pem; + +# 修改这里,加密或解密 session_ticket 密钥文件路径,建议定期更改 +# 生成方法: openssl rand 48> session_ticket.key +ssl_session_ticket_key /etc/nginx/ssl/session_ticket.key; + +# TLSv1.3 需要 Nginx 1.13+,OpenSSL draft-18+ 分支 +# ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; +# ssl_ciphers "TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-256-GCM-SHA384:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS"; + +ssl_protocols TLSv1 TLSv1.1 TLSv1.2; +ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS"; + +ssl_prefer_server_ciphers on; +ssl_session_timeout 1d; +ssl_session_cache shared:SSL:50m; +ssl_session_tickets on; +ssl_buffer_size 1400; +ssl_stapling on; +ssl_stapling_verify on; + +# 修改这里,国内填 223.5.5.5 223.6.6.6,国外填 8.8.4.4 8.8.8.8 +resolver 8.8.4.4 8.8.8.8 valid=300s; + +resolver_timeout 5s; + +add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; +add_header X-Content-Type-Options "nosniff"; +add_header X-Frame-Options "DENY"; +add_header X-XSS-Protection "1; mode=block"; diff --git a/SmoothScroll/SmoothScroll.js b/SmoothScroll/SmoothScroll.js new file mode 100644 index 0000000..6896176 --- /dev/null +++ b/SmoothScroll/SmoothScroll.js @@ -0,0 +1,659 @@ +// +// SmoothScroll for websites v1.3.8 (Balazs Galambosi) +// Licensed under the terms of the MIT license. +// +// You may use it in your theme if you credit me. +// It is also free to use on any individual website. +// +// Exception: +// The only restriction would be not to publish any +// extension for browsers or native application +// without getting a written permission first. +// + +(function(){ + +// Scroll Variables (tweakable) +var defaultOptions = { + + // Scrolling Core + frameRate : 150, // [Hz] + animationTime : 400, // [px] + stepSize : 120, // [px] + + // Pulse (less tweakable) + // ratio of "tail" to "acceleration" + pulseAlgorithm : true, + pulseScale : 8, + pulseNormalize : 1, + + // Acceleration + accelerationDelta : 20, // 20 + accelerationMax : 1, // 1 + + // Keyboard Settings + keyboardSupport : true, // option + arrowScroll : 50, // [px] + + // Other + touchpadSupport : true, + fixedBackground : true, + excluded : '' +}; + +var options = defaultOptions; + + +// Other Variables +var isExcluded = false; +var isFrame = false; +var direction = { x: 0, y: 0 }; +var initDone = false; +var root = document.documentElement; +var activeElement; +var observer; +var deltaBuffer = []; +var scrollRoot; +var isMac = /^Mac/.test(navigator.platform); + +var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32, + pageup: 33, pagedown: 34, end: 35, home: 36 }; + + +/*********************************************** + * SETTINGS + ***********************************************/ + +var options = defaultOptions; + + +/*********************************************** + * INITIALIZE + ***********************************************/ + +/** + * Tests if smooth scrolling is allowed. Shuts down everything if not. + */ +function initTest() { + if (options.keyboardSupport) { + addEvent('keydown', keydown); + } +} + +/** + * Sets up scrolls array, determines if frames are involved. + */ +function init() { + + if (initDone || !document.body) return; + + initDone = true; + + var body = document.body; + var html = document.documentElement; + var windowHeight = window.innerHeight; + var scrollHeight = body.scrollHeight; + + // check compat mode for root element + root = (document.compatMode.indexOf('CSS')>= 0) ? html : body; + activeElement = body; + + initTest(); + + // Checks if this script is running in a frame + if (top != self) { + isFrame = true; + } + + /** + * This fixes a bug where the areas left and right to + * the content does not trigger the onmousewheel event + * on some pages. e.g.: html, body { height: 100% } + */ + else if (scrollHeight> windowHeight && + (body.offsetHeight <= windowHeight || + html.offsetHeight <= windowHeight)) { + + // DOMChange (throttle): fix height + var pending = false; + var refresh = function () { + if (!pending && html.scrollHeight != document.height) { + pending = true; // add a new pending action + setTimeout(function () { + html.style.height = document.height + 'px'; + pending = false; + }, 500); // act rarely to stay fast + } + }; + + html.style.oldHeight = html.style.height; + html.style.height = 'auto'; + + setTimeout(refresh, 10); + + var config = { + attributes: true, + childList: true, + characterData: false + }; + + observer = new MutationObserver(refresh); + observer.observe(body, config); + + // clearfix + if (root.offsetHeight <= windowHeight) { + var underlay = document.createElement('div'); + underlay.style.clear = 'both'; + body.appendChild(underlay); + } + } + + // disable fixed background + if (!options.fixedBackground && !isExcluded) { + body.style.backgroundAttachment = 'scroll'; + html.style.backgroundAttachment = 'scroll'; + } +} + +/** + * Removes event listeners and other traces left on the page. + */ +function cleanup() { + observer && observer.disconnect(); + removeEvent(wheelEvent, wheel); + removeEvent('mousedown', mousedown); + removeEvent('keydown', keydown); + var html = document.documentElement; + html.style.height = html.style.oldHeight; +} + + +/************************************************ + * SCROLLING + ************************************************/ + +var que = []; +var pending = false; +var lastScroll = Date.now(); + +/** + * Pushes scroll actions to the scrolling queue. + */ +function scrollArray(elem, left, top, delay) { + + delay || (delay = 1000); + directionCheck(left, top); + + if (options.accelerationMax != 1) { + var now = Date.now(); + var elapsed = now - lastScroll; + if (elapsed < options.accelerationDelta) { + var factor = (1 + (50 / elapsed)) / 2; + if (factor> 1) { + factor = Math.min(factor, options.accelerationMax); + left *= factor; + top *= factor; + } + } + lastScroll = Date.now(); + } + + // push a scroll command + que.push({ + x: left, + y: top, + lastX: (left < 0) ? 0.99 : -0.99, + lastY: (top < 0) ? 0.99 : -0.99, + start: Date.now() + }); + + // don't act if there's a pending queue + if (pending) { + return; + } + + var scrollWindow = (elem === document.body); + + var step = function (time) { + + var now = Date.now(); + var scrollX = 0; + var scrollY = 0; + + for (var i = 0; i < que.length; i++) { + + var item = que[i]; + var elapsed = now - item.start; + var finished = (elapsed>= options.animationTime); + + // scroll position: [0, 1] + var position = (finished) ? 1 : elapsed / options.animationTime; + + // easing [optional] + if (options.pulseAlgorithm) { + position = pulse(position); + } + + // only need the difference + var x = (item.x * position - item.lastX)>> 0; + var y = (item.y * position - item.lastY)>> 0; + + // add this to the total scrolling + scrollX += x; + scrollY += y; + + // update last values + item.lastX += x; + item.lastY += y; + + // delete and step back if it's over + if (finished) { + que.splice(i, 1); i--; + } + } + + // scroll left and top + if (scrollWindow) { + window.scrollBy(scrollX, scrollY); + } + else { + if (scrollX) elem.scrollLeft += scrollX; + if (scrollY) elem.scrollTop += scrollY; + } + + // clean up if there's nothing left to do + if (!left && !top) { + que = []; + } + + if (que.length) { + requestFrame(step, elem, (delay / options.frameRate + 1)); + } else { + pending = false; + } + }; + + // start a new queue of actions + requestFrame(step, elem, 0); + pending = true; +} + + +/*********************************************** + * EVENTS + ***********************************************/ + +/** + * Mouse wheel handler. + * @param {Object} event + */ +function wheel(event) { + + if (!initDone) { + init(); + } + + var target = event.target; + var overflowing = overflowingAncestor(target); + + // use default if there's no overflowing + // element or default action is prevented + // or it's a zooming event with CTRL + if (!overflowing || event.defaultPrevented || event.ctrlKey) { + return true; + } + + // leave embedded content alone (flash & pdf) + if (isNodeName(activeElement, 'embed') || + (isNodeName(target, 'embed') && /\.pdf/i.test(target.src)) || + isNodeName(activeElement, 'object')) { + return true; + } + + var deltaX = -event.wheelDeltaX || event.deltaX || 0; + var deltaY = -event.wheelDeltaY || event.deltaY || 0; + + if (isMac) { + if (event.wheelDeltaX && isDivisible(event.wheelDeltaX, 120)) { + deltaX = -120 * (event.wheelDeltaX / Math.abs(event.wheelDeltaX)); + } + if (event.wheelDeltaY && isDivisible(event.wheelDeltaY, 120)) { + deltaY = -120 * (event.wheelDeltaY / Math.abs(event.wheelDeltaY)); + } + } + + // use wheelDelta if deltaX/Y is not available + if (!deltaX && !deltaY) { + deltaY = -event.wheelDelta || 0; + } + + // line based scrolling (Firefox mostly) + if (event.deltaMode === 1) { + deltaX *= 40; + deltaY *= 40; + } + + // check if it's a touchpad scroll that should be ignored + if (!options.touchpadSupport && isTouchpad(deltaY)) { + return true; + } + + // scale by step size + // delta is 120 most of the time + // synaptics seems to send 1 sometimes + if (Math.abs(deltaX)> 1.2) { + deltaX *= options.stepSize / 120; + } + if (Math.abs(deltaY)> 1.2) { + deltaY *= options.stepSize / 120; + } + + scrollArray(overflowing, deltaX, deltaY); + event.preventDefault(); + scheduleClearCache(); +} + +/** + * Keydown event handler. + * @param {Object} event + */ +function keydown(event) { + + var target = event.target; + var modifier = event.ctrlKey || event.altKey || event.metaKey || + (event.shiftKey && event.keyCode !== key.spacebar); + + // do nothing if user is editing text + // or using a modifier key (except shift) + // or in a dropdown + // or inside interactive elements + if ( /input|textarea|select|embed|object/i.test(target.nodeName) || + isNodeName(activeElement, 'video') || + isInsideYoutubeVideo(event) || + target.isContentEditable || + event.defaultPrevented || + modifier ) { + return true; + } + + // spacebar should trigger button press + if (isNodeName(target, 'button') && + event.keyCode === key.spacebar) { + return true; + } + + var shift, x = 0, y = 0; + var elem = overflowingAncestor(activeElement); + var clientHeight = elem.clientHeight; + + if (elem == document.body) { + clientHeight = window.innerHeight; + } + + switch (event.keyCode) { + case key.up: + y = -options.arrowScroll; + break; + case key.down: + y = options.arrowScroll; + break; + case key.spacebar: // (+ shift) + shift = event.shiftKey ? 1 : -1; + y = -shift * clientHeight * 0.9; + break; + case key.pageup: + y = -clientHeight * 0.9; + break; + case key.pagedown: + y = clientHeight * 0.9; + break; + case key.home: + y = -elem.scrollTop; + break; + case key.end: + var damt = elem.scrollHeight - elem.scrollTop - clientHeight; + y = (damt> 0) ? damt+10 : 0; + break; + case key.left: + x = -options.arrowScroll; + break; + case key.right: + x = options.arrowScroll; + break; + default: + return true; // a key we don't care about + } + + scrollArray(elem, x, y); + event.preventDefault(); + scheduleClearCache(); +} + +/** + * Mousedown event only for updating activeElement + */ +function mousedown(event) { + activeElement = event.target; +} + + +/*********************************************** + * OVERFLOW + ***********************************************/ + +var uniqueID = (function () { + var i = 0; + return function (el) { + return el.uniqueID || (el.uniqueID = i++); + }; +})(); + +var cache = {}; // cleared out after a scrolling session +var clearCacheTimer; + +//setInterval(function () { cache = {}; }, 10 * 1000); + +function scheduleClearCache() { + clearTimeout(clearCacheTimer); + clearCacheTimer = setInterval(function () { cache = {}; }, 1*1000); +} + +function setCache(elems, overflowing) { + for (var i = elems.length; i--;) + cache[uniqueID(elems[i])] = overflowing; + return overflowing; +} + +function overflowingAncestor(el) { + var elems = []; + var body = document.body; + var rootScrollHeight = root.scrollHeight; + do { + var cached = cache[uniqueID(el)]; + if (cached) { + return setCache(elems, cached); + } + elems.push(el); + if (rootScrollHeight === el.scrollHeight) { + var isOverflowingIframe = (isFrame && isContentOverflowing(root)); + var isOverflowAllowedCSS = (hasOverflowCSS(body) && hasOverflowCSS(root)); + if (isOverflowingIframe || isOverflowAllowedCSS) { + return setCache(elems, getScrollRoot()); + } + } else if (isContentOverflowing(el) && hasOverflowCSS(el)) { + return setCache(elems, el); + } + } while (el = el.parentElement); +} + +function isContentOverflowing(el) { + return (el.clientHeight + 10 < el.scrollHeight); +} + +function hasOverflowCSS(el) { + var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y'); + if (el.nodeName === 'BODY' || el.nodeName === 'HTML') + return (overflow !== 'hidden'); + else + return (overflow === 'scroll' || overflow === 'auto'); +} + + +/*********************************************** + * HELPERS + ***********************************************/ + +function addEvent(type, fn, bubble) { + window.addEventListener(type, fn, (bubble||false)); +} + +function removeEvent(type, fn, bubble) { + window.removeEventListener(type, fn, (bubble||false)); +} + +function isNodeName(el, tag) { + return (el.nodeName||'').toLowerCase() === tag.toLowerCase(); +} + +function directionCheck(x, y) { + x = (x> 0) ? 1 : -1; + y = (y> 0) ? 1 : -1; + if (direction.x !== x || direction.y !== y) { + direction.x = x; + direction.y = y; + que = []; + lastScroll = 0; + } +} + +var deltaBufferTimer; + +if (window.localStorage && localStorage.SS_deltaBuffer) { + deltaBuffer = localStorage.SS_deltaBuffer.split(','); +} + +function isTouchpad(deltaY) { + if (!deltaY) return; + if (!deltaBuffer.length) { + deltaBuffer = [deltaY, deltaY, deltaY]; + } + deltaY = Math.abs(deltaY) + deltaBuffer.push(deltaY); + deltaBuffer.shift(); + clearTimeout(deltaBufferTimer); + deltaBufferTimer = setTimeout(function () { + if (window.localStorage) { + localStorage.SS_deltaBuffer = deltaBuffer.join(','); + } + }, 1000); + return !allDeltasDivisableBy(120) && !allDeltasDivisableBy(100); +} + +function isDivisible(n, divisor) { + return (Math.floor(n / divisor) == n / divisor); +} + +function allDeltasDivisableBy(divisor) { + return (isDivisible(deltaBuffer[0], divisor) && + isDivisible(deltaBuffer[1], divisor) && + isDivisible(deltaBuffer[2], divisor)); +} + +function isInsideYoutubeVideo(event) { + var elem = event.target; + var isControl = false; + if (document.URL.indexOf ('www.youtube.com/watch') != -1) { + do { + isControl = (elem.classList && + elem.classList.contains('html5-video-controls')); + if (isControl) break; + } while (elem = elem.parentNode); + } + return isControl; +} + +var requestFrame = (function () { + return (window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + function (callback, element, delay) { + window.setTimeout(callback, delay || (1000/60)); + }); +})(); + +var MutationObserver = (window.MutationObserver || + window.WebKitMutationObserver || + window.MozMutationObserver); + +var getScrollRoot = (function() { + var SCROLL_ROOT; + return function() { + if (!SCROLL_ROOT) { + var dummy = document.createElement('div'); + dummy.style.cssText = 'height:10000px;width:1px;'; + document.body.appendChild(dummy); + var bodyScrollTop = document.body.scrollTop; + var docElScrollTop = document.documentElement.scrollTop; + window.scrollBy(0, 1); + if (document.body.scrollTop != bodyScrollTop) + (SCROLL_ROOT = document.body); + else + (SCROLL_ROOT = document.documentElement); + window.scrollBy(0, -1); + document.body.removeChild(dummy); + } + return SCROLL_ROOT; + }; +})(); + + +/*********************************************** + * PULSE (by Michael Herf) + ***********************************************/ + +/** + * Viscous fluid with a pulse for part and decay for the rest. + * - Applies a fixed force over an interval (a damped acceleration), and + * - Lets the exponential bleed away the velocity over a longer interval + * - Michael Herf, http://stereopsis.com/stopping/ + */ +function pulse_(x) { + var val, start, expx; + // test + x = x * options.pulseScale; + if (x < 1) { // acceleartion + val = x - (1 - Math.exp(-x)); + } else { // tail + // the previous animation ended here: + start = Math.exp(-1); + // simple viscous drag + x -= 1; + expx = 1 - Math.exp(-x); + val = start + (expx * (1 - start)); + } + return val * options.pulseNormalize; +} + +function pulse(x) { + if (x>= 1) return 1; + if (x <= 0) return 0; + + if (options.pulseNormalize == 1) { + options.pulseNormalize /= pulse_(1); + } + return pulse_(x); +} + +var wheelEvent; +if ('onwheel' in document.createElement('div')) + wheelEvent = 'wheel'; +else if ('onmousewheel' in document.createElement('div')) + wheelEvent = 'mousewheel'; + +if (wheelEvent) { + addEvent(wheelEvent, wheel); + addEvent('mousedown', mousedown); + addEvent('load', init); +} + +})(); \ No newline at end of file diff --git a/SmoothScroll/SmoothScroll.min.js b/SmoothScroll/SmoothScroll.min.js new file mode 100644 index 0000000..bd1a1e9 --- /dev/null +++ b/SmoothScroll/SmoothScroll.min.js @@ -0,0 +1,13 @@ +// +// SmoothScroll for websites v1.3.8 (Balazs Galambosi) +// Licensed under the terms of the MIT license. +// +// You may use it in your theme if you credit me. +// It is also free to use on any individual website. +// +// Exception: +// The only restriction would be not to publish any +// extension for browsers or native application +// without getting a written permission first. +// +!function(){function n(){b.keyboardSupport&&F("keydown",v)}function o(){if(!f&&document.body){f=!0;var a=document.body,e=document.documentElement,j=window.innerHeight,k=a.scrollHeight;if(g=document.compatMode.indexOf("CSS")>=0?e:a,h=a,n(),top!=self)d=!0;else if(k>j&&(a.offsetHeight<=j||e.offsetheight<=j)){var l=!1,m=function(){l||e.scrollpx",l=!1},500))};e.style.oldHeight=e.style.height,e.style.height="auto",setTimeout(m,10);var" o={attributes:!0,childList:!0,characterData:!1};if(i=new P(m),i.observe(a,o),g.offsetHeight<=j){var p=document.createElement("div");p.style.clear="both",a.appendChild(p)}}b.fixedBackground||c||(a.style.backgroundAttachment="scroll",e.style.backgroundAttachment="scroll")}}function t(a,c,d,e){if(e||(e=1e3),I(c,d),1!=b.accelerationMax){var f=Date.now(),g=f-s;if(g1&&(h=Math.min(h,b.accelerationMax),c*=h,d*=h)}s=Date.now()}if(q.push({x:c,y:d,lastX:0>c?.99:-.99,lastY:0>d?.99:-.99,start:Date.now()}),!r){var i=a===document.body,j=function(){for(var g=Date.now(),h=0,k=0,l=0;l=b.animationTime,p=o?1:n/b.animationTime;b.pulseAlgorithm&&(p=S(p));var s=m.x*p-m.lastX>>0,t=m.y*p-m.lastY>>0;h+=s,k+=t,m.lastX+=s,m.lastY+=t,o&&(q.splice(l,1),l--)}i?window.scrollBy(h,k):(h&&(a.scrollLeft+=h),k&&(a.scrollTop+=k)),c||d||(q=[]),q.length?O(j,a,e/b.frameRate+1):r=!1};O(j,a,0),r=!0}}function u(a){f||o();var c=a.target,d=C(c);if(!d||a.defaultPrevented||a.ctrlKey)return!0;if(H(h,"embed")||H(c,"embed")&&/\.pdf/i.test(c.src)||H(h,"object"))return!0;var e=-a.wheelDeltaX||a.deltaX||0,g=-a.wheelDeltaY||a.deltaY||0;return l&&(a.wheelDeltaX&&L(a.wheelDeltaX,120)&&(e=-120*(a.wheelDeltaX/Math.abs(a.wheelDeltaX))),a.wheelDeltaY&&L(a.wheelDeltaY,120)&&(g=-120*(a.wheelDeltaY/Math.abs(a.wheelDeltaY)))),e||g||(g=-a.wheelDelta||0),1===a.deltaMode&&(e*=40,g*=40),!b.touchpadSupport&&K(g)?!0:(Math.abs(e)>1.2&&(e*=b.stepSize/120),Math.abs(g)>1.2&&(g*=b.stepSize/120),t(d,e,g),a.preventDefault(),A(),void 0)}function v(a){var c=a.target,d=a.ctrlKey||a.altKey||a.metaKey||a.shiftKey&&a.keyCode!==m.spacebar;if(/input|textarea|select|embed|object/i.test(c.nodeName)||H(h,"video")||N(a)||c.isContentEditable||a.defaultPrevented||d)return!0;if(H(c,"button")&&a.keyCode===m.spacebar)return!0;var e,f=0,g=0,i=C(h),j=i.clientHeight;switch(i==document.body&&(j=window.innerHeight),a.keyCode){case m.up:g=-b.arrowScroll;break;case m.down:g=b.arrowScroll;break;case m.spacebar:e=a.shiftKey?1:-1,g=.9*-e*j;break;case m.pageup:g=.9*-j;break;case m.pagedown:g=.9*j;break;case m.home:g=-i.scrollTop;break;case m.end:var k=i.scrollHeight-i.scrollTop-j;g=k>0?k+10:0;break;case m.left:f=-b.arrowScroll;break;case m.right:f=b.arrowScroll;break;default:return!0}t(i,f,g),a.preventDefault(),A()}function w(a){h=a.target}function A(){clearTimeout(z),z=setInterval(function(){y={}},1e3)}function B(a,b){for(var c=a.length;c--;)y[x(a[c])]=b;return b}function C(a){var b=[],c=document.body,e=g.scrollHeight;do{var f=y[x(a)];if(f)return B(b,f);if(b.push(a),e===a.scrollHeight){var h=d&&D(g),i=E(c)&&E(g);if(h||i)return B(b,Q())}else if(D(a)&&E(a))return B(b,a)}while(a=a.parentElement)}function D(a){return a.clientHeight+100?1:-1,b=b>0?1:-1,(e.x!==a||e.y!==b)&&(e.x=a,e.y=b,q=[],s=0)}function K(a){return a?(j.length||(j=[a,a,a]),a=Math.abs(a),j.push(a),j.shift(),clearTimeout(J),J=setTimeout(function(){window.localStorage&&(localStorage.SS_deltaBuffer=j.join(","))},1e3),!M(120)&&!M(100)):void 0}function L(a,b){return Math.floor(a/b)==a/b}function M(a){return L(j[0],a)&&L(j[1],a)&&L(j[2],a)}function N(a){var b=a.target,c=!1;if(-1!=document.URL.indexOf("www.youtube.com/watch"))do if(c=b.classList&&b.classList.contains("html5-video-controls"))break;while(b=b.parentNode);return c}function R(a){var c,d,e;return a*=b.pulseScale,1>a?c=a-(1-Math.exp(-a)):(d=Math.exp(-1),a-=1,e=1-Math.exp(-a),c=d+e*(1-d)),c*b.pulseNormalize}function S(a){return a>=1?1:0>=a?0:(1==b.pulseNormalize&&(b.pulseNormalize/=R(1)),R(a))}var h,i,z,J,a={frameRate:150,animationTime:400,stepSize:120,pulseAlgorithm:!0,pulseScale:8,pulseNormalize:1,accelerationDelta:20,accelerationMax:1,keyboardSupport:!0,arrowScroll:50,touchpadSupport:!0,fixedBackground:!0,excluded:""},b=a,c=!1,d=!1,e={x:0,y:0},f=!1,g=document.documentElement,j=[],l=/^Mac/.test(navigator.platform),m={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36},b=a,q=[],r=!1,s=Date.now(),x=function(){var a=0;return function(b){return b.uniqueID||(b.uniqueID=a++)}}(),y={};window.localStorage&&localStorage.SS_deltaBuffer&&(j=localStorage.SS_deltaBuffer.split(","));var T,O=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a,b,c){window.setTimeout(a,c||1e3/60)}}(),P=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,Q=function(){var a;return function(){if(!a){var b=document.createElement("div");b.style.cssText="height:10000px;width:1px;",document.body.appendChild(b);var c=document.body.scrollTop;document.documentElement.scrollTop,window.scrollBy(0,1),a=document.body.scrollTop!=c?document.body:document.documentElement,window.scrollBy(0,-1),document.body.removeChild(b)}return a}}();"onwheel"in document.createElement("div")?T="wheel":"onmousewheel"in document.createElement("div")&&(T="mousewheel"),T&&(F(T,u),F("mousedown",w),F("load",o))}(); \ No newline at end of file diff --git a/config/.vimrc b/config/.vimrc new file mode 100644 index 0000000..c9e188d --- /dev/null +++ b/config/.vimrc @@ -0,0 +1,16 @@ +filetype on +syntax on +set number +set history=1000 +set background=dark +set wrapscan +set autoindent +set smartindent +set tabstop=4 +set shiftwidth=4 +set showmatch +set showmode +set guioptions-=T +set ruler +set hlsearch +set incsearch \ No newline at end of file diff --git a/config/.zshrc b/config/.zshrc new file mode 100644 index 0000000..3cc0c04 --- /dev/null +++ b/config/.zshrc @@ -0,0 +1,99 @@ +# Path to your oh-my-zsh installation. +export ZSH=/Users/maicong/.oh-my-zsh +## export ZSH=/root/.oh-my-zsh +export all_proxy='socks5://127.0.0.1:1080' +# Set name of the theme to load. +# Look in ~/.oh-my-zsh/themes/ +# Optionally, if you set this to "random", it'll load a random theme each +# time that oh-my-zsh is loaded. +ZSH_THEME="robbyrussell" +#ZSH_THEME="aussiegeek" +#ZSH_THEME="xxf" +#ZSH_THEME="agnoster" + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. Case +# sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(autojump brew brew-cask colored-man-pages command-not-found common-aliases composer copydir copyfile cp emoji emoji-clock encode64 fancy-ctrl-z git gitfast git-extras git-flow github git-hubflow gitignore git-prompt git-remote-branch grunt history history-substring-search jsontools jump man mix mix-fast node npm osx python svn sublime terminalapp thefuck urltools vim-interaction vi-mode zsh-autosuggestions zsh-completions zsh-syntax-highlighting zsh-navigation-tools) + +#autoload -U compinit && compinit + +# User configuration + +export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" +# export MANPATH="/usr/local/man:$MANPATH" + +source $ZSH/oh-my-zsh.sh + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# ssh +# export SSH_KEY_PATH="~/.ssh/dsa_id" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +alias fuck='$(thefuck $(fc -ln -1 | tail -n 1)); fc -R' +alias cnpm="npm --registry=https://registry.npm.taobao.org --cache=$HOME/.npm/.cache/cnpm --disturl=https://npm.taobao.org/dist --userconfig=$HOME/.cnpmrc" + +source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +export PATH="$(brew --prefix homebrew/php/php70)/bin:/usr/local/sbin:$PATH" + +[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh +## [[ -s /root/.autojump/etc/profile.d/autojump.sh ]] && source /root/.autojump/etc/profile.d/autojump.sh diff --git a/iptables2 b/iptables2 new file mode 100644 index 0000000..3f15a0d --- /dev/null +++ b/iptables2 @@ -0,0 +1,28 @@ +*filter + +:INPUT DROP [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:syn-flood - [0:0] +-A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN +-A syn-flood -j REJECT --reject-with icmp-port-unreachable +-A INPUT -i lo -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT +-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT +-A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT +-A INPUT -p icmp -m limit --limit 1/sec --limit-burst 10 -j ACCEPT +-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood +-A INPUT -p tcp --syn -m limit --limit 12/s --limit-burst 24 -j ACCEPT +-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7 +-A INPUT -j REJECT --reject-with icmp-host-prohibited +-A OUTPUT -j ACCEPT +-A FORWARD -j REJECT --reject-with icmp-host-prohibited +-A FORWARD -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m limit --limit 20/sec --limit-burst 200 -j ACCEPT +-A FORWARD -p icmp -m icmp --icmp-type 8 -m limit --limit 1/sec -j ACCEPT +-A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT +-A FORWARD -f -m limit --limit 100/sec --limit-burst 100 -j ACCEPT +-A INPUT -j DROP +-A FORWARD -j DROP + +COMMIT diff --git a/jquery_lazyload/README.md b/jquery_lazyload/README.md new file mode 100644 index 0000000..c5d9d1b --- /dev/null +++ b/jquery_lazyload/README.md @@ -0,0 +1,22 @@ +# jQuery Lazy Load - Modified by MaiCong + +## 说明 + +配置项增加 `broken_pic`,如果原始图片加载错误则使用 `broken_pic` 定义的图片 + +需要和 `jquery.imagesloaded.js` 配合使用 + +例如: + +``` +$("img.lazy").lazyload({ + effect: 'fadeIn', + broken_pic: '//xxx.com/images/broken_pic.jpg' +}); +``` + +## License + +see: https://github.com/desandro/imagesloaded + +see: https://github.com/tuupola/jquery_lazyload diff --git a/jquery_lazyload/jquery.imagesloaded.js b/jquery_lazyload/jquery.imagesloaded.js new file mode 100644 index 0000000..380c2ea --- /dev/null +++ b/jquery_lazyload/jquery.imagesloaded.js @@ -0,0 +1,893 @@ +/*! + * imagesLoaded PACKAGED v3.1.8 + * JavaScript is all like "You images are done yet or what?" + * MIT License + */ + + +/*! + * EventEmitter v4.2.6 - git.io/ee + * Oliver Caldwell + * MIT license + * @preserve + */ + +(function () { + + + /** + * Class for managing events. + * Can be extended to provide event functionality in other classes. + * + * @class EventEmitter Manages event registering and emitting. + */ + function EventEmitter() {} + + // Shortcuts to improve speed and size + var proto = EventEmitter.prototype; + var exports = this; + var originalGlobalValue = exports.EventEmitter; + + /** + * Finds the index of the listener for the event in it's storage array. + * + * @param {Function[]} listeners Array of listeners to search through. + * @param {Function} listener Method to look for. + * @return {Number} Index of the specified listener, -1 if not found + * @api private + */ + function indexOfListener(listeners, listener) { + var i = listeners.length; + while (i--) { + if (listeners[i].listener === listener) { + return i; + } + } + + return -1; + } + + /** + * Alias a method while keeping the context correct, to allow for overwriting of target method. + * + * @param {String} name The name of the target method. + * @return {Function} The aliased method + * @api private + */ + function alias(name) { + return function aliasClosure() { + return this[name].apply(this, arguments); + }; + } + + /** + * Returns the listener array for the specified event. + * Will initialise the event object and listener arrays if required. + * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. + * Each property in the object response is an array of listener functions. + * + * @param {String|RegExp} evt Name of the event to return the listeners from. + * @return {Function[]|Object} All listener functions for the event. + */ + proto.getListeners = function getListeners(evt) { + var events = this._getEvents(); + var response; + var key; + + // Return a concatenated array of all matching events if + // the selector is a regular expression. + if (typeof evt === 'object') { + response = {}; + for (key in events) { + if (events.hasOwnProperty(key) && evt.test(key)) { + response[key] = events[key]; + } + } + } + else { + response = events[evt] || (events[evt] = []); + } + + return response; + }; + + /** + * Takes a list of listener objects and flattens it into a list of listener functions. + * + * @param {Object[]} listeners Raw listener objects. + * @return {Function[]} Just the listener functions. + */ + proto.flattenListeners = function flattenListeners(listeners) { + var flatListeners = []; + var i; + + for (i = 0; i < listeners.length; i += 1) { + flatListeners.push(listeners[i].listener); + } + + return flatListeners; + }; + + /** + * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. + * + * @param {String|RegExp} evt Name of the event to return the listeners from. + * @return {Object} All listener functions for an event in an object. + */ + proto.getListenersAsObject = function getListenersAsObject(evt) { + var listeners = this.getListeners(evt); + var response; + + if (listeners instanceof Array) { + response = {}; + response[evt] = listeners; + } + + return response || listeners; + }; + + /** + * Adds a listener function to the specified event. + * The listener will not be added if it is a duplicate. + * If the listener returns true then it will be removed after it is called. + * If you pass a regular expression as the event name then the listener will be added to all events that match it. + * + * @param {String|RegExp} evt Name of the event to attach the listener to. + * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.addListener = function addListener(evt, listener) { + var listeners = this.getListenersAsObject(evt); + var listenerIsWrapped = typeof listener === 'object'; + var key; + + for (key in listeners) { + if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { + listeners[key].push(listenerIsWrapped ? listener : { + listener: listener, + once: false + }); + } + } + + return this; + }; + + /** + * Alias of addListener + */ + proto.on = alias('addListener'); + + /** + * Semi-alias of addListener. It will add a listener that will be + * automatically removed after it's first execution. + * + * @param {String|RegExp} evt Name of the event to attach the listener to. + * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.addOnceListener = function addOnceListener(evt, listener) { + return this.addListener(evt, { + listener: listener, + once: true + }); + }; + + /** + * Alias of addOnceListener. + */ + proto.once = alias('addOnceListener'); + + /** + * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. + * You need to tell it what event names should be matched by a regex. + * + * @param {String} evt Name of the event to create. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.defineEvent = function defineEvent(evt) { + this.getListeners(evt); + return this; + }; + + /** + * Uses defineEvent to define multiple events. + * + * @param {String[]} evts An array of event names to define. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.defineEvents = function defineEvents(evts) { + for (var i = 0; i < evts.length; i += 1) { + this.defineEvent(evts[i]); + } + return this; + }; + + /** + * Removes a listener function from the specified event. + * When passed a regular expression as the event name, it will remove the listener from all events that match it. + * + * @param {String|RegExp} evt Name of the event to remove the listener from. + * @param {Function} listener Method to remove from the event. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.removeListener = function removeListener(evt, listener) { + var listeners = this.getListenersAsObject(evt); + var index; + var key; + + for (key in listeners) { + if (listeners.hasOwnProperty(key)) { + index = indexOfListener(listeners[key], listener); + + if (index !== -1) { + listeners[key].splice(index, 1); + } + } + } + + return this; + }; + + /** + * Alias of removeListener + */ + proto.off = alias('removeListener'); + + /** + * Adds listeners in bulk using the manipulateListeners method. + * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. + * You can also pass it a regular expression to add the array of listeners to all events that match it. + * Yeah, this function does quite a bit. That's probably a bad thing. + * + * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. + * @param {Function[]} [listeners] An optional array of listener functions to add. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.addListeners = function addListeners(evt, listeners) { + // Pass through to manipulateListeners + return this.manipulateListeners(false, evt, listeners); + }; + + /** + * Removes listeners in bulk using the manipulateListeners method. + * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. + * You can also pass it an event name and an array of listeners to be removed. + * You can also pass it a regular expression to remove the listeners from all events that match it. + * + * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. + * @param {Function[]} [listeners] An optional array of listener functions to remove. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.removeListeners = function removeListeners(evt, listeners) { + // Pass through to manipulateListeners + return this.manipulateListeners(true, evt, listeners); + }; + + /** + * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. + * The first argument will determine if the listeners are removed (true) or added (false). + * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. + * You can also pass it an event name and an array of listeners to be added/removed. + * You can also pass it a regular expression to manipulate the listeners of all events that match it. + * + * @param {Boolean} remove True if you want to remove listeners, false if you want to add. + * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. + * @param {Function[]} [listeners] An optional array of listener functions to add/remove. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { + var i; + var value; + var single = remove ? this.removeListener : this.addListener; + var multiple = remove ? this.removeListeners : this.addListeners; + + // If evt is an object then pass each of it's properties to this method + if (typeof evt === 'object' && !(evt instanceof RegExp)) { + for (i in evt) { + if (evt.hasOwnProperty(i) && (value = evt[i])) { + // Pass the single listener straight through to the singular method + if (typeof value === 'function') { + single.call(this, i, value); + } + else { + // Otherwise pass back to the multiple function + multiple.call(this, i, value); + } + } + } + } + else { + // So evt must be a string + // And listeners must be an array of listeners + // Loop over it and pass each one to the multiple method + i = listeners.length; + while (i--) { + single.call(this, evt, listeners[i]); + } + } + + return this; + }; + + /** + * Removes all listeners from a specified event. + * If you do not specify an event then all listeners will be removed. + * That means every event will be emptied. + * You can also pass a regex to remove all events that match it. + * + * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.removeEvent = function removeEvent(evt) { + var type = typeof evt; + var events = this._getEvents(); + var key; + + // Remove different things depending on the state of evt + if (type === 'string') { + // Remove all listeners for the specified event + delete events[evt]; + } + else if (type === 'object') { + // Remove all events matching the regex. + for (key in events) { + if (events.hasOwnProperty(key) && evt.test(key)) { + delete events[key]; + } + } + } + else { + // Remove all listeners in all events + delete this._events; + } + + return this; + }; + + /** + * Alias of removeEvent. + * + * Added to mirror the node API. + */ + proto.removeAllListeners = alias('removeEvent'); + + /** + * Emits an event of your choice. + * When emitted, every listener attached to that event will be executed. + * If you pass the optional argument array then those arguments will be passed to every listener upon execution. + * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. + * So they will not arrive within the array on the other side, they will be separate. + * You can also pass a regular expression to emit to all events that match it. + * + * @param {String|RegExp} evt Name of the event to emit and execute listeners for. + * @param {Array} [args] Optional array of arguments to be passed to each listener. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.emitEvent = function emitEvent(evt, args) { + var listeners = this.getListenersAsObject(evt); + var listener; + var i; + var key; + var response; + + for (key in listeners) { + if (listeners.hasOwnProperty(key)) { + i = listeners[key].length; + + while (i--) { + // If the listener returns true then it shall be removed from the event + // The function is executed either with a basic call or an apply if there is an args array + listener = listeners[key][i]; + + if (listener.once === true) { + this.removeListener(evt, listener.listener); + } + + response = listener.listener.apply(this, args || []); + + if (response === this._getOnceReturnValue()) { + this.removeListener(evt, listener.listener); + } + } + } + } + + return this; + }; + + /** + * Alias of emitEvent + */ + proto.trigger = alias('emitEvent'); + + /** + * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. + * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. + * + * @param {String|RegExp} evt Name of the event to emit and execute listeners for. + * @param {...*} Optional additional arguments to be passed to each listener. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.emit = function emit(evt) { + var args = Array.prototype.slice.call(arguments, 1); + return this.emitEvent(evt, args); + }; + + /** + * Sets the current value to check against when executing listeners. If a + * listeners return value matches the one set here then it will be removed + * after execution. This value defaults to true. + * + * @param {*} value The new value to check for when executing listeners. + * @return {Object} Current instance of EventEmitter for chaining. + */ + proto.setOnceReturnValue = function setOnceReturnValue(value) { + this._onceReturnValue = value; + return this; + }; + + /** + * Fetches the current value to check against when executing listeners. If + * the listeners return value matches this one then it should be removed + * automatically. It will return true by default. + * + * @return {*|Boolean} The current value to check for or the default, true. + * @api private + */ + proto._getOnceReturnValue = function _getOnceReturnValue() { + if (this.hasOwnProperty('_onceReturnValue')) { + return this._onceReturnValue; + } + else { + return true; + } + }; + + /** + * Fetches the events object and creates one if required. + * + * @return {Object} The events storage object. + * @api private + */ + proto._getEvents = function _getEvents() { + return this._events || (this._events = {}); + }; + + /** + * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. + * + * @return {Function} Non conflicting EventEmitter class. + */ + EventEmitter.noConflict = function noConflict() { + exports.EventEmitter = originalGlobalValue; + return EventEmitter; + }; + + // Expose the class either via AMD, CommonJS or the global object + if (typeof define === 'function' && define.amd) { + define('eventEmitter/EventEmitter',[],function () { + return EventEmitter; + }); + } + else if (typeof module === 'object' && module.exports){ + module.exports = EventEmitter; + } + else { + this.EventEmitter = EventEmitter; + } +}.call(this)); + +/*! + * eventie v1.0.4 + * event binding helper + * eventie.bind( elem, 'click', myFn ) + * eventie.unbind( elem, 'click', myFn ) + */ + +/*jshint browser: true, undef: true, unused: true */ +/*global define: false */ + +( function( window ) { + + + +var docElem = document.documentElement; + +var bind = function() {}; + +function getIEEvent( obj ) { + var event = window.event; + // add event.target + event.target = event.target || event.srcElement || obj; + return event; +} + +if ( docElem.addEventListener ) { + bind = function( obj, type, fn ) { + obj.addEventListener( type, fn, false ); + }; +} else if ( docElem.attachEvent ) { + bind = function( obj, type, fn ) { + obj[ type + fn ] = fn.handleEvent ? + function() { + var event = getIEEvent( obj ); + fn.handleEvent.call( fn, event ); + } : + function() { + var event = getIEEvent( obj ); + fn.call( obj, event ); + }; + obj.attachEvent( "on" + type, obj[ type + fn ] ); + }; +} + +var unbind = function() {}; + +if ( docElem.removeEventListener ) { + unbind = function( obj, type, fn ) { + obj.removeEventListener( type, fn, false ); + }; +} else if ( docElem.detachEvent ) { + unbind = function( obj, type, fn ) { + obj.detachEvent( "on" + type, obj[ type + fn ] ); + try { + delete obj[ type + fn ]; + } catch ( err ) { + // can't delete window object properties + obj[ type + fn ] = undefined; + } + }; +} + +var eventie = { + bind: bind, + unbind: unbind +}; + +// transport +if ( typeof define === 'function' && define.amd ) { + // AMD + define( 'eventie/eventie',eventie ); +} else { + // browser global + window.eventie = eventie; +} + +})( this ); + +/*! + * imagesLoaded v3.1.8 + * JavaScript is all like "You images are done yet or what?" + * MIT License + */ + +( function( window, factory ) { + // universal module definition + + /*global define: false, module: false, require: false */ + + if ( typeof define === 'function' && define.amd ) { + // AMD + define( [ + 'eventEmitter/EventEmitter', + 'eventie/eventie' + ], function( EventEmitter, eventie ) { + return factory( window, EventEmitter, eventie ); + }); + } else if ( typeof exports === 'object' ) { + // CommonJS + module.exports = factory( + window, + require('wolfy87-eventemitter'), + require('eventie') + ); + } else { + // browser global + window.imagesLoaded = factory( + window, + window.EventEmitter, + window.eventie + ); + } + +})( window, + +// -------------------------- factory -------------------------- // + +function factory( window, EventEmitter, eventie ) { + + + +var $ = window.jQuery; +var console = window.console; +var hasConsole = typeof console !== 'undefined'; + +// -------------------------- helpers -------------------------- // + +// extend objects +function extend( a, b ) { + for ( var prop in b ) { + a[ prop ] = b[ prop ]; + } + return a; +} + +var objToString = Object.prototype.toString; +function isArray( obj ) { + return objToString.call( obj ) === '[object Array]'; +} + +// turn element or nodeList into an array +function makeArray( obj ) { + var ary = []; + if ( isArray( obj ) ) { + // use object if already an array + ary = obj; + } else if ( typeof obj.length === 'number' ) { + // convert nodeList to array + for ( var i=0, len = obj.length; i < len; i++ ) { + ary.push( obj[i] ); + } + } else { + // array of single index + ary.push( obj ); + } + return ary; +} + + // -------------------------- imagesLoaded -------------------------- // + + /** + * @param {Array, Element, NodeList, String} elem + * @param {Object or Function} options - if function, use as callback + * @param {Function} onAlways - callback function + */ + function ImagesLoaded( elem, options, onAlways ) { + // coerce ImagesLoaded() without new, to be new ImagesLoaded() + if ( !( this instanceof ImagesLoaded ) ) { + return new ImagesLoaded( elem, options ); + } + // use elem as selector string + if ( typeof elem === 'string' ) { + elem = document.querySelectorAll( elem ); + } + + this.elements = makeArray( elem ); + this.options = extend( {}, this.options ); + + if ( typeof options === 'function' ) { + onAlways = options; + } else { + extend( this.options, options ); + } + + if ( onAlways ) { + this.on( 'always', onAlways ); + } + + this.getImages(); + + if ( $ ) { + // add jQuery Deferred object + this.jqDeferred = new $.Deferred(); + } + + // HACK check async to allow time to bind listeners + var _this = this; + setTimeout( function() { + _this.check(); + }); + } + + ImagesLoaded.prototype = new EventEmitter(); + + ImagesLoaded.prototype.options = {}; + + ImagesLoaded.prototype.getImages = function() { + this.images = []; + + // filter & find items if we have an item selector + for ( var i=0, len = this.elements.length; i < len; i++ ) { + var elem = this.elements[i]; + // filter siblings + if ( elem.nodeName === 'IMG' ) { + this.addImage( elem ); + } + // find children + // no non-element nodes, #143 + var nodeType = elem.nodeType; + if ( !nodeType || !( nodeType === 1 || nodeType === 9 || nodeType === 11 ) ) { + continue; + } + var childElems = elem.querySelectorAll('img'); + // concat childElems to filterFound array + for ( var j=0, jLen = childElems.length; j < jLen; j++ ) { + var img = childElems[j]; + this.addImage( img ); + } + } + }; + + /** + * @param {Image} img + */ + ImagesLoaded.prototype.addImage = function( img ) { + var loadingImage = new LoadingImage( img ); + this.images.push( loadingImage ); + }; + + ImagesLoaded.prototype.check = function() { + var _this = this; + var checkedCount = 0; + var length = this.images.length; + this.hasAnyBroken = false; + // complete if no images + if ( !length ) { + this.complete(); + return; + } + + function onConfirm( image, message ) { + if ( _this.options.debug && hasConsole ) { + console.log( 'confirm', image, message ); + } + + _this.progress( image ); + checkedCount++; + if ( checkedCount === length ) { + _this.complete(); + } + return true; // bind once + } + + for ( var i=0; i < length; i++ ) { + var loadingImage = this.images[i]; + loadingImage.on( 'confirm', onConfirm ); + loadingImage.check(); + } + }; + + ImagesLoaded.prototype.progress = function( image ) { + this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; + // HACK - Chrome triggers event before object properties have changed. #83 + var _this = this; + setTimeout( function() { + _this.emit( 'progress', _this, image ); + if ( _this.jqDeferred && _this.jqDeferred.notify ) { + _this.jqDeferred.notify( _this, image ); + } + }); + }; + + ImagesLoaded.prototype.complete = function() { + var eventName = this.hasAnyBroken ? 'fail' : 'done'; + this.isComplete = true; + var _this = this; + // HACK - another setTimeout so that confirm happens after progress + setTimeout( function() { + _this.emit( eventName, _this ); + _this.emit( 'always', _this ); + if ( _this.jqDeferred ) { + var jqMethod = _this.hasAnyBroken ? 'reject' : 'resolve'; + _this.jqDeferred[ jqMethod ]( _this ); + } + }); + }; + + // -------------------------- jquery -------------------------- // + + if ( $ ) { + $.fn.imagesLoaded = function( options, callback ) { + var instance = new ImagesLoaded( this, options, callback ); + return instance.jqDeferred.promise( $(this) ); + }; + } + + + // -------------------------- -------------------------- // + + function LoadingImage( img ) { + this.img = img; + } + + LoadingImage.prototype = new EventEmitter(); + + LoadingImage.prototype.check = function() { + // first check cached any previous images that have same src + var resource = cache[ this.img.src ] || new Resource( this.img.src ); + if ( resource.isConfirmed ) { + this.confirm( resource.isLoaded, 'cached was confirmed' ); + return; + } + + // If complete is true and browser supports natural sizes, + // try to check for image status manually. + if ( this.img.complete && this.img.naturalWidth !== undefined ) { + // report based on naturalWidth + this.confirm( this.img.naturalWidth !== 0, 'naturalconfirm', function( resrc, message ) { + _this.confirm( resrc.isLoaded, message ); + return true; + }); + + resource.check(); + }; + + LoadingImage.prototype.confirm = function( isLoaded, message ) { + this.isLoaded = isLoaded; + this.emit( 'confirm', this, message ); + }; + + // -------------------------- Resource -------------------------- // + + // Resource checks each src, only once + // separate class from LoadingImage to prevent memory leaks. See #115 + + var cache = {}; + + function Resource( src ) { + this.src = src; + // add to cache + cache[ src ] = this; + } + + Resource.prototype = new EventEmitter(); + + Resource.prototype.check = function() { + // only trigger checking once + if ( this.isChecked ) { + return; + } + // simulate loading on detached element + var proxyImage = new Image(); + eventie.bind( proxyImage, 'load', this ); + eventie.bind( proxyImage, 'error', this ); + proxyImage.src = this.src; + // set flag + this.isChecked = true; + }; + + // ----- events ----- // + + // trigger specified handler for event type + Resource.prototype.handleEvent = function( event ) { + var method = 'on' + event.type; + if ( this[ method ] ) { + this[ method ]( event ); + } + }; + + Resource.prototype.onload = function( event ) { + this.confirm( true, 'onload' ); + this.unbindProxyEvents( event ); + }; + + Resource.prototype.onerror = function( event ) { + this.confirm( false, 'onerror' ); + this.unbindProxyEvents( event ); + }; + + // ----- confirm ----- // + + Resource.prototype.confirm = function( isLoaded, message ) { + this.isConfirmed = true; + this.isLoaded = isLoaded; + this.emit( 'confirm', this, message ); + }; + + Resource.prototype.unbindProxyEvents = function( event ) { + eventie.unbind( event.target, 'load', this ); + eventie.unbind( event.target, 'error', this ); + }; + + // ----- ----- // + + return ImagesLoaded; + +}); diff --git a/jquery_lazyload/jquery.imagesloaded.min.js b/jquery_lazyload/jquery.imagesloaded.min.js new file mode 100644 index 0000000..d66f658 --- /dev/null +++ b/jquery_lazyload/jquery.imagesloaded.min.js @@ -0,0 +1,7 @@ +/*! + * imagesLoaded PACKAGED v3.1.8 + * JavaScript is all like "You images are done yet or what?" + * MIT License + */ + +(function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("wolfy87-eventemitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(window,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function f(e){this.img=e}function c(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),f.prototype=new t,f.prototype.check=function(){var e=v[this.img.src]||new c(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return c.prototype=new t,c.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},c.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s}); \ No newline at end of file diff --git a/jquery_lazyload/jquery.lazyload.js b/jquery_lazyload/jquery.lazyload.js new file mode 100644 index 0000000..8ee92c9 --- /dev/null +++ b/jquery_lazyload/jquery.lazyload.js @@ -0,0 +1,253 @@ +/*! + * Lazy Load - jQuery plugin for lazy loading images + * + * Copyright (c) 2007-2015 Mika Tuupola + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + * + * Project home: + * http://www.appelsiini.net/projects/lazyload + * + * Version: 1.9.5 + * + * + * Modified: MaiCong + * https://github.com/maicong/OpenAPI/tree/master/jquery_lazyload + */ + +(function(,ドル window, document, undefined) { + var $window = $(window); + + $.fn.lazyload = function(options) { + var elements = this; + var $container; + var settings = { + threshold : 0, + failure_limit : 0, + event : "scroll", + effect : "show", + container : window, + data_attribute : "original", + skip_invisible : false, + appear : null, + load : null, + broken_pic : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=", + placeholder : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2O8e/fufwAIzgOYrS4BDgAAAABJRU5ErkJggg==" + }; + + function update() { + var counter = 0; + + elements.each(function() { + var $this = $(this); + if (settings.skip_invisible && !$this.is(":visible")) { + return; + } + if ($.abovethetop(this, settings) || + $.leftofbegin(this, settings)) { + /* Nothing. */ + } else if (!$.belowthefold(this, settings) && + !$.rightoffold(this, settings)) { + $this.trigger("appear"); + /* if we found an image we'll load, reset the counter */ + counter = 0; + } else { + if (++counter> settings.failure_limit) { + return false; + } + } + }); + + } + + if(options) { + /* Maintain BC for a couple of versions. */ + if (undefined !== options.failurelimit) { + options.failure_limit = options.failurelimit; + delete options.failurelimit; + } + if (undefined !== options.effectspeed) { + options.effect_speed = options.effectspeed; + delete options.effectspeed; + } + + $.extend(settings, options); + } + + if (!$.isFunction($.fn.imagesLoaded)) { + throw new Error('This JavaScript requires jQuery ImagesLoaded'); + } + + /* Cache container as jQuery as object. */ + $container = (settings.container === undefined || + settings.container === window) ? $window : $(settings.container); + + /* Fire one scroll event per scroll. Not one scroll event per image. */ + if (0 === settings.event.indexOf("scroll")) { + $container.bind(settings.event, function() { + return update(); + }); + } + + this.each(function() { + var self = this; + var $self = $(self); + + self.loaded = false; + + /* If no src attribute given use data:uri. */ + if ($self.attr("src") === undefined || $self.attr("src") === false) { + if ($self.is("img")) { + $self.attr("src", settings.placeholder); + } + } + + /* When appear is triggered load original image. */ + $self.one("appear", function() { + if (!this.loaded) { + if (settings.appear) { + var elements_left = elements.length; + settings.appear.call(self, elements_left, settings); + } + $("").on("load", function() { + var original = $self.attr("data-" + settings.data_attribute); + $self.hide(); + if ($self.is("img")) { + $self.attr("src", original); + } else { + $self.css("background-image", "url('" + original + "')"); + } + $self[settings.effect](settings.effect_speed); + + self.loaded = true; + + /* Remove image from array so it is not looped next time. */ + var temp = $.grep(elements, function(element) { + return !element.loaded; + }); + elements = $(temp); + + if (settings.load) { + var elements_left = elements.length; + settings.load.call(self, elements_left, settings); + } + }) + .attr("src", $self.attr("data-" + settings.data_attribute)) + .imagesLoaded(function() { + if (this.hasAnyBroken){ + $self.attr("src", settings.broken_pic); + } + }); + } + }); + + /* When wanted event is triggered load original image */ + /* by triggering appear. */ + if (0 !== settings.event.indexOf("scroll")) { + $self.bind(settings.event, function() { + if (!self.loaded) { + $self.trigger("appear"); + } + }); + } + }); + + /* Check if something appears when window is resized. */ + $window.bind("resize", function() { + update(); + }); + + /* With IOS5 force loading images when navigating with back button. */ + /* Non optimal workaround. */ + if ((/(?:iphone|ipod|ipad).*os 5/gi).test(navigator.appVersion)) { + $window.bind("pageshow", function(event) { + if (event.originalEvent && event.originalEvent.persisted) { + elements.each(function() { + $(this).trigger("appear"); + }); + } + }); + } + + /* Force initial check if images should appear. */ + $(document).ready(function() { + update(); + }); + + return this; + }; + + /* Convenience methods in jQuery namespace. */ + /* Use as $.belowthefold(element, {threshold : 100, container : window}) */ + + $.belowthefold = function(element, settings) { + var fold; + + if (settings.container === undefined || settings.container === window) { + fold = (window.innerHeight ? window.innerHeight : $window.height()) + $window.scrollTop(); + } else { + fold = $(settings.container).offset().top + $(settings.container).height(); + } + + return fold <= $(element).offset().top - settings.threshold; + }; + + $.rightoffold = function(element, settings) { + var fold; + + if (settings.container === undefined || settings.container === window) { + fold = $window.width() + $window.scrollLeft(); + } else { + fold = $(settings.container).offset().left + $(settings.container).width(); + } + + return fold <= $(element).offset().left - settings.threshold; + }; + + $.abovethetop = function(element, settings) { + var fold; + + if (settings.container === undefined || settings.container === window) { + fold = $window.scrollTop(); + } else { + fold = $(settings.container).offset().top; + } + + return fold>= $(element).offset().top + settings.threshold + $(element).height(); + }; + + $.leftofbegin = function(element, settings) { + var fold; + + if (settings.container === undefined || settings.container === window) { + fold = $window.scrollLeft(); + } else { + fold = $(settings.container).offset().left; + } + + return fold>= $(element).offset().left + settings.threshold + $(element).width(); + }; + + $.inviewport = function(element, settings) { + return !$.rightoffold(element, settings) && !$.leftofbegin(element, settings) && + !$.belowthefold(element, settings) && !$.abovethetop(element, settings); + }; + + /* Custom selectors for your convenience. */ + /* Use as $("img:below-the-fold").something() or */ + /* $("img").filter(":below-the-fold").something() which is faster */ + + $.extend($.expr[":"], { + "below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0}); }, + "above-the-top" : function(a) { return !$.belowthefold(a, {threshold : 0}); }, + "right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0}); }, + "left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0}); }, + "in-viewport" : function(a) { return $.inviewport(a, {threshold : 0}); }, + /* Maintain BC for couple of versions. */ + "above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0}); }, + "right-of-fold" : function(a) { return $.rightoffold(a, {threshold : 0}); }, + "left-of-fold" : function(a) { return !$.rightoffold(a, {threshold : 0}); } + }); + +})(jQuery, window, document); diff --git a/jquery_lazyload/jquery.lazyload.min.js b/jquery_lazyload/jquery.lazyload.min.js new file mode 100644 index 0000000..e6a878f --- /dev/null +++ b/jquery_lazyload/jquery.lazyload.min.js @@ -0,0 +1 @@ +!function(e,t,i,o){var r=e(t);e.fn.lazyload=function(n){function a(){var t=0;l.each(function(){var i=e(this);if(!d.skip_invisible||i.is(":visible"))if(e.abovethetop(this,d)||e.leftofbegin(this,d));else if(e.belowthefold(this,d)||e.rightoffold(this,d)){if(++t>d.failure_limit)return!1}else i.trigger("appear"),t=0})}var f,l=this,d={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:t,data_attribute:"original",skip_invisible:!1,appear:null,load:null,broken_pic:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2O8e/fufwAIzgOYrS4BDgAAAABJRU5ErkJggg=="};if(n&&(o!==n.failurelimit&&(n.failure_limit=n.failurelimit,delete n.failurelimit),o!==n.effectspeed&&(n.effect_speed=n.effectspeed,delete n.effectspeed),e.extend(d,n)),!e.isFunction(e.fn.imagesLoaded))throw new Error("This JavaScript requires jQuery ImagesLoaded");return f=d.container===o||d.container===t?r:e(d.container),0===d.event.indexOf("scroll")&&f.bind(d.event,function(){return a()}),this.each(function(){var t=this,i=e(t);t.loaded=!1,(i.attr("src")===o||i.attr("src")===!1)&&i.is("img")&&i.attr("src",d.placeholder),i.one("appear",function(){if(!this.loaded){if(d.appear){var o=l.length;d.appear.call(t,o,d)}e("").on("load",function(){var o=i.attr("data-"+d.data_attribute);i.hide(),i.is("img")?i.attr("src",o):i.css("background-image","url('"+o+"')"),i[d.effect](d.effect_speed),t.loaded=!0;var r=e.grep(l,function(e){return!e.loaded});if(l=e(r),d.load){var n=l.length;d.load.call(t,n,d)}}).attr("src",i.attr("data-"+d.data_attribute)).imagesLoaded(function(){this.hasAnyBroken&&i.attr("src",d.broken_pic)})}}),0!==d.event.indexOf("scroll")&&i.bind(d.event,function(){t.loaded||i.trigger("appear")})}),r.bind("resize",function(){a()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&r.bind("pageshow",function(t){t.originalEvent&&t.originalEvent.persisted&&l.each(function(){e(this).trigger("appear")})}),e(i).ready(function(){a()}),this},e.belowthefold=function(i,n){var a;return a=n.container===o||n.container===t?(t.innerHeight?t.innerHeight:r.height())+r.scrollTop():e(n.container).offset().top+e(n.container).height(),a<=e(i).offset().top-n.threshold},e.rightoffold=function(i,n){var a;return a=n.container===o||n.container===t?r.width()+r.scrollLeft():e(n.container).offset().left+e(n.container).width(),a<=e(i).offset().left-n.threshold},e.abovethetop=function(i,n){var a;return a=n.container===o||n.container===t?r.scrollTop():e(n.container).offset().top,a>=e(i).offset().top+n.threshold+e(i).height()},e.leftofbegin=function(i,n){var a;return a=n.container===o||n.container===t?r.scrollLeft():e(n.container).offset().left,a>=e(i).offset().left+n.threshold+e(i).width()},e.inviewport=function(t,i){return!(e.rightoffold(t,i)||e.leftofbegin(t,i)||e.belowthefold(t,i)||e.abovethetop(t,i))},e.extend(e.expr[":"],{"below-the-fold":function(t){return e.belowthefold(t,{threshold:0})},"above-the-top":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-screen":function(t){return e.rightoffold(t,{threshold:0})},"left-of-screen":function(t){return!e.rightoffold(t,{threshold:0})},"in-viewport":function(t){return e.inviewport(t,{threshold:0})},"above-the-fold":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-fold":function(t){return e.rightoffold(t,{threshold:0})},"left-of-fold":function(t){return!e.rightoffold(t,{threshold:0})}})}(jQuery,window,document); \ No newline at end of file diff --git a/scrollList.js/scrollList.js b/scrollList.js/scrollList.js new file mode 100644 index 0000000..ee73a9b --- /dev/null +++ b/scrollList.js/scrollList.js @@ -0,0 +1,111 @@ +/** + * + * 列表滚动侦听 + * + * 此插件备用,暂不加说明 + * + * @author MaiCong (i@maicong.me) + * @create 2016年09月12日 23:14:35 + * @update 2016年09月12日 23:14:35 + * @since 0.1 + */ + +!(function ($) { + $.fn.scrollList = function (options) { + var defaults = { + listBlock: '.list-block', + listElem: '.list-group', + listTitle: '.list-title', + navBlock: '.list-index', + navElem: 'span' + }; + var opts = $.extend(defaults, options || {}), + isJump = false, + $elems = [], + $nav = [], + $this = $(this), + $listBlock = $this.find(opts.listBlock), + $listElem = $listBlock.find(opts.listElem), + $navBlock = $this.find(opts.navBlock); + + // 监听滚动 + $this._scroll = function ($navElem) { + var isScrolling = false, timer = null; + $.map($navElem, function (e) { + $nav.push({ + 'offset': $(e).position().top + }); + }); + $listBlock.on('scroll', function () { + var _top = $(this).scrollTop(), + _eNum = Math.floor($navBlock.height() / 2 / $navElem.height()), + _offset = 0, i = 0; + if (timer !== null) { + window.clearTimeout(timer); + } + timer = window.setTimeout( function () { + for (; i < $elems.length; i++) { + _offset = (isJump) ? $elems[i].offset: $elems[i].offheight; + if (_top <= _offset) { + break; + } + } + if ($navBlock[0].scrollHeight> $navBlock.height()) { + if (isScrolling) { + return false; + } + isScrolling = true; + $navBlock.scrollTo({ + to: i> _eNum ? $nav[i].offset - $navBlock.height() / 2: 0, + callback: function () { + isScrolling = false; + } + }); + } + isJump = false; + $navElem.eq(i).addClass('active').siblings(opts.navElem).removeClass('active'); + }, 150); + }); + }; + + // 配置 + $this._init = function () { + // 遍历列表 + $.map($listElem, function (elem, i) { + var _height = $(elem).height(), + _offset = $(elem).position().top, + _title = $(elem).find(opts.listTitle).text(); + $elems.push({ + 'height': _height, + 'offset': _offset, + 'offheight': _height + _offset, + }); + if (i === $listElem.length - 1) { + $(elem).css({ + marginBottom: $listBlock.height() - _height + 4 + 'px' + }); + } + $navBlock.append($('<' + opts.navElem + '/>').text(_title)); + }); + $navBlock.find(opts.navElem).eq(0).addClass('active'); + + // 判断事件 + var $navElem = $navBlock.find(opts.navElem); + $navElem.on('click', function () { + var j = $(this).index(); + if ($elems[j]) { + isJump = true; + $listBlock.scrollTo({ + to: $elems[j].offset + }); + } + }); + + $this._scroll($navElem); + + window.initialledScroll = true; + }; + + return $this._init(); + }; +})(window.Zepto); diff --git a/scrollTo.js/README.md b/scrollTo.js/README.md new file mode 100644 index 0000000..41a5a96 --- /dev/null +++ b/scrollTo.js/README.md @@ -0,0 +1,16 @@ +scrollTo 滚动到指定位置插件 +======= + +有两个版本,选其一就行 + +### Zepto版 滚动到指定高度 + +``` +$('body').scrollTo({ to: 0 }); +``` + +### 非 Zepto 版 + +``` +animatedScrollTo(document.body, 0); +``` \ No newline at end of file diff --git a/scrollTo.js/scrollTo.js b/scrollTo.js/scrollTo.js new file mode 100644 index 0000000..b8f7a41 --- /dev/null +++ b/scrollTo.js/scrollTo.js @@ -0,0 +1,98 @@ +/** + * + * scrollTo 滚动到指定位置插件 + * + * 有两个版本,选其一就行 + * + * @author MaiCong (i@maicong.me) + * @create 2016年09月12日 22:59:37 + * @update 2016年09月12日 22:59:37 + * @since 0.1 + */ + +// Zepto版 滚动到指定高度 +// +// $('body').scrollTo({ to: 0 }); +// +!(function ($) { + $.fn.scrollTo = function(options){ + var defaults = { + to : 0, + durTime : 350, + delay : 10, + callback: null + }; + var opts = $.extend(defaults,options), + timer = null, + _this = this, + curTop = _this.scrollTop(), + subTop = opts.to - curTop, + index = 0, + dur = Math.round(opts.durTime / opts.delay), + smoothScroll = function(t){ + index++; + var per = Math.round(subTop/dur); + if(index>= dur){ + _this.scrollTop(t); + window.clearInterval(timer); + if(opts.callback && typeof opts.callback === 'function'){ + opts.callback(); + } + return; + }else{ + _this.scrollTop(curTop + index*per); + } + }; + timer = window.setInterval(function(){ + smoothScroll(opts.to); + }, opts.delay); + return _this; + }; +})(window.Zepto); + + +// 非 Zepto 版 +// +// animatedScrollTo(document.body, 0); +// +var animatedScrollTo = function(element, to, duration, callback) { + var requestAnimFrame = (function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60); }; })(); + var easeInOutQuad = function(t, b, c, d) { + t /= d / 2; + if (t < 1) return c / 2 * t * t + b; + t--; + return -c / 2 * (t * (t - 2) - 1) + b; + }; + var start = element.scrollTop, + change = to - start, + animationStart = +new Date(); + var animating = true; + var lastpos = null; + var animateScroll = function() { + if (!animating) { + return; + } + duration = duration || 600; + requestAnimFrame(animateScroll); + var now = +new Date(); + var val = Math.floor(easeInOutQuad(now - animationStart, start, change, duration)); + if (lastpos) { + if (lastpos === element.scrollTop) { + lastpos = val; + element.scrollTop = val; + } else { + animating = false; + } + } else { + lastpos = val; + element.scrollTop = val; + } + if (now> animationStart + duration) { + element.scrollTop = to; + animating = false; + if (callback) { callback(); } + } + }; + requestAnimFrame(animateScroll); +}; \ No newline at end of file diff --git a/server/BatToExe/Bat_To_Exe(32bit).exe b/server/BatToExe/Bat_To_Exe(32bit).exe new file mode 100644 index 0000000..5de5137 Binary files /dev/null and b/server/BatToExe/Bat_To_Exe(32bit).exe differ diff --git a/server/BatToExe/Bat_To_Exe(64bit).exe b/server/BatToExe/Bat_To_Exe(64bit).exe new file mode 100644 index 0000000..9650268 Binary files /dev/null and b/server/BatToExe/Bat_To_Exe(64bit).exe differ diff --git a/server/autorun/start_server.exe b/server/autorun/start_server.exe new file mode 100644 index 0000000..6e6f1c3 Binary files /dev/null and b/server/autorun/start_server.exe differ diff --git a/server/autorun/stop_server.exe b/server/autorun/stop_server.exe new file mode 100644 index 0000000..8d521d1 Binary files /dev/null and b/server/autorun/stop_server.exe differ diff --git a/server/bat/start_server.bat b/server/bat/start_server.bat new file mode 100644 index 0000000..c23b7fb --- /dev/null +++ b/server/bat/start_server.bat @@ -0,0 +1,9 @@ +@echo off +tasklist | findstr /i mysqld.exe && taskkill /f /im mysqld.exe +tasklist | findstr /i php-cgi.exe && taskkill /f /im php-cgi.exe +tasklist | findstr /i nginx.exe && taskkill /f /im nginx.exe +tasklist | findstr /i svnserve.exe && taskkill /f /im svnserve.exe +tasklist | findstr /i start_server.exe && taskkill /f /im start_server.exe + +mysqld.exe | php-cgi.exe -c C:/server/php/php.ini -b 127.0.0.1:9000 | nginx.exe -p C:/server/nginx | svnserve.exe -d -r C:\server\svn --log-file C:\server\temp\svn.log +exit \ No newline at end of file diff --git a/server/bat/stop_server.bat b/server/bat/stop_server.bat new file mode 100644 index 0000000..5e153f1 --- /dev/null +++ b/server/bat/stop_server.bat @@ -0,0 +1,7 @@ +@echo off +tasklist | findstr /i mysqld.exe && taskkill /f /im mysqld.exe +tasklist | findstr /i php-cgi.exe && taskkill /f /im php-cgi.exe +tasklist | findstr /i nginx.exe && taskkill /f /im nginx.exe +tasklist | findstr /i svnserve.exe && taskkill /f /im svnserve.exe +tasklist | findstr /i stop_server.exe && taskkill /f /im stop_server.exe +exit \ No newline at end of file diff --git a/svn.md b/svn.md new file mode 100644 index 0000000..c7ff03d --- /dev/null +++ b/svn.md @@ -0,0 +1,30 @@ +`yum install subversion -y` + +`mkdir -p /var/svn/repos/project` + +`svnadmin create /var/svn/repos/project` + +`cp /var/svn/repos/project/hooks/post-commit.tmpl /var/svn/repos/project/hooks/post-commit` + +``` +#!/bin/sh + +export LANG=zh_CN.UTF-8 + +REPOS="1ドル" +REV="2ドル" +WEB_PATH=/home/wwwroot/project +LOG_PATH=/tmp/svn_update.log +SVN_PATH=/usr/bin/svn +SVN_REPOS=svn://localhost/repos/project +SVN_USER="username"; +SVN_PWD="password"; + +echo "nnn##########开始提交 " `date "+%Y-%m-%d %H:%M:%S"` '##################'>> $LOG_PATH +echo `whoami`,$REPOS,$REV>> $LOG_PATH +echo `$SVN_PATH checkout $SVN_REPOS $WEB_PATH --username $SVN_USER --password $SVN_PWD --no-auth-cache>> $LOG_PATH` +chown -R www:www $WEB_PATH + +``` + +`systemctl start svnserve` diff --git a/tengine.sh b/tengine.sh new file mode 100644 index 0000000..72e5a45 --- /dev/null +++ b/tengine.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +wget https://dn-amh.qbox.me/@/tengine/tengine-2.1.1.tar.gz +wget https://dn-amh.qbox.me/@/tengine/ngx_cache_purge-2.3.tar.gz +wget https://dn-amh.qbox.me/@/tengine/v0.6.4.tar.gz +wget https://dn-amh.qbox.me/@/tengine/jemalloc-4.0.4.tar.bz2 +wget https://dn-amh.qbox.me/@/tengine/pcre-8.38.tar.gz +wget https://dn-amh.qbox.me/@/tengine/zlib-1.2.8.tar.gz +wget https://dn-amh.qbox.me/@/tengine/openssl-1.0.2d.tar.gz + +tar -zxf tengine-2.1.1.tar.gz +tar -zxf ngx_cache_purge-2.3.tar.gz +tar -zxf v0.6.4.tar.gz +tar -jxf jemalloc-4.0.4.tar.bz2 +tar -zxf pcre-8.38.tar.gz +tar -zxf zlib-1.2.8.tar.gz +tar -zxf openssl-1.0.2d.tar.gz + +mkdir -p /usr/local/src/{ngx_cache_purge,ngx_http_substitutions_filter_module,jemalloc,pcre,zlib,openssl} +cp -a ngx_cache_purge-2.3/* /usr/local/src/ngx_cache_purge +cp -a ngx_http_substitutions_filter_module-0.6.4/* /usr/local/src/ngx_http_substitutions_filter_module +cp -a jemalloc-4.0.4/* /usr/local/src/jemalloc +cp -a pcre-8.38/* /usr/local/src/pcre +cp -a zlib-1.2.8/* /usr/local/src/zlib +cp -a openssl-1.0.2d/* /usr/local/src/openssl + +chmod 755 -R /usr/local/src/jemalloc + +cd tengine-2.1.1 +./configure --prefix=/usr/local/tengine --user=nginx --group=nginx --with-http_ssl_module --with-http_spdy_module --with-http_concat_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_addition_module --with-http_secure_link_module --with-mail --with-mail_ssl_module --with-ipv6 --with-pcre=/usr/local/src/pcre --with-zlib=/usr/local/src/zlib --with-openssl=/usr/local/src/openssl --with-jemalloc=/usr/local/src/jemalloc --without-http_uwsgi_module --without-http_scgi_module --add-module=/usr/local/src/ngx_cache_purge --add-module=/usr/local/src/ngx_http_substitutions_filter_module; + +make +make install + +# /usr/local/tengine/sbin/nginx -V diff --git "a/wget346円225円264円347円253円231円344円270円213円350円275円275円.txt" "b/wget346円225円264円347円253円231円344円270円213円350円275円275円.txt" new file mode 100644 index 0000000..48ec3ff --- /dev/null +++ "b/wget346円225円264円347円253円231円344円270円213円350円275円275円.txt" @@ -0,0 +1 @@ +wget -r -p -c -np -k --restrict-file-names=nocontrol http://www.domain.com/ \ No newline at end of file diff --git "a/346円211円253円346円257円222円.txt" "b/346円211円253円346円257円222円.txt" new file mode 100644 index 0000000..a9f8b22 --- /dev/null +++ "b/346円211円253円346円257円222円.txt" @@ -0,0 +1,12 @@ +find / -name "*.php" -mtime -10> /home/test.log +find / -name "*.php" | xargs grep "eval" | more> /home/test1.log +find / -name "*.php" | xargs grep "shell_exec" | more> /home/test2.log +find / -name "*.php" | xargs grep "passthru" | more> /home/test3.log + +find / -name "*.php" | xargs grep "symlink(" | more> /home/test4.log + +find /home -name "*" | xargs grep "eval(" | more> /home/test5.log + +find /home | xargs grep "shell" | more> /home/test6.log + +find /home | xargs grep "???? | more> /home/test7.log \ No newline at end of file

AltStyle によって変換されたページ (->オリジナル) /