duoshuo-ua-core.min.js 1.0 KB

12345678
  1. /**
  2. * Duoshuo UA Plugin - 精简版
  3. * 此版本不集成ua-parser,需要自行设置getUAString
  4. * @version v1.0.5
  5. * @license MIT
  6. * @author Gerald <gera2ld@163.com>
  7. */
  8. !function(){function t(){return""}function n(t,n){var e=duoshuoQuery.myIds||[],i=n[0];1==n.length&&(i=i.post),t.agent=i.agent;var r=i.author_id;e.pop||(e=[e]),t.webmaster=e.indexOf(r)<0?0:r}function e(n){var e=n.result,i=e.indexOf('<div class="ds-comment-header">'),r=e.indexOf("</div>",i),u=duoshuoQuery.getUAString||s.getUAString||t;n.result=e.slice(0,r)+u.call(s,n)+e.slice(r)}function i(){var t=DUOSHUO.templates.post;DUOSHUO.templates.post=function(){var i={},r=arguments;return n.call(this,i,r),i.result=t.apply(this,r),e.call(this,i,r),i.result}}function r(t,n,e){function i(){var t=e;t&&(e=null,t())}var r;t[n]?i():Object.defineProperty(t,n,{get:function(){return r},set:function(t){r=t,i()},configurable:!0})}function u(t,n,e){function i(){r(t,u,function(){t=t[u],(u=n.shift())?i():e()})}var u=n.shift();i()}var s=this;u(window,["DUOSHUO","templates","post"],i)}.call({});