foldcontent-zhihu
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("foldcontent",[],e):"object"==typeof exports?exports.foldcontent=e():t.foldcontent=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return t[o].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";n(1),function(t,e,n,o){var i=function(e,n){this.$element=e,this.defaults={btnBg:"#eff6fa",btnColor:"#0c5897",fixBtnBg:"#81baeb",fixBtnColor:"#fff",fontSize:"12px",padding:"5px",text:"展开",bottom:"10px",right:"20px",lineHeight:"1"},this.options=t.extend({},this.defaults,n)};i.prototype={config:function(){return this.$element.text(this.options.text),this.$element.css({color:this.options.btnColor,fontSize:this.options.fontSize,backgroundColor:this.options.btnBg,position:"absolute",borderRadius:"5px",padding:this.options.padding,bottom:this.options.bottom,right:this.options.right,lineHeight:this.options.lineHeight}),this},fontContentFunction:function(){function o(t){t.css({right:"20px",color:f,backgroundColor:l,position:"absolute"})}function i(t){t.css({color:r,backgroundColor:s,position:"fixed"})}var r=this.options.fixBtnColor,s=this.options.fixBtnBg,f=this.options.btnColor,l=this.options.btnBg,a=Number(t(".unfold").css("padding").replace("px","")),c=Number(t(".unfold").css("font-size").replace("px","")),p=Number(t(".foldContentPanel").css("width").replace("px","")),u=Number(t(".foldContentPanel").css("padding-Bottom").replace("px","")),d=Number(this.options.right.replace("px","")),h=u+2*a+c,g=t(n),b=t(e);return g.on("click",".unfold",function(){var e=t(this);if("收起"!==e.text()){e.text("收起").siblings(".part-content").hide().siblings(".all-content").show();var n=e.parent(),r=n.offset().top+n.height(),s=g.scrollTop()+b.height(),f=(b.width()-p)/2+d>d?(b.width()-p)/2+d:d;s-r<h&&(e.css({right:f}),i(e));var l={onscroll:function(){var t=n.offset().top+n.height(),r=g.scrollTop()+b.height(),s=(b.width()-p)/2+d>d?(b.width()-p)/2+d:d;r-t<h&&n.offset().top-r<-90&&"展开"!==e.text()?(e.css({right:s}),i(e)):o(e),b.off("scroll",l.onscroll),setTimeout(function(){b.on("scroll",l.onscroll)},50)}};b.on("scroll",l.onscroll)}else{var a=t(this);o(a),a.text("展开").siblings(".part-content").show().siblings(".all-content").hide()}}),this}},t.fn.foldContentPlugin=function(t){var e=new i(this,t);e.config(),e.fontContentFunction()}}(jQuery,window,document)},function(t,e,n){var o=n(2);"string"==typeof o&&(o=[[t.id,o,""]]);n(4)(o,{});o.locals&&(t.exports=o.locals)},function(t,e,n){e=t.exports=n(3)(),e.push([t.id,".foldContentPanel{box-sizing:border-box;position:relative;width:700px;margin:20px auto;padding:30px;color:#666;line-height:2.5;border:1px solid #eee;box-shadow:5px 6px 5px #ccc}.all-content{display:none}",""])},function(t,e){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],e=0;e<this.length;e++){var n=this[e];n[2]?t.push("@media "+n[2]+"{"+n[1]+"}"):t.push(n[1])}return t.join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},i=0;i<this.length;i++){var r=this[i][0];"number"==typeof r&&(o[r]=!0)}for(i=0;i<e.length;i++){var s=e[i];"number"==typeof s[0]&&o[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),t.push(s))}},t}},function(t,e,n){function o(t,e){for(var n=0;n<t.length;n++){var o=t[n],i=d[o.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](o.parts[r]);for(;r<o.parts.length;r++)i.parts.push(a(o.parts[r],e))}else{for(var s=[],r=0;r<o.parts.length;r++)s.push(a(o.parts[r],e));d[o.id]={id:o.id,refs:1,parts:s}}}}function i(t){for(var e=[],n={},o=0;o<t.length;o++){var i=t[o],r=i[0],s=i[1],f=i[2],l=i[3],a={css:s,media:f,sourceMap:l};n[r]?n[r].parts.push(a):e.push(n[r]={id:r,parts:[a]})}return e}function r(t,e){var n=b(),o=m[m.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),m.push(e);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(e)}}function s(t){t.parentNode.removeChild(t);var e=m.indexOf(t);e>=0&&m.splice(e,1)}function f(t){var e=document.createElement("style");return e.type="text/css",r(t,e),e}function l(t){var e=document.createElement("link");return e.rel="stylesheet",r(t,e),e}function a(t,e){var n,o,i;if(e.singleton){var r=v++;n=x||(x=f(e)),o=c.bind(null,n,r,!1),i=c.bind(null,n,r,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(e),o=u.bind(null,n),i=function(){s(n),n.href&&URL.revokeObjectURL(n.href)}):(n=f(e),o=p.bind(null,n),i=function(){s(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}function c(t,e,n,o){var i=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=y(e,i);else{var r=document.createTextNode(i),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(r,s[e]):t.appendChild(r)}}function p(t,e){var n=e.css,o=e.media;if(o&&t.setAttribute("media",o),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function u(t,e){var n=e.css,o=e.sourceMap;o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([n],{type:"text/css"}),r=t.href;t.href=URL.createObjectURL(i),r&&URL.revokeObjectURL(r)}var d={},h=function(t){var e;return function(){return"undefined"==typeof e&&(e=t.apply(this,arguments)),e}},g=h(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),b=h(function(){return document.head||document.getElementsByTagName("head")[0]}),x=null,v=0,m=[];t.exports=function(t,e){e=e||{},"undefined"==typeof e.singleton&&(e.singleton=g()),"undefined"==typeof e.insertAt&&(e.insertAt="bottom");var n=i(t);return o(n,e),function(t){for(var r=[],s=0;s<n.length;s++){var f=n[s],l=d[f.id];l.refs--,r.push(l)}if(t){var a=i(t);o(a,e)}for(var s=0;s<r.length;s++){var l=r[s];if(0===l.refs){for(var c=0;c<l.parts.length;c++)l.parts[c]();delete d[l.id]}}}};var y=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("foldcontent",[],e):"object"==typeof exports?exports.foldcontent=e():t.foldcontent=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return t[o].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";n(1),function(t,e,n,o){var i=function(e,n){this.$element=e,this.defaults={btnBg:"#eff6fa",btnColor:"#0c5897",fixBtnBg:"#81baeb",fixBtnColor:"#fff",fontSize:"12px",padding:"5px",initialText:"展开",fixText:"收起",bottom:"10px",right:"20px",lineHeight:"1"},this.options=t.extend({},this.defaults,n)};i.prototype={config:function(){return this.$element.text(this.options.initialText),this.$element.css({color:this.options.btnColor,fontSize:this.options.fontSize,backgroundColor:this.options.btnBg,position:"absolute",borderRadius:"5px",padding:this.options.padding,bottom:this.options.bottom,right:this.options.right,lineHeight:this.options.lineHeight}),this},fontContentFunction:function(){function o(t){t.css({right:"20px",color:l,backgroundColor:f,position:"absolute"})}function i(t){t.css({color:r,backgroundColor:s,position:"fixed"})}var r=this.options.fixBtnColor,s=this.options.fixBtnBg,l=this.options.btnColor,f=this.options.btnBg,a=Number(t(".unfold").css("padding").replace("px","")),c=Number(t(".unfold").css("font-size").replace("px","")),p=Number(t(".foldcontent-panel").css("width").replace("px","")),u=Number(t(".foldcontent-panel").css("padding-Bottom").replace("px","")),d=Number(this.options.right.replace("px","")),h=this.options.initialText,g=this.options.fixText,x=u+2*a+c,b=t(n),v=t(e);return b.on("click",".unfold",function(){var e=t(this);if(e.text()!==g){e.text(g).siblings(".part-content").hide().siblings(".all-content").show();var n=e.parent(),r=n.offset().top+n.height(),s=b.scrollTop()+v.height(),l=(v.width()-p)/2+d>d?(v.width()-p)/2+d:d;s-r<x&&(e.css({right:l}),i(e));var f={onscroll:function(){var t=n.offset().top+n.height(),r=b.scrollTop()+v.height(),s=(v.width()-p)/2+d>d?(v.width()-p)/2+d:d;r-t<x&&n.offset().top-r<-90&&e.text()!==h?(e.css({right:s}),i(e)):o(e),v.off("scroll",f.onscroll),setTimeout(function(){v.on("scroll",f.onscroll)},50)}};v.on("scroll",f.onscroll)}else{var a=t(this);o(a),a.text(h).siblings(".part-content").show().siblings(".all-content").hide()}}),this}},t.fn.foldContentPlugin=function(t){var e=new i(this,t);e.config(),e.fontContentFunction()}}(jQuery,window,document)},function(t,e,n){var o=n(2);"string"==typeof o&&(o=[[t.id,o,""]]);n(4)(o,{});o.locals&&(t.exports=o.locals)},function(t,e,n){e=t.exports=n(3)(),e.push([t.id,".foldcontent-panel{box-sizing:border-box;position:relative;width:700px;margin:20px auto;padding:30px;color:#666;line-height:2.5;border:1px solid #eee;box-shadow:5px 6px 5px #ccc}.all-content{display:none}",""])},function(t,e){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],e=0;e<this.length;e++){var n=this[e];n[2]?t.push("@media "+n[2]+"{"+n[1]+"}"):t.push(n[1])}return t.join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},i=0;i<this.length;i++){var r=this[i][0];"number"==typeof r&&(o[r]=!0)}for(i=0;i<e.length;i++){var s=e[i];"number"==typeof s[0]&&o[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),t.push(s))}},t}},function(t,e,n){function o(t,e){for(var n=0;n<t.length;n++){var o=t[n],i=d[o.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](o.parts[r]);for(;r<o.parts.length;r++)i.parts.push(a(o.parts[r],e))}else{for(var s=[],r=0;r<o.parts.length;r++)s.push(a(o.parts[r],e));d[o.id]={id:o.id,refs:1,parts:s}}}}function i(t){for(var e=[],n={},o=0;o<t.length;o++){var i=t[o],r=i[0],s=i[1],l=i[2],f=i[3],a={css:s,media:l,sourceMap:f};n[r]?n[r].parts.push(a):e.push(n[r]={id:r,parts:[a]})}return e}function r(t,e){var n=x(),o=m[m.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),m.push(e);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(e)}}function s(t){t.parentNode.removeChild(t);var e=m.indexOf(t);e>=0&&m.splice(e,1)}function l(t){var e=document.createElement("style");return e.type="text/css",r(t,e),e}function f(t){var e=document.createElement("link");return e.rel="stylesheet",r(t,e),e}function a(t,e){var n,o,i;if(e.singleton){var r=v++;n=b||(b=l(e)),o=c.bind(null,n,r,!1),i=c.bind(null,n,r,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=f(e),o=u.bind(null,n),i=function(){s(n),n.href&&URL.revokeObjectURL(n.href)}):(n=l(e),o=p.bind(null,n),i=function(){s(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}function c(t,e,n,o){var i=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=y(e,i);else{var r=document.createTextNode(i),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(r,s[e]):t.appendChild(r)}}function p(t,e){var n=e.css,o=e.media;if(o&&t.setAttribute("media",o),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function u(t,e){var n=e.css,o=e.sourceMap;o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([n],{type:"text/css"}),r=t.href;t.href=URL.createObjectURL(i),r&&URL.revokeObjectURL(r)}var d={},h=function(t){var e;return function(){return"undefined"==typeof e&&(e=t.apply(this,arguments)),e}},g=h(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),x=h(function(){return document.head||document.getElementsByTagName("head")[0]}),b=null,v=0,m=[];t.exports=function(t,e){e=e||{},"undefined"==typeof e.singleton&&(e.singleton=g()),"undefined"==typeof e.insertAt&&(e.insertAt="bottom");var n=i(t);return o(n,e),function(t){for(var r=[],s=0;s<n.length;s++){var l=n[s],f=d[l.id];f.refs--,r.push(f)}if(t){var a=i(t);o(a,e)}for(var s=0;s<r.length;s++){var f=r[s];if(0===f.refs){for(var c=0;c<f.parts.length;c++)f.parts[c]();delete d[f.id]}}}};var y=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()}])}); | ||
//# sourceMappingURL=foldcontent.min.js.map |
{ | ||
"name": "foldcontent-zhihu", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "用 jquery 实现知乎收起答案功能", | ||
@@ -39,2 +39,2 @@ "main": "dist/foldcontent.min.js", | ||
"homepage": "https://github.com/luyilin/foldcontent-zhihu#readme" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
194414