如何将前端图片插件改写为长尾词?

2026-04-06 19:501阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计1501个文字,预计阅读时间需要7分钟。

如何将前端图片插件改写为长尾词?

javascript// 获取页面宽高var w=document.body.width;var h=document.body.height;

// 创建canvas并设置其宽高为容器宽高的2倍var canvas=document.createElement(canvas);canvas.width=w * 4;canvas.height=h * 4;canvas.style.width=100%; // 设置canvas宽度为100%

// 将canvas添加到页面中document.body.appendChild(canvas);

如何将前端图片插件改写为长尾词?

gistfile1.txt

//使用过程 var w = $("body").width(); var h = $("body").height(); //要将 canvas 的宽高设置成容器宽高的 2 倍 var canvas = document.createElement("canvas"); canvas.width = w * 4; canvas.height = h * 4; canvas.style.width = w*2 + "px"; canvas.style.height = h*2 + "px"; var context = canvas.getContext("2d"); //然后将画布缩放,将图像放大两倍画到画布上 context.scale(2,2); html2canvas(document.getElementById('wrap'), { canvas:canvas, onrendered: function(canvas) { document.getElementById('imgs').appendChild(canvas); }, }); html2canvas.js

/* html2canvas 0.5.0-beta3 state to , // but guard against overflow handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { error('overflow'); } delta += (m - n) * handledCPCountPlusOne; n = m; for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < n && ++delta > maxInt) { error('overflow'); } if (currentValue == n) { // Represent delta as a generalized variable-length integer for (q = delta, k = base; /* no condition */; k += base) { t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) { break; } qMinusT = q - t; baseMinusT = base - t; output.push( stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) ); q = floor(qMinusT / baseMinusT); } output.push(stringFromCharCode(digitToBasic(q, 0))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; ++handledCPCount; } } ++delta; ++n; } return output.join(''); } /** * Converts a Punycode string representing a domain name to Unicode. Only the * Punycoded parts of the domain name will be converted, i.e. it doesn't * matter if you call it on a string that has already been converted to * Unicode. * @memberOf punycode * @param {String} domain The Punycode domain name to convert to Unicode. * @returns {String} The Unicode representation of the given Punycode * string. */ function toUnicode(domain) { return mapDomain(domain, function(string) { return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; }); } /** * Converts a Unicode string representing a domain name to Punycode. Only the * non-ASCII parts of the domain name will be converted, i.e. it doesn't * matter if you call it with a domain that's already in ASCII. * @memberOf punycode * @param {String} domain The domain name to convert, as a Unicode string. * @returns {String} The Punycode representation of the given domain name. */ function toASCII(domain) { return mapDomain(domain, function(string) { return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; }); } /*--------------------------------------------------------------------------*/ /** Define the public API */ punycode = { /** * A string representing the current Punycode.js version number. * @memberOf punycode * @type String */ 'version': '1.2.4', /** * An object of methods to convert from JavaScript's internal character * representation (UCS-2) to Unicode code points, and back. * @see * @memberOf punycode * @type Object */ 'ucs2': { 'decode': ucs2decode, 'encode': ucs2encode }, 'decode': decode, 'encode': encode, 'toASCII': toASCII, 'toUnicode': toUnicode }; /** Expose `punycode` */ // Some AMD build optimizers, like r.js, check for specific condition patterns // like the following: if ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) { define('punycode', function() { return punycode; }); } else if (freeExports && !freeExports.nodeType) { if (freeModule) { // in Node.js or RingoJS v0.8.0+ freeModule.exports = punycode; } else { // in Narwhal or RingoJS v0.7.0- for (key in punycode) { punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); } } } else { // in Rhino or a web browser root.punycode = punycode; } }(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],2:[function(_dereq_,module,exports){ var log = _dereq_('./log'); function restoreOwnerScroll(ownerDocument, x, y) { if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) { ownerDocument.defaultView.scrollTo(x, y); } } function cloneCanvasContents(canvas, clonedCanvas) { try { if (clonedCanvas) { clonedCanvas.width = canvas.width; clonedCanvas.height = canvas.height; clonedCanvas.getContext("2d").putImageData(canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height), 0, 0); } } catch(e) { log("Unable to copy canvas content from", canvas, e); } } function cloneNode(node, javascriptEnabled) { var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false); var child = node.firstChild; while(child) { if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') { clone.appendChild(cloneNode(child, javascriptEnabled)); } child = child.nextSibling; } if (node.nodeType === 1) { clone._scrollTop = node.scrollTop; clone._scrollLeft = node.scrollLeft; if (node.nodeName === "CANVAS") { cloneCanvasContents(node, clone); } else if (node.nodeName === "TEXTAREA" || node.nodeName === "SELECT") { clone.value = node.value; } } return clone; } function initNode(node) { if (node.nodeType === 1) { node.scrollTop = node._scrollTop; node.scrollLeft = node._scrollLeft; var child = node.firstChild; while(child) { initNode(child); child = child.nextSibling; } } } module.exports = function(ownerDocument, containerDocument, width, height, options, x ,y) { var documentElement = cloneNode(ownerDocument.documentElement, options.javascriptEnabled); var container = containerDocument.createElement("iframe"); container.className = "html2canvas-container"; container.style.visibility = "hidden"; container.style.position = "fixed"; container.style.left = "-10000px"; container.style.top = "0px"; container.style.border = "0"; container.width = width; container.height = height; container.scrolling = "no"; // ios won't scroll without it containerDocument.body.appendChild(container); return new Promise(function(resolve) { var documentClone = container.contentWindow.document; /* Chrome doesn't detect relative background-images assigned in inline

本文共计1501个文字,预计阅读时间需要7分钟。

如何将前端图片插件改写为长尾词?

javascript// 获取页面宽高var w=document.body.width;var h=document.body.height;

// 创建canvas并设置其宽高为容器宽高的2倍var canvas=document.createElement(canvas);canvas.width=w * 4;canvas.height=h * 4;canvas.style.width=100%; // 设置canvas宽度为100%

// 将canvas添加到页面中document.body.appendChild(canvas);

如何将前端图片插件改写为长尾词?

gistfile1.txt

//使用过程 var w = $("body").width(); var h = $("body").height(); //要将 canvas 的宽高设置成容器宽高的 2 倍 var canvas = document.createElement("canvas"); canvas.width = w * 4; canvas.height = h * 4; canvas.style.width = w*2 + "px"; canvas.style.height = h*2 + "px"; var context = canvas.getContext("2d"); //然后将画布缩放,将图像放大两倍画到画布上 context.scale(2,2); html2canvas(document.getElementById('wrap'), { canvas:canvas, onrendered: function(canvas) { document.getElementById('imgs').appendChild(canvas); }, }); html2canvas.js

/* html2canvas 0.5.0-beta3 state to , // but guard against overflow handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { error('overflow'); } delta += (m - n) * handledCPCountPlusOne; n = m; for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < n && ++delta > maxInt) { error('overflow'); } if (currentValue == n) { // Represent delta as a generalized variable-length integer for (q = delta, k = base; /* no condition */; k += base) { t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) { break; } qMinusT = q - t; baseMinusT = base - t; output.push( stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) ); q = floor(qMinusT / baseMinusT); } output.push(stringFromCharCode(digitToBasic(q, 0))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; ++handledCPCount; } } ++delta; ++n; } return output.join(''); } /** * Converts a Punycode string representing a domain name to Unicode. Only the * Punycoded parts of the domain name will be converted, i.e. it doesn't * matter if you call it on a string that has already been converted to * Unicode. * @memberOf punycode * @param {String} domain The Punycode domain name to convert to Unicode. * @returns {String} The Unicode representation of the given Punycode * string. */ function toUnicode(domain) { return mapDomain(domain, function(string) { return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; }); } /** * Converts a Unicode string representing a domain name to Punycode. Only the * non-ASCII parts of the domain name will be converted, i.e. it doesn't * matter if you call it with a domain that's already in ASCII. * @memberOf punycode * @param {String} domain The domain name to convert, as a Unicode string. * @returns {String} The Punycode representation of the given domain name. */ function toASCII(domain) { return mapDomain(domain, function(string) { return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; }); } /*--------------------------------------------------------------------------*/ /** Define the public API */ punycode = { /** * A string representing the current Punycode.js version number. * @memberOf punycode * @type String */ 'version': '1.2.4', /** * An object of methods to convert from JavaScript's internal character * representation (UCS-2) to Unicode code points, and back. * @see * @memberOf punycode * @type Object */ 'ucs2': { 'decode': ucs2decode, 'encode': ucs2encode }, 'decode': decode, 'encode': encode, 'toASCII': toASCII, 'toUnicode': toUnicode }; /** Expose `punycode` */ // Some AMD build optimizers, like r.js, check for specific condition patterns // like the following: if ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) { define('punycode', function() { return punycode; }); } else if (freeExports && !freeExports.nodeType) { if (freeModule) { // in Node.js or RingoJS v0.8.0+ freeModule.exports = punycode; } else { // in Narwhal or RingoJS v0.7.0- for (key in punycode) { punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); } } } else { // in Rhino or a web browser root.punycode = punycode; } }(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],2:[function(_dereq_,module,exports){ var log = _dereq_('./log'); function restoreOwnerScroll(ownerDocument, x, y) { if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) { ownerDocument.defaultView.scrollTo(x, y); } } function cloneCanvasContents(canvas, clonedCanvas) { try { if (clonedCanvas) { clonedCanvas.width = canvas.width; clonedCanvas.height = canvas.height; clonedCanvas.getContext("2d").putImageData(canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height), 0, 0); } } catch(e) { log("Unable to copy canvas content from", canvas, e); } } function cloneNode(node, javascriptEnabled) { var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false); var child = node.firstChild; while(child) { if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') { clone.appendChild(cloneNode(child, javascriptEnabled)); } child = child.nextSibling; } if (node.nodeType === 1) { clone._scrollTop = node.scrollTop; clone._scrollLeft = node.scrollLeft; if (node.nodeName === "CANVAS") { cloneCanvasContents(node, clone); } else if (node.nodeName === "TEXTAREA" || node.nodeName === "SELECT") { clone.value = node.value; } } return clone; } function initNode(node) { if (node.nodeType === 1) { node.scrollTop = node._scrollTop; node.scrollLeft = node._scrollLeft; var child = node.firstChild; while(child) { initNode(child); child = child.nextSibling; } } } module.exports = function(ownerDocument, containerDocument, width, height, options, x ,y) { var documentElement = cloneNode(ownerDocument.documentElement, options.javascriptEnabled); var container = containerDocument.createElement("iframe"); container.className = "html2canvas-container"; container.style.visibility = "hidden"; container.style.position = "fixed"; container.style.left = "-10000px"; container.style.top = "0px"; container.style.border = "0"; container.width = width; container.height = height; container.scrolling = "no"; // ios won't scroll without it containerDocument.body.appendChild(container); return new Promise(function(resolve) { var documentClone = container.contentWindow.document; /* Chrome doesn't detect relative background-images assigned in inline