Explorar o código

use svg-inline-loader

DIYgod %!s(int64=7) %!d(string=hai) anos
pai
achega
df1deb3c75

+ 1 - 1
package.json

@@ -47,6 +47,7 @@
     "sass-loader": "^6.0.6",
     "strip-loader": "^0.1.2",
     "style-loader": "^0.20.1",
+    "svg-inline-loader": "0.8.0",
     "template-string-optimize-loader": "^2.2.3",
     "url-loader": "^0.6.2",
     "webpack": "^3.10.0",
@@ -54,7 +55,6 @@
   },
   "dependencies": {
     "balloon-css": "^0.5.0",
-    "object-assign": "4.1.1",
     "promise-polyfill": "7.0.2"
   }
 }

+ 3 - 0
src/assets/camera.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32">
+    <path d="M16 23c-3.309 0-6-2.691-6-6s2.691-6 6-6 6 2.691 6 6-2.691 6-6 6zM16 13c-2.206 0-4 1.794-4 4s1.794 4 4 4c2.206 0 4-1.794 4-4s-1.794-4-4-4zM27 28h-22c-1.654 0-3-1.346-3-3v-16c0-1.654 1.346-3 3-3h3c0.552 0 1 0.448 1 1s-0.448 1-1 1h-3c-0.551 0-1 0.449-1 1v16c0 0.552 0.449 1 1 1h22c0.552 0 1-0.448 1-1v-16c0-0.551-0.448-1-1-1h-11c-0.552 0-1-0.448-1-1s0.448-1 1-1h11c1.654 0 3 1.346 3 3v16c0 1.654-1.346 3-3 3zM24 10.5c0 0.828 0.672 1.5 1.5 1.5s1.5-0.672 1.5-1.5c0-0.828-0.672-1.5-1.5-1.5s-1.5 0.672-1.5 1.5zM15 4c0 0.552-0.448 1-1 1h-4c-0.552 0-1-0.448-1-1v0c0-0.552 0.448-1 1-1h4c0.552 0 1 0.448 1 1v0z"></path>
+</svg>

+ 3 - 0
src/assets/comment-off.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32">
+    <path d="M27.090 0.131h-22.731c-2.354 0-4.262 1.839-4.262 4.109v16.401c0 2.269 1.908 4.109 4.262 4.109h4.262v-2.706h8.469l-8.853 8.135 1.579 1.451 7.487-6.88h9.787c2.353 0 4.262-1.84 4.262-4.109v-16.401c0-2.27-1.909-4.109-4.262-4.109v0zM28.511 19.304c0 1.512-1.272 2.738-2.841 2.738h-8.425l-0.076-0.070-0.076 0.070h-11.311c-1.569 0-2.841-1.226-2.841-2.738v-13.696c0-1.513 1.272-2.739 2.841-2.739h19.889c1.569 0 2.841-0.142 2.841 1.37v15.064z"></path>
+</svg>

+ 3 - 0
src/assets/comment.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32">
+    <path d="M27.128 0.38h-22.553c-2.336 0-4.229 1.825-4.229 4.076v16.273c0 2.251 1.893 4.076 4.229 4.076h4.229v-2.685h8.403l-8.784 8.072 1.566 1.44 7.429-6.827h9.71c2.335 0 4.229-1.825 4.229-4.076v-16.273c0-2.252-1.894-4.076-4.229-4.076zM28.538 19.403c0 1.5-1.262 2.717-2.819 2.717h-8.36l-0.076-0.070-0.076 0.070h-11.223c-1.557 0-2.819-1.217-2.819-2.717v-13.589c0-1.501 1.262-2.718 2.819-2.718h19.734c1.557 0 2.819-0.141 2.819 1.359v14.947zM9.206 10.557c-1.222 0-2.215 0.911-2.215 2.036s0.992 2.035 2.215 2.035c1.224 0 2.216-0.911 2.216-2.035s-0.992-2.036-2.216-2.036zM22.496 10.557c-1.224 0-2.215 0.911-2.215 2.036s0.991 2.035 2.215 2.035c1.224 0 2.215-0.911 2.215-2.035s-0.991-2.036-2.215-2.036zM15.852 10.557c-1.224 0-2.215 0.911-2.215 2.036s0.991 2.035 2.215 2.035c1.222 0 2.215-0.911 2.215-2.035s-0.992-2.036-2.215-2.036z"></path>
+</svg>

+ 3 - 0
src/assets/full-web.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 33">
+    <path d="M24.965 24.38h-18.132c-1.366 0-2.478-1.113-2.478-2.478v-11.806c0-1.364 1.111-2.478 2.478-2.478h18.132c1.366 0 2.478 1.113 2.478 2.478v11.806c0 1.364-1.11 2.478-2.478 2.478zM6.833 10.097v11.806h18.134l-0.002-11.806h-18.132zM2.478 28.928h5.952c0.684 0 1.238-0.554 1.238-1.239 0-0.684-0.554-1.238-1.238-1.238h-5.952v-5.802c0-0.684-0.554-1.239-1.238-1.239s-1.239 0.556-1.239 1.239v5.802c0 1.365 1.111 2.478 2.478 2.478zM30.761 19.412c-0.684 0-1.238 0.554-1.238 1.238v5.801h-5.951c-0.686 0-1.239 0.554-1.239 1.238 0 0.686 0.554 1.239 1.239 1.239h5.951c1.366 0 2.478-1.111 2.478-2.478v-5.801c0-0.683-0.554-1.238-1.239-1.238zM0 5.55v5.802c0 0.683 0.554 1.238 1.238 1.238s1.238-0.555 1.238-1.238v-5.802h5.952c0.684 0 1.238-0.554 1.238-1.238s-0.554-1.238-1.238-1.238h-5.951c-1.366-0.001-2.478 1.111-2.478 2.476zM32 11.35v-5.801c0-1.365-1.11-2.478-2.478-2.478h-5.951c-0.686 0-1.239 0.554-1.239 1.238s0.554 1.238 1.239 1.238h5.951v5.801c0 0.683 0.554 1.237 1.238 1.237 0.686 0.002 1.239-0.553 1.239-1.236z"></path>
+</svg>

+ 3 - 0
src/assets/full.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 33">
+    <path d="M6.667 28h-5.333c-0.8 0-1.333-0.533-1.333-1.333v-5.333c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333v4h4c0.8 0 1.333 0.533 1.333 1.333s-0.533 1.333-1.333 1.333zM30.667 28h-5.333c-0.8 0-1.333-0.533-1.333-1.333s0.533-1.333 1.333-1.333h4v-4c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333v5.333c0 0.8-0.533 1.333-1.333 1.333zM30.667 12c-0.8 0-1.333-0.533-1.333-1.333v-4h-4c-0.8 0-1.333-0.533-1.333-1.333s0.533-1.333 1.333-1.333h5.333c0.8 0 1.333 0.533 1.333 1.333v5.333c0 0.8-0.533 1.333-1.333 1.333zM1.333 12c-0.8 0-1.333-0.533-1.333-1.333v-5.333c0-0.8 0.533-1.333 1.333-1.333h5.333c0.8 0 1.333 0.533 1.333 1.333s-0.533 1.333-1.333 1.333h-4v4c0 0.8-0.533 1.333-1.333 1.333z"></path>
+</svg>

+ 26 - 0
src/assets/loading.svg

@@ -0,0 +1,26 @@
+<svg height="100%" version="1.1" viewBox="0 0 22 22">
+    <svg x="7" y="1">
+        <circle class="diplayer-loading-dot diplayer-loading-dot-0" cx="4" cy="4" r="2"></circle>
+    </svg>
+    <svg x="11" y="3">
+        <circle class="diplayer-loading-dot diplayer-loading-dot-1" cx="4" cy="4" r="2"></circle>
+    </svg>
+    <svg x="13" y="7">
+        <circle class="diplayer-loading-dot diplayer-loading-dot-2" cx="4" cy="4" r="2"></circle>
+    </svg>
+    <svg x="11" y="11">
+        <circle class="diplayer-loading-dot diplayer-loading-dot-3" cx="4" cy="4" r="2"></circle>
+    </svg>
+    <svg x="7" y="13">
+        <circle class="diplayer-loading-dot diplayer-loading-dot-4" cx="4" cy="4" r="2"></circle>
+    </svg>
+    <svg x="3" y="11">
+        <circle class="diplayer-loading-dot diplayer-loading-dot-5" cx="4" cy="4" r="2"></circle>
+    </svg>
+    <svg x="1" y="7">
+        <circle class="diplayer-loading-dot diplayer-loading-dot-6" cx="4" cy="4" r="2"></circle>
+    </svg>
+    <svg x="3" y="3">
+        <circle class="diplayer-loading-dot diplayer-loading-dot-7" cx="4" cy="4" r="2"></circle>
+    </svg>
+</svg>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 0
src/assets/pallette.svg


+ 3 - 0
src/assets/pause.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 17 32">
+    <path d="M14.080 4.8q2.88 0 2.88 2.048v18.24q0 2.112-2.88 2.112t-2.88-2.112v-18.24q0-2.048 2.88-2.048zM2.88 4.8q2.88 0 2.88 2.048v18.24q0 2.112-2.88 2.112t-2.88-2.112v-18.24q0-2.048 2.88-2.048z"></path>
+</svg>

+ 3 - 0
src/assets/play.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 32">
+    <path d="M15.552 15.168q0.448 0.32 0.448 0.832 0 0.448-0.448 0.768l-13.696 8.512q-0.768 0.512-1.312 0.192t-0.544-1.28v-16.448q0-0.96 0.544-1.28t1.312 0.192z"></path>
+</svg>

+ 3 - 0
src/assets/right.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32">
+    <path d="M22 16l-10.105-10.6-1.895 1.987 8.211 8.613-8.211 8.612 1.895 1.988 8.211-8.613z"></path>
+</svg>

+ 3 - 0
src/assets/send.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32">
+    <path d="M13.725 30l3.9-5.325-3.9-1.125v6.45zM0 17.5l11.050 3.35 13.6-11.55-10.55 12.425 11.8 3.65 6.1-23.375-32 15.5z"></path>
+</svg>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 0
src/assets/setting.svg


+ 3 - 0
src/assets/subtitle.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32">
+    <path d="M26.667 5.333h-21.333c-0 0-0.001 0-0.001 0-1.472 0-2.666 1.194-2.666 2.666 0 0 0 0.001 0 0.001v-0 16c0 0 0 0.001 0 0.001 0 1.472 1.194 2.666 2.666 2.666 0 0 0.001 0 0.001 0h21.333c0 0 0.001 0 0.001 0 1.472 0 2.666-1.194 2.666-2.666 0-0 0-0.001 0-0.001v0-16c0-0 0-0.001 0-0.001 0-1.472-1.194-2.666-2.666-2.666-0 0-0.001 0-0.001 0h0zM5.333 16h5.333v2.667h-5.333v-2.667zM18.667 24h-13.333v-2.667h13.333v2.667zM26.667 24h-5.333v-2.667h5.333v2.667zM26.667 18.667h-13.333v-2.667h13.333v2.667z"></path>
+</svg>

+ 3 - 0
src/assets/volume-down.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 21 32">
+    <path d="M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528z"></path>
+</svg>

+ 3 - 0
src/assets/volume-off.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 21 32">
+    <path d="M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8z"></path>
+</svg>

+ 3 - 0
src/assets/volume-up.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 21 32">
+    <path d="M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528zM25.152 16q0 2.72-1.536 5.056t-4 3.36q-0.256 0.096-0.448 0.096-0.48 0-0.832-0.352t-0.32-0.8q0-0.704 0.672-1.056 1.024-0.512 1.376-0.8 1.312-0.96 2.048-2.4t0.736-3.104-0.736-3.104-2.048-2.4q-0.352-0.288-1.376-0.8-0.672-0.352-0.672-1.056 0-0.448 0.32-0.8t0.8-0.352q0.224 0 0.48 0.096 2.496 1.056 4 3.36t1.536 5.056z"></path>
+</svg>

+ 0 - 1
src/css/bezel.scss

@@ -59,7 +59,6 @@
         .diplayer-loading-dot {
             animation: diplayer-loading-dot-fade .8s ease infinite;
             opacity: 0;
-            fill: #fff;
             transform-origin: 4px 4px;
             @for $i from 7 through 1 {
                 &.diplayer-loading-dot-#{$i} {

+ 10 - 0
src/css/player.scss

@@ -8,6 +8,16 @@
         box-sizing: content-box;
     }
 
+    svg {
+        width: 100%;
+        height: 100%;
+        
+        path,
+        circle {
+            fill: #fff;
+        }
+    }
+
     &:-webkit-full-screen {
         width: 100%;
         height: 100%;

+ 2 - 1
src/js/controller.js

@@ -1,5 +1,6 @@
 import utils from './utils';
 import Thumbnails from './thumbnails';
+import Icons from './icons';
 
 class Controller {
     constructor (player) {
@@ -180,7 +181,7 @@ class Controller {
             }
             else {
                 this.player.video.muted = true;
-                this.player.template.volumeIcon.innerHTML = this.player.icons.get('volume-off');
+                this.player.template.volumeIcon.innerHTML = Icons.volumeOff;
                 this.player.bar.set('volume', 0, 'width');
             }
         });

+ 37 - 0
src/js/icons.js

@@ -0,0 +1,37 @@
+import play from '../assets/play.svg';
+import pause from '../assets/pause.svg';
+import volumeUp from '../assets/volume-up.svg';
+import volumeDown from '../assets/volume-down.svg';
+import volumeOff from '../assets/volume-off.svg';
+import full from '../assets/full.svg';
+import fullWeb from '../assets/full-web.svg';
+import setting from '../assets/setting.svg';
+import right from '../assets/right.svg';
+import comment from '../assets/comment.svg';
+import commentOff from '../assets/comment-off.svg';
+import send from '../assets/send.svg';
+import pallette from '../assets/pallette.svg';
+import camera from '../assets/camera.svg';
+import subtitle from '../assets/subtitle.svg';
+import loading from '../assets/loading.svg';
+
+const Icons = {
+    play: play,
+    pause: pause,
+    volumeUp: volumeUp,
+    volumeDown: volumeDown,
+    volumeOff: volumeOff,
+    full: full,
+    fullWeb: fullWeb,
+    setting: setting,
+    right: right,
+    comment: comment,
+    commentOff: commentOff,
+    send: send,
+    pallette: pallette,
+    camera: camera,
+    subtitle: subtitle,
+    loading: loading,
+};
+
+export default Icons;

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 36
src/js/options.js


+ 8 - 10
src/js/player.js

@@ -4,7 +4,7 @@ import utils from './utils';
 import handleOption from './options';
 import i18n from './i18n';
 import Template from './template';
-import SvgCollection from './svg';
+import Icons from './icons';
 import Danmaku from './danmaku';
 import Events from './events';
 import FullScreen from './fullscreen';
@@ -39,7 +39,6 @@ class DPlayer {
             this.quality = this.options.video.quality[this.options.video.defaultQuality];
         }
         this.tran = new i18n(this.options.lang).tran;
-        this.icons = new SvgCollection(this.options);
         this.events = new Events();
         this.user = new User(this);
         this.container = this.options.container;
@@ -64,7 +63,6 @@ class DPlayer {
             options: this.options,
             index: index,
             tran: this.tran,
-            icons: this.icons
         });
 
         this.video = this.template.video;
@@ -172,10 +170,10 @@ class DPlayer {
     play () {
         this.paused = false;
         if (this.video.paused) {
-            this.bezel.switch(this.icons.get('play'));
+            this.bezel.switch(Icons.play);
         }
 
-        this.template.playButton.innerHTML = this.icons.get('pause');
+        this.template.playButton.innerHTML = Icons.pause;
 
         const playedPromise = Promise.resolve(this.video.play());
         playedPromise.catch(() => {
@@ -206,11 +204,11 @@ class DPlayer {
         this.container.classList.remove('dplayer-loading');
 
         if (!this.video.paused) {
-            this.bezel.switch(this.icons.get('pause'));
+            this.bezel.switch(Icons.pause);
         }
 
         this.ended = false;
-        this.template.playButton.innerHTML = this.icons.get('play');
+        this.template.playButton.innerHTML = Icons.play;
         this.video.pause();
         this.time.disable('loading');
         this.time.disable('progress');
@@ -223,13 +221,13 @@ class DPlayer {
 
     switchVolumeIcon () {
         if (this.volume() >= 0.95) {
-            this.template.volumeIcon.innerHTML = this.icons.get('volume-up');
+            this.template.volumeIcon.innerHTML = Icons.volumeUp;
         }
         else if (this.volume() > 0) {
-            this.template.volumeIcon.innerHTML = this.icons.get('volume-down');
+            this.template.volumeIcon.innerHTML = Icons.volumeDown;
         }
         else {
-            this.template.volumeIcon.innerHTML = this.icons.get('volume-off');
+            this.template.volumeIcon.innerHTML = Icons.volumeOff;
         }
     }
 

+ 0 - 24
src/js/svg.js

@@ -1,24 +0,0 @@
-/**
-* SVG used by DPlayer
-*/
-
-class SvgSource {
-    constructor (options) {
-        this.icons = options.icons;
-        this.iconColor = options.iconsColor;
-    }
-
-    get (type) {
-        // Some SVG icons don't change icon size using viewBox. Ex.: Material Icons
-        // To fix these cases a optional index was added to icon object when change icon
-        // size is necessary
-
-        return `
-            <svg xmlns="http://www.w3.org/2000/svg" width="${this.icons[type][2] || '100%'}" height="${this.icons[type][2] || '100%'}" version="1.1" viewBox="${this.icons[type][0]}">
-                <path class="dplayer-fill" style="fill:${this.iconColor}" d="${this.icons[type][1]}" id="dplayer-${type}"></path>
-            </svg>
-        `;
-    }
-}
-
-export default SvgSource;

+ 18 - 44
src/js/template.js

@@ -1,15 +1,16 @@
+import Icons from './icons';
+
 class Template {
     constructor (options) {
         this.container = options.container;
         this.options = options.options;
         this.index = options.index;
         this.tran = options.tran;
-        this.icons = options.icons;
         this.init();
     }
 
     init () {
-        this.container.innerHTML = this.tpl(this.options, this.index, this.tran, this.icons);
+        this.container.innerHTML = this.tpl(this.options, this.index, this.tran);
 
         this.volumeBar = this.container.querySelector('.dplayer-volume-bar-inner');
         this.volumeBarWrap = this.container.querySelector('.dplayer-volume-bar');
@@ -49,9 +50,9 @@ class Template {
         this.commentButton = this.container.querySelector('.dplayer-comment-icon');
         this.commentSettingBox = this.container.querySelector('.dplayer-comment-setting-box');
         this.commentSettingButton = this.container.querySelector('.dplayer-comment-setting-icon');
-        this.commentSettingFill = this.container.querySelector('.dplayer-comment-setting-icon .dplayer-fill');
+        this.commentSettingFill = this.container.querySelector('.dplayer-comment-setting-icon path');
         this.commentSendButton = this.container.querySelector('.dplayer-send-icon');
-        this.commentSendFill = this.container.querySelector('.dplayer-send-icon .dplayer-fill');
+        this.commentSendFill = this.container.querySelector('.dplayer-send-icon path');
         this.commentColorSettingBox = this.container.querySelector('.dplayer-comment-setting-color');
         this.browserFullButton = this.container.querySelector('.dplayer-full-icon');
         this.webFullButton = this.container.querySelector('.dplayer-full-in-icon');
@@ -79,7 +80,7 @@ class Template {
         this.infoDanmakuAmount = this.container.querySelector('.dplayer-info-panel-item-danmaku-amount .dplayer-info-panel-item-data');
     }
 
-    tpl (options, index, tran, icons) {
+    tpl (options, index, tran) {
         return `
         <div class="dplayer-mask"></div>
         <div class="dplayer-video-wrap">
@@ -94,41 +95,14 @@ class Template {
             <div class="dplayer-bezel">
                 <span class="dplayer-bezel-icon"></span>
                 ${options.danmaku ? `<span class="dplayer-danloading">${tran('Danmaku is loading')}</span>` : ``}
-                <span class="diplayer-loading-icon">
-                    <svg height="100%" version="1.1" viewBox="0 0 22 22" width="100%">
-                        <svg x="7" y="1">
-                            <circle class="diplayer-loading-dot diplayer-loading-dot-0" cx="4" cy="4" r="2"></circle>
-                        </svg>
-                        <svg x="11" y="3">
-                            <circle class="diplayer-loading-dot diplayer-loading-dot-1" cx="4" cy="4" r="2"></circle>
-                        </svg>
-                        <svg x="13" y="7">
-                            <circle class="diplayer-loading-dot diplayer-loading-dot-2" cx="4" cy="4" r="2"></circle>
-                        </svg>
-                        <svg x="11" y="11">
-                            <circle class="diplayer-loading-dot diplayer-loading-dot-3" cx="4" cy="4" r="2"></circle>
-                        </svg>
-                        <svg x="7" y="13">
-                            <circle class="diplayer-loading-dot diplayer-loading-dot-4" cx="4" cy="4" r="2"></circle>
-                        </svg>
-                        <svg x="3" y="11">
-                            <circle class="diplayer-loading-dot diplayer-loading-dot-5" cx="4" cy="4" r="2"></circle>
-                        </svg>
-                        <svg x="1" y="7">
-                            <circle class="diplayer-loading-dot diplayer-loading-dot-6" cx="4" cy="4" r="2"></circle>
-                        </svg>
-                        <svg x="3" y="3">
-                            <circle class="diplayer-loading-dot diplayer-loading-dot-7" cx="4" cy="4" r="2"></circle>
-                        </svg>
-                    </svg>
-                </span>
+                <span class="diplayer-loading-icon">${Icons.loading}</span>
             </div>
         </div>
         <div class="dplayer-controller-mask"></div>
         <div class="dplayer-controller">
             <div class="dplayer-icons dplayer-comment-box">
                 <button class="dplayer-icon dplayer-comment-setting-icon" data-balloon="${tran('Setting')}" data-balloon-pos="up">
-                    <span class="dplayer-icon-content">${icons.get('pallette')}</span>
+                    <span class="dplayer-icon-content">${Icons.pallette}</span>
                 </button>
                 <div class="dplayer-comment-setting-box">
                     <div class="dplayer-comment-setting-color">
@@ -176,16 +150,16 @@ class Template {
                 </div>
                 <input class="dplayer-comment-input" type="text" placeholder="${tran('Input danmaku, hit Enter')}" maxlength="30">
                 <button class="dplayer-icon dplayer-send-icon" data-balloon="${tran('Send')}" data-balloon-pos="up">
-                    <span class="dplayer-icon-content">${icons.get('send')}</span>
+                    <span class="dplayer-icon-content">${Icons.send}</span>
                 </button>
             </div>
             <div class="dplayer-icons dplayer-icons-left">
                 <button class="dplayer-icon dplayer-play-icon">
-                    <span class="dplayer-icon-content">${icons.get('play')}</span>
+                    <span class="dplayer-icon-content">${Icons.play}</span>
                 </button>
                 <div class="dplayer-volume">
                     <button class="dplayer-icon dplayer-volume-icon">
-                        <span class="dplayer-icon-content">${icons.get('volume-down')}</span>
+                        <span class="dplayer-icon-content">${Icons.volumeDown}</span>
                     </button>
                     <div class="dplayer-volume-bar-wrap" data-balloon-pos="up">
                         <div class="dplayer-volume-bar">
@@ -209,31 +183,31 @@ class Template {
                 ` : ``}
                 ${options.screenshot ? `
                 <a href="#" class="dplayer-icon dplayer-camera-icon" data-balloon="${tran('Screenshot')}" data-balloon-pos="up">
-                    <span class="dplayer-icon-content">${icons.get('camera')}</span>
+                    <span class="dplayer-icon-content">${Icons.camera}</span>
                 </a>
                 ` : ``}
                 <div class="dplayer-comment">
                     <button class="dplayer-icon dplayer-comment-icon" data-balloon="${tran('Send danmaku')}" data-balloon-pos="up">
-                        <span class="dplayer-icon-content">${icons.get('comment')}</span>
+                        <span class="dplayer-icon-content">${Icons.comment}</span>
                     </button>
                 </div>
                 ${options.subtitle ? `
                 <div class="dplayer-subtitle-btn">
                     <button class="dplayer-icon dplayer-subtitle-icon" data-balloon="${tran('Hide subtitle')}" data-balloon-pos="up">
-                        <span class="dplayer-icon-content">${icons.get('subtitle')}</span>
+                        <span class="dplayer-icon-content">${Icons.subtitle}</span>
                     </button>
                 </div>
                 ` : ``}
                 <div class="dplayer-setting">
                     <button class="dplayer-icon dplayer-setting-icon" data-balloon="${tran('Setting')}" data-balloon-pos="up">
-                        <span class="dplayer-icon-content">${icons.get('setting')}</span>
+                        <span class="dplayer-icon-content">${Icons.setting}</span>
                     </button>
                     <div class="dplayer-setting-box">
                         <div class="dplayer-setting-origin-panel">
                             <div class="dplayer-setting-item dplayer-setting-speed">
                                 <span class="dplayer-label">${tran('Speed')}</span>
                                 <div class="dplayer-toggle">
-                                    ${icons.get('right')}
+                                    ${Icons.right}
                                 </div>
                             </div>
                             <div class="dplayer-setting-item dplayer-setting-loop">
@@ -292,10 +266,10 @@ class Template {
                 </div>
                 <div class="dplayer-full">
                     <button class="dplayer-icon dplayer-full-in-icon" data-balloon="${tran('Web full screen')}" data-balloon-pos="up">
-                        <span class="dplayer-icon-content">${icons.get('full-in')}</span>
+                        <span class="dplayer-icon-content">${Icons.fullWeb}</span>
                     </button>
                     <button class="dplayer-icon dplayer-full-icon" data-balloon="${tran('Full screen')}" data-balloon-pos="up">
-                        <span class="dplayer-icon-content">${icons.get('full')}</span>
+                        <span class="dplayer-icon-content">${Icons.full}</span>
                     </button>
                 </div>
             </div>

+ 4 - 0
webpack/dev.config.js

@@ -75,6 +75,10 @@ module.exports = {
                 options: {
                     'limit': 40000
                 }
+            },
+            {
+                test: /\.svg$/,
+                loader: 'svg-inline-loader'
             }
         ]
     },

+ 4 - 0
webpack/prod.config.js

@@ -83,6 +83,10 @@ module.exports = {
                 options: {
                     'limit': 40000
                 }
+            },
+            {
+                test: /\.svg$/,
+                loader: 'svg-inline-loader'
             }
         ]
     },

+ 14 - 2
yarn.lock

@@ -3242,7 +3242,7 @@ loader-runner@^2.3.0:
   version "2.3.0"
   resolved "http://registry.npm.taobao.org/loader-runner/download/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2"
 
-loader-utils@^0.2.6:
+loader-utils@^0.2.11, loader-utils@^0.2.6:
   version "0.2.17"
   resolved "http://registry.npm.taobao.org/loader-utils/download/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348"
   dependencies:
@@ -3717,7 +3717,7 @@ oauth-sign@~0.8.1, oauth-sign@~0.8.2:
   version "0.8.2"
   resolved "http://registry.npm.taobao.org/oauth-sign/download/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"
 
-object-assign@4.1.1, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
+object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
   version "4.1.1"
   resolved "http://registry.npm.taobao.org/object-assign/download/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
 
@@ -4921,6 +4921,10 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
   version "3.0.2"
   resolved "http://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
 
+simple-html-tokenizer@^0.1.1:
+  version "0.1.1"
+  resolved "https://registry.npmjs.org/simple-html-tokenizer/-/simple-html-tokenizer-0.1.1.tgz#05c2eec579ffffe145a030ac26cfea61b980fabe"
+
 slash@^1.0.0:
   version "1.0.0"
   resolved "http://registry.npm.taobao.org/slash/download/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
@@ -5231,6 +5235,14 @@ supports-color@^5.1.0:
   dependencies:
     has-flag "^2.0.0"
 
+svg-inline-loader@0.8.0:
+  version "0.8.0"
+  resolved "https://registry.npmjs.org/svg-inline-loader/-/svg-inline-loader-0.8.0.tgz#7e9d905d80d0b4e68d2df21afcd08ee9e9a3ea6e"
+  dependencies:
+    loader-utils "^0.2.11"
+    object-assign "^4.0.1"
+    simple-html-tokenizer "^0.1.1"
+
 svgo@^0.7.0:
   version "0.7.2"
   resolved "http://registry.npm.taobao.org/svgo/download/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5"

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio