外交习语|战“疫”时期,中国...
 
 
 
序号 主题 作者 回复/查看 最后回复
1 咨询南丰拆迁计划 尒娜/2020/4/10 0 尒娜
2 塘市东兴苑27幢西侧兰州拉面等饭店油烟噪... kiersten/2020/4/10 6 kiersten
3 国泰景云台夜间施工严重扰民 妞妞姐姐/2020/4/10 1 妞妞姐姐
4 为什么我的狗证在微信上操作好了一直没回... 尽人事听天命/2020/4/9 1 尽人事听天命
5 绿化带损毁 卓尔不群/2020/4/9 1 卓尔不群
6 哈哈哈,好荒谬,好搞笑 kiersten/2020/4/8 1 kiersten
  • 中心联合市家协赴江...
  • 2017年度中心“十佳...
  • 张家港市杨舍西城乐...
  • 中心特约加盟商对普...
  • 中心特约加盟商沈海...
  • 便民服务开展供电业...
  • 市领导节前走访慰问...
  • 家协万红广场活动
  • 市委书记姚林荣走访...
  • 市民向中心特约加盟...
  • 中心特约加盟服务商...
  • 中心特约服务商梁井...

 

关闭
0r
最新视频
/* * -- grayscale.js -- * Copyright (C) James Padolsey (http://james.padolsey.com) * */ var grayscale = (function(){ var config = { colorProps: ['color','backgroundColor','borderBottomColor','borderTopColor','borderLeftColor','borderRightColor','backgroundImage'], externalImageHandler : { /* Grayscaling externally hosted images does not work - Use these functions to handle those images as you so desire */ /* Out of convenience these functions are also used for browsers like Chrome that do not support CanvasContext.getImageData */ init : function(el, src) { if (el.nodeName.toLowerCase() === 'img') { // Is IMG element... } else { // Is background-image element: // Default - remove background images data(el).backgroundImageSRC = src; el.style.backgroundImage = ''; } }, reset : function(el) { if (el.nodeName.toLowerCase() === 'img') { // Is IMG element... } else { // Is background-image element: el.style.backgroundImage = 'url(' + (data(el).backgroundImageSRC || '') + ')'; } } } }, log = function(){ try { window.console.log.apply(console, arguments); } catch(e) {}; }, isExternal = function(url) { // Checks whether URL is external: 'CanvasContext.getImageData' // only works if the image is on the current domain. return (new RegExp('https?://(?!' + window.location.hostname + ')')).test(url); }, data = (function(){ var cache = [0], expando = 'data' + (+new Date()); return function(elem) { var cacheIndex = elem[expando], nextCacheIndex = cache.length; if(!cacheIndex) { cacheIndex = elem[expando] = nextCacheIndex; cache[cacheIndex] = {}; } return cache[cacheIndex]; }; })(), desatIMG = function(img, prepare, realEl) { // realEl is only set when img is temp (for BG images) var canvas = document.createElement('canvas'), context = canvas.getContext('2d'), height = img.naturalHeight || img.offsetHeight || img.height, width = img.naturalWidth || img.offsetWidth || img.width, imgData; canvas.height = height; canvas.width = width; context.drawImage(img, 0, 0); try { imgData = context.getImageData(0, 0, width, height); } catch(e) {} if (prepare) { desatIMG.preparing = true; // Slowly recurse through pixels for prep, // :: only occurs on grayscale.prepare() var y = 0; (function(){ if (!desatIMG.preparing) { return; } if (y === height) { // Finished! context.putImageData(imgData, 0, 0, 0, 0, width, height); realEl ? (data(realEl).BGdataURL = canvas.toDataURL()) : (data(img).dataURL = canvas.toDataURL()) } for (var x = 0; x < width; x++) { var i = (y * width + x) * 4; // Apply Monoschrome level across all channels: imgData.data[i] = imgData.data[i+1] = imgData.data[i+2] = RGBtoGRAYSCALE(imgData.data[i], imgData.data[i+1], imgData.data[i+2]); } y++; setTimeout(arguments.callee, 0); })(); return; } else { // If desatIMG was called without 'prepare' flag // then cancel recursion and proceed with force! (below) desatIMG.preparing = false; } for (var y = 0; y < height; y++) { for (var x = 0; x < width; x++) { var i = (y * width + x) * 4; // Apply Monoschrome level across all channels: imgData.data[i] = imgData.data[i+1] = imgData.data[i+2] = RGBtoGRAYSCALE(imgData.data[i], imgData.data[i+1], imgData.data[i+2]); } } context.putImageData(imgData, 0, 0, 0, 0, width, height); return canvas; }, getStyle = function(el, prop) { var style = document.defaultView && document.defaultView.getComputedStyle ? document.defaultView.getComputedStyle(el, null)[prop] : el.currentStyle[prop]; // If format is #FFFFFF: (convert to RGB) if (style && /^#[A-F0-9]/i.test(style)) { var hex = style.match(/[A-F0-9]{2}/ig); style = 'rgb(' + parseInt(hex[0], 16) + ',' + parseInt(hex[1], 16) + ',' + parseInt(hex[2], 16) + ')'; } return style; }, RGBtoGRAYSCALE = function(r,g,b) { // Returns single monochrome figure: return parseInt( (0.2125 * r) + (0.7154 * g) + (0.0721 * b), 10 ); }, getAllNodes = function(context) { var all = Array.prototype.slice.call(context.getElementsByTagName('*')); all.unshift(context); return all; }; var init = function(context) { // Handle if a DOM collection is passed instead of a single el: if (context && context[0] && context.length && context[0].nodeName) { // Is a DOM collection: var allContexts = Array.prototype.slice.call(context), cIndex = -1, cLen = allContexts.length; while (++cIndex -1) { var urlPatt = /\(['"]?(.+?)['"]?\)/, url = style.match(urlPatt)[1]; if (isExternal(url)) { config.externalImageHandler.init(cur, url); data(cur).externalBG = true; continue; } // data(cur).BGdataURL refers to caches URL (from preparation) try { var imgSRC = data(cur).BGdataURL || (function(){ var temp = document.createElement('img'); temp.src = url; return desatIMG(temp).toDataURL(); })(); cur.style[prop] = style.replace(urlPatt, function(_, url){ return '(' + imgSRC + ')'; }); } catch(e) { config.externalImageHandler.init(cur, url); } } } } } }; init.reset = function(context) { // Handle if a DOM collection is passed instead of a single el: if (context && context[0] && context.length && context[0].nodeName) { // Is a DOM collection: var allContexts = Array.prototype.slice.call(context), cIndex = -1, cLen = allContexts.length; while (++cIndex -1) { var urlPatt = /\(['"]?(.+?)['"]?\)/, url = style.match(urlPatt)[1]; if (!isExternal(url)) { var temp = document.createElement('img'); temp.src = url; desatIMG(temp, true, cur); } } } } }; return init; })(); var navStr = navigator.userAgent.toLowerCase(); if(navStr.indexOf("msie 10.0")!==-1||navStr.indexOf("rv:11.0")!==-1){ // 判断是IE10或者IE11 grayscale(document.body); }