disqus-react
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -1,2 +0,2 @@ | ||
var ReactDisqus=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=16)}([function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function a(){m&&d&&(m=!1,d.length?y=d.concat(y):h=-1,y.length&&u())}function u(){if(!m){var e=o(a);m=!0;for(var t=y.length;t;){for(d=y,y=[];++h<t;)d&&d[h].run();h=-1,t=y.length}d=null,m=!1,i(e)}}function c(e,t){this.fun=e,this.array=t}function s(){}var f,l,p=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var d,y=[],m=!1,h=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];y.push(new c(e,t)),1!==y.length||m||o(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=s,p.addListener=s,p.once=s,p.off=s,p.removeListener=s,p.removeAllListeners=s,p.emit=s,p.prependListener=s,p.prependOnceListener=s,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t){e.exports=React},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r=n(5);e.exports=n(13)(r.isElement,!0)}else e.exports=n(12)()}).call(t,n(0))},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e){return!!o.default.isValidElement(e)||!!Array.isArray(e)&&e.some(function(e){return o.default.isValidElement(e)})}Object.defineProperty(t,"__esModule",{value:!0}),t.insertScript=function(e,t,n){var r=window.document.createElement("script");return r.async=!0,r.src=e,r.id=t,n.appendChild(r),r},t.removeScript=function(e,t){var n=window.document.getElementById(e);n&&t.removeChild(n)},t.debounce=function(e,t,n){var r=void 0;return function(){var o=this,i=arguments,a=n&&!r;window.clearTimeout(r),r=setTimeout(function(){r=null,n||e.apply(o,i)},t),a&&e.apply(o,i)}},t.isReactElement=r,t.shallowComparison=function(e,t){var n=new Set(Object.keys(e),Object.keys(t)),o=!0,i=!1,a=void 0;try{for(var u,c=n[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var s=u.value;if(e[s]!==t[s]&&!r(e[s]))return!0}}catch(e){i=!0,a=e}finally{try{!o&&c.return&&c.return()}finally{if(i)throw a}}return!1};var o=function(e){return e&&e.__esModule?e:{default:e}}(n(1))},function(e,t,n){"use strict";(function(t){"production"===t.env.NODE_ENV?e.exports=n(15):e.exports=n(14)}).call(t,n(0))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DiscussionEmbed=t.CommentEmbed=t.CommentCount=void 0;var r=n(7),o=n(8),i=n(9);t.CommentCount=r.CommentCount,t.CommentEmbed=o.CommentEmbed,t.DiscussionEmbed=i.DiscussionEmbed;var a={CommentCount:r.CommentCount,CommentEmbed:o.CommentEmbed,DiscussionEmbed:i.DiscussionEmbed};t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.CommentCount=void 0;var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=r(n(1)),s=r(n(2)),f=n(4),l=(0,f.debounce)(function(){window.DISQUSWIDGETS&&window.DISQUSWIDGETS.getCount({reset:!0})},300,!1);(t.CommentCount=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,c.default.Component),u(t,[{key:"componentDidMount",value:function(){this.loadInstance()}},{key:"shouldComponentUpdate",value:function(e){return this.props!==e&&(0,f.shallowComparison)(this.props,e)}},{key:"componentDidUpdate",value:function(e){this.props.shortname!==e.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"loadInstance",value:function(){var e=window.document;e.getElementById("dsq-count-scr")?l():(0,f.insertScript)("https://"+this.props.shortname+".disqus.com/count.js","dsq-count-scr",e.body)}},{key:"cleanInstance",value:function(){var e=window.document.body;(0,f.removeScript)("dsq-count-scr",e),window.DISQUSWIDGETS=void 0}},{key:"render",value:function(){return c.default.createElement("span",{className:"disqus-comment-count","data-disqus-identifier":this.props.config.identifier,"data-disqus-url":this.props.config.url},this.props.children)}}]),t}()).propTypes={shortname:s.default.string.isRequired,config:s.default.shape({identifier:s.default.string,url:s.default.string,title:s.default.string}).isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.CommentEmbed=void 0;var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=r(n(1)),s=r(n(2)),f=t.CommentEmbed=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,c.default.Component),u(t,[{key:"getSrc",value:function(){return"https://embed.disqus.com/p/"+Number(this.props.commentId).toString(36)+"?p="+(this.props.showParentComment?"1":"0")+"&m="+(this.props.showMedia?"1":"0")}},{key:"render",value:function(){return c.default.createElement("iframe",{src:this.getSrc(),width:this.props.width,height:this.props.height,seamless:"seamless",scrolling:"no",frameBorder:"0"})}}]),t}();f.defaultProps={showMedia:!0,showParentComment:!0,width:420,height:320},f.propTypes={commentId:s.default.string.isRequired,showMedia:s.default.bool,showParentComment:s.default.bool,width:s.default.number,height:s.default.number}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.DiscussionEmbed=void 0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=r(n(1)),f=r(n(2)),l=n(4),p=["preData","preInit","onInit","onReady","afterRender","preReset","onIdentify","beforeComment","onNewComment","onPaginate"];(t.DiscussionEmbed=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,s.default.Component),c(t,[{key:"componentDidMount",value:function(){"undefined"!=typeof window&&window.disqus_shortname&&window.disqus_shortname!==this.props.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"shouldComponentUpdate",value:function(e){return this.props!==e&&(0,l.shallowComparison)(this.props,e)}},{key:"componentDidUpdate",value:function(e){this.props.shortname!==e.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"loadInstance",value:function(){var e=window.document;window&&window.DISQUS&&e.getElementById("dsq-embed-scr")?window.DISQUS.reset({reload:!0,config:this.getDisqusConfig(this.props.config)}):(window.disqus_config=this.getDisqusConfig(this.props.config),window.disqus_shortname=this.props.shortname,(0,l.insertScript)("https://"+this.props.shortname+".disqus.com/embed.js","dsq-embed-scr",e.body))}},{key:"cleanInstance",value:function(){var e=window.document;(0,l.removeScript)("dsq-embed-scr",e.body),window&&window.DISQUS&&window.DISQUS.reset({});try{delete window.DISQUS}catch(e){window.DISQUS=void 0}var t=e.getElementById("disqus_thread");if(t)for(;t.hasChildNodes();)t.removeChild(t.firstChild)}},{key:"getDisqusConfig",value:function(e){return function(){var t=this;this.page.identifier=e.identifier,this.page.url=e.url,this.page.title=e.title,this.page.remote_auth_s3=e.remoteAuthS3,this.page.api_key=e.apiKey,p.forEach(function(n){t.callbacks[n]=[e[n]]})}}},{key:"render",value:function(){return s.default.createElement("div",u({},this.props,{id:"disqus_thread"}))}}]),t}()).propTypes={shortname:f.default.string.isRequired,config:f.default.shape({identifier:f.default.string,url:f.default.string,title:f.default.string,preData:f.default.func,preInit:f.default.func,onInit:f.default.func,onReady:f.default.func,afterRender:f.default.func,preReset:f.default.func,onIdentify:f.default.func,beforeComment:f.default.func,onNewComment:f.default.func,onPaginate:f.default.func}).isRequired}},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,c=r(e),s=1;s<arguments.length;s++){n=Object(arguments[s]);for(var f in n)i.call(n,f)&&(c[f]=n[f]);if(o){u=o(n);for(var l=0;l<u.length;l++)a.call(n,u[l])&&(c[u[l]]=n[u[l]])}}return c}},function(e,t,n){"use strict";(function(t){function r(e,n,r,c,s){if("production"!==t.env.NODE_ENV)for(var f in e)if(u(e,f)){var l;try{if("function"!=typeof e[f]){var p=Error((c||"React class")+": "+r+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.");throw p.name="Invariant Violation",p}l=e[f](n,f,c,r,null,i)}catch(e){l=e}if(!l||l instanceof Error||o((c||"React class")+": type specification of "+r+" `"+f+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof l+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),l instanceof Error&&!(l.message in a)){a[l.message]=!0;var d=s?s():"";o("Failed "+r+" type: "+l.message+(null!=d?d:""))}}}var o=function(){};if("production"!==t.env.NODE_ENV){var i=n(3),a={},u=Function.call.bind(Object.prototype.hasOwnProperty);o=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}r.resetWarningCache=function(){"production"!==t.env.NODE_ENV&&(a={})},e.exports=r}).call(t,n(0))},function(e,t,n){"use strict";function r(){}function o(){}var i=n(3);o.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,o,a){if(a!==i){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:r};return n.PropTypes=n,n}},function(e,t,n){"use strict";(function(t){function r(){return null}var o=n(5),i=n(10),a=n(3),u=n(11),c=Function.call.bind(Object.prototype.hasOwnProperty),s=function(){};"production"!==t.env.NODE_ENV&&(s=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),e.exports=function(e,n){function f(e){var t=e&&(O&&e[O]||e[S]);if("function"==typeof t)return t}function l(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function p(e){this.message=e,this.stack=""}function d(e){function r(r,u,c,f,l,d,y){if(f=f||E,d=d||c,y!==a){if(n){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var h=f+":"+c;!o[h]&&i<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+f+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),o[h]=!0,i++)}}return null==u[c]?r?new p(null===u[c]?"The "+l+" `"+d+"` is marked as required in `"+f+"`, but its value is `null`.":"The "+l+" `"+d+"` is marked as required in `"+f+"`, but its value is `undefined`."):null:e(u,c,f,l,d)}if("production"!==t.env.NODE_ENV)var o={},i=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function y(e){return d(function(t,n,r,o,i,a){var u=t[n];return b(u)!==e?new p("Invalid "+o+" `"+i+"` of type `"+v(u)+"` supplied to `"+r+"`, expected `"+e+"`."):null})}function m(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(m);if(null===t||e(t))return!0;var n=f(t);if(!n)return!1;var r,o=n.call(t);if(n!==t.entries){for(;!(r=o.next()).done;)if(!m(r.value))return!1}else for(;!(r=o.next()).done;){var i=r.value;if(i&&!m(i[1]))return!1}return!0;default:return!1}}function h(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function b(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":h(t,e)?"symbol":t}function v(e){if(void 0===e||null===e)return""+e;var t=b(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function w(e){var t=v(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function g(e){return e.constructor&&e.constructor.name?e.constructor.name:E}var O="function"==typeof Symbol&&Symbol.iterator,S="@@iterator",E="<<anonymous>>",_={array:y("array"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:d(r),arrayOf:function(e){return d(function(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var u=t[n];if(!Array.isArray(u))return new p("Invalid "+o+" `"+i+"` of type `"+b(u)+"` supplied to `"+r+"`, expected an array.");for(var c=0;c<u.length;c++){var s=e(u,c,r,o,i+"["+c+"]",a);if(s instanceof Error)return s}return null})},element:function(){return d(function(t,n,r,o,i){var a=t[n];return e(a)?null:new p("Invalid "+o+" `"+i+"` of type `"+b(a)+"` supplied to `"+r+"`, expected a single ReactElement.")})}(),elementType:function(){return d(function(e,t,n,r,i){var a=e[t];return o.isValidElementType(a)?null:new p("Invalid "+r+" `"+i+"` of type `"+b(a)+"` supplied to `"+n+"`, expected a single ReactElement type.")})}(),instanceOf:function(e){return d(function(t,n,r,o,i){if(!(t[n]instanceof e)){var a=e.name||E;return new p("Invalid "+o+" `"+i+"` of type `"+g(t[n])+"` supplied to `"+r+"`, expected instance of `"+a+"`.")}return null})},node:function(){return d(function(e,t,n,r,o){return m(e[t])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")})}(),objectOf:function(e){return d(function(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var u=t[n],s=b(u);if("object"!==s)return new p("Invalid "+o+" `"+i+"` of type `"+s+"` supplied to `"+r+"`, expected an object.");for(var f in u)if(c(u,f)){var l=e(u,f,r,o,i+"."+f,a);if(l instanceof Error)return l}return null})},oneOf:function(e){return Array.isArray(e)?d(function(t,n,r,o,i){for(var a=t[n],u=0;u<e.length;u++)if(l(a,e[u]))return null;var c=JSON.stringify(e,function(e,t){return"symbol"===v(t)?String(t):t});return new p("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+r+"`, expected one of "+c+".")}):("production"!==t.env.NODE_ENV&&s(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),r)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==t.env.NODE_ENV&&s("Invalid argument supplied to oneOfType, expected an instance of array."),r;for(var n=0;n<e.length;n++){var o=e[n];if("function"!=typeof o)return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+w(o)+" at index "+n+"."),r}return d(function(t,n,r,o,i){for(var u=0;u<e.length;u++)if(null==(0,e[u])(t,n,r,o,i,a))return null;return new p("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")})},shape:function(e){return d(function(t,n,r,o,i){var u=t[n],c=b(u);if("object"!==c)return new p("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected `object`.");for(var s in e){var f=e[s];if(f){var l=f(u,s,r,o,i+"."+s,a);if(l)return l}}return null})},exact:function(e){return d(function(t,n,r,o,u){var c=t[n],s=b(c);if("object"!==s)return new p("Invalid "+o+" `"+u+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");var f=i({},t[n],e);for(var l in f){var d=e[l];if(!d)return new p("Invalid "+o+" `"+u+"` key `"+l+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=d(c,l,r,o,u+"."+l,a);if(y)return y}return null})}};return p.prototype=Error.prototype,_.checkPropTypes=u,_.resetWarningCache=u.resetWarningCache,_.PropTypes=_,_}}).call(t,n(0))},function(e,t,n){"use strict";(function(e){"production"!==e.env.NODE_ENV&&function(){function e(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:var n=e.type;switch(n){case l:case p:case a:case c:case u:case y:return n;default:var r=n&&n.$$typeof;switch(r){case f:case d:case s:return r;default:return t}}case b:case h:case i:return t}}}function n(t){return e(t)===p}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,u=r?Symbol.for("react.strict_mode"):60108,c=r?Symbol.for("react.profiler"):60114,s=r?Symbol.for("react.provider"):60109,f=r?Symbol.for("react.context"):60110,l=r?Symbol.for("react.async_mode"):60111,p=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,y=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.suspense_list"):60120,h=r?Symbol.for("react.memo"):60115,b=r?Symbol.for("react.lazy"):60116,v=r?Symbol.for("react.fundamental"):60117,w=r?Symbol.for("react.responder"):60118,g=r?Symbol.for("react.scope"):60119,O=function(){},S=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.warn(i);try{throw new Error(i)}catch(e){}},E=O=function(e,t){if(void 0===t)throw new Error("`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning message argument");if(!e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];S.apply(void 0,[t].concat(r))}},_=l,j=p,C=f,P=s,T=o,I=d,x=a,k=b,$=h,D=i,R=c,q=u,M=y,N=!1;t.typeOf=e,t.AsyncMode=_,t.ConcurrentMode=j,t.ContextConsumer=C,t.ContextProvider=P,t.Element=T,t.ForwardRef=I,t.Fragment=x,t.Lazy=k,t.Memo=$,t.Portal=D,t.Profiler=R,t.StrictMode=q,t.Suspense=M,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===p||e===c||e===u||e===y||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===h||e.$$typeof===s||e.$$typeof===f||e.$$typeof===d||e.$$typeof===v||e.$$typeof===w||e.$$typeof===g)},t.isAsyncMode=function(t){return N||(N=!0,E(!1,"The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),n(t)||e(t)===l},t.isConcurrentMode=n,t.isContextConsumer=function(t){return e(t)===f},t.isContextProvider=function(t){return e(t)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(t){return e(t)===d},t.isFragment=function(t){return e(t)===a},t.isLazy=function(t){return e(t)===b},t.isMemo=function(t){return e(t)===h},t.isPortal=function(t){return e(t)===i},t.isProfiler=function(t){return e(t)===c},t.isStrictMode=function(t){return e(t)===u},t.isSuspense=function(t){return e(t)===y}}()}).call(t,n(0))},function(e,t,n){"use strict";function r(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case a:switch(e=e.type){case d:case y:case c:case f:case s:case h:return e;default:switch(e=e&&e.$$typeof){case p:case m:case l:return e;default:return t}}case w:case v:case u:return t}}}function o(e){return r(e)===y}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&Symbol.for,a=i?Symbol.for("react.element"):60103,u=i?Symbol.for("react.portal"):60106,c=i?Symbol.for("react.fragment"):60107,s=i?Symbol.for("react.strict_mode"):60108,f=i?Symbol.for("react.profiler"):60114,l=i?Symbol.for("react.provider"):60109,p=i?Symbol.for("react.context"):60110,d=i?Symbol.for("react.async_mode"):60111,y=i?Symbol.for("react.concurrent_mode"):60111,m=i?Symbol.for("react.forward_ref"):60112,h=i?Symbol.for("react.suspense"):60113,b=i?Symbol.for("react.suspense_list"):60120,v=i?Symbol.for("react.memo"):60115,w=i?Symbol.for("react.lazy"):60116,g=i?Symbol.for("react.fundamental"):60117,O=i?Symbol.for("react.responder"):60118,S=i?Symbol.for("react.scope"):60119;t.typeOf=r,t.AsyncMode=d,t.ConcurrentMode=y,t.ContextConsumer=p,t.ContextProvider=l,t.Element=a,t.ForwardRef=m,t.Fragment=c,t.Lazy=w,t.Memo=v,t.Portal=u,t.Profiler=f,t.StrictMode=s,t.Suspense=h,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===c||e===y||e===f||e===s||e===h||e===b||"object"==typeof e&&null!==e&&(e.$$typeof===w||e.$$typeof===v||e.$$typeof===l||e.$$typeof===p||e.$$typeof===m||e.$$typeof===g||e.$$typeof===O||e.$$typeof===S)},t.isAsyncMode=function(e){return o(e)||r(e)===d},t.isConcurrentMode=o,t.isContextConsumer=function(e){return r(e)===p},t.isContextProvider=function(e){return r(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},t.isForwardRef=function(e){return r(e)===m},t.isFragment=function(e){return r(e)===c},t.isLazy=function(e){return r(e)===w},t.isMemo=function(e){return r(e)===v},t.isPortal=function(e){return r(e)===u},t.isProfiler=function(e){return r(e)===f},t.isStrictMode=function(e){return r(e)===s},t.isSuspense=function(e){return r(e)===h}},function(e,t,n){e.exports=n(6)}]); | ||
var ReactDisqus=function(n){var r={};function o(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}return o.m=n,o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=2)}([function(t,e,n){t.exports=n(3)()},function(t,e){t.exports=React},function(t,e,n){t.exports=n(5)},function(t,e,n){"use strict";var c=n(4);function r(){}function o(){}o.resetWarningCache=r,t.exports=function(){function t(t,e,n,r,o,i){if(i!==c){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function e(){return t}var n={array:t.isRequired=t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:r};return n.PropTypes=n}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){"use strict";n.r(e),n.d(e,"CommentCount",function(){return w}),n.d(e,"CommentEmbed",function(){return j}),n.d(e,"DiscussionEmbed",function(){return k});var r=n(1),u=n.n(r),o=n(0),i=n.n(o);function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function a(t,e,n){var r=window.document.createElement("script");return r.async=!0,r.src=t,r.id=e,n.appendChild(r),r}function s(t,e){var n=window.document.getElementById(t);n&&e.removeChild(n)}function f(t,e){var n,r,o=function(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=function(t){if(t){if("string"==typeof t)return c(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?c(t,void 0):void 0}}(t))){var e=0,n=function(){};return{s:n,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,i=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return i=t.done,t},e:function(t){u=!0,o=t},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw o}}}}(new Set(Object.keys(t),Object.keys(e)));try{for(o.s();!(n=o.n()).done;){var i=n.value;if(t[i]!==e[i]&&(r=t[i],!(u.a.isValidElement(r)||Array.isArray(r)&&r.some(function(t){return u.a.isValidElement(t)}))))return!0}}catch(t){o.e(t)}finally{o.f()}return!1}function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function y(i){var u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e,n,r,o=h(i);return e=u?(t=h(this).constructor,Reflect.construct(o,arguments,t)):o.apply(this,arguments),n=this,!(r=e)||"object"!==p(r)&&"function"!=typeof r?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n):r}}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var m,b,g=(m=function(){window.DISQUSWIDGETS&&window.DISQUSWIDGETS.getCount({reset:!0})},0,function(){var t=this,e=arguments;window.clearTimeout(b),b=setTimeout(function(){b=null,m.apply(t,e)},300)}),w=function(){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}(e,u.a.Component);var t=y(e);function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t.apply(this,arguments)}return l(e.prototype,[{key:"componentDidMount",value:function(){this.loadInstance()}},{key:"shouldComponentUpdate",value:function(t){return this.props!==t&&f(this.props,t)}},{key:"componentDidUpdate",value:function(t){this.props.shortname!==t.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"loadInstance",value:function(){var t=window.document;t.getElementById("dsq-count-scr")?g():a("https://".concat(this.props.shortname,".disqus.com/count.js"),"dsq-count-scr",t.body)}},{key:"cleanInstance",value:function(){s("dsq-count-scr",window.document.body),window.DISQUSWIDGETS=void 0}},{key:"render",value:function(){return u.a.createElement("span",{className:"disqus-comment-count","data-disqus-identifier":this.props.config.identifier,"data-disqus-url":this.props.config.url},this.props.children)}}]),e}();function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function S(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function O(t,e){return(O=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _(i){var u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e,n,r,o=I(i);return e=u?(t=I(this).constructor,Reflect.construct(o,arguments,t)):o.apply(this,arguments),n=this,!(r=e)||"object"!==v(r)&&"function"!=typeof r?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n):r}}function I(t){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}w.propTypes={shortname:i.a.string.isRequired,config:i.a.shape({identifier:i.a.string,url:i.a.string,title:i.a.string}).isRequired};var j=function(){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&O(t,e)}(e,u.a.Component);var t=_(e);function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t.apply(this,arguments)}return S(e.prototype,[{key:"getSrc",value:function(){var t=Number(this.props.commentId).toString(36),e=this.props.showParentComment?"1":"0",n=this.props.showMedia?"1":"0";return"https://embed.disqus.com/p/".concat(t,"?p=").concat(e,"&m=").concat(n)}},{key:"render",value:function(){return u.a.createElement("iframe",{src:this.getSrc(),width:this.props.width,height:this.props.height,seamless:"seamless",scrolling:"no",frameBorder:"0"})}}]),e}();function P(t){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function R(){return(R=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function C(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function D(t,e){return(D=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function E(i){var u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e,n,r,o=q(i);return e=u?(t=q(this).constructor,Reflect.construct(o,arguments,t)):o.apply(this,arguments),n=this,!(r=e)||"object"!==P(r)&&"function"!=typeof r?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n):r}}function q(t){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}j.defaultProps={showMedia:!0,showParentComment:!0,width:420,height:320},j.propTypes={commentId:i.a.string.isRequired,showMedia:i.a.bool,showParentComment:i.a.bool,width:i.a.number,height:i.a.number};var T=["preData","preInit","onInit","onReady","afterRender","preReset","onIdentify","beforeComment","onNewComment","onPaginate"],k=function(){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&D(t,e)}(e,u.a.Component);var t=E(e);function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t.apply(this,arguments)}return C(e.prototype,[{key:"componentDidMount",value:function(){"undefined"!=typeof window&&window.disqus_shortname&&window.disqus_shortname!==this.props.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"shouldComponentUpdate",value:function(t){return this.props!==t&&f(this.props,t)}},{key:"componentDidUpdate",value:function(t){this.props.shortname!==t.shortname&&this.cleanInstance(),this.loadInstance()}},{key:"loadInstance",value:function(){var t=window.document;window&&window.DISQUS&&t.getElementById("dsq-embed-scr")?window.DISQUS.reset({reload:!0,config:this.getDisqusConfig(this.props.config)}):(window.disqus_config=this.getDisqusConfig(this.props.config),window.disqus_shortname=this.props.shortname,a("https://".concat(this.props.shortname,".disqus.com/embed.js"),"dsq-embed-scr",t.body))}},{key:"cleanInstance",value:function(){var t=window.document;s("dsq-embed-scr",t.body),window&&window.DISQUS&&window.DISQUS.reset({});try{delete window.DISQUS}catch(t){window.DISQUS=void 0}var e=t.getElementById("disqus_thread");if(e)for(;e.hasChildNodes();)e.removeChild(e.firstChild)}},{key:"getDisqusConfig",value:function(n){return function(){var e=this;this.page.identifier=n.identifier,this.page.url=n.url,this.page.title=n.title,this.page.category_id=n.categoryID,this.page.remote_auth_s3=n.remoteAuthS3,this.page.api_key=n.apiKey,n.language&&(this.language=n.language),T.forEach(function(t){e.callbacks[t]=[n[t]]})}}},{key:"render",value:function(){return u.a.createElement("div",R({},this.props,{id:"disqus_thread"}))}}]),e}();k.propTypes={shortname:i.a.string.isRequired,config:i.a.shape({identifier:i.a.string,url:i.a.string,title:i.a.string,language:i.a.string,categoryID:i.a.string,remoteAuthS3:i.a.string,apiKey:i.a.string,preData:i.a.func,preInit:i.a.func,onInit:i.a.func,onReady:i.a.func,afterRender:i.a.func,preReset:i.a.func,onIdentify:i.a.func,beforeComment:i.a.func,onNewComment:i.a.func,onPaginate:i.a.func}).isRequired};var x={CommentCount:w,CommentEmbed:j,DiscussionEmbed:k};e.default=x}]); | ||
//# sourceMappingURL=index.min.js.map |
@@ -1,98 +0,108 @@ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
exports.CommentCount = undefined; | ||
exports.CommentCount = void 0; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react = require('react'); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _utils = require("./utils"); | ||
var _propTypes = require('prop-types'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var _utils = require('./utils'); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var queueResetCount = (0, _utils.debounce)(function () { | ||
if (window.DISQUSWIDGETS) window.DISQUSWIDGETS.getCount({ reset: true }); | ||
if (window.DISQUSWIDGETS) window.DISQUSWIDGETS.getCount({ | ||
reset: true | ||
}); | ||
}, 300, false); // eslint-disable-line no-magic-numbers | ||
var CommentCount = exports.CommentCount = function (_React$Component) { | ||
_inherits(CommentCount, _React$Component); | ||
var CommentCount = /*#__PURE__*/function (_React$Component) { | ||
_inherits(CommentCount, _React$Component); | ||
function CommentCount() { | ||
_classCallCheck(this, CommentCount); | ||
var _super = _createSuper(CommentCount); | ||
return _possibleConstructorReturn(this, (CommentCount.__proto__ || Object.getPrototypeOf(CommentCount)).apply(this, arguments)); | ||
function CommentCount() { | ||
_classCallCheck(this, CommentCount); | ||
return _super.apply(this, arguments); | ||
} | ||
_createClass(CommentCount, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.loadInstance(); | ||
} | ||
}, { | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps) { | ||
if (this.props === nextProps) return false; | ||
return (0, _utils.shallowComparison)(this.props, nextProps); | ||
} | ||
}, { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
if (this.props.shortname !== prevProps.shortname) this.cleanInstance(); | ||
this.loadInstance(); | ||
} | ||
}, { | ||
key: "loadInstance", | ||
value: function loadInstance() { | ||
var doc = window.document; | ||
if (doc.getElementById('dsq-count-scr')) queueResetCount();else (0, _utils.insertScript)("https://".concat(this.props.shortname, ".disqus.com/count.js"), 'dsq-count-scr', doc.body); | ||
} | ||
}, { | ||
key: "cleanInstance", | ||
value: function cleanInstance() { | ||
var body = window.document.body; | ||
(0, _utils.removeScript)('dsq-count-scr', body); // count.js only reassigns this window object if it's undefined. | ||
_createClass(CommentCount, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.loadInstance(); | ||
} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps) { | ||
if (this.props === nextProps) return false; | ||
return (0, _utils.shallowComparison)(this.props, nextProps); | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate(prevProps) { | ||
if (this.props.shortname !== prevProps.shortname) this.cleanInstance(); | ||
this.loadInstance(); | ||
} | ||
}, { | ||
key: 'loadInstance', | ||
value: function loadInstance() { | ||
var doc = window.document; | ||
if (doc.getElementById('dsq-count-scr')) queueResetCount();else (0, _utils.insertScript)('https://' + this.props.shortname + '.disqus.com/count.js', 'dsq-count-scr', doc.body); | ||
} | ||
}, { | ||
key: 'cleanInstance', | ||
value: function cleanInstance() { | ||
var body = window.document.body; | ||
(0, _utils.removeScript)('dsq-count-scr', body); | ||
window.DISQUSWIDGETS = undefined; | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
return /*#__PURE__*/_react["default"].createElement("span", { | ||
className: "disqus-comment-count", | ||
"data-disqus-identifier": this.props.config.identifier, | ||
"data-disqus-url": this.props.config.url | ||
}, this.props.children); | ||
} | ||
}]); | ||
// count.js only reassigns this window object if it's undefined. | ||
window.DISQUSWIDGETS = undefined; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement( | ||
'span', | ||
{ | ||
className: 'disqus-comment-count', | ||
'data-disqus-identifier': this.props.config.identifier, | ||
'data-disqus-url': this.props.config.url | ||
}, | ||
this.props.children | ||
); | ||
} | ||
}]); | ||
return CommentCount; | ||
}(_react["default"].Component); | ||
return CommentCount; | ||
}(_react2.default.Component); | ||
exports.CommentCount = CommentCount; | ||
CommentCount.propTypes = { | ||
shortname: _propTypes2.default.string.isRequired, | ||
config: _propTypes2.default.shape({ | ||
identifier: _propTypes2.default.string, | ||
url: _propTypes2.default.string, | ||
title: _propTypes2.default.string | ||
}).isRequired | ||
shortname: _propTypes["default"].string.isRequired, | ||
config: _propTypes["default"].shape({ | ||
identifier: _propTypes["default"].string, | ||
url: _propTypes["default"].string, | ||
title: _propTypes["default"].string | ||
}).isRequired | ||
}; |
@@ -1,76 +0,87 @@ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
exports.CommentEmbed = undefined; | ||
exports.CommentEmbed = void 0; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react = require('react'); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _propTypes = require('prop-types'); | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var RADIX_BASE = 36; | ||
var CommentEmbed = exports.CommentEmbed = function (_React$Component) { | ||
_inherits(CommentEmbed, _React$Component); | ||
var CommentEmbed = /*#__PURE__*/function (_React$Component) { | ||
_inherits(CommentEmbed, _React$Component); | ||
function CommentEmbed() { | ||
_classCallCheck(this, CommentEmbed); | ||
var _super = _createSuper(CommentEmbed); | ||
return _possibleConstructorReturn(this, (CommentEmbed.__proto__ || Object.getPrototypeOf(CommentEmbed)).apply(this, arguments)); | ||
} | ||
function CommentEmbed() { | ||
_classCallCheck(this, CommentEmbed); | ||
_createClass(CommentEmbed, [{ | ||
key: 'getSrc', | ||
value: function getSrc() { | ||
var post = Number(this.props.commentId).toString(RADIX_BASE); | ||
var parentParam = this.props.showParentComment ? '1' : '0'; | ||
var mediaParam = this.props.showMedia ? '1' : '0'; | ||
return _super.apply(this, arguments); | ||
} | ||
return 'https://embed.disqus.com/p/' + post + '?p=' + parentParam + '&m=' + mediaParam; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement('iframe', { | ||
src: this.getSrc(), | ||
width: this.props.width, | ||
height: this.props.height, | ||
seamless: 'seamless', | ||
scrolling: 'no', | ||
frameBorder: '0' | ||
}); | ||
} | ||
}]); | ||
_createClass(CommentEmbed, [{ | ||
key: "getSrc", | ||
value: function getSrc() { | ||
var post = Number(this.props.commentId).toString(RADIX_BASE); | ||
var parentParam = this.props.showParentComment ? '1' : '0'; | ||
var mediaParam = this.props.showMedia ? '1' : '0'; | ||
return "https://embed.disqus.com/p/".concat(post, "?p=").concat(parentParam, "&m=").concat(mediaParam); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
return /*#__PURE__*/_react["default"].createElement("iframe", { | ||
src: this.getSrc(), | ||
width: this.props.width, | ||
height: this.props.height, | ||
seamless: "seamless", | ||
scrolling: "no", | ||
frameBorder: "0" | ||
}); | ||
} | ||
}]); | ||
return CommentEmbed; | ||
}(_react2.default.Component); | ||
return CommentEmbed; | ||
}(_react["default"].Component); | ||
exports.CommentEmbed = CommentEmbed; | ||
CommentEmbed.defaultProps = { | ||
showMedia: true, | ||
showParentComment: true, | ||
width: 420, | ||
height: 320 | ||
showMedia: true, | ||
showParentComment: true, | ||
width: 420, | ||
height: 320 | ||
}; | ||
CommentEmbed.propTypes = { | ||
commentId: _propTypes2.default.string.isRequired, | ||
showMedia: _propTypes2.default.bool, | ||
showParentComment: _propTypes2.default.bool, | ||
width: _propTypes2.default.number, | ||
height: _propTypes2.default.number | ||
commentId: _propTypes["default"].string.isRequired, | ||
showMedia: _propTypes["default"].bool, | ||
showParentComment: _propTypes["default"].bool, | ||
width: _propTypes["default"].number, | ||
height: _propTypes["default"].number | ||
}; |
@@ -1,137 +0,160 @@ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
exports.DiscussionEmbed = undefined; | ||
exports.DiscussionEmbed = void 0; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _react = require('react'); | ||
var _utils = require("./utils"); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _propTypes = require('prop-types'); | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var _utils = require('./utils'); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var callbacks = ['preData', 'preInit', 'onInit', 'onReady', 'afterRender', 'preReset', 'onIdentify', 'beforeComment', 'onNewComment', 'onPaginate']; | ||
var DiscussionEmbed = exports.DiscussionEmbed = function (_React$Component) { | ||
_inherits(DiscussionEmbed, _React$Component); | ||
var DiscussionEmbed = /*#__PURE__*/function (_React$Component) { | ||
_inherits(DiscussionEmbed, _React$Component); | ||
function DiscussionEmbed() { | ||
_classCallCheck(this, DiscussionEmbed); | ||
var _super = _createSuper(DiscussionEmbed); | ||
return _possibleConstructorReturn(this, (DiscussionEmbed.__proto__ || Object.getPrototypeOf(DiscussionEmbed)).apply(this, arguments)); | ||
function DiscussionEmbed() { | ||
_classCallCheck(this, DiscussionEmbed); | ||
return _super.apply(this, arguments); | ||
} | ||
_createClass(DiscussionEmbed, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
if (typeof window !== 'undefined' && window.disqus_shortname && window.disqus_shortname !== this.props.shortname) this.cleanInstance(); | ||
this.loadInstance(); | ||
} | ||
}, { | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps) { | ||
if (this.props === nextProps) return false; | ||
return (0, _utils.shallowComparison)(this.props, nextProps); | ||
} | ||
}, { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(nextProps) { | ||
if (this.props.shortname !== nextProps.shortname) this.cleanInstance(); | ||
this.loadInstance(); | ||
} | ||
}, { | ||
key: "loadInstance", | ||
value: function loadInstance() { | ||
var doc = window.document; | ||
_createClass(DiscussionEmbed, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
if (typeof window !== 'undefined' && window.disqus_shortname && window.disqus_shortname !== this.props.shortname) this.cleanInstance(); | ||
this.loadInstance(); | ||
} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps) { | ||
if (this.props === nextProps) return false; | ||
return (0, _utils.shallowComparison)(this.props, nextProps); | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate(nextProps) { | ||
if (this.props.shortname !== nextProps.shortname) this.cleanInstance(); | ||
this.loadInstance(); | ||
} | ||
}, { | ||
key: 'loadInstance', | ||
value: function loadInstance() { | ||
var doc = window.document; | ||
if (window && window.DISQUS && doc.getElementById('dsq-embed-scr')) { | ||
window.DISQUS.reset({ | ||
reload: true, | ||
config: this.getDisqusConfig(this.props.config) | ||
}); | ||
} else { | ||
window.disqus_config = this.getDisqusConfig(this.props.config); | ||
window.disqus_shortname = this.props.shortname; | ||
(0, _utils.insertScript)('https://' + this.props.shortname + '.disqus.com/embed.js', 'dsq-embed-scr', doc.body); | ||
} | ||
} | ||
}, { | ||
key: 'cleanInstance', | ||
value: function cleanInstance() { | ||
var doc = window.document; | ||
(0, _utils.removeScript)('dsq-embed-scr', doc.body); | ||
if (window && window.DISQUS) window.DISQUS.reset({}); | ||
if (window && window.DISQUS && doc.getElementById('dsq-embed-scr')) { | ||
window.DISQUS.reset({ | ||
reload: true, | ||
config: this.getDisqusConfig(this.props.config) | ||
}); | ||
} else { | ||
window.disqus_config = this.getDisqusConfig(this.props.config); | ||
window.disqus_shortname = this.props.shortname; | ||
(0, _utils.insertScript)("https://".concat(this.props.shortname, ".disqus.com/embed.js"), 'dsq-embed-scr', doc.body); | ||
} | ||
} | ||
}, { | ||
key: "cleanInstance", | ||
value: function cleanInstance() { | ||
var doc = window.document; | ||
(0, _utils.removeScript)('dsq-embed-scr', doc.body); | ||
if (window && window.DISQUS) window.DISQUS.reset({}); | ||
try { | ||
delete window.DISQUS; | ||
} catch (error) { | ||
window.DISQUS = undefined; | ||
} | ||
var disqusThread = doc.getElementById('disqus_thread'); | ||
if (disqusThread) { | ||
while (disqusThread.hasChildNodes()) { | ||
disqusThread.removeChild(disqusThread.firstChild); | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'getDisqusConfig', | ||
value: function getDisqusConfig(config) { | ||
return function () { | ||
var _this2 = this; | ||
try { | ||
delete window.DISQUS; | ||
} catch (error) { | ||
window.DISQUS = undefined; | ||
} | ||
this.page.identifier = config.identifier; | ||
this.page.url = config.url; | ||
this.page.title = config.title; | ||
this.page.remote_auth_s3 = config.remoteAuthS3; | ||
this.page.api_key = config.apiKey; | ||
var disqusThread = doc.getElementById('disqus_thread'); | ||
callbacks.forEach(function (callbackName) { | ||
_this2.callbacks[callbackName] = [config[callbackName]]; | ||
}); | ||
}; | ||
if (disqusThread) { | ||
while (disqusThread.hasChildNodes()) { | ||
disqusThread.removeChild(disqusThread.firstChild); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement('div', _extends({}, this.props, { id: 'disqus_thread' })); | ||
} | ||
}]); | ||
} | ||
} | ||
}, { | ||
key: "getDisqusConfig", | ||
value: function getDisqusConfig(config) { | ||
return function () { | ||
var _this = this; | ||
return DiscussionEmbed; | ||
}(_react2.default.Component); | ||
this.page.identifier = config.identifier; | ||
this.page.url = config.url; | ||
this.page.title = config.title; | ||
this.page.category_id = config.categoryID; | ||
this.page.remote_auth_s3 = config.remoteAuthS3; | ||
this.page.api_key = config.apiKey; | ||
if (config.language) this.language = config.language; | ||
callbacks.forEach(function (callbackName) { | ||
_this.callbacks[callbackName] = [config[callbackName]]; | ||
}); | ||
}; | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
return /*#__PURE__*/_react["default"].createElement("div", _extends({}, this.props, { | ||
id: "disqus_thread" | ||
})); | ||
} | ||
}]); | ||
return DiscussionEmbed; | ||
}(_react["default"].Component); | ||
exports.DiscussionEmbed = DiscussionEmbed; | ||
DiscussionEmbed.propTypes = { | ||
shortname: _propTypes2.default.string.isRequired, | ||
config: _propTypes2.default.shape({ | ||
identifier: _propTypes2.default.string, | ||
url: _propTypes2.default.string, | ||
title: _propTypes2.default.string, | ||
preData: _propTypes2.default.func, | ||
preInit: _propTypes2.default.func, | ||
onInit: _propTypes2.default.func, | ||
onReady: _propTypes2.default.func, | ||
afterRender: _propTypes2.default.func, | ||
preReset: _propTypes2.default.func, | ||
onIdentify: _propTypes2.default.func, | ||
beforeComment: _propTypes2.default.func, | ||
onNewComment: _propTypes2.default.func, | ||
onPaginate: _propTypes2.default.func | ||
}).isRequired | ||
shortname: _propTypes["default"].string.isRequired, | ||
config: _propTypes["default"].shape({ | ||
identifier: _propTypes["default"].string, | ||
url: _propTypes["default"].string, | ||
title: _propTypes["default"].string, | ||
language: _propTypes["default"].string, | ||
categoryID: _propTypes["default"].string, | ||
remoteAuthS3: _propTypes["default"].string, | ||
apiKey: _propTypes["default"].string, | ||
preData: _propTypes["default"].func, | ||
preInit: _propTypes["default"].func, | ||
onInit: _propTypes["default"].func, | ||
onReady: _propTypes["default"].func, | ||
afterRender: _propTypes["default"].func, | ||
preReset: _propTypes["default"].func, | ||
onIdentify: _propTypes["default"].func, | ||
beforeComment: _propTypes["default"].func, | ||
onNewComment: _propTypes["default"].func, | ||
onPaginate: _propTypes["default"].func | ||
}).isRequired | ||
}; |
@@ -1,25 +0,38 @@ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
exports.DiscussionEmbed = exports.CommentEmbed = exports.CommentCount = undefined; | ||
Object.defineProperty(exports, "CommentCount", { | ||
enumerable: true, | ||
get: function get() { | ||
return _CommentCount.CommentCount; | ||
} | ||
}); | ||
Object.defineProperty(exports, "CommentEmbed", { | ||
enumerable: true, | ||
get: function get() { | ||
return _CommentEmbed.CommentEmbed; | ||
} | ||
}); | ||
Object.defineProperty(exports, "DiscussionEmbed", { | ||
enumerable: true, | ||
get: function get() { | ||
return _DiscussionEmbed.DiscussionEmbed; | ||
} | ||
}); | ||
exports["default"] = void 0; | ||
var _CommentCount = require('./CommentCount'); | ||
var _CommentCount = require("./CommentCount"); | ||
var _CommentEmbed = require('./CommentEmbed'); | ||
var _CommentEmbed = require("./CommentEmbed"); | ||
var _DiscussionEmbed = require('./DiscussionEmbed'); | ||
var _DiscussionEmbed = require("./DiscussionEmbed"); | ||
exports.CommentCount = _CommentCount.CommentCount; | ||
exports.CommentEmbed = _CommentEmbed.CommentEmbed; | ||
exports.DiscussionEmbed = _DiscussionEmbed.DiscussionEmbed; | ||
var Disqus = { | ||
CommentCount: _CommentCount.CommentCount, | ||
CommentEmbed: _CommentEmbed.CommentEmbed, | ||
DiscussionEmbed: _DiscussionEmbed.DiscussionEmbed | ||
CommentCount: _CommentCount.CommentCount, | ||
CommentEmbed: _CommentEmbed.CommentEmbed, | ||
DiscussionEmbed: _DiscussionEmbed.DiscussionEmbed | ||
}; | ||
exports.default = Disqus; | ||
var _default = Disqus; | ||
exports["default"] = _default; |
113
lib/utils.js
@@ -1,5 +0,5 @@ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
@@ -12,83 +12,76 @@ exports.insertScript = insertScript; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function insertScript(src, id, parentElement) { | ||
var script = window.document.createElement('script'); | ||
script.async = true; | ||
script.src = src; | ||
script.id = id; | ||
parentElement.appendChild(script); | ||
return script; | ||
var script = window.document.createElement('script'); | ||
script.async = true; | ||
script.src = src; | ||
script.id = id; | ||
parentElement.appendChild(script); | ||
return script; | ||
} | ||
function removeScript(id, parentElement) { | ||
var script = window.document.getElementById(id); | ||
if (script) parentElement.removeChild(script); | ||
var script = window.document.getElementById(id); | ||
if (script) parentElement.removeChild(script); | ||
} | ||
function debounce(func, wait, runOnFirstCall) { | ||
var timeout = void 0; | ||
return function () { | ||
var context = this; // eslint-disable-line consistent-this | ||
var args = arguments; | ||
var timeout; | ||
return function () { | ||
var context = this; // eslint-disable-line consistent-this | ||
var deferredExecution = function deferredExecution() { | ||
timeout = null; | ||
if (!runOnFirstCall) func.apply(context, args); | ||
}; | ||
var args = arguments; | ||
var callNow = runOnFirstCall && !timeout; | ||
var deferredExecution = function deferredExecution() { | ||
timeout = null; | ||
if (!runOnFirstCall) func.apply(context, args); | ||
}; | ||
window.clearTimeout(timeout); | ||
timeout = setTimeout(deferredExecution, wait); | ||
if (callNow) func.apply(context, args); | ||
}; | ||
var callNow = runOnFirstCall && !timeout; | ||
window.clearTimeout(timeout); | ||
timeout = setTimeout(deferredExecution, wait); | ||
if (callNow) func.apply(context, args); | ||
}; | ||
} | ||
function isReactElement(element) { | ||
if (_react2.default.isValidElement(element)) { | ||
return true; | ||
} else if (Array.isArray(element)) { | ||
return element.some(function (value) { | ||
return _react2.default.isValidElement(value); | ||
}); | ||
} | ||
return false; | ||
if (_react["default"].isValidElement(element)) { | ||
return true; | ||
} else if (Array.isArray(element)) { | ||
return element.some(function (value) { | ||
return _react["default"].isValidElement(value); | ||
}); | ||
} | ||
return false; | ||
} | ||
function shallowComparison(currentProps, nextProps) { | ||
// Perform a comparison of all props, excluding React Elements, to prevent unnecessary updates | ||
var propNames = new Set(Object.keys(currentProps), Object.keys(nextProps)); // eslint-disable-line no-undef | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
// Perform a comparison of all props, excluding React Elements, to prevent unnecessary updates | ||
var propNames = new Set(Object.keys(currentProps), Object.keys(nextProps)); // eslint-disable-line no-undef | ||
try { | ||
for (var _iterator = propNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var name = _step.value; | ||
var _iterator = _createForOfIteratorHelper(propNames), | ||
_step; | ||
if (currentProps[name] !== nextProps[name] && !isReactElement(currentProps[name])) return true; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var name = _step.value; | ||
if (currentProps[name] !== nextProps[name] && !isReactElement(currentProps[name])) return true; | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
return false; | ||
return false; | ||
} |
{ | ||
"name": "disqus-react", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Official React components to embed Disqus discussions and comments.", | ||
@@ -21,3 +21,3 @@ "repository": { | ||
"build:dist": "webpack --config webpack.dist.config.js --progress --colors && uglifyjs dist/index.js -cm -o dist/index.min.js --source-map content=dist/index.js.map,url=index.min.js.map", | ||
"build:babel": "babel src --out-dir lib --source-map", | ||
"build:babel": "babel src --out-dir lib", | ||
"build": "npm run build:example && npm run build:dist && npm run build:babel", | ||
@@ -33,17 +33,18 @@ "prepublish": "npm run build" | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.24.0", | ||
"babel-eslint": "^7.2.1", | ||
"babel-loader": "^6.4.1", | ||
"babel-preset-es2015": "^6.24.0", | ||
"babel-preset-react": "^6.23.0", | ||
"eslint": "^4.18.2", | ||
"eslint-plugin-react": "^6.10.3", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.9.6", | ||
"@babel/preset-env": "^7.9.6", | ||
"@babel/preset-react": "^7.9.4", | ||
"babel-eslint": "^10.1.0", | ||
"babel-loader": "^8.1.0", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-react": "^7.19.0", | ||
"prop-types": "^15.7.2", | ||
"react": "^15.6.2", | ||
"react-dom": "^15.6.2", | ||
"uglify-js": "^3.1.2", | ||
"webpack": "^2.3.2", | ||
"webpack-dev-server": "^3.1.11" | ||
"uglify-js": "^3.9.2", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.11", | ||
"webpack-dev-server": "^3.10.3" | ||
} | ||
} |
@@ -32,5 +32,8 @@ # disqus-react | ||
config={ | ||
url: this.props.article.url, | ||
identifier: this.props.article.id, | ||
title: this.props.article.title, | ||
{ | ||
url: this.props.article.url, | ||
identifier: this.props.article.id, | ||
title: this.props.article.title, | ||
language: 'zh_TW' //e.g. for Traditional Chinese (Taiwan) | ||
} | ||
} | ||
@@ -53,5 +56,7 @@ /> | ||
config={ | ||
url: this.props.article.url, | ||
identifier: this.props.article.id, | ||
title: this.props.article.title, | ||
{ | ||
url: this.props.article.url, | ||
identifier: this.props.article.id, | ||
title: this.props.article.title, | ||
} | ||
} | ||
@@ -58,0 +63,0 @@ > |
@@ -1,15 +0,35 @@ | ||
import * as React from "react"; | ||
import * as React from 'react'; | ||
interface DisqusProps { | ||
interface DisqusConfig { | ||
url?: string; | ||
identifier?: string; | ||
title?: string; | ||
}; | ||
interface DiscussionEmbedConfig extends DisqusConfig { | ||
categoryID?: string; | ||
language?: string; | ||
// Callbacks | ||
preData?: (...args: any[]) => any; | ||
preInit?: (...args: any[]) => any; | ||
onInit?: (...args: any[]) => any; | ||
onReady?: (...args: any[]) => any; | ||
afterRender?: (...args: any[]) => any; | ||
preReset?: (...args: any[]) => any; | ||
onIdentify?: (...args: any[]) => any; | ||
beforeComment?: (...args: any[]) => any; | ||
onNewComment?: (...args: any[]) => any; | ||
onPaginate?: (...args: any[]) => any; | ||
}; | ||
interface DiscussionEmbedProps { | ||
shortname: string; | ||
config: { | ||
url: string; | ||
identifier: string; | ||
title: string; | ||
}; | ||
} | ||
config: DiscussionEmbedConfig; | ||
}; | ||
interface CommentCountProps extends DisqusProps { | ||
shortname: string, | ||
config: DisqusConfig; | ||
children?: React.ReactNode; | ||
} | ||
}; | ||
@@ -22,3 +42,3 @@ interface CommentEmbedProps { | ||
height?: number; | ||
} | ||
}; | ||
@@ -28,12 +48,12 @@ interface IDisqus { | ||
CommentEmbed: React.Component<CommentEmbedProps, {}>; | ||
DiscussionEmbed: React.Component<DisqusProps, {}>; | ||
} | ||
DiscussionEmbed: React.Component<DiscussionEmbedProps, {}>; | ||
}; | ||
declare class CommentCount extends React.Component<CommentCountProps, {}> {} | ||
declare class CommentEmbed extends React.Component<CommentEmbedProps, {}> {} | ||
declare class DiscussionEmbed extends React.Component<DisqusProps, {}> {} | ||
declare class DiscussionEmbed extends React.Component<DiscussionEmbedProps, {}> {} | ||
declare const Disqus: { | ||
CommentCount: React.ComponentType<CommentCountProps>; | ||
CommentEmbed: React.ComponentType<CommentEmbedProps>; | ||
DiscussionEmbed: React.ComponentType<DisqusProps>; | ||
DiscussionEmbed: React.ComponentType<DiscussionEmbedProps>; | ||
}; | ||
@@ -40,0 +60,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
93
87160
15
13
541
1