整合營(yíng)銷(xiāo)服務(wù)商

          電腦端+手機(jī)端+微信端=數(shù)據(jù)同步管理

          免費(fèi)咨詢(xún)熱線(xiàn):

          JavaScript-第四章

          、什么是面向?qū)ο?

          面向?qū)ο髢H僅是一個(gè)概念或者編程思想

          通過(guò)一種叫做原型的方式來(lái)實(shí)現(xiàn)面向?qū)ο缶幊?/p>

          1、 創(chuàng)建對(duì)象(自定義對(duì)象,內(nèi)置對(duì)象)

          基于Object對(duì)象的方式創(chuàng)建對(duì)象-自定義對(duì)象

          示例:

          var 對(duì)象名稱(chēng)=new Object( );

          var flower=new Object();

          flower.name="長(zhǎng)春花";

          flower.genera="夾竹桃科 長(zhǎng)春花屬";

          flower.area="非洲、亞熱帶、熱帶以及中國(guó)大陸的華東、西南、中南等地";

          flower.uses="觀(guān)賞或用藥等";

          flower.showName=function(){ alert(this.name); }

          flower.showName();


          常見(jiàn)的內(nèi)置對(duì)象

          String(字符串)對(duì)象

          Date(日期)對(duì)象

          Array(數(shù)組)對(duì)象

          Boolean(邏輯)對(duì)象

          Math(算數(shù))對(duì)象

          RegExp對(duì)象


          二、

          如何解決使用同一個(gè)接口不需要?jiǎng)?chuàng)建很多對(duì)象,減少產(chǎn)生大量的重復(fù)代碼?

          1、構(gòu)造函數(shù):

          function Flower(name,genera,area,uses){

          this.name=name;

          …….

          this.showName=function(){

          alert(this.name);

          }

          }

          var flower1=new Flower("長(zhǎng)春花","夾竹桃科 長(zhǎng)春花屬","非洲、亞熱帶、熱帶以及中國(guó)大陸的華東、西南、中南等地","觀(guān)賞或用藥等")

          flower1.showName();

          2、原型對(duì)象:

          function Flower(){


          }

          Flower.prototype.name="曼陀羅花";

          Flower.prototype.genera="茄科 曼陀羅屬";

          Flower.prototype.area="印度、中國(guó)北部";

          Flower.prototype.uses="觀(guān)賞或藥用";

          Flower.prototype.showName=function() {

          alert(this.name);

          }

          var flower1=new Flower();

          flower1.showName();

          var flower2=new Flower();

          flower2.showName();

          alert(flower1.showName==flower2.showName);

          三、繼承

          1.原型鏈:一個(gè)原型對(duì)象是另一個(gè)原型對(duì)象的實(shí)例

          相關(guān)的原型對(duì)象層層遞進(jìn),就構(gòu)成了實(shí)例與原型的鏈條,就是原型鏈

          示例:

          function Humans(){

          this.foot=2;

          }

          Humans.prototype.getFoot=function(){

          return this.foot;

          }

          function Man(){

          this.head=1;

          }

          Man.prototype=new Humans(); //繼承了Humans

          Man.prototype.getHead=function(){

          return this.head;

          }

          var man1=new Man();

          alert(man1.getFoot()); //2

          alert(man1 instanceof Object); //true

          alert(man1 instanceof Humans); //true

          alert(man1 instanceof Man); //true

          2.對(duì)象繼承:

          function Humans(){

          this.clothing=["trousers","dress","jacket"];

          }

          function Man(){ }

          //繼承了Humans

          Man.prototype=new Humans();

          var man1=new Man();

          man1.clothing.push("coat");

          alert(man1.clothing);

          var man2=new Man();

          alert(man2.clothing);

          3.組合繼承:

          組合繼承:有時(shí)也叫做偽經(jīng)典繼承

          將原型鏈和借用構(gòu)造函數(shù)的技術(shù)組合到一塊,發(fā)揮二者之長(zhǎng)的一種繼承模式

          使用原型鏈實(shí)現(xiàn)對(duì)原型屬性和方法的繼承,而通過(guò)借用構(gòu)造函數(shù)來(lái)實(shí)現(xiàn)對(duì)實(shí)例屬性的繼承


          四、這一章的示例代碼:

          <html>


          <head>

          <title>面向?qū)ο髽?biāo)題欄替換和修改</title>

          </head>

          <style>

          * {

          margin: 0;

          padding: 0;

          }


          ul li {

          list-style: none;

          }


          main {

          width: 960px;

          height: 500px;

          border-radius: 10px;

          margin: 50px auto;

          }


          main h4 {

          height: 100px;

          line-height: 100px;

          text-align: center;

          }


          .tabsbox {

          width: 900px;

          margin: 0 auto;

          height: 400px;

          border: 1px solid lightsalmon;

          position: relative;

          }


          nav ul {

          overflow: hidden;

          }


          nav ul li {

          float: left;

          width: 100px;

          height: 50px;

          line-height: 50px;

          text-align: center;

          border-right: 1px solid #ccc;

          position: relative;

          }


          nav ul li.liactive {

          border-bottom: 2px solid #fff;

          z-index: 9;

          }


          #tab input {

          width: 80%;

          height: 60%;

          }


          nav ul li span:last-child {

          position: absolute;

          user-select: none;

          font-size: 12px;

          top: -18px;

          right: 0;

          display: inline-block;

          height: 20px;

          }


          .tabadd {

          position: absolute;

          /* width: 100px; */

          top: 0;

          right: 0;

          }


          .tabadd span {

          display: block;

          width: 20px;

          height: 20px;

          line-height: 20px;

          text-align: center;

          border: 1px solid #ccc;

          float: right;

          margin: 10px;

          user-select: none;

          }


          .tabscon {

          width: 100%;

          height: 300px;

          position: absolute;

          padding: 30px;

          top: 50px;

          left: 0px;

          box-sizing: border-box;

          border-top: 1px solid #ccc;

          }


          .tabscon section,

          .tabscon section.conactive {

          display: none;

          width: 100%;

          height: 100%;

          }


          .tabscon section.conactive {

          display: block;

          }

          </style>


          <body>

          <main>

          <h4>

          JS面向?qū)ο?動(dòng)態(tài)添加標(biāo)簽頁(yè)

          </h4>

          <div class="tabsbox" id="tab">

          <!-- tab標(biāo)簽 -->

          <nav class="fisrstnav">

          <ul>

          <li class="liactive"><span>測(cè)試1</span><span class="iconfont icon-guanbi"></span> </li>

          <li><span>測(cè)試2</span><span class="iconfont icon-guanbi"></span> </li>

          <li class="liactive"><span>測(cè)試3</span><span class="iconfont icon-guanbi"></span> </li>

          </ul>

          <div class="tabadd">

          <span>+</span>

          </div>

          </nav>

          <!-- tab內(nèi)容 -->

          <div class="tabscon">

          <section class="conactive">測(cè)試1</section>

          <section>測(cè)試2</section>

          <section>測(cè)試3</section>

          </div>

          </div>

          </main>

          </body>

          <script>

          var that;

          class Tab {

          constructor(id) {

          // 獲取元素

          that = this;

          this.main = document.querySelector(id);

          this.add = this.main.querySelector('.tabadd');

          // li的父元素

          this.ul = this.main.querySelector('.fisrstnav ul:first-child');

          // section 父元素

          this.fsection = this.main.querySelector('.tabscon');

          this.init();

          }

          init() {

          this.updateNode();

          // init 初始化操作讓相關(guān)的元素綁定事件

          this.add.onclick = this.addTab;

          for (var i = 0; i < this.lis.length; i++) {

          this.lis[i].index = i;

          this.lis[i].onclick = this.toggleTab;

          this.remove[i].onclick = this.removeTab;

          this.spans[i].ondblclick = this.editTab;

          this.sections[i].ondblclick = this.editTab;


          }

          }

          // 因?yàn)槲覀儎?dòng)態(tài)添加元素 需要從新獲取對(duì)應(yīng)的元素

          updateNode() {

          this.lis = this.main.querySelectorAll('li');

          this.sections = this.main.querySelectorAll('section');

          this.remove = this.main.querySelectorAll('.icon-guanbi');

          this.spans = this.main.querySelectorAll('.fisrstnav li span:first-child');

          }

          // 1. 切換功能

          toggleTab() {

          // console.log(this.index);

          that.clearClass();

          this.className = 'liactive';

          that.sections[this.index].className = 'conactive';

          }

          // 清除所有l(wèi)i 和section 的類(lèi)

          clearClass() {

          for (var i = 0; i < this.lis.length; i++) {

          this.lis[i].className = '';

          this.sections[i].className = '';

          }

          }

          // 2. 添加功能

          addTab() {

          that.clearClass();

          // (1) 創(chuàng)建li元素和section元素

          var random = Math.random();

          var li = '<li class="liactive"><span>新選項(xiàng)卡</span><span class="iconfont icon-guanbi"></span></li>';

          var section = '<section class="conactive">測(cè)試 ' + random + '</section>';

          // (2) 把這兩個(gè)元素追加到對(duì)應(yīng)的父元素里面

          that.ul.insertAdjacentHTML('beforeend', li);

          that.fsection.insertAdjacentHTML('beforeend', section);

          that.init();

          }

          // 3. 刪除功能

          removeTab(e) {

          e.stopPropagation(); // 阻止冒泡 防止觸發(fā)li 的切換點(diǎn)擊事件

          var index = this.parentNode.index;

          console.log(index);

          // 根據(jù)索引號(hào)刪除對(duì)應(yīng)的li 和section remove()方法可以直接刪除指定的元素

          that.lis[index].remove();

          that.sections[index].remove();

          that.init();

          // 當(dāng)我們刪除的不是選中狀態(tài)的li 的時(shí)候,原來(lái)的選中狀態(tài)li保持不變

          if (document.querySelector('.liactive')) return;

          // 當(dāng)我們刪除了選中狀態(tài)的這個(gè)li 的時(shí)候, 讓它的前一個(gè)li 處于選定狀態(tài)

          index--;

          // 手動(dòng)調(diào)用我們的點(diǎn)擊事件 不需要鼠標(biāo)觸發(fā)

          that.lis[index] && that.lis[index].click();

          }

          // 4. 修改功能

          editTab() {

          var str = this.innerHTML;

          // 雙擊禁止選定文字

          window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();

          // alert(11);

          this.innerHTML = '<input type="text" />';

          var input = this.children[0];

          input.value = str;

          input.select(); // 文本框里面的文字處于選定狀態(tài)

          // 當(dāng)我們離開(kāi)文本框就把文本框里面的值給span

          input.onblur = function () {

          this.parentNode.innerHTML = this.value;

          };

          // 按下回車(chē)也可以把文本框里面的值給span

          input.onkeyup = function (e) {

          if (e.keyCode === 13) {

          // 手動(dòng)調(diào)用表單失去焦點(diǎn)事件 不需要鼠標(biāo)離開(kāi)操作

          this.blur();

          }

          }

          }


          }

          new Tab('#tab');

          </script>


          </html>

          內(nèi)容來(lái)源于@什么值得買(mǎi)APP,觀(guān)點(diǎn)僅代表作者本人 |作者:突突兔too禿

          老婆做進(jìn)出口的,前一段發(fā)了一個(gè)知識(shí)貼給我,以為是要打印,搞了半天是因?yàn)榫W(wǎng)頁(yè)不讓復(fù)制,所以分享給我。

          這可笑壞我了,還有什么方法能突破“禁止復(fù)制”禁術(shù),當(dāng)然唯我漩渦鳴人的影分身之術(shù)了??次胰绾位顚W(xué)活用,復(fù)制粘貼。

          途徑一:自抱自泣

          方法1:發(fā)送給自己

          實(shí)際上,我覺(jué)得老婆大人的方法是最實(shí)際的了。這絕不僅僅是出于對(duì)老婆大人的尊重,而是實(shí)事求是。不讓復(fù)制就不復(fù)制唄。我也就平時(shí)存起來(lái)備查。當(dāng)然,如果實(shí)在找不到人分享,那就分享給“文件傳輸助手”吧。

          有一種孤獨(dú)叫智能發(fā)給穿書(shū)助手

          同樣的寂寞(劃掉)方法,我們也可以通過(guò)QQ把地址分享給“我的Android手機(jī)”。

          方法1.2:收藏備查

          比方法1稍微高級(jí)一點(diǎn)的是,將有關(guān)內(nèi)容在微信中打開(kāi)后,選擇“收藏”,這樣以后就可以直接在我的“收藏”中找到了。

          當(dāng)然,以上方法還只是迂回作戰(zhàn),說(shuō)白了禁術(shù)還在,只是找了個(gè)方法替代。真的如果需要復(fù)制的時(shí)候就白瞎了。

          途徑二:生拉硬拽

          方法2:直接拖拽到聊天框。

          使用Chrome瀏覽器或者360瀏覽器,然后直接選擇部分文字,鼠標(biāo)按住左鍵,就可以把文字拖拽到QQ對(duì)話(huà)框了。


          step1


          step2

          方法3:360瀏覽器右鍵復(fù)制。

          同樣是在360瀏覽器上面,鼠標(biāo)選擇要復(fù)制的文字,然后右擊鼠標(biāo),選擇保存為文本。

          step1

          再選擇一個(gè)文件夾保存。

          step2

          打開(kāi)指定文件夾中的TXT文檔,就能得到相應(yīng)的文字了。

          如果要評(píng)論這種生拉硬拽的方法,那就是霸氣。

          當(dāng)然,也有不足,每一次都要這么拖拽,鼠標(biāo)手是跑不掉的了。而且并沒(méi)有辦法一次性全部選擇。

          途徑三:圖文識(shí)別

          方法4:QQ截圖文字識(shí)別。

          step1:使用QQ對(duì)話(huà)框的截圖工具。

          step2:然后右擊圖片,選擇提取圖中文字。

          step3:點(diǎn)擊下載。

          step4:就可以在指定文件夾中找到picture和result兩個(gè)文件。馬上就能下載了。

          當(dāng)然,這個(gè)和方法3一樣,不能全選,需要反復(fù)的復(fù)制粘貼。

          方法5:使用傳圖識(shí)字小程序。

          使用手機(jī)自帶功能進(jìn)行滾動(dòng)截屏后,再打開(kāi)微信小程序“傳圖識(shí)字”,然后進(jìn)行orc識(shí)字,就可以復(fù)制了。

          step1:我的手機(jī)是華為的,使用指關(guān)節(jié)寫(xiě)一個(gè)“S”,就可以滾動(dòng)截屏。

          step2:然后進(jìn)入傳圖識(shí)字后,點(diǎn)擊“從相冊(cè)中選取”。

          step3:點(diǎn)擊全選,然后復(fù)制,就可以在對(duì)話(huà)框中張貼了。

          不過(guò)需要注意的是,過(guò)長(zhǎng)的圖片也可能出現(xiàn)識(shí)別失敗。像這次,我就只選擇了一半。而orc識(shí)別最大的問(wèn)題,還是準(zhǔn)確性。只能安慰自己就當(dāng)是檢查作業(yè),外加復(fù)習(xí)了唄。

          途徑4:曲徑通幽。

          方法6:使用edge閱讀模式。

          step1:使用手機(jī)edge,然后在網(wǎng)址中點(diǎn)擊閱讀模式;

          step2:選擇“全選”-“復(fù)制”;

          step3:再粘貼到備忘錄中。

          同樣的方式,也可以在UC上使用。

          方法7:直接使用夸克打開(kāi)網(wǎng)頁(yè)。

          比起edge和UC還要使用閱讀模式,夸克直接跳過(guò)了第一步。

          難怪這款手機(jī)App會(huì)受到大家的喜歡。

          途徑5:極客逍遙。

          方法8:Chrome瀏覽器檢查選項(xiàng)。

          在谷歌瀏覽器上打開(kāi)網(wǎng)頁(yè),點(diǎn)擊“F12”,又或者在網(wǎng)頁(yè)上點(diǎn)擊右鍵,選擇“檢查”。

          然后再選擇“setting”或者直接按“F1”,然后找到debugger-disable Javascript,勾選,就可以復(fù)制粘貼了。

          不過(guò),記得用完取消勾選disable-Javascript,需要的時(shí)候才開(kāi)啟。

          總結(jié)一下,其實(shí)無(wú)非就是三種方法,一種是聽(tīng)之任之,一種是使用其他工具進(jìn)行orc識(shí)別,最后一種就是破壞網(wǎng)頁(yè)的規(guī)則。以上的方法大部分也是小白級(jí)別,還沒(méi)涉及到油猴腳本等等。但是貴在實(shí)用,平時(shí)有文案撰寫(xiě)、論文寫(xiě)作等需求的值友歡迎收藏,畢竟用的時(shí)候才能記得住。

          為工作中經(jīng)常用到這些方法,所有便把這些方法進(jìn)行了總結(jié)。

          JavaScript

          1. type 類(lèi)型判斷

          isString (o) { //是否字符串
              return Object.prototype.toString.call(o).slice(8, -1) === 'String'
          }
          
          isNumber (o) { //是否數(shù)字
              return Object.prototype.toString.call(o).slice(8, -1) === 'Number'
          }
          
          isBoolean (o) { //是否boolean
              return Object.prototype.toString.call(o).slice(8, -1) === 'Boolean'
          }
          
          isFunction (o) { //是否函數(shù)
              return Object.prototype.toString.call(o).slice(8, -1) === 'Function'
          }
          
          isNull (o) { //是否為null
              return Object.prototype.toString.call(o).slice(8, -1) === 'Null'
          }
          
          isUndefined (o) { //是否undefined
              return Object.prototype.toString.call(o).slice(8, -1) === 'Undefined'
          }
          
          isObj (o) { //是否對(duì)象
              return Object.prototype.toString.call(o).slice(8, -1) === 'Object'
          }
          
          isArray (o) { //是否數(shù)組
              return Object.prototype.toString.call(o).slice(8, -1) === 'Array'
          }
          
          isDate (o) { //是否時(shí)間
              return Object.prototype.toString.call(o).slice(8, -1) === 'Date'
          }
          
          isRegExp (o) { //是否正則
              return Object.prototype.toString.call(o).slice(8, -1) === 'RegExp'
          }
          
          isError (o) { //是否錯(cuò)誤對(duì)象
              return Object.prototype.toString.call(o).slice(8, -1) === 'Error'
          }
          
          isSymbol (o) { //是否Symbol函數(shù)
              return Object.prototype.toString.call(o).slice(8, -1) === 'Symbol'
          }
          
          isPromise (o) { //是否Promise對(duì)象
              return Object.prototype.toString.call(o).slice(8, -1) === 'Promise'
          }
          
          isSet (o) { //是否Set對(duì)象
              return Object.prototype.toString.call(o).slice(8, -1) === 'Set'
          }
          
          isFalse (o) {
              if (!o || o === 'null' || o === 'undefined' || o === 'false' || o === 'NaN') return true
                  return false
          }
          
          isTrue (o) {
              return !this.isFalse(o)
          }
          
          isIos () {
              var u = navigator.userAgent;
              if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手機(jī)
                  // return "Android";
                  return false
              } else if (u.indexOf('iPhone') > -1) {//蘋(píng)果手機(jī)
                  // return "iPhone";
                  return true
              } else if (u.indexOf('iPad') > -1) {//iPad
                  // return "iPad";
                  return false
              } else if (u.indexOf('Windows Phone') > -1) {//winphone手機(jī)
                  // return "Windows Phone";
                  return false
              }else{
                  return false
              }
          }
          
          isPC () { //是否為PC端
              var userAgentInfo = navigator.userAgent;
              var Agents = ["Android", "iPhone",
                          "SymbianOS", "Windows Phone",
                          "iPad", "iPod"];
              var flag = true;
              for (var v = 0; v < Agents.length; v++) {
                  if (userAgentInfo.indexOf(Agents[v]) > 0) {
                      flag = false;
                      break;
                  }
              }
              return flag;
          }
          
          browserType(){
              var userAgent = navigator.userAgent; //取得瀏覽器的userAgent字符串
              var isOpera = userAgent.indexOf("Opera") > -1; //判斷是否Opera瀏覽器
              var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判斷是否IE瀏覽器
              var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
              var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判斷是否IE的Edge瀏覽器  
              var isFF = userAgent.indexOf("Firefox") > -1; //判斷是否Firefox瀏覽器
              var isSafari = userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") == -1; //判斷是否Safari瀏覽器
              var isChrome = userAgent.indexOf("Chrome") > -1 && userAgent.indexOf("Safari") > -1; //判斷Chrome瀏覽器
          
              if (isIE) {
                  var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
                  reIE.test(userAgent);
                  var fIEVersion = parseFloat(RegExp["$1"]);
                  if(fIEVersion == 7) return "IE7"
                  else if(fIEVersion == 8) return "IE8";
                  else if(fIEVersion == 9) return "IE9";
                  else if(fIEVersion == 10) return "IE10";
                  else return "IE7以下"//IE版本過(guò)低
              }
              if (isIE11) return 'IE11';
              if (isEdge) return "Edge";
              if (isFF) return "FF";
              if (isOpera) return "Opera";
              if (isSafari) return "Safari";
              if (isChrome) return "Chrome";
          }
          
          checkStr (str, type) {
              switch (type) {
                  case 'phone':   //手機(jī)號(hào)碼
                      return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(str);
                  case 'tel':     //座機(jī)
                      return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(str);
                  case 'card':    //身份證
                      return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(str);
                  case 'pwd':     //密碼以字母開(kāi)頭,長(zhǎng)度在6~18之間,只能包含字母、數(shù)字和下劃線(xiàn)
                      return /^[a-zA-Z]\w{5,17}$/.test(str)
                  case 'postal':  //郵政編碼
                      return /[1-9]\d{5}(?!\d)/.test(str);
                  case 'QQ':      //QQ號(hào)
                      return /^[1-9][0-9]{4,9}$/.test(str);
                  case 'email':   //郵箱
                      return /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(str);
                  case 'money':   //金額(小數(shù)點(diǎn)2位)
                      return /^\d*(?:\.\d{0,2})?$/.test(str);
                  case 'URL':     //網(wǎng)址
                      return /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(str)
                  case 'IP':      //IP
                      return /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(str);
                  case 'date':    //日期時(shí)間
                      return /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(str) || /^(\d{4})\-(\d{2})\-(\d{2})$/.test(str)
                  case 'number':  //數(shù)字
                      return /^[0-9]$/.test(str);
                  case 'english': //英文
                      return /^[a-zA-Z]+$/.test(str);
                  case 'chinese': //中文
                      return /^[\u4E00-\u9FA5]+$/.test(str);
                  case 'lower':   //小寫(xiě)
                      return /^[a-z]+$/.test(str);
                  case 'upper':   //大寫(xiě)
                      return /^[A-Z]+$/.test(str);
                  case 'HTML':    //HTML標(biāo)記
                      return /<("[^"]*"|'[^']*'|[^'">])*>/.test(str);
                  default:
                      return true;
              }
          
              // 嚴(yán)格的身份證校驗(yàn)
              isCardID(sId) {
                  if (!/(^\d{15}$)|(^\d{17}(\d|X|x)$)/.test(sId)) {
                      alert('你輸入的身份證長(zhǎng)度或格式錯(cuò)誤')
                      return false
                  }
                  //身份證城市
                  var aCity={11:"北京",12:"天津",13:"河北",14:"山西",15:"內(nèi)蒙古",21:"遼寧",22:"吉林",23:"黑龍江",31:"上海",32:"江蘇",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山東",41:"河南",42:"湖北",43:"湖南",44:"廣東",45:"廣西",46:"海南",50:"重慶",51:"四川",52:"貴州",53:"云南",54:"西藏",61:"陜西",62:"甘肅",63:"青海",64:"寧夏",65:"新疆",71:"臺(tái)灣",81:"香港",82:"澳門(mén)",91:"國(guó)外"};
                  if(!aCity[parseInt(sId.substr(0,2))]) { 
                      alert('你的身份證地區(qū)非法')
                      return false
                  }
          
                  // 出生日期驗(yàn)證
                  var sBirthday=(sId.substr(6,4)+"-"+Number(sId.substr(10,2))+"-"+Number(sId.substr(12,2))).replace(/-/g,"/"),
                      d = new Date(sBirthday)
                  if(sBirthday != (d.getFullYear()+"/"+ (d.getMonth()+1) + "/" + d.getDate())) {
                      alert('身份證上的出生日期非法')
                      return false
                  }
          
                  // 身份證號(hào)碼校驗(yàn)
                  var sum = 0,
                      weights =  [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2],
                      codes = "10X98765432"
                  for (var i = 0; i < sId.length - 1; i++) {
                      sum += sId[i] * weights[i];
                  }
                  var last = codes[sum % 11]; //計(jì)算出來(lái)的最后一位身份證號(hào)碼
                  if (sId[sId.length-1] != last) { 
                      alert('你輸入的身份證號(hào)非法')
                      return false
                  }
          
                  return true
              }
          }

          2. Date

          /**
           * 格式化時(shí)間
           * 
           * @param  {time} 時(shí)間
           * @param  {cFormat} 格式
           * @return {String} 字符串
           *
           * @example formatTime('2018-1-29', '{y}/{m}/jbxpj97 {h}:{i}:{s}') // -> 2018/01/29 00:00:00
           */
          formatTime(time, cFormat) {
              if (arguments.length === 0) return null
              if ((time + '').length === 10) {
                  time = +time * 1000
              }
          
              var format = cFormat || '{y}-{m}-rbt7fvb {h}:{i}:{s}', date
              if (typeof time === 'object') {
                  date = time
              } else {
                  date = new Date(time)
              }
          
              var formatObj = {
                  y: date.getFullYear(),
                  m: date.getMonth() + 1,
                  d: date.getDate(),
                  h: date.getHours(),
                  i: date.getMinutes(),
                  s: date.getSeconds(),
                  a: date.getDay()
              }
              var time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
                  var value = formatObj[key]
                  if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]
                  if (result.length > 0 && value < 10) {
                      value = '0' + value
                  }
                  return value || 0
              })
              return time_str
          }
          
          /**
           * 返回指定長(zhǎng)度的月份集合
           * 
           * @param  {time} 時(shí)間
           * @param  {len} 長(zhǎng)度
           * @param  {direction} 方向:  1: 前幾個(gè)月;  2: 后幾個(gè)月;  3:前后幾個(gè)月  默認(rèn) 3
           * @return {Array} 數(shù)組
           * 
           * @example   getMonths('2018-1-29', 6, 1)  // ->  ["2018-1", "2017-12", "2017-11", "2017-10", "2017-9", "2017-8", "2017-7"]
           */
          getMonths(time, len, direction) {
              var mm = new Date(time).getMonth(),
                  yy = new Date(time).getFullYear(),
                  direction = isNaN(direction) ? 3 : direction,
                  index = mm;
              var cutMonth = function(index) {
                  if ( index <= len && index >= -len) {
                      return direction === 1 ? formatPre(index).concat(cutMonth(++index)):
                          direction === 2 ? formatNext(index).concat(cutMonth(++index)):formatCurr(index).concat(cutMonth(++index))
                  }
                  return []
              }
              var formatNext = function(i) {
                  var y = Math.floor(i/12),
                      m = i%12
                  return [yy+y + '-' + (m+1)]
              }
              var formatPre = function(i) {
                  var y = Math.ceil(i/12),
                      m = i%12
                  m = m===0 ? 12 : m
                  return [yy-y + '-' + (13 - m)]
              }
              var formatCurr = function(i) {
                  var y = Math.floor(i/12),
                      yNext = Math.ceil(i/12),
                      m = i%12,
                      mNext = m===0 ? 12 : m
                  return [yy-yNext + '-' + (13 - mNext),yy+y + '-' + (m+1)]
              }
              // 數(shù)組去重
              var unique = function(arr) {
                  if ( Array.hasOwnProperty('from') ) {
                      return Array.from(new Set(arr));
                  }else{
                      var n = {},r=[]; 
                      for(var i = 0; i < arr.length; i++){
                          if (!n[arr[i]]){
                              n[arr[i]] = true; 
                              r.push(arr[i]);
                          }
                      }
                      return r;
                  }
              }
              return direction !== 3 ? cutMonth(index) : unique(cutMonth(index).sort(function(t1, t2){
                  return new Date(t1).getTime() - new Date(t2).getTime()
              }))
          }
          
          /**
           * 返回指定長(zhǎng)度的天數(shù)集合
           * 
           * @param  {time} 時(shí)間
           * @param  {len} 長(zhǎng)度
           * @param  {direction} 方向: 1: 前幾天;  2: 后幾天;  3:前后幾天  默認(rèn) 3
           * @return {Array} 數(shù)組
           *
           * @example date.getDays('2018-1-29', 6) // -> ["2018-1-26", "2018-1-27", "2018-1-28", "2018-1-29", "2018-1-30", "2018-1-31", "2018-2-1"]
           */
          getDays(time, len, diretion) {
              var tt = new Date(time)
              var getDay = function(day) {
                  var t = new Date(time)
                  t.setDate(t.getDate() + day)
                  var m = t.getMonth()+1
                  return t.getFullYear()+'-'+m+'-'+t.getDate()
              }
              var arr = []
              if (diretion === 1) {
                  for (var i = 1; i <= len; i++) {
                      arr.unshift(getDay(-i))
                  }
              }else if(diretion === 2) {
                  for (var i = 1; i <= len; i++) {
                      arr.push(getDay(i))
                  }
              }else {
                  for (var i = 1; i <= len; i++) {
                      arr.unshift(getDay(-i))
                  }
                  arr.push(tt.getFullYear()+'-'+(tt.getMonth()+1)+'-'+tt.getDate())
                  for (var i = 1; i <= len; i++) {
                      arr.push(getDay(i))
                  }
              }
              return diretion === 1 ? arr.concat([tt.getFullYear()+'-'+(tt.getMonth()+1)+'-'+tt.getDate()]) : 
                  diretion === 2 ? [tt.getFullYear()+'-'+(tt.getMonth()+1)+'-'+tt.getDate()].concat(arr) : arr
          }
          
          /**
           * @param  {s} 秒數(shù)
           * @return {String} 字符串 
           *
           * @example formatHMS(3610) // -> 1h0m10s
           */
          formatHMS (s) {
              var str = ''
              if (s > 3600) {
                  str = Math.floor(s/3600)+'h'+Math.floor(s%3600/60)+'m'+s%60+'s'
              }else if(s > 60) {
                  str = Math.floor(s/60)+'m'+s%60+'s'
              }else{
                  str = s%60+'s'
              }
              return str
          }
          
          /*獲取某月有多少天*/
          getMonthOfDay (time) {
              var date = new Date(time)
              var year = date.getFullYear()
              var mouth = date.getMonth() + 1
              var days
          
              //當(dāng)月份為二月時(shí),根據(jù)閏年還是非閏年判斷天數(shù)
              if (mouth == 2) {
                  days = (year%4==0 && year%100==0 && year%400==0) || (year%4==0 && year%100!=0) ? 28 : 29
              } else if (mouth == 1 || mouth == 3 || mouth == 5 || mouth == 7 || mouth == 8 || mouth == 10 || mouth == 12) {
                  //月份為:1,3,5,7,8,10,12 時(shí),為大月.則天數(shù)為31;
                  days = 31
              } else {
                  //其他月份,天數(shù)為:30.
                  days = 30
              }
              return days
          }
          
          /*獲取某年有多少天*/
          getYearOfDay (time) {
              var firstDayYear = this.getFirstDayOfYear(time);
              var lastDayYear = this.getLastDayOfYear(time);
              var numSecond = (new Date(lastDayYear).getTime() - new Date(firstDayYear).getTime())/1000;
              return Math.ceil(numSecond/(24*3600));
          }
          
          /*獲取某年的第一天*/
          getFirstDayOfYear (time) {
              var year = new Date(time).getFullYear();
              return year + "-01-01 00:00:00";
          }
          
          /*獲取某年最后一天*/
          getLastDayOfYear (time) {
              var year = new Date(time).getFullYear();
              var dateString = year + "-12-01 00:00:00";
              var endDay = this.getMonthOfDay(dateString);
              return year + "-12-" + endDay + " 23:59:59";
          }
          
          /*獲取某個(gè)日期是當(dāng)年中的第幾天*/
          getDayOfYear (time) {
              var firstDayYear = this.getFirstDayOfYear(time);
              var numSecond = (new Date(time).getTime() - new Date(firstDayYear).getTime())/1000;
              return Math.ceil(numSecond/(24*3600));
          }
          
          /*獲取某個(gè)日期在這一年的第幾周*/
          getDayOfYearWeek (time) {
              var numdays = this.getDayOfYear(time);
              return Math.ceil(numdays / 7);
          }

          3. Array

          /*判斷一個(gè)元素是否在數(shù)組中*/
          contains (arr, val) {
              return arr.indexOf(val) != -1 ? true : false;
          }
          
          /**
           * @param  {arr} 數(shù)組
           * @param  {fn} 回調(diào)函數(shù)
           * @return {undefined}
           */
          each (arr, fn) {
              fn = fn || Function;
              var a = [];
              var args = Array.prototype.slice.call(arguments, 1);
              for(var i = 0; i < arr.length; i++) {
                  var res = fn.apply(arr, [arr[i], i].concat(args));
                  if(res != null) a.push(res);
              }
          }
          
          /**
           * @param  {arr} 數(shù)組
           * @param  {fn} 回調(diào)函數(shù)
           * @param  {thisObj} this指向
           * @return {Array} 
           */
          map (arr, fn, thisObj) {
              var scope = thisObj || window;
              var a = [];
              for(var i = 0, j = arr.length; i < j; ++i) {
                  var res = fn.call(scope, arr[i], i, this);
                  if(res != null) a.push(res);
              }
              return a;
          }
          
          /**
           * @param  {arr} 數(shù)組
           * @param  {type} 1:從小到大   2:從大到小   3:隨機(jī)
           * @return {Array}
           */
          sort (arr, type = 1) {
              return arr.sort( (a, b) => {
                  switch(type) {
                      case 1:
                          return a - b;
                      case 2:
                          return b - a;
                      case 3:
                          return Math.random() - 0.5;
                      default:
                          return arr;
                  }
              })
          }
          
          /*去重*/
          unique (arr) {
              if ( Array.hasOwnProperty('from') ) {
                  return Array.from(new Set(arr));
              }else{
                  var n = {},r=[]; 
                  for(var i = 0; i < arr.length; i++){
                      if (!n[arr[i]]){
                          n[arr[i]] = true; 
                          r.push(arr[i]);
                      }
                  }
                  return r;
              }
              // 注:上面 else 里面的排重并不能區(qū)分 2 和 '2',但能減少用indexOf帶來(lái)的性能,暫時(shí)沒(méi)找到替代的方法。。。
              /* 正確排重
              if ( Array.hasOwnProperty('from') ) {
                  return Array.from(new Set(arr))
              }else{
                  var r = [], NaNBol = true
                  for(var i=0; i < arr.length; i++) {
                      if (arr[i] !== arr[i]) {
                          if (NaNBol && r.indexOf(arr[i]) === -1) {
                              r.push(arr[i])
                              NaNBol = false
                          }
                      }else{
                          if(r.indexOf(arr[i]) === -1) r.push(arr[i])
                      }
                  }
                  return r
              }
          
               */
          }
          
          /*求兩個(gè)集合的并集*/
          union (a, b) {
              var newArr = a.concat(b);
              return this.unique(newArr);
          }
          
          /*求兩個(gè)集合的交集*/
          intersect (a, b) {
              var _this = this;
              a = this.unique(a);
              return this.map(a, function(o) {
                  return _this.contains(b, o) ? o : null;
              });
          }
          
          /*刪除其中一個(gè)元素*/
          remove (arr, ele) {
              var index = arr.indexOf(ele);
              if(index > -1) {
                  arr.splice(index, 1);
              }
              return arr;
          }
          
          /*將類(lèi)數(shù)組轉(zhuǎn)換為數(shù)組的方法*/
          formArray (ary) {
              var arr = [];
              if(Array.isArray(ary)) {
                  arr = ary;
              } else {
                  arr = Array.prototype.slice.call(ary);
              };
              return arr;
          }
          
          /*最大值*/
          max (arr) {
              return Math.max.apply(null, arr);
          }
          
          /*最小值*/
          min (arr) {
              return Math.min.apply(null, arr);
          }
          
          /*求和*/
          sum (arr) {
              return arr.reduce( (pre, cur) => {
                  return pre + cur
              })
          }
          
          /*平均值*/
          average (arr) {
              return this.sum(arr)/arr.length
          }

          4. String 字符串操作

          /**
           * 去除空格
           * @param  {str}
           * @param  {type} 
           *       type:  1-所有空格  2-前后空格  3-前空格 4-后空格
           * @return {String}
           */
          trim (str, type) {
              type = type || 1
              switch (type) {
                  case 1:
                      return str.replace(/\s+/g, "");
                  case 2:
                      return str.replace(/(^\s*)|(\s*$)/g, "");
                  case 3:
                      return str.replace(/(^\s*)/g, "");
                  case 4:
                      return str.replace(/(\s*$)/g, "");
                  default:
                      return str;
              }
          }
          
          /**
           * @param  {str} 
           * @param  {type}
           *       type:  1:首字母大寫(xiě)  2:首頁(yè)母小寫(xiě)  3:大小寫(xiě)轉(zhuǎn)換  4:全部大寫(xiě)  5:全部小寫(xiě)
           * @return {String}
           */
          changeCase (str, type) {
              type = type || 4
              switch (type) {
                  case 1:
                      return str.replace(/\b\w+\b/g, function (word) {
                          return word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase();
          
                      });
                  case 2:
                      return str.replace(/\b\w+\b/g, function (word) {
                          return word.substring(0, 1).toLowerCase() + word.substring(1).toUpperCase();
                      });
                  case 3:
                      return str.split('').map( function(word){
                          if (/[a-z]/.test(word)) {
                              return word.toUpperCase();
                          }else{
                              return word.toLowerCase()
                          }
                      }).join('')
                  case 4:
                      return str.toUpperCase();
                  case 5:
                      return str.toLowerCase();
                  default:
                      return str;
              }
          }
          
          /*
              檢測(cè)密碼強(qiáng)度
          */
          checkPwd (str) {
              var Lv = 0;
              if (str.length < 6) {
                  return Lv
              }
              if (/[0-9]/.test(str)) {
                  Lv++
              }
              if (/[a-z]/.test(str)) {
                  Lv++
              }
              if (/[A-Z]/.test(str)) {
                  Lv++
              }
              if (/[\.|-|_]/.test(str)) {
                  Lv++
              }
              return Lv;
          }
          
          /*過(guò)濾html代碼(把<>轉(zhuǎn)換)*/
          filterTag (str) {
              str = str.replace(/&/ig, "&");
              str = str.replace(/</ig, "<");
              str = str.replace(/>/ig, ">");
              str = str.replace(" ", " ");
              return str;
          }

          5. Number

          /*隨機(jī)數(shù)范圍*/
          random (min, max) {
              if (arguments.length === 2) {
                  return Math.floor(min + Math.random() * ( (max+1) - min ))
              }else{
                  return null;
              }
          
          }
          
          /*將阿拉伯?dāng)?shù)字翻譯成中文的大寫(xiě)數(shù)字*/
          numberToChinese (num) {
              var AA = new Array("零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十");
              var BB = new Array("", "十", "百", "仟", "萬(wàn)", "億", "點(diǎn)", "");
              var a = ("" + num).replace(/(^0*)/g, "").split("."),
                  k = 0,
                  re = "";
              for(var i = a[0].length - 1; i >= 0; i--) {
                  switch(k) {
                      case 0:
                          re = BB[7] + re;
                          break;
                      case 4:
                          if(!new RegExp("0{4}//d{" + (a[0].length - i - 1) + "}$")
                              .test(a[0]))
                              re = BB[4] + re;
                          break;
                      case 8:
                          re = BB[5] + re;
                          BB[7] = BB[5];
                          k = 0;
                          break;
                  }
                  if(k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0)
                      re = AA[0] + re;
                  if(a[0].charAt(i) != 0)
                      re = AA[a[0].charAt(i)] + BB[k % 4] + re;
                  k++;
              }
          
              if(a.length > 1) // 加上小數(shù)部分(如果有小數(shù)部分)
              {
                  re += BB[6];
                  for(var i = 0; i < a[1].length; i++)
                      re += AA[a[1].charAt(i)];
              }
              if(re == '一十')
                  re = "十";
              if(re.match(/^一/) && re.length == 3)
                  re = re.replace("一", "");
              return re;
          }
          
          /*將數(shù)字轉(zhuǎn)換為大寫(xiě)金額*/
          changeToChinese (Num) {
                  //判斷如果傳遞進(jìn)來(lái)的不是字符的話(huà)轉(zhuǎn)換為字符
                  if(typeof Num == "number") {
                      Num = new String(Num);
                  };
                  Num = Num.replace(/,/g, "") //替換tomoney()中的“,”
                  Num = Num.replace(/ /g, "") //替換tomoney()中的空格
                  Num = Num.replace(/¥/g, "") //替換掉可能出現(xiàn)的¥字符
                  if(isNaN(Num)) { //驗(yàn)證輸入的字符是否為數(shù)字
                      //alert("請(qǐng)檢查小寫(xiě)金額是否正確");
                      return "";
                  };
                  //字符處理完畢后開(kāi)始轉(zhuǎn)換,采用前后兩部分分別轉(zhuǎn)換
                  var part = String(Num).split(".");
                  var newchar = "";
                  //小數(shù)點(diǎn)前進(jìn)行轉(zhuǎn)化
                  for(var i = part[0].length - 1; i >= 0; i--) {
                      if(part[0].length > 10) {
                          return "";
                          //若數(shù)量超過(guò)拾億單位,提示
                      }
                      var tmpnewchar = ""
                      var perchar = part[0].charAt(i);
                      switch(perchar) {
                          case "0":
                              tmpnewchar = "零" + tmpnewchar;
                              break;
                          case "1":
                              tmpnewchar = "壹" + tmpnewchar;
                              break;
                          case "2":
                              tmpnewchar = "貳" + tmpnewchar;
                              break;
                          case "3":
                              tmpnewchar = "叁" + tmpnewchar;
                              break;
                          case "4":
                              tmpnewchar = "肆" + tmpnewchar;
                              break;
                          case "5":
                              tmpnewchar = "伍" + tmpnewchar;
                              break;
                          case "6":
                              tmpnewchar = "陸" + tmpnewchar;
                              break;
                          case "7":
                              tmpnewchar = "柒" + tmpnewchar;
                              break;
                          case "8":
                              tmpnewchar = "捌" + tmpnewchar;
                              break;
                          case "9":
                              tmpnewchar = "玖" + tmpnewchar;
                              break;
                      }
                      switch(part[0].length - i - 1) {
                          case 0:
                              tmpnewchar = tmpnewchar + "元";
                              break;
                          case 1:
                              if(perchar != 0) tmpnewchar = tmpnewchar + "拾";
                              break;
                          case 2:
                              if(perchar != 0) tmpnewchar = tmpnewchar + "佰";
                              break;
                          case 3:
                              if(perchar != 0) tmpnewchar = tmpnewchar + "仟";
                              break;
                          case 4:
                              tmpnewchar = tmpnewchar + "萬(wàn)";
                              break;
                          case 5:
                              if(perchar != 0) tmpnewchar = tmpnewchar + "拾";
                              break;
                          case 6:
                              if(perchar != 0) tmpnewchar = tmpnewchar + "佰";
                              break;
                          case 7:
                              if(perchar != 0) tmpnewchar = tmpnewchar + "仟";
                              break;
                          case 8:
                              tmpnewchar = tmpnewchar + "億";
                              break;
                          case 9:
                              tmpnewchar = tmpnewchar + "拾";
                              break;
                      }
                      var newchar = tmpnewchar + newchar;
                  }
                  //小數(shù)點(diǎn)之后進(jìn)行轉(zhuǎn)化
                  if(Num.indexOf(".") != -1) {
                      if(part[1].length > 2) {
                          // alert("小數(shù)點(diǎn)之后只能保留兩位,系統(tǒng)將自動(dòng)截?cái)?#34;);
                          part[1] = part[1].substr(0, 2)
                      }
                      for(i = 0; i < part[1].length; i++) {
                          tmpnewchar = ""
                          perchar = part[1].charAt(i)
                          switch(perchar) {
                              case "0":
                                  tmpnewchar = "零" + tmpnewchar;
                                  break;
                              case "1":
                                  tmpnewchar = "壹" + tmpnewchar;
                                  break;
                              case "2":
                                  tmpnewchar = "貳" + tmpnewchar;
                                  break;
                              case "3":
                                  tmpnewchar = "叁" + tmpnewchar;
                                  break;
                              case "4":
                                  tmpnewchar = "肆" + tmpnewchar;
                                  break;
                              case "5":
                                  tmpnewchar = "伍" + tmpnewchar;
                                  break;
                              case "6":
                                  tmpnewchar = "陸" + tmpnewchar;
                                  break;
                              case "7":
                                  tmpnewchar = "柒" + tmpnewchar;
                                  break;
                              case "8":
                                  tmpnewchar = "捌" + tmpnewchar;
                                  break;
                              case "9":
                                  tmpnewchar = "玖" + tmpnewchar;
                                  break;
                          }
                          if(i == 0) tmpnewchar = tmpnewchar + "角";
                          if(i == 1) tmpnewchar = tmpnewchar + "分";
                          newchar = newchar + tmpnewchar;
                      }
                  }
                  //替換所有無(wú)用漢字
                  while(newchar.search("零零") != -1)
                      newchar = newchar.replace("零零", "零");
                  newchar = newchar.replace("零億", "億");
                  newchar = newchar.replace("億萬(wàn)", "億");
                  newchar = newchar.replace("零萬(wàn)", "萬(wàn)");
                  newchar = newchar.replace("零元", "元");
                  newchar = newchar.replace("零角", "");
                  newchar = newchar.replace("零分", "");
                  if(newchar.charAt(newchar.length - 1) == "元") {
                      newchar = newchar + "整"
                  }
                  return newchar;
              }

          6. Http

          /**
           * @param  {setting}
           */
          ajax(setting){
              //設(shè)置參數(shù)的初始值
              var opts={
                  method: (setting.method || "GET").toUpperCase(), //請(qǐng)求方式
                  url: setting.url || "", // 請(qǐng)求地址
                  async: setting.async || true, // 是否異步
                  dataType: setting.dataType || "json", // 解析方式
                  data: setting.data || "", // 參數(shù)
                  success: setting.success || function(){}, // 請(qǐng)求成功回調(diào)
                  error: setting.error || function(){} // 請(qǐng)求失敗回調(diào)
              }
          
              // 參數(shù)格式化
              function params_format (obj) {
                  var str = ''
                  for (var i in obj) {
                      str += i + '=' + obj[i] + '&'
                  }
                  return str.split('').slice(0, -1).join('')
              }
          
              // 創(chuàng)建ajax對(duì)象
              var xhr=new XMLHttpRequest();
          
              // 連接服務(wù)器open(方法GET/POST,請(qǐng)求地址, 異步傳輸)
              if(opts.method == 'GET'){
                  xhr.open(opts.method, opts.url + "?" + params_format(opts.data), opts.async);
                  xhr.send();
              }else{
                  xhr.open(opts.method, opts.url, opts.async);
                  xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
                  xhr.send(opts.data);
              }
          
              /*
              ** 每當(dāng)readyState改變時(shí),就會(huì)觸發(fā)onreadystatechange事件
              ** readyState屬性存儲(chǔ)有XMLHttpRequest的狀態(tài)信息
              ** 0 :請(qǐng)求未初始化
              ** 1 :服務(wù)器連接已建立
              ** 2 :請(qǐng)求已接受
              ** 3 : 請(qǐng)求處理中
              ** 4 :請(qǐng)求已完成,且相應(yīng)就緒
              */
              xhr.onreadystatechange = function() {
                  if (xhr.readyState === 4 && (xhr.status === 200 || xhr.status === 304)) {
                      switch(opts.dataType){
                          case "json":
                              var json = JSON.parse(xhr.responseText);
                              opts.success(json);
                              break;
                          case "xml":
                              opts.success(xhr.responseXML);
                              break;
                          default:
                              opts.success(xhr.responseText);
                              break;
                      }
                  }
              }
          
              xhr.onerror = function(err) {
                  opts.error(err);
              }
          }
          
          /**
           * @param  {url}
           * @param  {setting}
           * @return {Promise}
           */
          fetch(url, setting) {
              //設(shè)置參數(shù)的初始值
              let opts={
                  method: (setting.method || 'GET').toUpperCase(), //請(qǐng)求方式
                  headers : setting.headers  || {}, // 請(qǐng)求頭設(shè)置
                  credentials : setting.credentials  || true, // 設(shè)置cookie是否一起發(fā)送
                  body: setting.body || {},
                  mode : setting.mode  || 'no-cors', // 可以設(shè)置 cors, no-cors, same-origin
                  redirect : setting.redirect  || 'follow', // follow, error, manual
                  cache : setting.cache  || 'default' // 設(shè)置 cache 模式 (default, reload, no-cache)
              }
              let dataType = setting.dataType || "json", // 解析方式  
                  data = setting.data || "" // 參數(shù)
          
              // 參數(shù)格式化
              function params_format (obj) {
                  var str = ''
                  for (var i in obj) {
                      str += `${i}=${obj[i]}&`
                  }
                  return str.split('').slice(0, -1).join('')
              }
          
              if (opts.method === 'GET') {
                  url = url + (data?`?${params_format(data)}`:'')
              }else{
                  setting.body = data || {}
              }
          
              return new Promise( (resolve, reject) => {
                  fetch(url, opts).then( async res => {
                      let data = dataType === 'text' ? await res.text() :
                          dataType === 'blob' ? await res.blob() : await res.json() 
                      resolve(data)
                  }).catch( e => {
                      reject(e)
                  })
              })
          
          }

          7. DOM

          $ (selector){ 
              var type = selector.substring(0, 1);
              if (type === '#') {
                  if (document.querySelecotor) return document.querySelector(selector)
                      return document.getElementById(selector.substring(1))
          
              }else if (type === '.') {
                  if (document.querySelecotorAll) return document.querySelectorAll(selector)
                      return document.getElementsByClassName(selector.substring(1))
              }else{
                  return document['querySelectorAll' ? 'querySelectorAll':'getElementsByTagName'](selector)
              }
          } 
          
          /*檢測(cè)類(lèi)名*/
          hasClass (ele, name) {
              return ele.className.match(new RegExp('(\\s|^)' + name + '(\\s|$)'));
          }
          
          /*添加類(lèi)名*/
          addClass (ele, name) {
              if (!this.hasClass(ele, name)) ele.className += " " + name;
          }
          
          /*刪除類(lèi)名*/
          removeClass (ele, name) {
              if (this.hasClass(ele, name)) {
                  var reg = new RegExp('(\\s|^)' + name + '(\\s|$)');
                  ele.className = ele.className.replace(reg, '');
              }
          }
          
          /*替換類(lèi)名*/
          replaceClass (ele, newName, oldName) {
              this.removeClass(ele, oldName);
              this.addClass(ele, newName);
          }
          
          /*獲取兄弟節(jié)點(diǎn)*/
          siblings (ele) {
              console.log(ele.parentNode)
              var chid = ele.parentNode.children,eleMatch = []; 
              for(var i = 0, len = chid.length; i < len; i ++){ 
                  if(chid[i] != ele){ 
                      eleMatch.push(chid[i]); 
                  } 
              } 
              return eleMatch;
          }
          
          /*獲取行間樣式屬性*/
          getByStyle (obj,name){
              if(obj.currentStyle){
                  return  obj.currentStyle[name];
              }else{
                  return  getComputedStyle(obj,false)[name];
              }
          }

          8. Storage 儲(chǔ)存操作

          class StorageFn {
              constructor () {
                  this.ls = window.localStorage;
                  this.ss = window.sessionStorage;
              }
          
              /*-----------------cookie---------------------*/
              /*設(shè)置cookie*/
              setCookie (name, value, day) {
                  var setting = arguments[0];
                  if (Object.prototype.toString.call(setting).slice(8, -1) === 'Object'){
                      for (var i in setting) {
                          var oDate = new Date();
                          oDate.setDate(oDate.getDate() + day);
                          document.cookie = i + '=' + setting[i] + ';expires=' + oDate;
                      }
                  }else{
                      var oDate = new Date();
                      oDate.setDate(oDate.getDate() + day);
                      document.cookie = name + '=' + value + ';expires=' + oDate;
                  }
          
              }
          
              /*獲取cookie*/
              getCookie (name) {
                  var arr = document.cookie.split('; ');
                  for (var i = 0; i < arr.length; i++) {
                      var arr2 = arr[i].split('=');
                      if (arr2[0] == name) {
                          return arr2[1];
                      }
                  }
                  return '';
              }
          
              /*刪除cookie*/
              removeCookie (name) {
                  this.setCookie(name, 1, -1);
              }
          
              /*-----------------localStorage---------------------*/
              /*設(shè)置localStorage*/
              setLocal(key, val) {
                  var setting = arguments[0];
                  if (Object.prototype.toString.call(setting).slice(8, -1) === 'Object'){
                      for(var i in setting){
                          this.ls.setItem(i, JSON.stringify(setting[i]))
                      }
                  }else{
                      this.ls.setItem(key, JSON.stringify(val))
                  }
          
              }
          
              /*獲取localStorage*/
              getLocal(key) {
                  if (key) return JSON.parse(this.ls.getItem(key))
                  return null;
          
              }
          
              /*移除localStorage*/
              removeLocal(key) {
                  this.ls.removeItem(key)
              }
          
              /*移除所有l(wèi)ocalStorage*/
              clearLocal() {
                  this.ls.clear()
              }
          
              /*-----------------sessionStorage---------------------*/
              /*設(shè)置sessionStorage*/
              setSession(key, val) {
                  var setting = arguments[0];
                  if (Object.prototype.toString.call(setting).slice(8, -1) === 'Object'){
                      for(var i in setting){
                          this.ss.setItem(i, JSON.stringify(setting[i]))
                      }
                  }else{
                      this.ss.setItem(key, JSON.stringify(val))
                  }
          
              }
          
              /*獲取sessionStorage*/
              getSession(key) {
                  if (key) return JSON.parse(this.ss.getItem(key))
                  return null;
          
              }
          
              /*移除sessionStorage*/
              removeSession(key) {
                  this.ss.removeItem(key)
              }
          
              /*移除所有sessionStorage*/
              clearSession() {
                  this.ss.clear()
              }
          
          }

          9. Other 其它操作

          /*獲取網(wǎng)址參數(shù)*/
          getURL(name){
              var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
              var r = decodeURI(window.location.search).substr(1).match(reg);
              if(r!=null) return  r[2]; return null;
          }
          
          /*獲取全部url參數(shù),并轉(zhuǎn)換成json對(duì)象*/
          getUrlAllParams (url) {
              var url = url ? url : window.location.href;
              var _pa = url.substring(url.indexOf('?') + 1),
                  _arrS = _pa.split('&'),
                  _rs = {};
              for (var i = 0, _len = _arrS.length; i < _len; i++) {
                  var pos = _arrS[i].indexOf('=');
                  if (pos == -1) {
                      continue;
                  }
                  var name = _arrS[i].substring(0, pos),
                      value = window.decodeURIComponent(_arrS[i].substring(pos + 1));
                  _rs[name] = value;
              }
              return _rs;
          }
          
          /*刪除url指定參數(shù),返回url*/
          delParamsUrl(url, name){
              var baseUrl = url.split('?')[0] + '?';
              var query = url.split('?')[1];
              if (query.indexOf(name)>-1) {
                  var obj = {}
                  var arr = query.split("&");
                  for (var i = 0; i < arr.length; i++) {
                      arr[i] = arr[i].split("=");
                      obj[arr[i][0]] = arr[i][1];
                  };
                  delete obj[name];
                  var url = baseUrl + JSON.stringify(obj).replace(/[\"\{\}]/g,"").replace(/\:/g,"=").replace(/\,/g,"&");
                  return url
              }else{
                  return url;
              }
          }
          
          /*獲取十六進(jìn)制隨機(jī)顏色*/
          getRandomColor () {
              return '#' + (function(h) {
                  return new Array(7 - h.length).join("0") + h;
              })((Math.random() * 0x1000000 << 0).toString(16));
          }
          
          /*圖片加載*/
          imgLoadAll(arr,callback){
              var arrImg = []; 
              for (var i = 0; i < arr.length; i++) {
                  var img = new Image();
                  img.src = arr[i];
                  img.onload = function(){
                      arrImg.push(this);
                      if (arrImg.length == arr.length) {
                          callback && callback();
                      }
                  }
              }
          }
          
          /*音頻加載*/
          loadAudio(src, callback) {
              var audio = new Audio(src);
              audio.onloadedmetadata = callback;
              audio.src = src;
          }
          
          /*DOM轉(zhuǎn)字符串*/
          domToStirng(htmlDOM){
              var div= document.createElement("div");
              div.appendChild(htmlDOM);
              return div.innerHTML
          }
          
          /*字符串轉(zhuǎn)DOM*/
          stringToDom(htmlString){
              var div= document.createElement("div");
              div.innerHTML=htmlString;
              return div.children[0];
          }
          
          /**
           * 光標(biāo)所在位置插入字符,并設(shè)置光標(biāo)位置
           * 
           * @param {dom} 輸入框
           * @param {val} 插入的值
           * @param {posLen} 光標(biāo)位置處在 插入的值的哪個(gè)位置
           */
          setCursorPosition (dom,val,posLen) {
              var cursorPosition = 0;
              if(dom.selectionStart){
                  cursorPosition = dom.selectionStart;
              }
              this.insertAtCursor(dom,val);
              dom.focus();
              console.log(posLen)
              dom.setSelectionRange(dom.value.length,cursorPosition + (posLen || val.length));
          }
          
          /*光標(biāo)所在位置插入字符*/
          insertAtCursor(dom, val) {
              if (document.selection){
                  dom.focus();
                  sel = document.selection.createRange();
                  sel.text = val;
                  sel.select();
              }else if (dom.selectionStart || dom.selectionStart == '0'){
                  let startPos = dom.selectionStart;
                  let endPos = dom.selectionEnd;
                  let restoreTop = dom.scrollTop;
                  dom.value = dom.value.substring(0, startPos) + val + dom.value.substring(endPos, dom.value.length);
                  if (restoreTop > 0){
                      dom.scrollTop = restoreTop;
                  }
                  dom.focus();
                  dom.selectionStart = startPos + val.length;
                  dom.selectionEnd = startPos + val.length;
              } else {
                  dom.value += val;
                  dom.focus();
              }
          }

          CSS

          1. pc-reset PC樣式初始化

          /* normalize.css */
          
          html {
            line-height: 1.15;
            /* 1 */
            -ms-text-size-adjust: 100%;
            /* 2 */
            -webkit-text-size-adjust: 100%;
            /* 2 */
          }
          
          body {
            margin: 0;
          }
          
          article,
          aside,
          footer,
          header,
          nav,
          section {
            display: block;
          }
          
          h1 {
            font-size: 2em;
            margin: 0.67em 0;
          }
          
          figcaption,
          figure,
          main {
            /* 1 */
            display: block;
          }
          
          figure {
            margin: 1em 40px;
          }
          
          hr {
            box-sizing: content-box;
            /* 1 */
            height: 0;
            /* 1 */
            overflow: visible;
            /* 2 */
          }
          
          pre {
            font-family: monospace, monospace;
            /* 1 */
            font-size: 1em;
            /* 2 */
          }
          
          a {
            background-color: transparent;
            /* 1 */
            -webkit-text-decoration-skip: objects;
            /* 2 */
          }
          
          abbr[title] {
            border-bottom: none;
            /* 1 */
            text-decoration: underline;
            /* 2 */
            text-decoration: underline dotted;
            /* 2 */
          }
          
          b,
          strong {
            font-weight: inherit;
          }
          
          b,
          strong {
            font-weight: bolder;
          }
          
          code,
          kbd,
          samp {
            font-family: monospace, monospace;
            /* 1 */
            font-size: 1em;
            /* 2 */
          }
          
          dfn {
            font-style: italic;
          }
          
          mark {
            background-color: #ff0;
            color: #000;
          }
          
          small {
            font-size: 80%;
          }
          
          sub,
          sup {
            font-size: 75%;
            line-height: 0;
            position: relative;
            vertical-align: baseline;
          }
          
          sub {
            bottom: -0.25em;
          }
          
          sup {
            top: -0.5em;
          }
          
          audio,
          video {
            display: inline-block;
          }
          
          audio:not([controls]) {
            display: none;
            height: 0;
          }
          
          img {
            border-style: none;
          }
          
          svg:not(:root) {
            overflow: hidden;
          }
          
          button,
          input,
          optgroup,
          select,
          textarea {
            font-family: sans-serif;
            /* 1 */
            font-size: 100%;
            /* 1 */
            line-height: 1.15;
            /* 1 */
            margin: 0;
            /* 2 */
          }
          
          button,
          input {
            /* 1 */
            overflow: visible;
          }
          
          button,
          select {
            /* 1 */
            text-transform: none;
          }
          
          button,
          html [type="button"],
          
          /* 1 */
          
          [type="reset"],
          [type="submit"] {
            -webkit-appearance: button;
            /* 2 */
          }
          
          button::-moz-focus-inner,
          [type="button"]::-moz-focus-inner,
          [type="reset"]::-moz-focus-inner,
          [type="submit"]::-moz-focus-inner {
            border-style: none;
            padding: 0;
          }
          
          button:-moz-focusring,
          [type="button"]:-moz-focusring,
          [type="reset"]:-moz-focusring,
          [type="submit"]:-moz-focusring {
            outline: 1px dotted ButtonText;
          }
          
          fieldset {
            padding: 0.35em 0.75em 0.625em;
          }
          
          legend {
            box-sizing: border-box;
            /* 1 */
            color: inherit;
            /* 2 */
            display: table;
            /* 1 */
            max-width: 100%;
            /* 1 */
            padding: 0;
            /* 3 */
            white-space: normal;
            /* 1 */
          }
          
          progress {
            display: inline-block;
            /* 1 */
            vertical-align: baseline;
            /* 2 */
          }
          
          textarea {
            overflow: auto;
          }
          
          [type="checkbox"],
          [type="radio"] {
            box-sizing: border-box;
            /* 1 */
            padding: 0;
            /* 2 */
          }
          
          [type="number"]::-webkit-inner-spin-button,
          [type="number"]::-webkit-outer-spin-button {
            height: auto;
          }
          
          [type="search"] {
            -webkit-appearance: textfield;
            /* 1 */
            outline-offset: -2px;
            /* 2 */
          }
          
          [type="search"]::-webkit-search-cancel-button,
          [type="search"]::-webkit-search-decoration {
            -webkit-appearance: none;
          }
          
           ::-webkit-file-upload-button {
            -webkit-appearance: button;
            /* 1 */
            font: inherit;
            /* 2 */
          }
          
          details,
          
          /* 1 */
          
          menu {
            display: block;
          }
          
          summary {
            display: list-item;
          }
          
          canvas {
            display: inline-block;
          }
          
          template {
            display: none;
          }
          
          [hidden] {
            display: none;
          }
          
          /* reset */
          
          html,
          body,
          h1,
          h2,
          h3,
          h4,
          h5,
          h6,
          div,
          dl,
          dt,
          dd,
          ul,
          ol,
          li,
          p,
          blockquote,
          pre,
          hr,
          figure,
          table,
          caption,
          th,
          td,
          form,
          fieldset,
          legend,
          input,
          button,
          textarea,
          menu {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
          }

          2. Phone-reset

          /* normalize.css */
          
          html {
            line-height: 1.15;
            /* 1 */
            -ms-text-size-adjust: 100%;
            /* 2 */
            -webkit-text-size-adjust: 100%;
            /* 2 */
          }
          
          body {
            margin: 0;
          }
          
          article,
          aside,
          footer,
          header,
          nav,
          section {
            display: block;
          }
          
          h1 {
            font-size: 2em;
            margin: 0.67em 0;
          }
          
          figcaption,
          figure,
          main {
            /* 1 */
            display: block;
          }
          
          figure {
            margin: 1em 40px;
          }
          
          hr {
            box-sizing: content-box;
            /* 1 */
            height: 0;
            /* 1 */
            overflow: visible;
            /* 2 */
          }
          
          pre {
            font-family: monospace, monospace;
            /* 1 */
            font-size: 1em;
            /* 2 */
          }
          
          a {
            background-color: transparent;
            /* 1 */
            -webkit-text-decoration-skip: objects;
            /* 2 */
          }
          
          abbr[title] {
            border-bottom: none;
            /* 1 */
            text-decoration: underline;
            /* 2 */
            text-decoration: underline dotted;
            /* 2 */
          }
          
          b,
          strong {
            font-weight: inherit;
          }
          
          b,
          strong {
            font-weight: bolder;
          }
          
          code,
          kbd,
          samp {
            font-family: monospace, monospace;
            /* 1 */
            font-size: 1em;
            /* 2 */
          }
          
          dfn {
            font-style: italic;
          }
          
          mark {
            background-color: #ff0;
            color: #000;
          }
          
          small {
            font-size: 80%;
          }
          
          sub,
          sup {
            font-size: 75%;
            line-height: 0;
            position: relative;
            vertical-align: baseline;
          }
          
          sub {
            bottom: -0.25em;
          }
          
          sup {
            top: -0.5em;
          }
          
          audio,
          video {
            display: inline-block;
          }
          
          audio:not([controls]) {
            display: none;
            height: 0;
          }
          
          img {
            border-style: none;
          }
          
          svg:not(:root) {
            overflow: hidden;
          }
          
          button,
          input,
          optgroup,
          select,
          textarea {
            font-family: sans-serif;
            /* 1 */
            font-size: 100%;
            /* 1 */
            line-height: 1.15;
            /* 1 */
            margin: 0;
            /* 2 */
          }
          
          button,
          input {
            /* 1 */
            overflow: visible;
          }
          
          button,
          select {
            /* 1 */
            text-transform: none;
          }
          
          button,
          html [type="button"],
          
          /* 1 */
          
          [type="reset"],
          [type="submit"] {
            -webkit-appearance: button;
            /* 2 */
          }
          
          button::-moz-focus-inner,
          [type="button"]::-moz-focus-inner,
          [type="reset"]::-moz-focus-inner,
          [type="submit"]::-moz-focus-inner {
            border-style: none;
            padding: 0;
          }
          
          button:-moz-focusring,
          [type="button"]:-moz-focusring,
          [type="reset"]:-moz-focusring,
          [type="submit"]:-moz-focusring {
            outline: 1px dotted ButtonText;
          }
          
          fieldset {
            padding: 0.35em 0.75em 0.625em;
          }
          
          legend {
            box-sizing: border-box;
            /* 1 */
            color: inherit;
            /* 2 */
            display: table;
            /* 1 */
            max-width: 100%;
            /* 1 */
            padding: 0;
            /* 3 */
            white-space: normal;
            /* 1 */
          }
          
          progress {
            display: inline-block;
            /* 1 */
            vertical-align: baseline;
            /* 2 */
          }
          
          textarea {
            overflow: auto;
          }
          
          [type="checkbox"],
          [type="radio"] {
            box-sizing: border-box;
            /* 1 */
            padding: 0;
            /* 2 */
          }
          
          [type="number"]::-webkit-inner-spin-button,
          [type="number"]::-webkit-outer-spin-button {
            height: auto;
          }
          
          [type="search"] {
            -webkit-appearance: textfield;
            /* 1 */
            outline-offset: -2px;
            /* 2 */
          }
          
          [type="search"]::-webkit-search-cancel-button,
          [type="search"]::-webkit-search-decoration {
            -webkit-appearance: none;
          }
          
           ::-webkit-file-upload-button {
            -webkit-appearance: button;
            /* 1 */
            font: inherit;
            /* 2 */
          }
          
          details,
          
          /* 1 */
          
          menu {
            display: block;
          }
          
          summary {
            display: list-item;
          }
          
          canvas {
            display: inline-block;
          }
          
          template {
            display: none;
          }
          
          [hidden] {
            display: none;
          }
          
          /* reset */
          
          html,
          body,
          h1,
          h2,
          h3,
          h4,
          h5,
          h6,
          div,
          dl,
          dt,
          dd,
          ul,
          ol,
          li,
          p,
          blockquote,
          pre,
          hr,
          figure,
          table,
          caption,
          th,
          td,
          form,
          fieldset,
          legend,
          input,
          button,
          textarea,
          menu {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
          }
          
          html,
          body {
            /* 禁止選中文本 */
            -webkit-user-select: none;
            user-select: none;
            font: Oswald, 'Open Sans', Helvetica, Arial, sans-serif
          }
          
          /* 禁止長(zhǎng)按鏈接與圖片彈出菜單 */
          
          a,
          img {
            -webkit-touch-callout: none;
          }
          
          /*ios android去除自帶陰影的樣式*/
          
          a,
          input {
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
          }
          
          input[type="text"] {
            -webkit-appearance: none;
          }

          2. Phone-reset

          /* normalize.css */
          
          html {
            line-height: 1.15;
            /* 1 */
            -ms-text-size-adjust: 100%;
            /* 2 */
            -webkit-text-size-adjust: 100%;
            /* 2 */
          }
          
          body {
            margin: 0;
          }
          
          article,
          aside,
          footer,
          header,
          nav,
          section {
            display: block;
          }
          
          h1 {
            font-size: 2em;
            margin: 0.67em 0;
          }
          
          figcaption,
          figure,
          main {
            /* 1 */
            display: block;
          }
          
          figure {
            margin: 1em 40px;
          }
          
          hr {
            box-sizing: content-box;
            /* 1 */
            height: 0;
            /* 1 */
            overflow: visible;
            /* 2 */
          }
          
          pre {
            font-family: monospace, monospace;
            /* 1 */
            font-size: 1em;
            /* 2 */
          }
          
          a {
            background-color: transparent;
            /* 1 */
            -webkit-text-decoration-skip: objects;
            /* 2 */
          }
          
          abbr[title] {
            border-bottom: none;
            /* 1 */
            text-decoration: underline;
            /* 2 */
            text-decoration: underline dotted;
            /* 2 */
          }
          
          b,
          strong {
            font-weight: inherit;
          }
          
          b,
          strong {
            font-weight: bolder;
          }
          
          code,
          kbd,
          samp {
            font-family: monospace, monospace;
            /* 1 */
            font-size: 1em;
            /* 2 */
          }
          
          dfn {
            font-style: italic;
          }
          
          mark {
            background-color: #ff0;
            color: #000;
          }
          
          small {
            font-size: 80%;
          }
          
          sub,
          sup {
            font-size: 75%;
            line-height: 0;
            position: relative;
            vertical-align: baseline;
          }
          
          sub {
            bottom: -0.25em;
          }
          
          sup {
            top: -0.5em;
          }
          
          audio,
          video {
            display: inline-block;
          }
          
          audio:not([controls]) {
            display: none;
            height: 0;
          }
          
          img {
            border-style: none;
          }
          
          svg:not(:root) {
            overflow: hidden;
          }
          
          button,
          input,
          optgroup,
          select,
          textarea {
            font-family: sans-serif;
            /* 1 */
            font-size: 100%;
            /* 1 */
            line-height: 1.15;
            /* 1 */
            margin: 0;
            /* 2 */
          }
          
          button,
          input {
            /* 1 */
            overflow: visible;
          }
          
          button,
          select {
            /* 1 */
            text-transform: none;
          }
          
          button,
          html [type="button"],
          
          /* 1 */
          
          [type="reset"],
          [type="submit"] {
            -webkit-appearance: button;
            /* 2 */
          }
          
          button::-moz-focus-inner,
          [type="button"]::-moz-focus-inner,
          [type="reset"]::-moz-focus-inner,
          [type="submit"]::-moz-focus-inner {
            border-style: none;
            padding: 0;
          }
          
          button:-moz-focusring,
          [type="button"]:-moz-focusring,
          [type="reset"]:-moz-focusring,
          [type="submit"]:-moz-focusring {
            outline: 1px dotted ButtonText;
          }
          
          fieldset {
            padding: 0.35em 0.75em 0.625em;
          }
          
          legend {
            box-sizing: border-box;
            /* 1 */
            color: inherit;
            /* 2 */
            display: table;
            /* 1 */
            max-width: 100%;
            /* 1 */
            padding: 0;
            /* 3 */
            white-space: normal;
            /* 1 */
          }
          
          progress {
            display: inline-block;
            /* 1 */
            vertical-align: baseline;
            /* 2 */
          }
          
          textarea {
            overflow: auto;
          }
          
          [type="checkbox"],
          [type="radio"] {
            box-sizing: border-box;
            /* 1 */
            padding: 0;
            /* 2 */
          }
          
          [type="number"]::-webkit-inner-spin-button,
          [type="number"]::-webkit-outer-spin-button {
            height: auto;
          }
          
          [type="search"] {
            -webkit-appearance: textfield;
            /* 1 */
            outline-offset: -2px;
            /* 2 */
          }
          
          [type="search"]::-webkit-search-cancel-button,
          [type="search"]::-webkit-search-decoration {
            -webkit-appearance: none;
          }
          
           ::-webkit-file-upload-button {
            -webkit-appearance: button;
            /* 1 */
            font: inherit;
            /* 2 */
          }
          
          details,
          
          /* 1 */
          
          menu {
            display: block;
          }
          
          summary {
            display: list-item;
          }
          
          canvas {
            display: inline-block;
          }
          
          template {
            display: none;
          }
          
          [hidden] {
            display: none;
          }
          
          /* reset */
          
          html,
          body,
          h1,
          h2,
          h3,
          h4,
          h5,
          h6,
          div,
          dl,
          dt,
          dd,
          ul,
          ol,
          li,
          p,
          blockquote,
          pre,
          hr,
          figure,
          table,
          caption,
          th,
          td,
          form,
          fieldset,
          legend,
          input,
          button,
          textarea,
          menu {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
          }
          
          html,
          body {
            /* 禁止選中文本 */
            -webkit-user-select: none;
            user-select: none;
            font: Oswald, 'Open Sans', Helvetica, Arial, sans-serif
          }
          
          /* 禁止長(zhǎng)按鏈接與圖片彈出菜單 */
          
          a,
          img {
            -webkit-touch-callout: none;
          }
          
          /*ios android去除自帶陰影的樣式*/
          
          a,
          input {
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
          }
          
          input[type="text"] {
            -webkit-appearance: none;
          }

          3. 公共樣式提取


          主站蜘蛛池模板: 日本伊人精品一区二区三区| 亚洲综合一区无码精品| 国产精久久一区二区三区| 一区二区不卡视频在线观看 | 亚洲AV无码一区二三区| 人成精品视频三区二区一区| 亚洲国产一区明星换脸| 亚洲A∨无码一区二区三区 | 亚洲一区二区影院| 亚洲欧美成人一区二区三区 | 亚洲熟女综合一区二区三区| 日本一区二区三区精品视频| 日韩精品无码一区二区三区四区 | 日本精品一区二区久久久| 国产另类ts人妖一区二区三区| 日本一区二区三区在线观看| 人妻视频一区二区三区免费| 亚洲AV无码一区二区三区国产| 精品视频无码一区二区三区| 国产免费一区二区三区VR| 久久久精品一区二区三区| 亚洲欧美成人一区二区三区 | 亚洲国产视频一区| 波多野结衣一区二区三区高清在线| 亚洲A∨精品一区二区三区| 日韩高清国产一区在线| 麻豆视频一区二区三区| 国产精品免费一区二区三区四区 | aⅴ一区二区三区无卡无码| AV无码精品一区二区三区| 一区二区手机视频| 中文字幕日韩一区| 中文字幕永久一区二区三区在线观看| 国产精品综合AV一区二区国产馆| 香蕉免费看一区二区三区| 日本一区二区三区免费高清| 午夜福利一区二区三区高清视频| 国产成人av一区二区三区在线观看| 青青青国产精品一区二区| 国产福利电影一区二区三区,免费久久久久久久精 | 国内精品一区二区三区在线观看|