<commit_before>define(function(require, exports, module) {
  var Actions = require('app/resources/Actions');
  var Msgbox = require('widget/Msgbox');
  var WechatShare = require('util/WechatShare');
  var YiXinShare = require('util/YiXinShare');

  var BasicModel = require('app/model/Model');

  function View(){
    this.models = {
      Basic: BasicModel
    }

    var VIEW = this,
      els,
      params = Core.localParam(),
      isApp = Core.NativeBridge.isApp();
    //click事件
    this.tapEvent = $.os.ios || $.os.android?'tap':'click';

    function init(){
      Core.MetaHandler.fixViewportWidth();
      initEls();
      bindEvent();
      VIEW.hide();
      els.body.css({'visibility': 'visible'});
    };//end init

    function initEls(){
      var body = $('body');
      els = {
        body: body,
        views: body.children('.view')
      }
      VIEW.GlobalTouch = {
        preventMove: false,
        touched: false
      }
      window.GlobalTouch = VIEW.GlobalTouch;
      VIEW.msgbox = new Msgbox({
        GlobalTouch : VIEW.GlobalTouch
      });
    }
    this.getEls = function(){
      return els;
    }
    this.getView = function(viewCls){
      return els.views.filter('.'+viewCls);
    }
    this.getTemplates = function(viewCls){
      var el = this.getView(viewCls);
      if(el.$Templates){return el.$Templates;}
      var Templates = {};
      el.find('*[data-template]').each(function(){
        var key = $(this),
          name = key.attr('data-template');
        if(name){
          Templates[name] = Core.microTmpl(key.text());
        }
      });
      el.$Templates = Templates;
      return Templates;
    }
    function bindEvent(){
      document.addEventListener('touchmove', function (e) {
        VIEW.GlobalTouch.preventMove && e.preventDefault();
      },false);
      document.addEventListener('touchstart', function (e) {
        VIEW.GlobalTouch.touched = true;
      },false);
      document.addEventListener('touchend', function (e) {
        VIEW.GlobalTouch.touched = false;
      },false);
      if(VIEW.tapEvent=='tap'){
        els.body.on('click','a',function(e){
          e.preventDefault();
          return false;
        });
        els.body.on('tap','a',function(){
          Core.Event.trigger('redirect',this.href);
        });
      }
      //fix chrome for android active effect remain issue
      $.os.android && /Chrome/i.test(window.navigator.userAgent) && els.body.on('touchstart','* [data-fix-active]',function(e){
        e.preventDefault();
      });
      els.body.on(VIEW.tapEvent,'* [data-fake-link]',function(){
        Core.Event.trigger('redirect',this.getAttribute('data-fake-link'));
      });
      els.body.on(VIEW.tapEvent=='tap'?'touchstart':VIEW.tapEvent,'* [data-analytics]',function(){
        Core.Event.trigger(this.getAttribute('data-analytics-global')?'analytics':'analyticsCurView',this.getAttribute('data-analytics'));
      });
      els.body.on(VIEW.tapEvent,'* [data-eventname]',function(){
        var ename = this.getAttribute('data-eventname'),
          eparam = this.getAttribute('data-eventparam')||'',
          eparams = this.getAttribute('data-eventparams')||'';

        if(ename){
          var params = [];
          params.push(ename);
          if(eparams){
            Array.prototype.push.apply(params,eparams.split(','));
          }else if(eparam){
            params.push(eparam);
          }
          Core.Event.trigger.apply(null,params);
        }
      });
    }
    this.show = function(viewCls){
      this.hide(viewCls);

      var view = this.getView(viewCls);
      !view.hasClass('show') && view.addClass('show');
      return this;
    }
    this.hide = function(notCls){
      (notCls?els.views.not('.'+notCls):els.views).removeClass('show');
      return this;
    }

    /**
     *
     * option = {
             title String 'share title',
             text String 'share text',
             summary String 'share summary',<commit_msg>added auto revert history scroll position<commit_after>define(function(require, exports, module) {
  var Actions = require('app/resources/Actions');
  var Msgbox = require('widget/Msgbox');
  var WechatShare = require('util/WechatShare');
  var YiXinShare = require('util/YiXinShare');

  var BasicModel = require('app/model/Model');

  function View(){
    this.models = {
      Basic: BasicModel
    }

    var VIEW = this,
      els,
      params = Core.localParam(),
      isApp = Core.NativeBridge.isApp();
    //click事件
    this.tapEvent = $.os.ios || $.os.android?'tap':'click';

    function init(){
      Core.MetaHandler.fixViewportWidth();
      initEls();
      bindEvent();
      VIEW.hide();
      els.body.css({'visibility': 'visible'});
    };//end init

    function initEls(){
      var body = $('body');
      els = {
        body: body,
        views: body.children('.view')
      }
      VIEW.GlobalTouch = {
        preventMove: false,
        touched: false
      }
      window.GlobalTouch = VIEW.GlobalTouch;
      VIEW.msgbox = new Msgbox({
        GlobalTouch : VIEW.GlobalTouch
      });
    }
    this.getEls = function(){
      return els;
    }
    this.getView = function(viewCls){
      return els.views.filter('.'+viewCls);
    }
    this.getTemplates = function(viewCls){
      var el = this.getView(viewCls);
      if(el.$Templates){return el.$Templates;}
      var Templates = {};
      el.find('*[data-template]').each(function(){
        var key = $(this),
          name = key.attr('data-template');
        if(name){
          Templates[name] = Core.microTmpl(key.text());
        }
      });
      el.$Templates = Templates;
      return Templates;
    }

    function bindEvent(){
      document.addEventListener('touchmove', function (e) {
        VIEW.GlobalTouch.preventMove && e.preventDefault();
      },false);
      document.addEventListener('touchstart', function (e) {
        VIEW.GlobalTouch.touched = true;
      },false);
      document.addEventListener('touchend', function (e) {
        VIEW.GlobalTouch.touched = false;
      },false);
      if(VIEW.tapEvent=='tap'){
        els.body.on('click','a',function(e){
          e.preventDefault();
          return false;
        });
        els.body.on('tap','a',function(){
          Core.Event.trigger('redirect',this.href);
        });
      }
      //fix chrome for android active effect remain issue
      $.os.android && /Chrome/i.test(window.navigator.userAgent) && els.body.on('touchstart','* [data-fix-active]',function(e){
        e.preventDefault();
      });
      els.body.on(VIEW.tapEvent,'* [data-fake-link]',function(){
        Core.Event.trigger('redirect',this.getAttribute('data-fake-link'));
      });
      els.body.on(VIEW.tapEvent=='tap'?'touchstart':VIEW.tapEvent,'* [data-analytics]',function(){
        Core.Event.trigger(this.getAttribute('data-analytics-global')?'analytics':'analyticsCurView',this.getAttribute('data-analytics'));
      });
      els.body.on(VIEW.tapEvent,'* [data-eventname]',function(){
        var ename = this.getAttribute('data-eventname'),
          eparam = this.getAttribute('data-eventparam')||'',
          eparams = this.getAttribute('data-eventparams')||'';

        if(ename){
          var params = [];
          params.push(ename);
          if(eparams){
            Array.prototype.push.apply(params,eparams.split(','));
          }else if(eparam){
            params.push(eparam);
          }
          Core.Event.trigger.apply(null,params);
        }
      });
    }
    this.show = function(viewCls,autoRevert){
      this.hide(viewCls);

      var view = this.getView(viewCls);
      !view.hasClass('show') && view.addClass('show');
      //auto scroll to history position
      (autoRevert==undefined || autoRevert) && setTimeout(Core.Router.scrollToHistoryPosition,100);
      return this;
    }
    this.hide = function(notCls){
      (notCls?els.views.not('.'+notCls):els.views).removeClass('show');
      return this;
    }

    /**
     *
     * option = {
             title String 'share title',
             text String 'share text',
             summary String 'share summary',
{'fraction_non_alphanumeric': 0.16433136676499507, 'fraction_numerical': 0.0003687315634218289, 'mean_word_length': 2.423222549432057, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6631008', 'n_tokens_mistral': 2512, 'n_tokens_neox': 2464, 'n_words': 392}