├── LICENSE ├── README.md ├── controller ├── caption.go ├── guestbook.go ├── index.go └── video.go ├── db ├── redisdb │ ├── redis.go │ └── redis_test.go └── sqldb │ ├── comments.go │ ├── comments_test.go │ └── db.go ├── go.mod ├── go.sum ├── main.go ├── manager └── youtubeapi │ ├── oauth2.go │ └── service.go ├── middleware └── middleware.go ├── model ├── comments.go ├── logs.go └── videos.go ├── resources ├── css │ ├── guestbook │ │ └── guestbook.css │ ├── index │ │ └── index.css │ └── intro │ │ └── intro.css ├── favicon.ico ├── img │ └── screenshot.PNG ├── js │ ├── common │ │ └── util.js │ ├── guestbook │ │ └── guestbook.js │ └── index │ │ └── index.js └── layui │ ├── css │ ├── layui.css │ ├── layui.mobile.css │ └── modules │ │ ├── code.css │ │ ├── laydate │ │ └── default │ │ │ └── laydate.css │ │ └── layer │ │ └── default │ │ ├── icon-ext.png │ │ ├── icon.png │ │ ├── layer.css │ │ ├── loading-0.gif │ │ ├── loading-1.gif │ │ └── loading-2.gif │ ├── font │ ├── iconfont.eot │ ├── iconfont.svg │ ├── iconfont.ttf │ ├── iconfont.woff │ └── iconfont.woff2 │ ├── images │ └── face │ │ ├── 0.gif │ │ ├── 1.gif │ │ ├── 10.gif │ │ ├── 11.gif │ │ ├── 12.gif │ │ ├── 13.gif │ │ ├── 14.gif │ │ ├── 15.gif │ │ ├── 16.gif │ │ ├── 17.gif │ │ ├── 18.gif │ │ ├── 19.gif │ │ ├── 2.gif │ │ ├── 20.gif │ │ ├── 21.gif │ │ ├── 22.gif │ │ ├── 23.gif │ │ ├── 24.gif │ │ ├── 25.gif │ │ ├── 26.gif │ │ ├── 27.gif │ │ ├── 28.gif │ │ ├── 29.gif │ │ ├── 3.gif │ │ ├── 30.gif │ │ ├── 31.gif │ │ ├── 32.gif │ │ ├── 33.gif │ │ ├── 34.gif │ │ ├── 35.gif │ │ ├── 36.gif │ │ ├── 37.gif │ │ ├── 38.gif │ │ ├── 39.gif │ │ ├── 4.gif │ │ ├── 40.gif │ │ ├── 41.gif │ │ ├── 42.gif │ │ ├── 43.gif │ │ ├── 44.gif │ │ ├── 45.gif │ │ ├── 46.gif │ │ ├── 47.gif │ │ ├── 48.gif │ │ ├── 49.gif │ │ ├── 5.gif │ │ ├── 50.gif │ │ ├── 51.gif │ │ ├── 52.gif │ │ ├── 53.gif │ │ ├── 54.gif │ │ ├── 55.gif │ │ ├── 56.gif │ │ ├── 57.gif │ │ ├── 58.gif │ │ ├── 59.gif │ │ ├── 6.gif │ │ ├── 60.gif │ │ ├── 61.gif │ │ ├── 62.gif │ │ ├── 63.gif │ │ ├── 64.gif │ │ ├── 65.gif │ │ ├── 66.gif │ │ ├── 67.gif │ │ ├── 68.gif │ │ ├── 69.gif │ │ ├── 7.gif │ │ ├── 70.gif │ │ ├── 71.gif │ │ ├── 8.gif │ │ └── 9.gif │ ├── lay │ └── modules │ │ ├── carousel.js │ │ ├── code.js │ │ ├── colorpicker.js │ │ ├── element.js │ │ ├── flow.js │ │ ├── form.js │ │ ├── jquery.js │ │ ├── laydate.js │ │ ├── layedit.js │ │ ├── layer.js │ │ ├── laypage.js │ │ ├── laytpl.js │ │ ├── mobile.js │ │ ├── rate.js │ │ ├── slider.js │ │ ├── table.js │ │ ├── transfer.js │ │ ├── tree.js │ │ ├── upload.js │ │ └── util.js │ ├── layui.all.js │ └── layui.js ├── service ├── captions.go ├── comment.go ├── download_local.go ├── downoad.go └── video.go ├── templates ├── 400.html ├── 500.html ├── guestbook.html ├── index.tmpl └── intro.html └── utils ├── util.go └── util_test.go /README.md: -------------------------------------------------------------------------------- 1 | # ytvc 2 | 3 | 4 | --- 5 | 用于下载youtube字幕和视频的一个web应用。[访问地址](https://y2b.treant.me) 6 | 7 | 开发目的是为了解决我在ipad上下载youtube字幕和视频的需求。 8 | (pc可以使用chrome插件/油猴脚本/youtube-dl/annie等方式下载youtube视频,但是ipad上不能这样) 9 | 可以在pc上运行服务,然后ipad通过局域网访问。 10 | 配合nPlayer使用,可以比较方便地下载字幕和视频。 11 | 12 | ![截图](resources/img/screenshot.PNG) 13 | 14 | --- 15 | 16 | ### 运行 17 | 默认端口8080 18 | ```bash 19 | git clone https://github.com/treant5612/ytvc-web.git 20 | cd ytvc-web 21 | go build 22 | ./ytvc-web 23 | ``` 24 | 如需代理,使用 25 | ```bash 26 | https_proxy=ip:port ./ytvc-web 27 | ``` 28 | 29 | 使用了redis暂存数据,无redis会重复访问youtube视频页面获取数据,不影响功能。 30 | -------------------------------------------------------------------------------- /controller/caption.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "fmt" 5 | "github.com/gin-gonic/gin" 6 | "github.com/treant5612/ytvc-web/service" 7 | "log" 8 | ) 9 | 10 | func CaptionDownload(c *gin.Context) { 11 | videoId := c.Param("id") 12 | captionId := c.Query("vssid") 13 | fname := c.DefaultQuery("fname", "subtitle") 14 | tlang := c.Query("tlang") 15 | secondaryId := c.Query("secondary") 16 | secondaryTlang := c.Query("secondary_tlang") 17 | var fpath string 18 | var err error 19 | if secondaryId == "" { 20 | fpath, err = service.DownloadCaption(videoId, captionId, tlang) 21 | } else { 22 | fpath, err = service.DownloadAndMergeCaption(videoId, captionId, tlang, secondaryId, secondaryTlang) 23 | } 24 | if err != nil { 25 | log.Println(err) 26 | c.Status(500) 27 | return 28 | } 29 | // defer os.Remove(fpath) 30 | fileName := fmt.Sprintf("%s.srt", fname) 31 | c.FileAttachment(fpath, fileName) 32 | } 33 | -------------------------------------------------------------------------------- /controller/guestbook.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | "github.com/treant5612/ytvc-web/service" 6 | "log" 7 | "net/http" 8 | ) 9 | 10 | func GuestBookPage(c *gin.Context) { 11 | pageNo := c.DefaultQuery("page", "1") 12 | pageSize := c.DefaultQuery("size", "15") 13 | 14 | comments, err := service.ListComment(pageNo, pageSize) 15 | if err != nil { 16 | log.Println("list comments failed", err) 17 | } 18 | c.HTML(http.StatusOK, "templates/guestbook.html", comments) 19 | } 20 | 21 | func GuestBookComment(c *gin.Context) { 22 | nickname := c.PostForm("nickname") 23 | content := c.PostForm("comment") 24 | if nickname != "" && content != "" { 25 | err := service.InsertComment(nickname, content, c.Request.RemoteAddr) 26 | if err == nil { 27 | c.JSON(200, gin.H{ 28 | "msg": "comment success", 29 | }) 30 | return 31 | } 32 | log.Println(err) 33 | } 34 | 35 | c.JSON(400, gin.H{ 36 | "msg": "invalid parameter", 37 | }) 38 | 39 | } 40 | -------------------------------------------------------------------------------- /controller/index.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | "net/http" 6 | ) 7 | 8 | func Index(c *gin.Context) { 9 | c.HTML(http.StatusOK, "templates/index.html", nil) 10 | } 11 | -------------------------------------------------------------------------------- /controller/video.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "bufio" 5 | "github.com/gin-gonic/gin" 6 | "github.com/treant5612/ytvc-web/service" 7 | "io" 8 | "log" 9 | "net/http" 10 | "strconv" 11 | ) 12 | 13 | var ( 14 | Page400 = `templates/400.html` 15 | Page500 = `templates/500.html` 16 | ) 17 | 18 | func Video(c *gin.Context) { 19 | var err error 20 | urlParam := c.DefaultQuery("url", c.PostForm("url")) 21 | if urlParam == "" { 22 | c.JSON(http.StatusBadRequest, gin.H{ 23 | "code": 400, 24 | "err": "invalid param", 25 | }) 26 | return 27 | } 28 | video, err := service.Video(urlParam) 29 | if err != nil { 30 | log.Println(err) 31 | c.JSON(http.StatusBadRequest, gin.H{ 32 | "code": 400, 33 | "err": "invalid param", 34 | }) 35 | return 36 | } 37 | 38 | c.JSON(http.StatusOK, gin.H{ 39 | "code": 200, 40 | "data": video, 41 | }) 42 | } 43 | 44 | func VideoDownload(c *gin.Context) { 45 | log.SetFlags(log.Lshortfile | log.Ltime) 46 | id := c.Param("id") 47 | noStr := c.Query("no") 48 | kind := c.Query("kind") 49 | no, err := strconv.Atoi(noStr) 50 | if err != nil { 51 | c.HTML(400, Page400, nil) 52 | return 53 | } 54 | fileName, downUrl, err := service.DownloadInfo(id, no, kind) 55 | if err != nil { 56 | c.HTML(404, Page400, nil) 57 | return 58 | } 59 | resp, err := service.Download(downUrl, func(r *http.Request) { 60 | copyHeader(r.Header, c.Request.Header, "Range") 61 | }) 62 | if err != nil { 63 | log.Println(err) 64 | c.HTML(500, Page500, nil) 65 | return 66 | } 67 | defer resp.Body.Close() 68 | 69 | c.Status(resp.StatusCode) 70 | copyHeader(c.Writer.Header(), resp.Header, 71 | "Range", "Accept-Ranges", "Content-Range", "Content-Type", "Content-Length") 72 | c.Writer.Header().Set("Content-Disposition", "attachment;filename="+fileName) 73 | _, err = io.Copy(c.Writer, bufio.NewReaderSize(resp.Body, 512*1024)) 74 | if err != nil { 75 | log.Println(err) 76 | } 77 | } 78 | 79 | func copyHeader(dst, src http.Header, fields ...string) { 80 | for _, field := range fields { 81 | if v := src.Get(field); v != "" { 82 | dst.Set(field, v) 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /db/redisdb/redis.go: -------------------------------------------------------------------------------- 1 | package redisdb 2 | 3 | import ( 4 | "encoding/json" 5 | "github.com/go-redis/redis" 6 | "github.com/treant5612/ytvc-web/model" 7 | "log" 8 | "time" 9 | ) 10 | 11 | var rdb *redis.Client 12 | 13 | var ( 14 | expire = time.Hour / 2 15 | ) 16 | 17 | func SetVideoDetail(video *model.Video) { 18 | bytes, err := json.Marshal(video) 19 | if err != nil { 20 | log.Printf("redis set video detail failed:%v", err) 21 | return 22 | } 23 | rdb.Set("video."+video.Info.ID, bytes, expire) 24 | 25 | } 26 | 27 | func GetVideoDetail(id string) (video *model.Video, err error) { 28 | video = new(model.Video) 29 | bytes, err := rdb.Get("video." + id).Bytes() 30 | if err != nil { 31 | return nil, err 32 | } 33 | err = json.Unmarshal(bytes, video) 34 | return 35 | } 36 | 37 | func Init(options *redis.Options) { 38 | rdb = redis.NewClient(options) 39 | rdb.Options() 40 | } 41 | -------------------------------------------------------------------------------- /db/redisdb/redis_test.go: -------------------------------------------------------------------------------- 1 | package redisdb 2 | 3 | import ( 4 | "fmt" 5 | "github.com/go-redis/redis" 6 | "github.com/treant5612/ytvc-web/model" 7 | "testing" 8 | "time" 9 | ) 10 | 11 | func init() { 12 | Init(&redis.Options{Addr: ":6379"}) 13 | } 14 | func TestVideoDetail(t *testing.T) { 15 | video := &model.Video{ 16 | Info: &model.VideoInfo{ 17 | ID: "testid", 18 | Title: "", 19 | Description: "", 20 | DatePublished: time.Time{}, 21 | Uploader: "", 22 | Duration: 0, 23 | }, 24 | Files: nil, 25 | Captions: nil, 26 | } 27 | SetVideoDetail(video) 28 | v, err := GetVideoDetail("texstid") 29 | 30 | rdb.Set("a","a",0) 31 | 32 | fmt.Println(v, err) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /db/sqldb/comments.go: -------------------------------------------------------------------------------- 1 | package sqldb 2 | 3 | import ( 4 | "fmt" 5 | "github.com/treant5612/ytvc-web/model" 6 | "time" 7 | ) 8 | 9 | func InsertComment(comment *model.Comment) (err error) { 10 | comment.Time = time.Now() 11 | return db.Create(comment).Error 12 | } 13 | 14 | func ListComment(pageNo int, pageSize int) (comments []*model.Comment, err error) { 15 | if pageNo < 1 || pageSize < 1 { 16 | return nil, fmt.Errorf("invalid parameter:pageNo=%d,pageSize=%d", pageNo, pageSize) 17 | } 18 | offset := (pageNo - 1) * pageSize 19 | err = db.Order("time desc"). 20 | Offset(offset). 21 | Limit(pageSize). 22 | Find(&comments).Error 23 | return 24 | } 25 | 26 | func DeleteComment(comment *model.Comment) (err error) { 27 | if comment.ID == 0 { 28 | return 29 | } 30 | return db.Delete(comment).Error 31 | } 32 | 33 | func FindCommentById(id int) (comment *model.Comment, err error) { 34 | comment = new(model.Comment) 35 | err = db.First(comment, id).Error 36 | return 37 | } 38 | -------------------------------------------------------------------------------- /db/sqldb/comments_test.go: -------------------------------------------------------------------------------- 1 | package sqldb 2 | 3 | import ( 4 | "github.com/jinzhu/gorm" 5 | "github.com/treant5612/ytvc-web/model" 6 | "os" 7 | "strconv" 8 | "strings" 9 | "testing" 10 | ) 11 | 12 | func InitTestDb() { 13 | os.Remove("test.db") 14 | InitSqlite("test.db") 15 | } 16 | 17 | func TestInsertComment(t *testing.T) { 18 | InitTestDb() 19 | comment := &model.Comment{ 20 | Content: "test comment3", 21 | NickName: "pal", 22 | Addr: "127.0.0.1", 23 | } 24 | err := InsertComment(comment) 25 | if err != nil { 26 | t.Fatal(err) 27 | } 28 | } 29 | 30 | func TestListComment(t *testing.T) { 31 | InitTestDb() 32 | 33 | for i := 0; i < 100; i++ { 34 | InsertComment(&model.Comment{ 35 | Content: strings.Repeat(strconv.Itoa(i), 10), 36 | NickName: "com" + strconv.Itoa(i+1), 37 | Addr: "addr", 38 | }) 39 | } 40 | 41 | pageNo, pageSize := 1, 10 42 | comments, err := ListComment(pageNo, pageSize) 43 | if err != nil { 44 | t.Fatal(err) 45 | } 46 | if len(comments) != pageSize { 47 | t.Fatal(err) 48 | } 49 | for i, v := range comments { 50 | if v.ID != uint(100-(pageNo-1)*pageSize-i) { 51 | t.Fatalf("wrong id%v,page%d ,pageSize%d",v.ID,pageNo,pageSize) 52 | } 53 | if v.NickName != "com"+strconv.Itoa(int(v.ID)) { 54 | t.Fatal("wrong nickname",v.NickName) 55 | } 56 | } 57 | } 58 | 59 | func TestDeleteComment(t *testing.T) { 60 | InitTestDb() 61 | for i := 0; i < 100; i++ { 62 | InsertComment(&model.Comment{ 63 | Content: strings.Repeat(strconv.Itoa(i), 10), 64 | NickName: "com" + strconv.Itoa(i+1), 65 | Addr: "addr", 66 | }) 67 | } 68 | _,err := FindCommentById(10) 69 | if err!=nil{ 70 | t.Fatal(err) 71 | } 72 | err =DeleteComment(&model.Comment{ID:10}) 73 | if err!=nil{ 74 | t.Fatal("delete record error:",err) 75 | } 76 | _,err = FindCommentById(10) 77 | if err!=gorm.ErrRecordNotFound{ 78 | t.Fatal("find record after deleting",err) 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /db/sqldb/db.go: -------------------------------------------------------------------------------- 1 | package sqldb 2 | 3 | import ( 4 | "github.com/jinzhu/gorm" 5 | _ "github.com/jinzhu/gorm/dialects/sqlite" 6 | "github.com/treant5612/ytvc-web/model" 7 | ) 8 | 9 | var db *gorm.DB 10 | 11 | func InitSqlite(dbPath string) (err error) { 12 | db, err = gorm.Open("sqlite3", dbPath) 13 | db.AutoMigrate(&model.RequestLog{}) 14 | db.AutoMigrate(&model.Comment{}) 15 | return err 16 | } 17 | 18 | func SaveRequestLog(reqLog *model.RequestLog) (err error) { 19 | return db.Save(reqLog).Error 20 | } 21 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/treant5612/ytvc-web 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/PuerkitoBio/goquery v1.5.1 // indirect 7 | github.com/asticode/go-astisub v0.2.0 8 | github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 9 | github.com/gin-gonic/gin v1.5.0 10 | github.com/go-redis/redis v6.15.7+incompatible 11 | github.com/jinzhu/gorm v1.9.12 12 | github.com/onsi/ginkgo v1.12.0 // indirect 13 | github.com/onsi/gomega v1.9.0 // indirect 14 | github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff // indirect 15 | github.com/rylio/ytdl v0.6.2 16 | github.com/treant5612/pornhub-dl v0.0.0-20200217061558-67eeb53f7f7c 17 | github.com/treant5612/y2bcaptions v0.0.0-20200219062827-70ce1df88b99 18 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d 19 | golang.org/x/text v0.3.2 20 | google.golang.org/api v0.17.0 21 | gopkg.in/sourcemap.v1 v1.0.5 // indirect 22 | ) 23 | 24 | replace github.com/rylio/ytdl v0.6.2 => github.com/treant5612/ytdl v0.6.3-0.20200214091400-8424bbb14de5 25 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | "github.com/go-redis/redis" 6 | "github.com/treant5612/ytvc-web/controller" 7 | "github.com/treant5612/ytvc-web/db/redisdb" 8 | "github.com/treant5612/ytvc-web/db/sqldb" 9 | "github.com/treant5612/ytvc-web/middleware" 10 | "github.com/treant5612/ytvc-web/service" 11 | "github.com/fvbock/endless" 12 | "log" 13 | ) 14 | 15 | func main() { 16 | prepare() 17 | gin.SetMode(gin.ReleaseMode) 18 | router := gin.Default() 19 | router.Use(middleware.Logger()) 20 | router.LoadHTMLGlob("templates/*") 21 | y2b := router 22 | { 23 | y2b.Static("/resources", "./resources") 24 | y2b.StaticFile("/favicon.ico", "./resources/favicon.ico") 25 | y2b.StaticFile("/intro", "./templates/intro.html") 26 | y2b.GET("/", controller.Index) 27 | y2b.GET("/index.html", controller.Index) 28 | 29 | y2b.GET("/video",middleware.AccessControl(), controller.Video) 30 | y2b.GET("/video/:id", controller.VideoDownload) 31 | y2b.GET("/caption/:id", controller.CaptionDownload) 32 | 33 | y2b.GET("/guestbook", controller.GuestBookPage) 34 | y2b.POST("/guestbook", controller.GuestBookComment) 35 | } 36 | endless.ListenAndServe(":8080",router) 37 | } 38 | 39 | func prepare() { 40 | log.SetFlags(log.Lshortfile | log.Ltime) 41 | //youtubeapi.InitServiceFSC("client_secret.json", "youtubeForceSslToken.json") 42 | redisdb.Init(&redis.Options{Addr: ":6379"}) 43 | sqldb.InitSqlite("./sql.db") 44 | service.SetDownloadPath("/dev/shm") 45 | 46 | } 47 | -------------------------------------------------------------------------------- /manager/youtubeapi/oauth2.go: -------------------------------------------------------------------------------- 1 | /* 2 | most code of this file is from google youtube api samples 3 | */ 4 | package youtubeapi 5 | 6 | import ( 7 | "context" 8 | "encoding/json" 9 | "fmt" 10 | "golang.org/x/oauth2" 11 | "golang.org/x/oauth2/google" 12 | "io/ioutil" 13 | "log" 14 | "net/http" 15 | "os" 16 | ) 17 | 18 | func getClient(scope, clientSecretFile, tokenFile string) *http.Client { 19 | b, err := ioutil.ReadFile(clientSecretFile) 20 | if err != nil { 21 | log.Fatalf("Unable to read client secret file: %v", err) 22 | } 23 | config, err := google.ConfigFromJSON(b, scope) 24 | if err != nil { 25 | log.Fatalf("Unable to parse client secret file to config: %v", err) 26 | } 27 | 28 | tok, err := tokenFromFile(tokenFile) 29 | if err != nil { 30 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 31 | tok, err = getTokenFromPrompt(config, authURL) 32 | saveToken(tokenFile, tok) 33 | 34 | } 35 | return config.Client(context.TODO(), tok) 36 | } 37 | 38 | func tokenFromFile(file string) (*oauth2.Token, error) { 39 | f, err := os.Open(file) 40 | if err != nil { 41 | return nil, err 42 | } 43 | t := &oauth2.Token{} 44 | err = json.NewDecoder(f).Decode(t) 45 | defer f.Close() 46 | return t, err 47 | } 48 | 49 | func getTokenFromPrompt(config *oauth2.Config, authURL string) (*oauth2.Token, error) { 50 | var code string 51 | fmt.Printf("Go to the following link in your browser. After completing "+ 52 | "the authorization flow, enter the authorization code on the command "+ 53 | "line: \n%v\n", authURL) 54 | 55 | if _, err := fmt.Scan(&code); err != nil { 56 | log.Fatalf("Unable to read authorization code %v", err) 57 | } 58 | fmt.Println(authURL) 59 | return exchangeToken(config, code) 60 | } 61 | 62 | func exchangeToken(config *oauth2.Config, code string) (*oauth2.Token, error) { 63 | tok, err := config.Exchange(context.TODO(), code) 64 | if err != nil { 65 | log.Fatalf("Unable to retrieve token %v", err) 66 | } 67 | return tok, nil 68 | } 69 | 70 | // saveToken uses a file path to create a file and store the 71 | // token in it. 72 | func saveToken(file string, token *oauth2.Token) { 73 | fmt.Println("trying to save token") 74 | fmt.Printf("Saving credential file to: %s\n", file) 75 | f, err := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 76 | if err != nil { 77 | log.Fatalf("Unable to cache oauth token: %v", err) 78 | } 79 | defer f.Close() 80 | json.NewEncoder(f).Encode(token) 81 | } 82 | -------------------------------------------------------------------------------- /manager/youtubeapi/service.go: -------------------------------------------------------------------------------- 1 | package youtubeapi 2 | 3 | import ( 4 | "context" 5 | "google.golang.org/api/option" 6 | "google.golang.org/api/youtube/v3" 7 | ) 8 | 9 | var ServiceFSC *youtube.Service 10 | 11 | func InitServiceFSC(clientSecretFile, tokenFile string) (err error) { 12 | client := getClient(youtube.YoutubeForceSslScope, clientSecretFile, tokenFile) 13 | ServiceFSC, err = youtube.NewService(context.TODO(), option.WithHTTPClient(client)) 14 | return err 15 | } 16 | -------------------------------------------------------------------------------- /middleware/middleware.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | "github.com/treant5612/ytvc-web/db/sqldb" 6 | "github.com/treant5612/ytvc-web/model" 7 | "time" 8 | ) 9 | 10 | func Logger() gin.HandlerFunc { 11 | return func(c *gin.Context) { 12 | reqTime := time.Now() 13 | c.Next() 14 | reqLog := &model.RequestLog{ 15 | RemoteAddr: c.ClientIP(), 16 | RequestUrl: c.Request.RequestURI, 17 | RequestMethod: c.Request.Method, 18 | RequestTime: reqTime, 19 | RequestDuration: time.Since(reqTime), 20 | ResponseSize: c.Writer.Size(), 21 | ResponseStatus: c.Writer.Status(), 22 | Referer: c.GetHeader("REFERER"), 23 | } 24 | sqldb.SaveRequestLog(reqLog) 25 | } 26 | } 27 | 28 | var limit_per_min = 10 29 | 30 | func AccessControl() gin.HandlerFunc { 31 | ch := make(chan struct{}, limit_per_min) 32 | go func() { 33 | ticker := time.Tick(time.Minute / time.Duration(limit_per_min)) 34 | for { 35 | select { 36 | case ch <- struct{}{}: 37 | default: 38 | } 39 | <-ticker 40 | } 41 | }() 42 | 43 | return func(c *gin.Context) { 44 | select { 45 | case <-ch: 46 | c.Next() 47 | default: 48 | c.Abort() 49 | c.JSON(429, gin.H{ 50 | "error": "Too Many Requests", 51 | }) 52 | 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /model/comments.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type Comment struct { 8 | ID uint `gorm:"primary_key"` 9 | Content string `gorm:"size:1024` //内容 10 | NickName string //昵称 11 | Addr string 12 | 13 | Time time.Time 14 | DeletedAt *time.Time `gorm:"index:id_deleted"` 15 | } 16 | -------------------------------------------------------------------------------- /model/logs.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type RequestLog struct { 8 | ID uint `gorm:"primary_key"` 9 | RemoteAddr string 10 | RequestUrl string 11 | RequestMethod string 12 | 13 | RequestTime time.Time 14 | RequestDuration time.Duration 15 | 16 | ResponseStatus int 17 | ResponseSize int 18 | 19 | Referer string 20 | } 21 | -------------------------------------------------------------------------------- /model/videos.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import ( 4 | "github.com/treant5612/y2bcaptions" 5 | "time" 6 | ) 7 | 8 | type Video struct { 9 | Info *VideoInfo `json:"info"` 10 | Files []*FileInfo `json:"files"` 11 | Captions *y2bcaptions.Captions `json:"captions"` 12 | //Captions []*youtube.Caption `json:"captions"` 13 | } 14 | 15 | type VideoInfo struct { 16 | ID string `json:"id"` // ID 17 | Title string `json:"title"` //标题 18 | Description string `json:"description"` //描述 19 | DatePublished time.Time `json:"datePublished"` //发表日期 20 | Uploader string `json:"uploader"` //上传者 21 | Duration time.Duration `json:"duration"` //时长 22 | ThumbnailUrl string 23 | //Captions *y2bcaptions.Captions 24 | Kind string `json:"kind"` //类型 25 | } 26 | 27 | type FileInfo struct { 28 | Number int `json:"number"` 29 | Extension string `json:"extension"` //格式 30 | Resolution string `json:"resolution"` //解析度 31 | VideoEncoding string `json:"videoEncoding"` 32 | AudioEncoding string `json:"audioEncoding"` 33 | AudioBitrate int `json:"audioBitrate"` 34 | FPS int `json:"fps"` // FPS are frames per second 35 | Url string `json:"url"` //视频下载地址 36 | Size int64 `json:"size"` //视频大小 37 | } 38 | -------------------------------------------------------------------------------- /resources/css/guestbook/guestbook.css: -------------------------------------------------------------------------------- 1 | .body { 2 | background-color: #f8f8f8; 3 | } 4 | 5 | .icon { 6 | padding: 10px; 7 | font-size: xx-large; 8 | color: #1E9FFF; 9 | } 10 | 11 | .main { 12 | margin-top: 44px; 13 | padding-left: 18px; 14 | padding-right: 18px; 15 | margin-left: 8%; 16 | margin-right: auto; 17 | } 18 | 19 | 20 | select { 21 | height: 24px; 22 | border-width: 1px; 23 | border-style: solid; 24 | background-color: #fff; 25 | border-radius: 2px; 26 | width: 62%; 27 | } 28 | 29 | .layui-input-block { 30 | margin-left: 0; 31 | } 32 | 33 | .name-input { 34 | margin-left: 20px; 35 | width: 166px; 36 | } 37 | 38 | .inline-block { 39 | display: inline-block; 40 | } 41 | 42 | .left { 43 | float: left; 44 | } 45 | 46 | .right { 47 | float: right; 48 | } 49 | 50 | .name { 51 | margin-left: 20px; 52 | } 53 | 54 | .text { 55 | padding-left: 10px; 56 | paddiing-right: 10px; 57 | line-height: 22px; 58 | color: #333; 59 | border-radius: 5px; 60 | } 61 | 62 | .tit { 63 | margin-bottom: 18px; 64 | } 65 | 66 | .date { 67 | float: right; 68 | margin-right: 10px; 69 | } 70 | 71 | .text { 72 | padding-left: 0; 73 | line-height: 22px; 74 | color: #333; 75 | border-width: 0 0 2px 0; 76 | border-style: solid; 77 | border-color: #dddddd; 78 | 79 | } 80 | 81 | .comment { 82 | margin-top: 20px; 83 | margin-bottom: 20px; 84 | } 85 | 86 | .comment-block { 87 | margin: 5px 5px 20px 5px; 88 | padding-bottom: 24px; 89 | } 90 | 91 | .comment-info { 92 | font-size: small; 93 | } -------------------------------------------------------------------------------- /resources/css/index/index.css: -------------------------------------------------------------------------------- 1 | .body { 2 | background-color: #f8f8f8; 3 | } 4 | 5 | 6 | .icon { 7 | padding: 10px; 8 | font-size: xx-large; 9 | color: #1E9FFF; 10 | } 11 | 12 | .main { 13 | margin-top: 44px; 14 | padding-left: 18px; 15 | padding-right: 18px; 16 | margin-left: 8%; 17 | margin-right: auto; 18 | } 19 | 20 | .url-input { 21 | display: inline-block; 22 | width: calc(100% - 200px); 23 | max-width: 596px; 24 | margin-right: 16px; 25 | font-size: 14px; 26 | padding-left: 7px; 27 | padding-right: 7px; 28 | border: 1px solid #abadb3; 29 | border-radius: 4px; 30 | } 31 | 32 | .video-info { 33 | margin-top: 20px; 34 | } 35 | 36 | .info-title { 37 | color: #777777; 38 | } 39 | 40 | select { 41 | height:24px; 42 | border-width: 1px; 43 | border-style: solid; 44 | background-color: #fff; 45 | border-radius: 2px; 46 | width: 62%; 47 | } -------------------------------------------------------------------------------- /resources/css/intro/intro.css: -------------------------------------------------------------------------------- 1 | html { 2 | overflow-x: initial !important 3 | } 4 | 5 | :root { 6 | --bg-color: #fff; 7 | --text-color: #333; 8 | --select-text-bg-color: #b5d6fc; 9 | --select-text-font-color: auto; 10 | --monospace: "Lucida Console", Consolas, "Courier", monospace 11 | } 12 | 13 | html { 14 | font-size: 14px; 15 | background-color: var(--bg-color); 16 | color: var(--text-color); 17 | font-family: Helvetica Neue, Helvetica, Arial, sans-serif; 18 | -webkit-font-smoothing: antialiased 19 | } 20 | 21 | body { 22 | margin: 0; 23 | padding: 0; 24 | height: auto; 25 | bottom: 0; 26 | top: 0; 27 | left: 0; 28 | right: 0; 29 | font-size: 1rem; 30 | line-height: 1.42857; 31 | overflow-x: hidden; 32 | background: inherit; 33 | tab-size: 4 34 | } 35 | 36 | iframe { 37 | margin: auto 38 | } 39 | 40 | a.url { 41 | word-break: break-all 42 | } 43 | 44 | a:active, a:hover { 45 | outline: 0 46 | } 47 | 48 | #write { 49 | margin: 0 auto; 50 | height: auto; 51 | width: inherit; 52 | word-break: normal; 53 | overflow-wrap: break-word; 54 | position: relative; 55 | white-space: normal; 56 | overflow-x: visible; 57 | padding-top: 40px 58 | } 59 | 60 | #write.first-line-indent p { 61 | text-indent: 2em 62 | } 63 | 64 | #write.first-line-indent li p, #write.first-line-indent p * { 65 | text-indent: 0 66 | } 67 | 68 | #write.first-line-indent li { 69 | margin-left: 2em 70 | } 71 | 72 | .for-image #write { 73 | padding-left: 8px; 74 | padding-right: 8px 75 | } 76 | 77 | body.typora-export { 78 | padding-left: 30px; 79 | padding-right: 30px 80 | } 81 | 82 | @media screen and (max-width: 500px) { 83 | body.typora-export { 84 | padding-left: 0; 85 | padding-right: 0 86 | } 87 | 88 | #write { 89 | padding-left: 20px; 90 | padding-right: 20px 91 | } 92 | 93 | } 94 | 95 | #write li > figure:last-child { 96 | margin-bottom: .5rem 97 | } 98 | 99 | #write ol, #write ul { 100 | position: relative 101 | } 102 | 103 | img { 104 | max-width: 100%; 105 | vertical-align: middle 106 | } 107 | 108 | button, input, select, textarea { 109 | color: inherit; 110 | font: inherit 111 | } 112 | 113 | input[type=checkbox], input[type=radio] { 114 | line-height: normal; 115 | padding: 0 116 | } 117 | 118 | *, :after, :before { 119 | box-sizing: border-box 120 | } 121 | 122 | #write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p, #write pre { 123 | width: inherit 124 | } 125 | 126 | #write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p { 127 | position: relative 128 | } 129 | 130 | p { 131 | line-height: inherit 132 | } 133 | 134 | h1, h2, h3, h4, h5, h6 { 135 | break-after: avoid-page; 136 | break-inside: avoid; 137 | orphans: 2 138 | } 139 | 140 | p { 141 | orphans: 4 142 | } 143 | 144 | h1 { 145 | font-size: 2rem 146 | } 147 | 148 | h2 { 149 | font-size: 1.8rem 150 | } 151 | 152 | h3 { 153 | font-size: 1.6rem 154 | } 155 | 156 | h4 { 157 | font-size: 1.4rem 158 | } 159 | 160 | h5 { 161 | font-size: 1.2rem 162 | } 163 | 164 | h6 { 165 | font-size: 1rem 166 | } 167 | 168 | a { 169 | cursor: pointer 170 | } 171 | 172 | sup.md-footnote a, sup.md-footnote a:hover { 173 | color: inherit; 174 | text-transform: inherit; 175 | text-decoration: inherit 176 | } 177 | 178 | #write input[type=checkbox] { 179 | cursor: pointer; 180 | width: inherit; 181 | height: inherit 182 | } 183 | 184 | figure { 185 | overflow-x: auto; 186 | margin: 1.2em 0; 187 | max-width: calc(100% + 1pc); 188 | padding: 0 189 | } 190 | 191 | figure > table { 192 | margin: 0 !important 193 | } 194 | 195 | tr { 196 | break-inside: avoid; 197 | break-after: auto 198 | } 199 | 200 | thead { 201 | display: table-header-group 202 | } 203 | 204 | table { 205 | border-collapse: collapse; 206 | border-spacing: 0; 207 | width: 100%; 208 | overflow: auto; 209 | break-inside: auto; 210 | text-align: left 211 | } 212 | 213 | table.md-table td { 214 | min-width: 2pc 215 | } 216 | 217 | .CodeMirror pre { 218 | padding: 0 4px 219 | } 220 | 221 | 222 | #write pre { 223 | white-space: pre-wrap 224 | } 225 | 226 | #write.fences-no-line-wrapping pre { 227 | white-space: pre 228 | } 229 | 230 | li div { 231 | padding-top: 0 232 | } 233 | 234 | blockquote { 235 | margin: 1rem 0 236 | } 237 | 238 | li { 239 | margin: 0; 240 | position: relative 241 | } 242 | 243 | blockquote > :last-child { 244 | margin-bottom: 0 245 | } 246 | 247 | blockquote > :first-child, li > :first-child { 248 | margin-top: 0 249 | } 250 | 251 | @media print { 252 | body, html { 253 | border: 1px solid transparent; 254 | height: 99%; 255 | break-after: avoid; 256 | break-before: avoid 257 | } 258 | 259 | #write { 260 | margin-top: 0; 261 | padding-top: 0; 262 | border-color: transparent !important 263 | } 264 | 265 | .typora-export * { 266 | -webkit-print-color-adjust: exact 267 | } 268 | 269 | html.blink-to-pdf { 270 | font-size: 13px 271 | } 272 | 273 | .typora-export #write { 274 | padding-left: 2pc; 275 | padding-right: 2pc; 276 | padding-bottom: 0; 277 | break-after: avoid 278 | } 279 | 280 | .typora-export #write:after { 281 | height: 0 282 | } 283 | } 284 | 285 | a img, img a { 286 | cursor: pointer 287 | } 288 | 289 | p > .md-image:only-child:not(.md-img-error) img, p > img:only-child { 290 | display: block; 291 | margin: auto 292 | } 293 | 294 | [contenteditable=true]:active, [contenteditable=true]:focus { 295 | outline: 0; 296 | box-shadow: none 297 | } 298 | 299 | .md-task-list-item > input { 300 | position: absolute; 301 | top: 0; 302 | left: 0; 303 | margin-left: -1.2em; 304 | margin-top: calc(1em - 10px); 305 | border: none 306 | } 307 | 308 | .md-toc-item a { 309 | text-decoration: none 310 | } 311 | 312 | .footnote-line a:not(.reversefootnote) { 313 | color: inherit 314 | } 315 | 316 | code, pre, samp, tt { 317 | font-family: var(--monospace) 318 | } 319 | 320 | kbd { 321 | margin: 0 .1em; 322 | padding: .1em .6em; 323 | font-size: .8em; 324 | color: #242729; 325 | background: #fff; 326 | border: 1px solid #adb3b9; 327 | border-radius: 3px; 328 | box-shadow: rgba(12, 13, 14, .2) 0 1px 0, #fff 0 0 0 2px inset; 329 | white-space: nowrap; 330 | vertical-align: middle 331 | } 332 | 333 | code { 334 | text-align: left; 335 | vertical-align: initial 336 | } 337 | 338 | .MathJax_SVG * { 339 | transition: none 0s ease 0s 340 | } 341 | 342 | .MathJax_SVG_Display svg { 343 | vertical-align: middle !important; 344 | margin-bottom: 0 !important; 345 | margin-top: 0 !important 346 | } 347 | 348 | .md-diagram-panel > svg { 349 | max-width: 100% 350 | } 351 | 352 | [lang=flow] svg, [lang=mermaid] svg { 353 | max-width: 100%; 354 | height: auto 355 | } 356 | 357 | [lang=mermaid] .node text { 358 | font-size: 1rem 359 | } 360 | 361 | table tr th { 362 | border-bottom: 0 363 | } 364 | 365 | video { 366 | display: block; 367 | margin: 0 auto 368 | } 369 | 370 | iframe, video { 371 | max-width: 100% 372 | } 373 | 374 | iframe { 375 | width: 100%; 376 | border: none 377 | } 378 | 379 | .highlight td, .highlight tr { 380 | border: 0 381 | } 382 | 383 | mark { 384 | background: #ff0; 385 | color: #000 386 | } 387 | 388 | :root { 389 | --side-bar-bg-color: #fafafa; 390 | --control-text-color: #777 391 | } 392 | 393 | @include-when-export url(https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext); html { 394 | font-size: 1pc 395 | } 396 | 397 | body { 398 | font-family: Open Sans, Clear Sans, Helvetica Neue, Helvetica, Arial, sans-serif; 399 | color: #333; 400 | line-height: 1.6 401 | } 402 | 403 | #write { 404 | max-width: 860px; 405 | margin: 0 auto; 406 | padding: 30px; 407 | padding-bottom: 75pt 408 | } 409 | 410 | #write > ol:first-child, #write > ul:first-child { 411 | margin-top: 30px 412 | } 413 | 414 | a { 415 | color: #4183c4 416 | } 417 | 418 | h1, h2, h3, h4, h5, h6 { 419 | position: relative; 420 | margin-top: 1rem; 421 | margin-bottom: 1rem; 422 | font-weight: 700; 423 | line-height: 1.4; 424 | cursor: text 425 | } 426 | 427 | h1 code, h1 tt, h2 code, h2 tt, h3 code, h3 tt, h4 code, h4 tt, h5 code, h5 tt, h6 code, h6 tt { 428 | font-size: inherit 429 | } 430 | 431 | h1 { 432 | font-size: 2.25em; 433 | line-height: 1.2 434 | } 435 | 436 | h1, h2 { 437 | padding-bottom: .3em; 438 | border-bottom: 1px solid #eee 439 | } 440 | 441 | h2 { 442 | font-size: 1.75em; 443 | line-height: 1.225 444 | } 445 | 446 | h3 { 447 | font-size: 1.5em; 448 | line-height: 1.43 449 | } 450 | 451 | h4 { 452 | font-size: 1.25em 453 | } 454 | 455 | h5, h6 { 456 | font-size: 1em 457 | } 458 | 459 | h6 { 460 | color: #777 461 | } 462 | 463 | blockquote, dl, ol, p, table, ul { 464 | margin: .8em 0 465 | } 466 | 467 | li > ol, li > ul { 468 | margin: 0 469 | } 470 | 471 | hr { 472 | height: 2px; 473 | padding: 0; 474 | margin: 1pc 0; 475 | background-color: #e7e7e7; 476 | border: 0 none; 477 | overflow: hidden; 478 | box-sizing: content-box 479 | } 480 | 481 | ol, ul { 482 | padding-left: 30px 483 | } 484 | 485 | ol:first-child, ul:first-child { 486 | margin-top: 0 487 | } 488 | 489 | ol:last-child, ul:last-child { 490 | margin-bottom: 0 491 | } 492 | 493 | blockquote { 494 | border-left: 4px solid #dfe2e5; 495 | padding: 0 15px; 496 | color: #777 497 | } 498 | 499 | blockquote blockquote { 500 | padding-right: 0 501 | } 502 | 503 | table { 504 | padding: 0; 505 | word-break: initial 506 | } 507 | 508 | table tr { 509 | border-top: 1px solid #dfe2e5; 510 | margin: 0; 511 | padding: 0 512 | } 513 | 514 | table tr:nth-child(2n), thead { 515 | background-color: #f8f8f8 516 | } 517 | 518 | table tr th { 519 | font-weight: 700; 520 | border-bottom: 0 521 | } 522 | 523 | table tr td, table tr th { 524 | border: 1px solid #dfe2e5; 525 | margin: 0; 526 | padding: 6px 13px 527 | } 528 | 529 | table tr td:first-child, table tr th:first-child { 530 | margin-top: 0 531 | } 532 | 533 | table tr td:last-child, table tr th:last-child { 534 | margin-bottom: 0 535 | } 536 | 537 | code { 538 | background-color: #f3f4f4; 539 | padding: 0 2px 540 | } 541 | 542 | .md-task-list-item > input { 543 | margin-left: -1.3em 544 | } 545 | 546 | @media print { 547 | html { 548 | font-size: 13px 549 | } 550 | 551 | pre, table { 552 | page-break-inside: avoid 553 | } 554 | 555 | pre { 556 | word-wrap: break-word 557 | } 558 | } 559 | 560 | .on-focus-mode blockquote { 561 | border-left-color: rgba(85, 85, 85, .12) 562 | } 563 | -------------------------------------------------------------------------------- /resources/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/favicon.ico -------------------------------------------------------------------------------- /resources/img/screenshot.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/img/screenshot.PNG -------------------------------------------------------------------------------- /resources/js/common/util.js: -------------------------------------------------------------------------------- 1 | /* 2 | fileSize --human 3 | */ 4 | function prettySize(bytes, separator = '', postFix = '') { 5 | if (bytes) { 6 | const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; 7 | const i = Math.min(parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10), sizes.length - 1); 8 | return `${(bytes / (1024 ** i)).toFixed(i ? 1 : 0)}${separator}${sizes[i]}${postFix}`; 9 | } 10 | return 'n/a'; 11 | } 12 | 13 | /* 14 | 将time.Duration 格式化为人类友好的格式 15 | */ 16 | function simpleDuration(duration, type) { 17 | if (type === 's') { 18 | duration = duration * 1000 19 | } 20 | let days = '', hours = '', minutes = '', seconds = '' 21 | let day = 24 * 60 * 60 * 1000, 22 | hour = 60 * 60 * 1000, 23 | minute = 60 * 1000, 24 | second = 1000 25 | if (duration >= day) { 26 | days = Math.floor(duration / day) + '天' 27 | hours = Math.floor(duration % day / hour) + '小时' 28 | } else if (duration >= hour && duration < day) { 29 | hours = Math.floor(duration / hour) + '小时' 30 | minutes = Math.floor(duration % hour / minute) + '分钟' 31 | } else if (duration > minute && duration < hour) { 32 | minutes = Math.floor(duration / minute) + '分钟' 33 | seconds = Math.floor(duration % minute / second) + '秒' 34 | } else if (duration < minute) { 35 | seconds = Math.floor(duration / second) + '秒' 36 | } 37 | return days + hours + minutes + seconds 38 | } 39 | 40 | /* 41 | 为date原型增加format方法 42 | */ 43 | Date.prototype.format = function (fmt) { 44 | let o = { 45 | "M+": this.getMonth() + 1, //月份 46 | "d+": this.getDate(), //日 47 | "h+": this.getHours(), //小时 48 | "m+": this.getMinutes(), //分 49 | "s+": this.getSeconds(), //秒 50 | "q+": Math.floor((this.getMonth() + 3) / 3), //季度 51 | "S": this.getMilliseconds() //毫秒 52 | }; 53 | if (/(y+)/.test(fmt)) { 54 | fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); 55 | } 56 | for (let k in o) { 57 | if (new RegExp("(" + k + ")").test(fmt)) { 58 | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); 59 | } 60 | } 61 | return fmt; 62 | } 63 | 64 | 65 | /* 66 | 下载文件 67 | */ 68 | function fDownload(url, filename) { 69 | var eleLink = document.createElement('a'); 70 | eleLink.download = filename; 71 | eleLink.style.display = 'none'; 72 | eleLink.href = url; 73 | document.body.appendChild(eleLink); 74 | eleLink.click(); 75 | document.body.removeChild(eleLink); 76 | } -------------------------------------------------------------------------------- /resources/js/guestbook/guestbook.js: -------------------------------------------------------------------------------- 1 | const $ = layui.$ 2 | 3 | $(function () { 4 | $("#comment_btn").on("click", function () { 5 | nickname = $("#nickname").val() 6 | comment = $("#comment_content").val() 7 | $.ajax({ 8 | method: "POST", 9 | url: "/guestbook", 10 | data: { 11 | nickname: nickname, 12 | comment: comment 13 | }, 14 | success: commentSucc, 15 | error: commentErr, 16 | }) 17 | }) 18 | }) 19 | 20 | function commentSucc() { 21 | window.location.reload() 22 | } 23 | 24 | function commentErr() { 25 | layer.msg("评论失败", {icon: 2}) 26 | 27 | } -------------------------------------------------------------------------------- /resources/js/index/index.js: -------------------------------------------------------------------------------- 1 | const $ = layui.$ 2 | $(function () { 3 | $("#fetch_btn").on("click", function () { 4 | window.loadingFrame = layer.load(2, {shade: 0.3}) 5 | $.ajax({ 6 | url: "/video", 7 | type: "GET", 8 | data: { 9 | "url": $("#target_url").val() 10 | }, 11 | complete: function () { 12 | }, 13 | success: fetchSucc, 14 | error: fetchErr, 15 | 16 | }) 17 | }); 18 | }); 19 | 20 | function fetchSucc(result, status, xhr) { 21 | layer.close(window.loadingFrame) 22 | 23 | fillVideoInfo(result.data.info) 24 | listCaptions(result.data.captions) 25 | listFiles(result.data.files, result.data.info.id) 26 | showDetails() 27 | 28 | } 29 | 30 | function fetchErr(xhr, status, error) { 31 | layer.close(window.loadingFrame) 32 | layer.msg("视频信息获取失败:" + error, {icon: 2}) 33 | } 34 | 35 | function showDetails() { 36 | $("#details").show() 37 | } 38 | 39 | function fillVideoInfo(info) { 40 | $("#videoTitle").text(cutString(info.title)) 41 | $("#videoId").text(info.id) 42 | $("#videoKind").text(info.kind) 43 | // $("#videoDescription").html(info.description); 44 | $("#videoUploader").text(info.uploader) 45 | $("#videoThumbnail").attr("src", info.ThumbnailUrl) 46 | $("#videoDuration").text(simpleDuration(info.duration / 10e5)) 47 | $("#thumbnailUrl").attr("href", `http://img.youtube.com/vi/${info.id}/maxresdefault.jpg`) 48 | } 49 | 50 | function listFiles(files, vid) { 51 | $("#fileList .file-row").remove() 52 | if (files == null || files.length == 0) { 53 | $("#fileList").append(`
暂无该视频相关文件信息
`) 54 | return 55 | } 56 | files.forEach(function (f) { 57 | $("#fileList").append(createFileRow(f, vid)) 58 | }) 59 | } 60 | 61 | function createFileRow(f, vid) { 62 | let v = f.videoEncoding != "" ? f.videoEncoding : "-" 63 | let a = f.audioEncoding != "" ? f.audioEncoding : "-" 64 | let resolution = f.resolution != "" ? f.resolution : "-" 65 | let encoding = v + " / " + a 66 | let size = prettySize(f.size) 67 | let title = $("#videoTitle").text() 68 | let kind = $("#videoKind").text() 69 | let link = "#" 70 | if (kind == "youtube") { 71 | link = f.url 72 | } 73 | let temp = `
74 |
${f.extension}
75 |
${resolution}
76 |
${encoding}
77 |
${size}
78 |
链接
79 |
下载
80 |
81 |
82 | ` 83 | return temp 84 | } 85 | 86 | function listCaptions(captions) { 87 | $("#captionList .caption-row").remove() 88 | 89 | if (captions == null || captions.CaptionTrack.length == 0) { 90 | $("#captionList").append(`
暂无该视频相关字幕信息
`) 91 | return 92 | } 93 | captions.CaptionTrack.forEach(function (c, i, arr) { 94 | $("#captionList").append(createCaptionRow(c, i, arr)) 95 | }) 96 | } 97 | 98 | function createCaptionRow(track, i, arr) { 99 | let lang = track.Name 100 | let trackKind = cTrackKind(track.kind) 101 | 102 | let lastUpdated = "" //= new Date(c.snippet.lastUpdated).format("yyyy-MM-dd") 103 | let captionId = track.vssId 104 | let secondaryOptions = createSecondaryOptions(track, i, arr) 105 | let temp = `
106 | 107 |
${lang}
108 |
${trackKind}
109 |
110 | 111 |
112 |
113 | 机翻中文 114 |
115 |
116 | 下载 117 |
118 |
119 |
120 | ` 121 | return temp 122 | } 123 | 124 | function createSecondaryOptions(track, i, arr) { 125 | let tmp = ` 126 | ` 127 | for (j = 0; j < arr.length; j++) { 128 | if (j == i) { 129 | continue 130 | } 131 | tmp += `` 132 | } 133 | return tmp 134 | } 135 | 136 | 137 | function downloadCaption(i) { 138 | let videoId = $("#videoId").text() 139 | let captionId = $(`#caption_${i}`).val() 140 | let title = encodeURIComponent($("#videoTitle").text()) 141 | let url = `./caption/${videoId}?fname=${title}&vssid=${captionId}` 142 | if ($(`#trans_${i}`).is(":checked")) { 143 | url += "&tlang=zh" 144 | } 145 | let secondary = $(`#cap_select_${i}`).val() 146 | if (secondary != "") { 147 | url += `&secondary=${secondary}` 148 | if (secondary == captionId) { 149 | url += "&secondary_tlang=zh" 150 | } 151 | } 152 | fDownload(url) 153 | } 154 | 155 | 156 | function cTrackKind(k) { 157 | switch (k) { 158 | case "asr": 159 | return "自动生成" 160 | case "ASR": 161 | return "自动生成" 162 | default: 163 | return "标准" 164 | } 165 | } 166 | 167 | function cutString(s) { 168 | if (s.length < 64) { 169 | return s 170 | } 171 | return s.substr(0, 64) + "..." 172 | } -------------------------------------------------------------------------------- /resources/layui/css/layui.mobile.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | blockquote,body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,legend,li,ol,p,td,textarea,th,ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}html{font:12px 'Helvetica Neue','PingFang SC',STHeitiSC-Light,Helvetica,Arial,sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0)}a{text-decoration:none;background:0 0}a:active,a:hover{outline:0}table{border-collapse:collapse;border-spacing:0}li{list-style:none}b,strong{font-weight:700}h1,h2,h3,h4,h5,h6{font-weight:500}address,cite,dfn,em,var{font-style:normal}dfn{font-style:italic}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}img{border:0;vertical-align:bottom}.layui-inline,input,label{vertical-align:middle}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;outline:0}button,select{text-transform:none}select{-webkit-appearance:none;border:none}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}@font-face{font-family:layui-icon;src:url(../font/iconfont.eot?v=1.0.7);src:url(../font/iconfont.eot?v=1.0.7#iefix) format('embedded-opentype'),url(../font/iconfont.woff?v=1.0.7) format('woff'),url(../font/iconfont.ttf?v=1.0.7) format('truetype'),url(../font/iconfont.svg?v=1.0.7#iconfont) format('svg')}.layui-icon{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-box,.layui-box *{-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important;box-sizing:content-box!important}.layui-border-box,.layui-border-box *{-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important}.layui-inline{position:relative;display:inline-block;*display:inline;*zoom:1}.layui-edge,.layui-upload-iframe{position:absolute;width:0;height:0}.layui-edge{border-style:dashed;border-color:transparent;overflow:hidden}.layui-elip{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-unselect{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-disabled,.layui-disabled:active{background-color:#d2d2d2!important;color:#fff!important;cursor:not-allowed!important}.layui-circle{border-radius:100%}.layui-show{display:block!important}.layui-hide{display:none!important}.layui-upload-iframe{border:0;visibility:hidden}.layui-upload-enter{border:1px solid #009E94;background-color:#009E94;color:#fff;-webkit-transform:scale(1.1);transform:scale(1.1)}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}@-webkit-keyframes layui-m-anim-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes layui-m-anim-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}.layui-m-anim-left{-webkit-animation-name:layui-m-anim-left;animation-name:layui-m-anim-left}@-webkit-keyframes layui-m-anim-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes layui-m-anim-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}.layui-m-anim-right{-webkit-animation-name:layui-m-anim-right;animation-name:layui-m-anim-right}@-webkit-keyframes layui-m-anim-lout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}@keyframes layui-m-anim-lout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}.layui-m-anim-lout{-webkit-animation-name:layui-m-anim-lout;animation-name:layui-m-anim-lout}@-webkit-keyframes layui-m-anim-rout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(100%);transform:translateX(100%)}}@keyframes layui-m-anim-rout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(100%);transform:translateX(100%)}}.layui-m-anim-rout{-webkit-animation-name:layui-m-anim-rout;animation-name:layui-m-anim-rout}.layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} -------------------------------------------------------------------------------- /resources/layui/css/modules/code.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none} -------------------------------------------------------------------------------- /resources/layui/css/modules/laydate/default/laydate.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | .laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} -------------------------------------------------------------------------------- /resources/layui/css/modules/layer/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/css/modules/layer/default/icon-ext.png -------------------------------------------------------------------------------- /resources/layui/css/modules/layer/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/css/modules/layer/default/icon.png -------------------------------------------------------------------------------- /resources/layui/css/modules/layer/default/layer.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | .layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{text-overflow:ellipsis;white-space:nowrap}html #layuicss-layer{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{-webkit-overflow-scrolling:touch;top:150px;left:0;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;border-radius:2px;box-shadow:1px 1px 50px rgba(0,0,0,.3)}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #B2B2B2;border:1px solid rgba(0,0,0,.1);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-load{background:url(loading-1.gif) center center no-repeat #eee}.layui-layer-ico{background:url(icon.png) no-repeat}.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-move{display:none;position:fixed;*position:absolute;left:0;top:0;width:100%;height:100%;cursor:move;opacity:0;filter:alpha(opacity=0);background-color:#fff;z-index:2147483647}.layui-layer-resize{position:absolute;width:15px;height:15px;right:0;bottom:0;cursor:se-resize}.layer-anim{-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}@-webkit-keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-00{-webkit-animation-name:layer-bounceIn;animation-name:layer-bounceIn}@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layui-layer-title{padding:0 80px 0 20px;height:42px;line-height:42px;border-bottom:1px solid #eee;font-size:14px;color:#333;overflow:hidden;background-color:#F8F8F8;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:15px;font-size:0;line-height:initial}.layui-layer-setwin a{position:relative;width:16px;height:16px;margin-left:10px;font-size:12px;_overflow:hidden}.layui-layer-setwin .layui-layer-min cite{position:absolute;width:14px;height:2px;left:0;top:50%;margin-top:-1px;background-color:#2E2D3C;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA}.layui-layer-setwin .layui-layer-max{background-position:-32px -40px}.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px}.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px}.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px}.layui-layer-setwin .layui-layer-close1{background-position:1px -40px;cursor:pointer}.layui-layer-setwin .layui-layer-close1:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;width:30px;height:30px;margin-left:0;background-position:-149px -31px;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{background-position:-180px -31px}.layui-layer-btn{text-align:right;padding:0 15px 12px;pointer-events:auto;user-select:none;-webkit-user-select:none}.layui-layer-btn a{height:28px;line-height:28px;margin:5px 5px 0;padding:0 15px;border:1px solid #dedede;background-color:#fff;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.8}.layui-layer-btn .layui-layer-btn0{border-color:#1E9FFF;background-color:#1E9FFF;color:#fff}.layui-layer-btn-l{text-align:left}.layui-layer-btn-c{text-align:center}.layui-layer-dialog{min-width:260px}.layui-layer-dialog .layui-layer-content{position:relative;padding:20px;line-height:24px;word-break:break-all;overflow:hidden;font-size:14px;overflow-x:hidden;overflow-y:auto}.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute;top:16px;left:15px;_left:-40px;width:30px;height:30px}.layui-layer-ico1{background-position:-30px 0}.layui-layer-ico2{background-position:-60px 0}.layui-layer-ico3{background-position:-90px 0}.layui-layer-ico4{background-position:-120px 0}.layui-layer-ico5{background-position:-150px 0}.layui-layer-ico6{background-position:-180px 0}.layui-layer-rim{border:6px solid #8D8D8D;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #D3D4D3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-content{padding:12px 25px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:20px 20px 20px 55px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:60px;height:24px;background:url(loading-0.gif) no-repeat}.layui-layer-loading .layui-layer-loading1{width:37px;height:37px;background:url(loading-1.gif) no-repeat}.layui-layer-ico16,.layui-layer-loading .layui-layer-loading2{width:32px;height:32px;background:url(loading-2.gif) no-repeat}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:8px 15px;font-size:12px;_float:left;border-radius:2px;box-shadow:1px 1px 3px rgba(0,0,0,.2);background-color:#000;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#000}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:5px;border-bottom-style:solid;border-bottom-color:#000}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan[type=dialog]{min-width:280px}.layui-layer-lan .layui-layer-title{background:#4476A7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:5px 10px 10px;text-align:right;border-top:1px solid #E9E7E7}.layui-layer-lan .layui-layer-btn a{background:#fff;border-color:#E9E7E7;color:#333}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95;border-color:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1}.layui-layer-iconext{background:url(icon-ext.png) no-repeat}.layui-layer-prompt .layui-layer-input{display:block;width:230px;height:36px;margin:0 auto;line-height:30px;padding-left:10px;border:1px solid #e6e6e6;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px;padding:6px 10px}.layui-layer-prompt .layui-layer-content{padding:20px}.layui-layer-prompt .layui-layer-btn{padding-top:0}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;overflow:hidden;cursor:pointer}.layui-layer-tab .layui-layer-title span.layui-this{height:43px;border-left:1px solid #eee;border-right:1px solid #eee;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.layui-this{display:block}.layui-layer-photos{-webkit-animation-duration:.8s;animation-duration:.8s}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal}@-webkit-keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-close{-webkit-animation-name:layer-bounceOut;animation-name:layer-bounceOut;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (max-width:1100px){.layui-layer-iframe{overflow-y:auto;-webkit-overflow-scrolling:touch}} -------------------------------------------------------------------------------- /resources/layui/css/modules/layer/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/css/modules/layer/default/loading-0.gif -------------------------------------------------------------------------------- /resources/layui/css/modules/layer/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/css/modules/layer/default/loading-1.gif -------------------------------------------------------------------------------- /resources/layui/css/modules/layer/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/css/modules/layer/default/loading-2.gif -------------------------------------------------------------------------------- /resources/layui/font/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/font/iconfont.eot -------------------------------------------------------------------------------- /resources/layui/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/font/iconfont.ttf -------------------------------------------------------------------------------- /resources/layui/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/font/iconfont.woff -------------------------------------------------------------------------------- /resources/layui/font/iconfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/font/iconfont.woff2 -------------------------------------------------------------------------------- /resources/layui/images/face/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/0.gif -------------------------------------------------------------------------------- /resources/layui/images/face/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/1.gif -------------------------------------------------------------------------------- /resources/layui/images/face/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/10.gif -------------------------------------------------------------------------------- /resources/layui/images/face/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/11.gif -------------------------------------------------------------------------------- /resources/layui/images/face/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/12.gif -------------------------------------------------------------------------------- /resources/layui/images/face/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/13.gif -------------------------------------------------------------------------------- /resources/layui/images/face/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/14.gif -------------------------------------------------------------------------------- /resources/layui/images/face/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/15.gif -------------------------------------------------------------------------------- /resources/layui/images/face/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/16.gif -------------------------------------------------------------------------------- /resources/layui/images/face/17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/17.gif -------------------------------------------------------------------------------- /resources/layui/images/face/18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/18.gif -------------------------------------------------------------------------------- /resources/layui/images/face/19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/19.gif -------------------------------------------------------------------------------- /resources/layui/images/face/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/2.gif -------------------------------------------------------------------------------- /resources/layui/images/face/20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/20.gif -------------------------------------------------------------------------------- /resources/layui/images/face/21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/21.gif -------------------------------------------------------------------------------- /resources/layui/images/face/22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/22.gif -------------------------------------------------------------------------------- /resources/layui/images/face/23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/23.gif -------------------------------------------------------------------------------- /resources/layui/images/face/24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/24.gif -------------------------------------------------------------------------------- /resources/layui/images/face/25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/25.gif -------------------------------------------------------------------------------- /resources/layui/images/face/26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/26.gif -------------------------------------------------------------------------------- /resources/layui/images/face/27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/27.gif -------------------------------------------------------------------------------- /resources/layui/images/face/28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/28.gif -------------------------------------------------------------------------------- /resources/layui/images/face/29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/29.gif -------------------------------------------------------------------------------- /resources/layui/images/face/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/3.gif -------------------------------------------------------------------------------- /resources/layui/images/face/30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/30.gif -------------------------------------------------------------------------------- /resources/layui/images/face/31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/31.gif -------------------------------------------------------------------------------- /resources/layui/images/face/32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/32.gif -------------------------------------------------------------------------------- /resources/layui/images/face/33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/33.gif -------------------------------------------------------------------------------- /resources/layui/images/face/34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/34.gif -------------------------------------------------------------------------------- /resources/layui/images/face/35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/35.gif -------------------------------------------------------------------------------- /resources/layui/images/face/36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/36.gif -------------------------------------------------------------------------------- /resources/layui/images/face/37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/37.gif -------------------------------------------------------------------------------- /resources/layui/images/face/38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/38.gif -------------------------------------------------------------------------------- /resources/layui/images/face/39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/39.gif -------------------------------------------------------------------------------- /resources/layui/images/face/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/4.gif -------------------------------------------------------------------------------- /resources/layui/images/face/40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/40.gif -------------------------------------------------------------------------------- /resources/layui/images/face/41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/41.gif -------------------------------------------------------------------------------- /resources/layui/images/face/42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/42.gif -------------------------------------------------------------------------------- /resources/layui/images/face/43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/43.gif -------------------------------------------------------------------------------- /resources/layui/images/face/44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/44.gif -------------------------------------------------------------------------------- /resources/layui/images/face/45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/45.gif -------------------------------------------------------------------------------- /resources/layui/images/face/46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/46.gif -------------------------------------------------------------------------------- /resources/layui/images/face/47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/47.gif -------------------------------------------------------------------------------- /resources/layui/images/face/48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/48.gif -------------------------------------------------------------------------------- /resources/layui/images/face/49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/49.gif -------------------------------------------------------------------------------- /resources/layui/images/face/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/5.gif -------------------------------------------------------------------------------- /resources/layui/images/face/50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/50.gif -------------------------------------------------------------------------------- /resources/layui/images/face/51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/51.gif -------------------------------------------------------------------------------- /resources/layui/images/face/52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/52.gif -------------------------------------------------------------------------------- /resources/layui/images/face/53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/53.gif -------------------------------------------------------------------------------- /resources/layui/images/face/54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/54.gif -------------------------------------------------------------------------------- /resources/layui/images/face/55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/55.gif -------------------------------------------------------------------------------- /resources/layui/images/face/56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/56.gif -------------------------------------------------------------------------------- /resources/layui/images/face/57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/57.gif -------------------------------------------------------------------------------- /resources/layui/images/face/58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/58.gif -------------------------------------------------------------------------------- /resources/layui/images/face/59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/59.gif -------------------------------------------------------------------------------- /resources/layui/images/face/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/6.gif -------------------------------------------------------------------------------- /resources/layui/images/face/60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/60.gif -------------------------------------------------------------------------------- /resources/layui/images/face/61.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/61.gif -------------------------------------------------------------------------------- /resources/layui/images/face/62.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/62.gif -------------------------------------------------------------------------------- /resources/layui/images/face/63.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/63.gif -------------------------------------------------------------------------------- /resources/layui/images/face/64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/64.gif -------------------------------------------------------------------------------- /resources/layui/images/face/65.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/65.gif -------------------------------------------------------------------------------- /resources/layui/images/face/66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/66.gif -------------------------------------------------------------------------------- /resources/layui/images/face/67.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/67.gif -------------------------------------------------------------------------------- /resources/layui/images/face/68.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/68.gif -------------------------------------------------------------------------------- /resources/layui/images/face/69.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/69.gif -------------------------------------------------------------------------------- /resources/layui/images/face/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/7.gif -------------------------------------------------------------------------------- /resources/layui/images/face/70.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/70.gif -------------------------------------------------------------------------------- /resources/layui/images/face/71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/71.gif -------------------------------------------------------------------------------- /resources/layui/images/face/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/8.gif -------------------------------------------------------------------------------- /resources/layui/images/face/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/treant5612/ytvc-web/34674f195441e633c3b6d877e37c78ecf57b4a6f/resources/layui/images/face/9.gif -------------------------------------------------------------------------------- /resources/layui/lay/modules/carousel.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a/g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
  1. '+o.replace(/[\r\t\n]+/g,"
  2. ")+"
"),c.find(">.layui-code-h3")[0]||c.prepend('

'+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); -------------------------------------------------------------------------------- /resources/layui/lay/modules/colorpicker.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var i=layui.jquery,o={config:{},index:layui.colorpicker?layui.colorpicker.index+1e4:0,set:function(e){var o=this;return o.config=i.extend({},o.config,e),o},on:function(e,i){return layui.onevent.call(this,"colorpicker",e,i)}},r=function(){var e=this,i=e.config;return{config:i}},t="colorpicker",n="layui-show",l="layui-colorpicker",c=".layui-colorpicker-main",a="layui-icon-down",s="layui-icon-close",f="layui-colorpicker-trigger-span",d="layui-colorpicker-trigger-i",u="layui-colorpicker-side",p="layui-colorpicker-side-slider",g="layui-colorpicker-basis",v="layui-colorpicker-alpha-bgcolor",h="layui-colorpicker-alpha-slider",m="layui-colorpicker-basis-cursor",b="layui-colorpicker-main-input",k=function(e){var i={h:0,s:0,b:0},o=Math.min(e.r,e.g,e.b),r=Math.max(e.r,e.g,e.b),t=r-o;return i.b=r,i.s=0!=r?255*t/r:0,0!=i.s?e.r==r?i.h=(e.g-e.b)/t:e.g==r?i.h=2+(e.b-e.r)/t:i.h=4+(e.r-e.g)/t:i.h=-1,r==o&&(i.h=0),i.h*=60,i.h<0&&(i.h+=360),i.s*=100/255,i.b*=100/255,i},y=function(e){var e=e.indexOf("#")>-1?e.substring(1):e;if(3==e.length){var i=e.split("");e=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]}e=parseInt(e,16);var o={r:e>>16,g:(65280&e)>>8,b:255&e};return k(o)},x=function(e){var i={},o=e.h,r=255*e.s/100,t=255*e.b/100;if(0==r)i.r=i.g=i.b=t;else{var n=t,l=(255-r)*t/255,c=(n-l)*(o%60)/60;360==o&&(o=0),o<60?(i.r=n,i.b=l,i.g=l+c):o<120?(i.g=n,i.b=l,i.r=n-c):o<180?(i.g=n,i.r=l,i.b=l+c):o<240?(i.b=n,i.r=l,i.g=n-c):o<300?(i.b=n,i.g=l,i.r=l+c):o<360?(i.r=n,i.g=l,i.b=n-c):(i.r=0,i.g=0,i.b=0)}return{r:Math.round(i.r),g:Math.round(i.g),b:Math.round(i.b)}},C=function(e){var o=x(e),r=[o.r.toString(16),o.g.toString(16),o.b.toString(16)];return i.each(r,function(e,i){1==i.length&&(r[e]="0"+i)}),r.join("")},P=function(e){var i=/[0-9]{1,3}/g,o=e.match(i)||[];return{r:o[0],g:o[1],b:o[2]}},B=i(window),w=i(document),D=function(e){var r=this;r.index=++o.index,r.config=i.extend({},r.config,o.config,e),r.render()};D.prototype.config={color:"",size:null,alpha:!1,format:"hex",predefine:!1,colors:["#009688","#5FB878","#1E9FFF","#FF5722","#FFB800","#01AAED","#999","#c00","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgb(0, 186, 189)","rgb(255, 120, 0)","rgb(250, 212, 0)","#393D49","rgba(0,0,0,.5)","rgba(255, 69, 0, 0.68)","rgba(144, 240, 144, 0.5)","rgba(31, 147, 255, 0.73)"]},D.prototype.render=function(){var e=this,o=e.config,r=i(['
',"",'3&&(o.alpha&&"rgb"==o.format||(e="#"+C(k(P(o.color))))),"background: "+e):e}()+'">','',"","","
"].join("")),t=i(o.elem);o.size&&r.addClass("layui-colorpicker-"+o.size),t.addClass("layui-inline").html(e.elemColorBox=r),e.color=e.elemColorBox.find("."+f)[0].style.background,e.events()},D.prototype.renderPicker=function(){var e=this,o=e.config,r=e.elemColorBox[0],t=e.elemPicker=i(['
','
','
','
','
','
',"
",'
','
',"
","
",'
','
','
',"
","
",function(){if(o.predefine){var e=['
'];return layui.each(o.colors,function(i,o){e.push(['
','
',"
"].join(""))}),e.push("
"),e.join("")}return""}(),'
','
','',"
",'
','','',"","
"].join(""));e.elemColorBox.find("."+f)[0];i(c)[0]&&i(c).data("index")==e.index?e.removePicker(D.thisElemInd):(e.removePicker(D.thisElemInd),i("body").append(t)),D.thisElemInd=e.index,D.thisColor=r.style.background,e.position(),e.pickerEvents()},D.prototype.removePicker=function(e){var o=this;o.config;return i("#layui-colorpicker"+(e||o.index)).remove(),o},D.prototype.position=function(){var e=this,i=e.config,o=e.bindElem||e.elemColorBox[0],r=e.elemPicker[0],t=o.getBoundingClientRect(),n=r.offsetWidth,l=r.offsetHeight,c=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},a=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},s=5,f=t.left,d=t.bottom;f-=(n-o.offsetWidth)/2,d+=s,f+n+s>a("width")?f=a("width")-n-s:fa()&&(d=t.top>l?t.top-l:a()-l,d-=2*s),i.position&&(r.style.position=i.position),r.style.left=f+("fixed"===i.position?0:c(1))+"px",r.style.top=d+("fixed"===i.position?0:c())+"px"},D.prototype.val=function(){var e=this,i=(e.config,e.elemColorBox.find("."+f)),o=e.elemPicker.find("."+b),r=i[0],t=r.style.backgroundColor;if(t){var n=k(P(t)),l=i.attr("lay-type");if(e.select(n.h,n.s,n.b),"torgb"===l&&o.find("input").val(t),"rgba"===l){var c=P(t);if(3==(t.match(/[0-9]{1,3}/g)||[]).length)o.find("input").val("rgba("+c.r+", "+c.g+", "+c.b+", 1)"),e.elemPicker.find("."+h).css("left",280);else{o.find("input").val(t);var a=280*t.slice(t.lastIndexOf(",")+1,t.length-1);e.elemPicker.find("."+h).css("left",a)}e.elemPicker.find("."+v)[0].style.background="linear-gradient(to right, rgba("+c.r+", "+c.g+", "+c.b+", 0), rgb("+c.r+", "+c.g+", "+c.b+"))"}}else e.select(0,100,100),o.find("input").val(""),e.elemPicker.find("."+v)[0].style.background="",e.elemPicker.find("."+h).css("left",280)},D.prototype.side=function(){var e=this,o=e.config,r=e.elemColorBox.find("."+f),t=r.attr("lay-type"),n=e.elemPicker.find("."+u),l=e.elemPicker.find("."+p),c=e.elemPicker.find("."+g),y=e.elemPicker.find("."+m),C=e.elemPicker.find("."+v),w=e.elemPicker.find("."+h),D=l[0].offsetTop/180*360,E=100-(y[0].offsetTop+3)/180*100,H=(y[0].offsetLeft+3)/260*100,W=Math.round(w[0].offsetLeft/280*100)/100,j=e.elemColorBox.find("."+d),F=e.elemPicker.find(".layui-colorpicker-pre").children("div"),L=function(i,n,l,c){e.select(i,n,l);var f=x({h:i,s:n,b:l});if(j.addClass(a).removeClass(s),r[0].style.background="rgb("+f.r+", "+f.g+", "+f.b+")","torgb"===t&&e.elemPicker.find("."+b).find("input").val("rgb("+f.r+", "+f.g+", "+f.b+")"),"rgba"===t){var d=0;d=280*c,w.css("left",d),e.elemPicker.find("."+b).find("input").val("rgba("+f.r+", "+f.g+", "+f.b+", "+c+")"),r[0].style.background="rgba("+f.r+", "+f.g+", "+f.b+", "+c+")",C[0].style.background="linear-gradient(to right, rgba("+f.r+", "+f.g+", "+f.b+", 0), rgb("+f.r+", "+f.g+", "+f.b+"))"}o.change&&o.change(e.elemPicker.find("."+b).find("input").val())},M=i(['
t&&(r=t);var l=r/180*360;D=l,L(l,H,E,W),e.preventDefault()};Y(r),e.preventDefault()}),n.on("click",function(e){var o=e.clientY-i(this).offset().top;o<0&&(o=0),o>this.offsetHeight&&(o=this.offsetHeight);var r=o/180*360;D=r,L(r,H,E,W),e.preventDefault()}),y.on("mousedown",function(e){var i=this.offsetTop,o=this.offsetLeft,r=e.clientY,t=e.clientX,n=function(e){var n=i+(e.clientY-r),l=o+(e.clientX-t),a=c[0].offsetHeight-3,s=c[0].offsetWidth-3;n<-3&&(n=-3),n>a&&(n=a),l<-3&&(l=-3),l>s&&(l=s);var f=(l+3)/260*100,d=100-(n+3)/180*100;E=d,H=f,L(D,f,d,W),e.preventDefault()};layui.stope(e),Y(n),e.preventDefault()}),c.on("mousedown",function(e){var o=e.clientY-i(this).offset().top-3+B.scrollTop(),r=e.clientX-i(this).offset().left-3+B.scrollLeft();o<-3&&(o=-3),o>this.offsetHeight-3&&(o=this.offsetHeight-3),r<-3&&(r=-3),r>this.offsetWidth-3&&(r=this.offsetWidth-3);var t=(r+3)/260*100,n=100-(o+3)/180*100;E=n,H=t,L(D,t,n,W),e.preventDefault(),y.trigger(e,"mousedown")}),w.on("mousedown",function(e){var i=this.offsetLeft,o=e.clientX,r=function(e){var r=i+(e.clientX-o),t=C[0].offsetWidth;r<0&&(r=0),r>t&&(r=t);var n=Math.round(r/280*100)/100;W=n,L(D,H,E,n),e.preventDefault()};Y(r),e.preventDefault()}),C.on("click",function(e){var o=e.clientX-i(this).offset().left;o<0&&(o=0),o>this.offsetWidth&&(o=this.offsetWidth);var r=Math.round(o/280*100)/100;W=r,L(D,H,E,r),e.preventDefault()}),F.each(function(){i(this).on("click",function(){i(this).parent(".layui-colorpicker-pre").addClass("selected").siblings().removeClass("selected");var e,o=this.style.backgroundColor,r=k(P(o)),t=o.slice(o.lastIndexOf(",")+1,o.length-1);D=r.h,H=r.s,E=r.b,3==(o.match(/[0-9]{1,3}/g)||[]).length&&(t=1),W=t,e=280*t,L(r.h,r.s,r.b,t)})})},D.prototype.select=function(e,i,o,r){var t=this,n=(t.config,C({h:e,s:100,b:100})),l=C({h:e,s:i,b:o}),c=e/360*180,a=180-o/100*180-3,s=i/100*260-3;t.elemPicker.find("."+p).css("top",c),t.elemPicker.find("."+g)[0].style.background="#"+n,t.elemPicker.find("."+m).css({top:a,left:s}),"change"!==r&&t.elemPicker.find("."+b).find("input").val("#"+l)},D.prototype.pickerEvents=function(){var e=this,o=e.config,r=e.elemColorBox.find("."+f),t=e.elemPicker.find("."+b+" input"),n={clear:function(i){r[0].style.background="",e.elemColorBox.find("."+d).removeClass(a).addClass(s),e.color="",o.done&&o.done(""),e.removePicker()},confirm:function(i,n){var l=t.val(),c=l,f={};if(l.indexOf(",")>-1){if(f=k(P(l)),e.select(f.h,f.s,f.b),r[0].style.background=c="#"+C(f),(l.match(/[0-9]{1,3}/g)||[]).length>3&&"rgba"===r.attr("lay-type")){var u=280*l.slice(l.lastIndexOf(",")+1,l.length-1);e.elemPicker.find("."+h).css("left",u),r[0].style.background=l,c=l}}else f=y(l),r[0].style.background=c="#"+C(f),e.elemColorBox.find("."+d).removeClass(s).addClass(a);return"change"===n?(e.select(f.h,f.s,f.b,n),void(o.change&&o.change(c))):(e.color=l,o.done&&o.done(l),void e.removePicker())}};e.elemPicker.on("click","*[colorpicker-events]",function(){var e=i(this),o=e.attr("colorpicker-events");n[o]&&n[o].call(this,e)}),t.on("keyup",function(e){var o=i(this);n.confirm.call(this,o,13===e.keyCode?null:"change")})},D.prototype.events=function(){var e=this,o=e.config,r=e.elemColorBox.find("."+f);e.elemColorBox.on("click",function(){e.renderPicker(),i(c)[0]&&(e.val(),e.side())}),o.elem[0]&&!e.elemColorBox[0].eventHandler&&(w.on("click",function(o){if(!i(o.target).hasClass(l)&&!i(o.target).parents("."+l)[0]&&!i(o.target).hasClass(c.replace(/\./g,""))&&!i(o.target).parents(c)[0]&&e.elemPicker){if(e.color){var t=k(P(e.color));e.select(t.h,t.s,t.b)}else e.elemColorBox.find("."+d).removeClass(a).addClass(s);r[0].style.background=e.color||"",e.removePicker()}}),B.on("resize",function(){return!(!e.elemPicker||!i(c)[0])&&void e.position()}),e.elemColorBox[0].eventHandler=!0)},o.render=function(e){var i=new D(e);return r.call(i)},e(t,o)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/element.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(t){"use strict";var a=layui.$,i=(layui.hint(),layui.device()),e="element",l="layui-this",n="layui-show",s=function(){this.config={}};s.prototype.set=function(t){var i=this;return a.extend(!0,i.config,t),i},s.prototype.on=function(t,a){return layui.onevent.call(this,e,t,a)},s.prototype.tabAdd=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.children(".layui-tab-bar"),o=l.children(".layui-tab-content"),r='
  • "+(i.title||"unnaming")+"
  • ";return s[0]?s.before(r):n.append(r),o.append('
    '+(i.content||"")+"
    "),f.hideTabMore(!0),f.tabAuto(),this},s.prototype.tabDelete=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabDelete(null,s),this},s.prototype.tabChange=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabClick.call(s[0],null,null,s),this},s.prototype.tab=function(t){t=t||{},b.on("click",t.headerElem,function(i){var e=a(this).index();f.tabClick.call(this,i,e,null,t)})},s.prototype.progress=function(t,i){var e="layui-progress",l=a("."+e+"[lay-filter="+t+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",i),s.text(i),this};var o=".layui-nav",r="layui-nav-item",c="layui-nav-bar",u="layui-nav-tree",d="layui-nav-child",y="layui-nav-more",h="layui-anim layui-anim-upbit",f={tabClick:function(t,i,s,o){o=o||{};var r=s||a(this),i=i||r.parent().children("li").index(r),c=o.headerElem?r.parent():r.parents(".layui-tab").eq(0),u=o.bodyElem?a(o.bodyElem):c.children(".layui-tab-content").children(".layui-tab-item"),d=r.find("a"),y=c.attr("lay-filter");"javascript:;"!==d.attr("href")&&"_blank"===d.attr("target")||(r.addClass(l).siblings().removeClass(l),u.eq(i).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+y+")",{elem:c,index:i})},tabDelete:function(t,i){var n=i||a(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),r=o.children(".layui-tab-content").children(".layui-tab-item"),c=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?f.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&f.tabClick.call(n.prev()[0],null,s-1)),n.remove(),r.eq(s).remove(),setTimeout(function(){f.tabAuto()},50),layui.event.call(this,e,"tabDelete("+c+")",{elem:o,index:s})},tabAuto:function(){var t="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;a(".layui-tab").each(function(){var s=a(this),o=s.children(".layui-tab-title"),r=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),c=a('');if(n===window&&8!=i.ie&&f.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var t=a(this);if(!t.find("."+l)[0]){var i=a('');i.on("click",f.tabDelete),t.append(i)}}),"string"!=typeof s.attr("lay-unauto"))if(o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(c),s.attr("overflow",""),c.on("click",function(a){o[this.title?"removeClass":"addClass"](t),this.title=this.title?"":"收缩"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(t){var i=a(".layui-tab-title");t!==!0&&"tabmore"===a(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=a(this),i=t.parents(o),n=i.attr("lay-filter"),s=t.parent(),c=t.siblings("."+d),y="string"==typeof s.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||y||c[0]||(i.find("."+l).removeClass(l),s.addClass(l)),i.hasClass(u)&&(c.removeClass(h),c[0]&&(s["none"===c.css("display")?"addClass":"removeClass"](r+"ed"),"all"===i.attr("lay-shrink")&&s.siblings().removeClass(r+"ed"))),layui.event.call(this,e,"nav("+n+")",t)},collapse:function(){var t=a(this),i=t.find(".layui-colla-icon"),l=t.siblings(".layui-colla-content"),s=t.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),r="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var c=s.children(".layui-colla-item").children("."+n);c.siblings(".layui-colla-title").children(".layui-colla-icon").html(""),c.removeClass(n)}l[r?"addClass":"removeClass"](n),i.html(r?"":""),layui.event.call(this,e,"collapse("+o+")",{title:t,content:l,show:r})}};s.prototype.init=function(t,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){f.tabAuto.call({})},nav:function(){var t=200,e={},s={},p={},b=function(l,o,r){var c=a(this),f=c.find("."+d);o.hasClass(u)?l.css({top:c.position().top,height:c.children("a").outerHeight(),opacity:1}):(f.addClass(h),l.css({left:c.position().left+parseFloat(c.css("marginLeft")),top:c.position().top+c.height()-l.height()}),e[r]=setTimeout(function(){l.css({width:c.width(),opacity:1})},i.ie&&i.ie<10?0:t),clearTimeout(p[r]),"block"===f.css("display")&&clearTimeout(s[r]),s[r]=setTimeout(function(){f.addClass(n),c.find("."+y).addClass(y+"d")},300))};a(o+l).each(function(i){var l=a(this),o=a(''),h=l.find("."+r);l.find("."+c)[0]||(l.append(o),h.on("mouseenter",function(){b.call(this,o,l,i)}).on("mouseleave",function(){l.hasClass(u)||(clearTimeout(s[i]),s[i]=setTimeout(function(){l.find("."+d).removeClass(n),l.find("."+y).removeClass(y+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[i]),p[i]=setTimeout(function(){l.hasClass(u)?o.css({height:0,top:o.position().top+o.height()/2,opacity:0}):o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},t)})),h.find("a").each(function(){var t=a(this),i=(t.parent(),t.siblings("."+d));i[0]&&!t.children("."+y)[0]&&t.append(''),t.off("click",f.clickThis).on("click",f.clickThis)})})},breadcrumb:function(){var t=".layui-breadcrumb";a(t+l).each(function(){var t=a(this),i="lay-separator",e=t.attr(i)||"/",l=t.find("a");l.next("span["+i+"]")[0]||(l.each(function(t){t!==l.length-1&&a(this).after(""+e+"")}),t.css("visibility","visible"))})},progress:function(){var t="layui-progress";a("."+t+l).each(function(){var i=a(this),e=i.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),i.attr("lay-showPercent")&&setTimeout(function(){e.html(''+l+"")},350)})},collapse:function(){var t="layui-collapse";a("."+t+l).each(function(){var t=a(this).find(".layui-colla-item");t.each(function(){var t=a(this),i=t.find(".layui-colla-title"),e=t.find(".layui-colla-content"),l="none"===e.css("display");i.find(".layui-colla-icon").remove(),i.append(''+(l?"":"")+""),i.off("click",f.collapse).on("click",f.collapse)})})}};return s[t]?s[t]():layui.each(s,function(t,a){a()})},s.prototype.render=s.prototype.init;var p=new s,b=a(document);p.render();var v=".layui-tab-title li";b.on("click",v,f.tabClick),b.on("click",f.hideTabMore),a(window).on("resize",f.tabAuto),t(e,p)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/flow.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),!i&&f.width()&&(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/form.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",s="layui-this",o="layui-hide",c="layui-disabled",u=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:function(e){if(!e||isNaN(e))return"只能填写数字"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};u.prototype.set=function(e){var i=this;return t.extend(!0,i.config,e),i},u.prototype.verify=function(e){var i=this;return t.extend(!0,i.config.verify,e),i},u.prototype.on=function(e,t){return layui.onevent.call(this,l,e,t)},u.prototype.val=function(e,i){var a=this,n=t(r+'[lay-filter="'+e+'"]');return n.each(function(e,a){var n=t(this);layui.each(i,function(e,t){var i,a=n.find('[name="'+e+'"]');a[0]&&(i=a[0].type,"checkbox"===i?a[0].checked=t:"radio"===i?a.each(function(){this.value==t&&(this.checked=!0)}):a.val(t))})}),f.render(null,e),a.getValue(e)},u.prototype.getValue=function(e,i){i=i||t(r+'[lay-filter="'+e+'"]').eq(0);var a={},n={},l=i.find("input,select,textarea");return layui.each(l,function(e,t){if(t.name=(t.name||"").replace(/^\s*|\s*&/,""),t.name){if(/^.*\[\]$/.test(t.name)){var i=t.name.match(/^(.*)\[\]$/g)[0];a[i]=0|a[i],t.name=t.name.replace(/^(.*)\[\]$/,"$1["+a[i]++ +"]")}/^checkbox|radio$/.test(t.type)&&!t.checked||(n[t.name]=t.value)}}),n},u.prototype.render=function(e,i){var n=this,u=t(r+function(){return i?'[lay-filter="'+i+'"]':""}()),d={select:function(){var e,i="请选择",a="layui-form-select",n="layui-select-title",r="layui-select-none",d="",f=u.find("select"),v=function(i,l){t(i.target).parent().hasClass(n)&&!l||(t("."+a).removeClass(a+"ed "+a+"up"),e&&d&&e.val(d)),e=null},y=function(i,u,f){var y,p=t(this),m=i.find("."+n),k=m.find("input"),g=i.find("dl"),x=g.children("dd"),b=this.selectedIndex;if(!u){var C=function(){var e=i.offset().top+i.outerHeight()+5-h.scrollTop(),t=g.outerHeight();b=p[0].selectedIndex,i.addClass(a+"ed"),x.removeClass(o),y=null,x.eq(b).addClass(s).siblings().removeClass(s),e+t>h.height()&&e>=t&&i.addClass(a+"up"),T()},w=function(e){i.removeClass(a+"ed "+a+"up"),k.blur(),y=null,e||$(k.val(),function(e){var i=p[0].selectedIndex;e&&(d=t(p[0].options[i]).html(),0===i&&d===k.attr("placeholder")&&(d=""),k.val(d||""))})},T=function(){var e=g.children("dd."+s);if(e[0]){var t=e.position().top,i=g.height(),a=e.height();t>i&&g.scrollTop(t+g.scrollTop()-i+a-5),t<0&&g.scrollTop(t+g.scrollTop()-5)}};m.on("click",function(e){i.hasClass(a+"ed")?w():(v(e,!0),C()),g.find("."+r).remove()}),m.find(".layui-edge").on("click",function(){k.focus()}),k.on("keyup",function(e){var t=e.keyCode;9===t&&C()}).on("keydown",function(e){var t=e.keyCode;9===t&&w();var i=function(t,a){var n,l;e.preventDefault();var r=function(){var e=g.children("dd."+s);if(g.children("dd."+o)[0]&&"next"===t){var i=g.children("dd:not(."+o+",."+c+")"),n=i.eq(0).index();if(n>=0&&n无匹配项

    '):g.find("."+r).remove()},"keyup"),""===t&&g.find("."+r).remove(),void T())};f&&k.on("keyup",q).on("blur",function(i){var a=p[0].selectedIndex;e=k,d=t(p[0].options[a]).html(),0===a&&d===k.attr("placeholder")&&(d=""),setTimeout(function(){$(k.val(),function(e){d||k.val("")},"blur")},200)}),x.on("click",function(){var e=t(this),a=e.attr("lay-value"),n=p.attr("lay-filter");return!e.hasClass(c)&&(e.hasClass("layui-select-tips")?k.val(""):(k.val(e.text()),e.addClass(s)),e.siblings().removeClass(s),p.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:p[0],value:a,othis:i}),w(!0),!1)}),i.find("dl>dt").on("click",function(e){return!1}),t(document).off("click",v).on("click",v)}};f.each(function(e,l){var r=t(this),o=r.next("."+a),u=this.disabled,d=l.value,f=t(l.options[l.selectedIndex]),v=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var h="string"==typeof r.attr("lay-search"),p=v?v.value?i:v.innerHTML||i:i,m=t(['
    ','
    ','','
    ','
    ',function(e){var t=[];return layui.each(e,function(e,a){0!==e||a.value?"optgroup"===a.tagName.toLowerCase()?t.push("
    "+a.label+"
    "):t.push('
    '+a.innerHTML+"
    "):t.push('
    '+(a.innerHTML||i)+"
    ")}),0===t.length&&t.push('
    没有选项
    '),t.join("")}(r.find("*"))+"
    ","
    "].join(""));o[0]&&o.remove(),r.after(m),y.call(this,m,u,h)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},i=u.find("input[type=checkbox]"),a=function(e,i){var a=t(this);e.on("click",function(){var t=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(i[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(i[1]).find("em").text(n[0])),layui.event.call(a[0],l,i[2]+"("+t+")",{elem:a[0],value:a[0].value,othis:e}))})};i.each(function(i,n){var l=t(this),r=l.attr("lay-skin"),s=(l.attr("lay-text")||"").split("|"),o=this.disabled;"switch"===r&&(r="_"+r);var u=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+u[0]),f=t(['
    ",function(){var e=n.title.replace(/\s/g,""),t={checkbox:[e?""+n.title+"":"",''].join(""),_switch:""+((n.checked?s[0]:s[1])||"")+""};return t[r]||t.checkbox}(),"
    "].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,u)})},radio:function(){var e="layui-form-radio",i=["",""],a=u.find("input[type=radio]"),n=function(a){var n=t(this),s="layui-anim-scaleSpring";a.on("click",function(){var o=n[0].name,c=n.parents(r),u=n.attr("lay-filter"),d=c.find("input[name="+o.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=t(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(s).html(i[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(s).html(i[0]),layui.event.call(n[0],l,"radio("+u+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=t(this),s=r.next("."+e),o=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();s[0]&&s.remove();var u=t(['
    ',''+i[l.checked?0:1]+"","
    "+function(){var e=l.title||"";return"string"==typeof r.next().attr("lay-radio")&&(e=r.next().html(),r.next().remove()),e}()+"
    ","
    "].join(""));r.after(u),n.call(this,u)})}};return e?d[e]?d[e]():a.error("不支持的"+e+"表单渲染"):layui.each(d,function(e,t){t()}),n};var d=function(){var e=null,a=f.config.verify,s="layui-form-danger",o={},c=t(this),u=c.parents(r),d=u.find("*[lay-verify]"),v=c.parents("form")[0],h=c.attr("lay-filter");return layui.each(d,function(l,r){var o=t(this),c=o.attr("lay-verify").split("|"),u=o.attr("lay-verType"),d=o.val();if(o.removeClass(s),layui.each(c,function(t,l){var c,f="",v="function"==typeof a[l];if(a[l]){var c=v?f=a[l](d,r):!a[l][0].test(d);if(f=f||a[l][1],"required"===l&&(f=o.attr("lay-reqText")||f),c)return"tips"===u?i.tips(f,function(){return"string"==typeof o.attr("lay-ignore")||"select"!==r.tagName.toLowerCase()&&!/^checkbox|radio$/.test(r.type)?o:o.next()}(),{tips:1}):"alert"===u?i.alert(f,{title:"提示",shadeClose:!0}):i.msg(f,{icon:5,shift:6}),n.android||n.ios||setTimeout(function(){r.focus()},7),o.addClass(s),e=!0}}),e)return e}),!e&&(o=f.getValue(null,u),layui.event.call(this,l,"submit("+h+")",{elem:this,form:v,field:o}))},f=new u,v=t(document),h=t(window);f.render(),v.on("reset",r,function(){var e=t(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),v.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/layedit.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define(["layer","form"],function(t){"use strict";var e=layui.$,i=layui.layer,a=layui.form,l=(layui.hint(),layui.device()),n="layedit",o="layui-show",r="layui-disabled",c=function(){var t=this;t.index=0,t.config={tool:["strong","italic","underline","del","|","left","center","right","|","link","unlink","face","image"],hideTool:[],height:280}};c.prototype.set=function(t){var i=this;return e.extend(!0,i.config,t),i},c.prototype.on=function(t,e){return layui.onevent(n,t,e)},c.prototype.build=function(t,i){i=i||{};var a=this,n=a.config,r="layui-layedit",c=e("string"==typeof t?"#"+t:t),u="LAY_layedit_"+ ++a.index,d=c.next("."+r),y=e.extend({},n,i),f=function(){var t=[],e={};return layui.each(y.hideTool,function(t,i){e[i]=!0}),layui.each(y.tool,function(i,a){C[a]&&!e[a]&&t.push(C[a])}),t.join("")}(),m=e(['
    ','
    '+f+"
    ",'
    ','',"
    ","
    "].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("请暂时用shift+enter"),!1}r.execCommand("formatBlock",!1,"

    ")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

    "),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"上传失败")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"帮助",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["http://www.layui.com/about/layedit/help.html","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

    "),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"超链接",skin:"layui-layer-msg",content:['

      ','
    • ','','
      ','',"
      ","
    • ",'
    • ','','
      ','",'","
      ","
    • ",'
    • ','','',"
    • ","
    "].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[微笑]","[嘻嘻]","[哈哈]","[可爱]","[可怜]","[挖鼻]","[吃惊]","[害羞]","[挤眼]","[闭嘴]","[鄙视]","[爱你]","[泪]","[偷笑]","[亲亲]","[生病]","[太开心]","[白眼]","[右哼哼]","[左哼哼]","[嘘]","[衰]","[委屈]","[吐]","[哈欠]","[抱抱]","[怒]","[疑问]","[馋嘴]","[拜拜]","[思考]","[汗]","[困]","[睡]","[钱]","[失望]","[酷]","[色]","[哼]","[鼓掌]","[晕]","[悲伤]","[抓狂]","[黑线]","[阴险]","[怒骂]","[互粉]","[心]","[伤心]","[猪头]","[熊猫]","[兔子]","[ok]","[耶]","[good]","[NO]","[赞]","[来]","[弱]","[草泥马]","[神马]","[囧]","[浮云]","[给力]","[围观]","[威武]","[奥特曼]","[礼物]","[钟]","[话筒]","[蜡烛]","[蛋糕]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
  • '+e+'
  • ')}),'
      '+t.join("")+"
    "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"插入代码",skin:"layui-layer-msg",content:['
      ','
    • ','','
      ','","
      ","
    • ",'
    • ','','
      ','',"
      ","
    • ",'
    • ','','',"
    • ","
    "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},w=new c;t(n,w)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/laypage.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),refresh:['','',""].join(""),skip:function(){return['到第','','页',""].join("")}()};return['
    ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
    "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/laytpl.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/rate.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var a=layui.jquery,i={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,a){return layui.onevent.call(this,n,e,a)}},l=function(){var e=this,a=e.config;return{setvalue:function(a){e.setvalue.call(e,a)},config:a}},n="rate",t="layui-rate",o="layui-icon-rate",s="layui-icon-rate-solid",u="layui-icon-rate-half",r="layui-icon-rate-solid layui-icon-rate-half",c="layui-icon-rate-solid layui-icon-rate",f="layui-icon-rate layui-icon-rate-half",v=function(e){var l=this;l.index=++i.index,l.config=a.extend({},l.config,i.config,e),l.render()};v.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},v.prototype.render=function(){var e=this,i=e.config,l=i.theme?'style="color: '+i.theme+';"':"";i.elem=a(i.elem),parseInt(i.value)!==i.value&&(i.half||(i.value=Math.ceil(i.value)-i.value<.5?Math.ceil(i.value):Math.floor(i.value)));for(var n='
      ",u=1;u<=i.length;u++){var r='
    • ";i.half&&parseInt(i.value)!==i.value&&u==Math.ceil(i.value)?n=n+'
    • ":n+=r}n+="
    "+(i.text?''+i.value+"星":"")+"";var c=i.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),i.span=e.elemTemp.next("span"),i.setText&&i.setText(i.value),c.html(e.elemTemp),c.addClass("layui-inline"),i.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,i=a.config;i.value=e,a.render()},v.prototype.action=function(){var e=this,i=e.config,l=e.elemTemp,n=l.find("i").width();l.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(i.value=t,i.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(i.value=i.value-.5)}i.text&&l.next("span").text(i.value+"星"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),v.on("mousemove",function(e){if(l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+t+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(u).removeClass(s)}}),v.on("mouseleave",function(){l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+Math.floor(i.value)+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half&&parseInt(i.value)!==i.value&&l.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(u).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},i.render=function(e){var a=new v(e);return l.call(a)},e(n,i)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/slider.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var i=layui.jquery,t={config:{},index:layui.slider?layui.slider.index+1e4:0,set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,n,e,i)}},a=function(){var e=this,i=e.config;return{setValue:function(i,t){return e.slide("set",i,t||0)},config:i}},n="slider",l="layui-disabled",s="layui-slider",r="layui-slider-bar",o="layui-slider-wrap",u="layui-slider-wrap-btn",d="layui-slider-tips",v="layui-slider-input",c="layui-slider-input-txt",m="layui-slider-input-btn",p="layui-slider-hover",f=function(e){var a=this;a.index=++t.index,a.config=i.extend({},a.config,t.config,e),a.render()};f.prototype.config={type:"default",min:0,max:100,value:0,step:1,showstep:!1,tips:!0,input:!1,range:!1,height:200,disabled:!1,theme:"#009688"},f.prototype.render=function(){var e=this,t=e.config;if(t.step<1&&(t.step=1),t.maxt.min?a:t.min,t.value[1]=n>t.min?n:t.min,t.value[0]=t.value[0]>t.max?t.max:t.value[0],t.value[1]=t.value[1]>t.max?t.max:t.value[1];var r=Math.floor((t.value[0]-t.min)/(t.max-t.min)*100),v=Math.floor((t.value[1]-t.min)/(t.max-t.min)*100),m=v-r+"%";r+="%",v+="%"}else{"object"==typeof t.value&&(t.value=Math.min.apply(null,t.value)),t.valuet.max&&(t.value=t.max);var m=Math.floor((t.value-t.min)/(t.max-t.min)*100)+"%"}var p=t.disabled?"#c2c2c2":t.theme,f='
    '+(t.tips?'
    ':"")+'
    '+(t.range?'
    ':"")+"
    ",h=i(t.elem),y=h.next("."+s);if(y[0]&&y.remove(),e.elemTemp=i(f),t.range?(e.elemTemp.find("."+o).eq(0).data("value",t.value[0]),e.elemTemp.find("."+o).eq(1).data("value",t.value[1])):e.elemTemp.find("."+o).data("value",t.value),h.html(e.elemTemp),"vertical"===t.type&&e.elemTemp.height(t.height+"px"),t.showstep){for(var g=(t.max-t.min)/t.step,b="",x=1;x
    ')}e.elemTemp.append(b)}if(t.input&&!t.range){var w=i('
    ');h.css("position","relative"),h.append(w),h.find("."+c).children("input").val(t.value),"vertical"===t.type?w.css({left:0,top:-48}):e.elemTemp.css("margin-right",w.outerWidth()+15)}t.disabled?(e.elemTemp.addClass(l),e.elemTemp.find("."+u).addClass(l)):e.slide(),e.elemTemp.find("."+u).on("mouseover",function(){var a="vertical"===t.type?t.height:e.elemTemp[0].offsetWidth,n=e.elemTemp.find("."+o),l="vertical"===t.type?a-i(this).parent()[0].offsetTop-n.height():i(this).parent()[0].offsetLeft,s=l/a*100,r=i(this).parent().data("value"),u=t.setTips?t.setTips(r):r;e.elemTemp.find("."+d).html(u),"vertical"===t.type?e.elemTemp.find("."+d).css({bottom:s+"%","margin-bottom":"20px",display:"inline-block"}):e.elemTemp.find("."+d).css({left:s+"%",display:"inline-block"})}).on("mouseout",function(){e.elemTemp.find("."+d).css("display","none")})},f.prototype.slide=function(e,t,a){var n=this,l=n.config,s=n.elemTemp,f=function(){return"vertical"===l.type?l.height:s[0].offsetWidth},h=s.find("."+o),y=s.next("."+v),g=y.children("."+c).children("input").val(),b=100/((l.max-l.min)/Math.ceil(l.step)),x=function(e,i){e=Math.ceil(e)*b>100?Math.ceil(e)*b:Math.round(e)*b,e=e>100?100:e,h.eq(i).css("vertical"===l.type?"bottom":"left",e+"%");var t=T(h[0].offsetLeft),a=l.range?T(h[1].offsetLeft):0;"vertical"===l.type?(s.find("."+d).css({bottom:e+"%","margin-bottom":"20px"}),t=T(f()-h[0].offsetTop-h.height()),a=l.range?T(f()-h[1].offsetTop-h.height()):0):s.find("."+d).css("left",e+"%"),t=t>100?100:t,a=a>100?100:a;var n=Math.min(t,a),o=Math.abs(t-a);"vertical"===l.type?s.find("."+r).css({height:o+"%",bottom:n+"%"}):s.find("."+r).css({width:o+"%",left:n+"%"});var u=l.min+Math.round((l.max-l.min)*e/100);if(g=u,y.children("."+c).children("input").val(g),h.eq(i).data("value",u),u=l.setTips?l.setTips(u):u,s.find("."+d).html(u),l.range){var v=[h.eq(0).data("value"),h.eq(1).data("value")];v[0]>v[1]&&v.reverse()}l.change&&l.change(l.range?v:u)},T=function(e){var i=e/f()*100/b,t=Math.round(i)*b;return e==f()&&(t=Math.ceil(i)*b),t},w=i(['
    f()&&(r=f());var o=r/f()*100/b;x(o,e),t.addClass(p),s.find("."+d).show(),i.preventDefault()},o=function(){t.removeClass(p),s.find("."+d).hide()};M(r,o)})}),s.on("click",function(e){var t=i("."+u);if(!t.is(event.target)&&0===t.has(event.target).length&&t.length){var a,n="vertical"===l.type?f()-e.clientY+i(this).offset().top:e.clientX-i(this).offset().left;n<0&&(n=0),n>f()&&(n=f());var s=n/f()*100/b;a=l.range?"vertical"===l.type?Math.abs(n-parseInt(i(h[0]).css("bottom")))>Math.abs(n-parseInt(i(h[1]).css("bottom")))?1:0:Math.abs(n-h[0].offsetLeft)>Math.abs(n-h[1].offsetLeft)?1:0:0,x(s,a),e.preventDefault()}}),y.hover(function(){var e=i(this);e.children("."+m).fadeIn("fast")},function(){var e=i(this);e.children("."+m).fadeOut("fast")}),y.children("."+m).children("i").each(function(e){i(this).on("click",function(){g=1==e?g-l.stepl.max?l.max:Number(g)+l.step;var i=(g-l.min)/(l.max-l.min)*100/b;x(i,0)})});var q=function(){var e=this.value;e=isNaN(e)?0:e,e=el.max?l.max:e,this.value=e;var i=(e-l.min)/(l.max-l.min)*100/b;x(i,0)};y.children("."+c).children("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),q.call(this))}).on("change",q)},f.prototype.events=function(){var e=this;e.config},t.render=function(e){var i=new f(e);return a.call(i)},e(n,t)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/transfer.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define(["laytpl","form"],function(e){"use strict";var a=layui.$,t=layui.laytpl,n=layui.form,i="transfer",l={config:{},index:layui[i]?layui[i].index+1e4:0,set:function(e){var t=this;return t.config=a.extend({},t.config,e),t},on:function(e,a){return layui.onevent.call(this,i,e,a)}},r=function(){var e=this,a=e.config,t=a.id||e.index;return r.that[t]=e,r.config[t]=a,{config:a,reload:function(a){e.reload.call(e,a)},getData:function(){return e.getData.call(e)}}},c="layui-hide",o="layui-btn-disabled",d="layui-none",s="layui-transfer-box",u="layui-transfer-header",h="layui-transfer-search",f="layui-transfer-active",y="layui-transfer-data",p=function(e){return e=e||{},['
    ','
    ','","
    ","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
      ',"
      "].join("")},v=['
      ',p({index:0,checkAllName:"layTransferLeftCheckAll"}),'
      ','",'","
      ",p({index:1,checkAllName:"layTransferRightCheckAll"}),"
      "].join(""),x=function(e){var t=this;t.index=++l.index,t.config=a.extend({},t.config,l.config,e),t.render()};x.prototype.config={title:["列表一","列表二"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"无数据",searchNone:"无匹配数据"}},x.prototype.reload=function(e){var t=this;layui.each(e,function(e,a){a.constructor===Array&&delete t.config[e]}),t.config=a.extend(!0,{},t.config,e),t.render()},x.prototype.render=function(){var e=this,n=e.config,i=e.elem=a(t(v).render({data:n,index:e.index})),l=n.elem=a(n.elem);l[0]&&(n.data=n.data||[],n.value=n.value||[],e.key=n.id||e.index,l.html(e.elem),e.layBox=e.elem.find("."+s),e.layHeader=e.elem.find("."+u),e.laySearch=e.elem.find("."+h),e.layData=i.find("."+y),e.layBtn=i.find("."+f+" .layui-btn"),e.layBox.css({width:n.width,height:n.height}),e.layData.css({height:function(){return n.height-e.layHeader.outerHeight()-e.laySearch.outerHeight()-2}()}),e.renderData(),e.events())},x.prototype.renderData=function(){var e=this,a=(e.config,[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}]);e.parseData(function(e){var t=e.selected?1:0,n=["
    • ",'',"
    • "].join("");a[t].views.push(n),delete e.selected}),e.layData.eq(0).html(a[0].views.join("")),e.layData.eq(1).html(a[1].views.join("")),e.renderCheckBtn()},x.prototype.renderForm=function(e){n.render(e,"LAY-transfer-"+this.index)},x.prototype.renderCheckBtn=function(e){var t=this,n=t.config;e=e||{},t.layBox.each(function(i){var l=a(this),r=l.find("."+y),d=l.find("."+u).find('input[type="checkbox"]'),s=r.find('input[type="checkbox"]'),h=0,f=!1;if(s.each(function(){var e=a(this).data("hide");(this.checked||this.disabled||e)&&h++,this.checked&&!e&&(f=!0)}),d.prop("checked",f&&h===s.length),t.layBtn.eq(i)[f?"removeClass":"addClass"](o),!e.stopNone){var p=r.children("li:not(."+c+")").length;t.noneView(r,p?"":n.text.none)}}),t.renderForm("checkbox")},x.prototype.noneView=function(e,t){var n=a('

      '+(t||"")+"

      ");e.find("."+d)[0]&&e.find("."+d).remove(),t.replace(/\s/g,"")&&e.append(n)},x.prototype.setValue=function(){var e=this,t=e.config,n=[];return e.layBox.eq(1).find("."+y+' input[type="checkbox"]').each(function(){var e=a(this).data("hide");e||n.push(this.value)}),t.value=n,e},x.prototype.parseData=function(e){var t=this,n=t.config,i=[];return layui.each(n.data,function(t,l){l=("function"==typeof n.parseData?n.parseData(l):l)||l,i.push(l=a.extend({},l)),layui.each(n.value,function(e,a){a==l.value&&(l.selected=!0)}),e&&e(l)}),n.data=i,t},x.prototype.getData=function(e){var a=this,t=a.config,n=[];return a.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&n.push(t)})}),n},x.prototype.events=function(){var e=this,t=e.config;e.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var t=a(this).prev(),n=t[0].checked,i=t.parents("."+s).eq(0).find("."+y);t[0].disabled||("all"===t.attr("lay-type")&&i.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=n)}),e.renderCheckBtn({stopNone:!0}))}),e.layBtn.on("click",function(){var n=a(this),i=n.data("index"),l=e.layBox.eq(i),r=[];if(!n.hasClass(o)){e.layBox.eq(i).each(function(t){var n=a(this),i=n.find("."+y);i.children("li").each(function(){var t=a(this),n=t.find('input[type="checkbox"]'),i=n.data("hide");n[0].checked&&!i&&(n[0].checked=!1,l.siblings("."+s).find("."+y).append(t.clone()),t.remove(),r.push(n[0].value)),e.setValue()})}),e.renderCheckBtn();var c=l.siblings("."+s).find("."+h+" input");""===c.val()||c.trigger("keyup"),t.onchange&&t.onchange(e.getData(r),i)}}),e.laySearch.find("input").on("keyup",function(){var n=this.value,i=a(this).parents("."+h).eq(0).siblings("."+y),l=i.children("li");l.each(function(){var e=a(this),t=e.find('input[type="checkbox"]'),i=t[0].title.indexOf(n)!==-1;e[i?"removeClass":"addClass"](c),t.data("hide",!i)}),e.renderCheckBtn();var r=l.length===i.children("li."+c).length;e.noneView(i,r?t.text.searchNone:"")})},r.that={},r.config={},l.reload=function(e,a){var t=r.that[e];return t.reload(a),r.call(t)},l.getData=function(e){var a=r.that[e];return a.getData()},l.render=function(e){var a=new x(e);return r.call(a)},e(i,l)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/tree.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("form",function(e){"use strict";var i=layui.$,a=layui.form,n=layui.layer,t="tree",r={config:{},index:layui[t]?layui[t].index+1e4:0,set:function(e){var a=this;return a.config=i.extend({},a.config,e),a},on:function(e,i){return layui.onevent.call(this,t,e,i)}},l=function(){var e=this,i=e.config,a=i.id||e.index;return l.that[a]=e,l.config[a]=i,{config:i,reload:function(i){e.reload.call(e,i)},getChecked:function(){return e.getChecked.call(e)},setChecked:function(i){return e.setChecked.call(e,i)}}},c="layui-hide",d="layui-disabled",s="layui-tree-set",o="layui-tree-iconClick",h="layui-icon-addition",u="layui-icon-subtraction",p="layui-tree-entry",f="layui-tree-main",y="layui-tree-txt",v="layui-tree-pack",C="layui-tree-spread",k="layui-tree-setLineShort",m="layui-tree-showLine",x="layui-tree-lineExtend",b=function(e){var a=this;a.index=++r.index,a.config=i.extend({},a.config,r.config,e),a.render()};b.prototype.config={data:[],showCheckbox:!1,showLine:!0,accordion:!1,onlyIconControl:!1,isJump:!1,edit:!1,text:{defaultNodeName:"未命名",none:"无数据"}},b.prototype.reload=function(e){var a=this;layui.each(e,function(e,i){i.constructor===Array&&delete a.config[e]}),a.config=i.extend(!0,{},a.config,e),a.render()},b.prototype.render=function(){var e=this,a=e.config;e.checkids=[];var n=i('
      ');e.tree(n);var t=a.elem=i(a.elem);if(t[0]){if(e.key=a.id||e.index,e.elem=n,e.elemNone=i('
      '+a.text.none+"
      "),t.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);a.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=i(this);e.parent(".layui-tree-pack")[0]||e.addClass("layui-tree-setHide"),!e.next()[0]&&e.parents(".layui-tree-pack").eq(1).hasClass("layui-tree-lineExtend")&&e.addClass(k),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(k)}),e.events()}},b.prototype.renderForm=function(e){a.render(e,"LAY-tree-"+this.index)},b.prototype.tree=function(e,a){var n=this,t=n.config,r=a||t.data;layui.each(r,function(a,r){var l=r.children&&r.children.length>0,o=i('
      '),h=i(['
      ','
      ','
      ',function(){return t.showLine?l?'':'':''}(),function(){return t.showCheckbox?'':""}(),function(){return t.isJump&&r.href?''+(r.title||r.label||t.text.defaultNodeName)+"":''+(r.title||r.label||t.text.defaultNodeName)+""}(),"
      ",function(){if(!t.edit)return"";var e={add:'',update:'',del:''},i=['
      '];return t.edit===!0&&(t.edit=["update","del"]),"object"==typeof t.edit?(layui.each(t.edit,function(a,n){i.push(e[n]||"")}),i.join("")+"
      "):void 0}(),"
      "].join(""));l&&(h.append(o),n.tree(o,r.children)),e.append(h),h.prev("."+s)[0]&&h.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),l||h.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),n.spread(h,r),t.showCheckbox&&(r.checked&&n.checkids.push(r.id),n.checkClick(h,r)),t.edit&&n.operate(h,r)})},b.prototype.spread=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f),c=r.find("."+o),k=r.find("."+y),m=t.onlyIconControl?c:l,x="";m.on("click",function(i){var a=e.children("."+v),n=m.children(".layui-icon")[0]?m.children(".layui-icon"):m.find(".layui-tree-icon").children(".layui-icon");if(a[0]){if(e.hasClass(C))e.removeClass(C),a.slideUp(200),n.removeClass(u).addClass(h);else if(e.addClass(C),a.slideDown(200),n.addClass(u).removeClass(h),t.accordion){var r=e.siblings("."+s);r.removeClass(C),r.children("."+v).slideUp(200),r.find(".layui-tree-icon").children(".layui-icon").removeClass(u).addClass(h)}}else x="normal"}),k.on("click",function(){var n=i(this);n.hasClass(d)||(x=e.hasClass(C)?t.onlyIconControl?"open":"close":t.onlyIconControl?"close":"open",t.click&&t.click({elem:e,state:x,data:a}))})},b.prototype.setCheckbox=function(e,i,a){var n=this,t=(n.config,a.prop("checked"));if(!a.prop("disabled")){if("object"==typeof i.children||e.find("."+v)[0]){var r=e.find("."+v).find('input[same="layuiTreeCheck"]');r.each(function(){this.disabled||(this.checked=t)})}var l=function(e){if(e.parents("."+s)[0]){var i,a=e.parent("."+v),n=a.parent(),r=a.prev().find('input[same="layuiTreeCheck"]');t?r.prop("checked",t):(a.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||r.prop("checked",!1)),l(n)}};l(e),n.renderForm("checkbox")}},b.prototype.checkClick=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f);l.on("click",'input[same="layuiTreeCheck"]+',function(r){layui.stope(r);var l=i(this).prev(),c=l.prop("checked");l.prop("disabled")||(n.setCheckbox(e,a,l),t.oncheck&&t.oncheck({elem:e,checked:c,data:a}))})},b.prototype.operate=function(e,a){var t=this,r=t.config,l=e.children("."+p),d=l.children("."+f);l.children(".layui-tree-btnGroup").on("click",".layui-icon",function(l){layui.stope(l);var f=i(this).data("type"),b=e.children("."+v),g={data:a,type:f,elem:e};if("add"==f){b[0]||(r.showLine?(d.find("."+o).addClass("layui-tree-icon"),d.find("."+o).children(".layui-icon").addClass(h).removeClass("layui-icon-file")):d.find(".layui-tree-iconArrow").removeClass(c),e.append('
      '));var w=r.operate&&r.operate(g),N={};if(N.title=r.text.defaultNodeName,N.id=w,t.tree(e.children("."+v),[N]),r.showLine)if(b[0])b.hasClass(x)||b.addClass(x),e.find("."+v).each(function(){i(this).children("."+s).last().addClass(k)}),b.children("."+s).last().prev().hasClass(k)?b.children("."+s).last().prev().removeClass(k):b.children("."+s).last().removeClass(k),!e.parent("."+v)[0]&&e.next()[0]&&b.children("."+s).last().removeClass(k);else{var T=e.siblings("."+s),L=1,A=e.parent("."+v);layui.each(T,function(e,a){i(a).children("."+v)[0]||(L=0)}),1==L?(T.children("."+v).addClass(m),T.children("."+v).children("."+s).removeClass(k),e.children("."+v).addClass(m),A.removeClass(x),A.children("."+s).last().children("."+v).children("."+s).last().addClass(k)):e.children("."+v).children("."+s).addClass(k)}if(!r.showCheckbox)return;if(d.find('input[same="layuiTreeCheck"]')[0].checked){var I=e.children("."+v).children("."+s).last();I.find('input[same="layuiTreeCheck"]')[0].checked=!0}t.renderForm("checkbox")}else if("update"==f){var F=d.children("."+y).html();d.children("."+y).html(""),d.append(''),d.children(".layui-tree-editInput").val(F).focus();var j=function(e){var i=e.val().trim();i=i?i:r.text.defaultNodeName,e.remove(),d.children("."+y).html(i),g.data.title=i,r.operate&&r.operate(g)};d.children(".layui-tree-editInput").blur(function(){j(i(this))}),d.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),j(i(this)))})}else n.confirm('确认删除该节点 "'+(a.title||"")+'" 吗?',function(a){if(r.operate&&r.operate(g),g.status="remove",n.close(a),!e.prev("."+s)[0]&&!e.next("."+s)[0]&&!e.parent("."+v)[0])return e.remove(),void t.elem.append(t.elemNone);if(e.siblings("."+s).children("."+p)[0]){if(r.showCheckbox){var l=function(e){if(e.parents("."+s)[0]){var a=e.siblings("."+s).children("."+p),n=e.parent("."+v).prev(),r=n.find('input[same="layuiTreeCheck"]')[0],c=1,d=0;0==r.checked&&(a.each(function(e,a){var n=i(a).find('input[same="layuiTreeCheck"]')[0];0!=n.checked||n.disabled||(c=0),n.disabled||(d=1)}),1==c&&1==d&&(r.checked=!0,t.renderForm("checkbox"),l(n.parent("."+s))))}};l(e)}if(r.showLine){var d=e.siblings("."+s),h=1,f=e.parent("."+v);layui.each(d,function(e,a){i(a).children("."+v)[0]||(h=0)}),1==h?(b[0]||(f.removeClass(x),d.children("."+v).addClass(m),d.children("."+v).children("."+s).removeClass(k)),e.next()[0]?f.children("."+s).last().children("."+v).children("."+s).last().addClass(k):e.prev().children("."+v).children("."+s).last().addClass(k),e.next()[0]||e.parents("."+s)[1]||e.parents("."+s).eq(0).next()[0]||e.prev("."+s).addClass(k)):!e.next()[0]&&e.hasClass(k)&&e.prev().addClass(k)}}else{var y=e.parent("."+v).prev();if(r.showLine){y.find("."+o).removeClass("layui-tree-icon"),y.find("."+o).children(".layui-icon").removeClass(u).addClass("layui-icon-file");var w=y.parents("."+v).eq(0);w.addClass(x),w.children("."+s).each(function(){i(this).children("."+v).children("."+s).last().addClass(k)})}else y.find(".layui-tree-iconArrow").addClass(c);e.parents("."+s).eq(0).removeClass(C),e.parent("."+v).remove()}e.remove()})})},b.prototype.events=function(){var e=this,a=e.config;e.elem.find(".layui-tree-checkedFirst");e.setChecked(e.checkids),e.elem.find(".layui-tree-search").on("keyup",function(){var n=i(this),t=n.val(),r=n.nextAll(),l=[];r.find("."+y).each(function(){var e=i(this).parents("."+p);if(i(this).html().indexOf(t)!=-1){l.push(i(this).parent());var a=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+v)[0]&&a(e.parent("."+v).parent("."+s))};a(e.parent("."+s))}}),r.find("."+p).each(function(){var e=i(this).parent("."+s);e.hasClass("layui-tree-searchShow")||e.addClass(c)}),0==r.find(".layui-tree-searchShow").length&&e.elem.append(e.elemNone),a.onsearch&&a.onsearch({elem:l})}),e.elem.find(".layui-tree-search").on("keydown",function(){i(this).nextAll().find("."+p).each(function(){var e=i(this).parent("."+s);e.removeClass("layui-tree-searchShow "+c)}),i(".layui-tree-emptyText")[0]&&i(".layui-tree-emptyText").remove()})},b.prototype.getChecked=function(){var e=this,a=e.config,n=[],t=[];e.elem.find(".layui-form-checked").each(function(){n.push(i(this).prev()[0].value)});var r=function(e,a){layui.each(e,function(e,t){layui.each(n,function(e,n){if(t.id==n){var l=i.extend({},t);return delete l.children,a.push(l),t.children&&(l.children=[],r(t.children,l.children)),!0}})})};return r(i.extend({},a.data),t),t},b.prototype.setChecked=function(e){var a=this;a.config;a.elem.find("."+s).each(function(a,n){var t=i(this).data("id"),r=i(n).children("."+p).find('input[same="layuiTreeCheck"]'),l=r.next();if("number"==typeof e){if(t==e)return r[0].checked||l.click(),!1}else"object"==typeof e&&layui.each(e,function(e,i){if(i==t&&!r[0].checked)return l.click(),!0})})},l.that={},l.config={},r.reload=function(e,i){var a=l.that[e];return a.reload(i),l.call(a)},r.getChecked=function(e){var i=l.that[e];return i.getChecked()},r.setChecked=function(e,i){var a=l.that[e];return a.setChecked(i)},r.render=function(e){var i=new b(e);return l.call(i)},e(t,r)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/upload.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,n=layui.hint(),o=layui.device(),a={config:{},set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,r,e,t)}},l=function(){var e=this;return{upload:function(t){e.upload.call(e,t)},reload:function(t){e.reload.call(e,t)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var i=this;i.config=t.extend({},i.config,a.config,e),i.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",acceptMime:"",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var i=this,e=i.config;e.elem=t(e.elem),e.bindAction=t(e.bindAction),i.file(),i.events()},p.prototype.file=function(){var e=this,i=e.config,n=e.elemFile=t(['"].join("")),a=i.elem.next();(a.hasClass(u)||a.hasClass(c))&&a.remove(),o.ie&&o.ie<10&&i.elem.wrap('
      '),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(n),o.ie&&o.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,i=e.config,n=t(''),o=t(['
      ',"
      "].join(""));t("#"+f)[0]||t("body").append(n),i.elem.next().hasClass(c)||(e.elemFile.wrap(o),i.elem.next("."+c).append(function(){var e=[];return layui.each(i.data,function(t,i){i="function"==typeof i?i():i,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var t=this;window.FileReader&&layui.each(t.chooseFiles,function(t,i){var n=new FileReader;n.readAsDataURL(i),n.onload=function(){e&&e(t,i,this.result)}})},p.prototype.upload=function(e,i){var n,a=this,l=a.config,r=a.elemFile[0],u=function(){var i=0,n=0,o=e||a.files||a.chooseFiles||r.files,u=function(){l.multiple&&i+n===a.fileLength&&"function"==typeof l.allDone&&l.allDone({total:a.fileLength,successful:i,aborted:n})};layui.each(o,function(e,o){var r=new FormData;r.append(l.field,o),layui.each(l.data,function(e,t){t="function"==typeof t?t():t,r.append(e,t)});var c={url:l.url,type:"post",data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(t){i++,d(e,t),u()},error:function(){n++,a.msg("请求上传接口出现异常"),m(e),u()}};"function"==typeof l.progress&&(c.xhr=function(){var e=t.ajaxSettings.xhr();return e.upload.addEventListener("progress",function(e){if(e.lengthComputable){var t=Math.floor(e.loaded/e.total*100);l.progress(t,l.item[0],e)}}),e}),t.ajax(c)})},c=function(){var e=t("#"+f);a.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var t,i=e.contents().find("body");try{t=i.text()}catch(n){a.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}t&&(clearInterval(p.timer),i.html(""),d(0,t))},30)},d=function(e,t){if(a.elemFile.next("."+s).remove(),r.value="","object"!=typeof t)try{t=JSON.parse(t)}catch(i){return t={},a.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(t,e||0,function(e){a.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){a.upload(e)})},h=l.exts,v=function(){var t=[];return layui.each(e||a.chooseFiles,function(e,i){t.push(i.name)}),t}(),g={preview:function(e){a.preview(e)},upload:function(e,t){var i={};i[e]=t,a.upload(i)},pushFile:function(){return a.files=a.files||{},layui.each(a.chooseFiles,function(e,t){a.files[e]=t}),a.files},resetFile:function(e,t,i){var n=new File([t],i);a.files=a.files||{},a.files[e]=n}},y=function(){if("choose"!==i&&!l.auto||(l.choose&&l.choose(g),"choose"!==i))return l.before&&l.before(g),o.ie?o.ie>9?u():c():void u()};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return a.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return a.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return a.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,t){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(t))||(n=!0)}),n)return a.msg("选择的图片中包含不支持的格式"),r.value=""}if(a.fileLength=function(){var t=0,i=e||a.files||a.chooseFiles||r.files;return layui.each(i,function(){t++}),t}(),l.number&&a.fileLength>l.number)return a.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(o.ie&&o.ie<10)){var F;if(layui.each(a.chooseFiles,function(e,t){if(t.size>1024*l.size){var i=l.size/1024;i=i>=1?i.toFixed(2)+"MB":l.size+"KB",r.value="",F=i}}),F)return a.msg("文件不能超过"+F)}y()}},p.prototype.reload=function(e){e=e||{},delete e.elem,delete e.bindAction;var i=this,e=i.config=t.extend({},i.config,a.config,e),n=e.elem.next();n.attr({name:e.name,accept:e.acceptMime,multiple:e.multiple})},p.prototype.events=function(){var e=this,i=e.config,a=function(t){e.chooseFiles={},layui.each(t,function(t,i){var n=(new Date).getTime();e.chooseFiles[n+"-"+t]=i})},l=function(t,n){var o=e.elemFile,a=t.length>1?t.length+"个文件":(t[0]||{}).name||o[0].value.match(/[^\/\\]+\..+/g)||[]||"";o.next().hasClass(s)&&o.next().remove(),e.upload(null,"choose"),e.isFile()||i.choose||o.after(''+a+"")};i.elem.off("upload.start").on("upload.start",function(){var o=t(this),a=o.attr("lay-data");if(a)try{a=new Function("return "+a)(),e.config=t.extend({},i,a)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+a)}e.config.item=o,e.elemFile[0].click()}),o.ie&&o.ie<10||i.elem.off("upload.over").on("upload.over",function(){var e=t(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=t(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,o){var r=t(this),u=o.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),a(u),i.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var t=this.files||[];a(t),i.auto?e.upload():l(t)}),i.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),i.elem.data("haveEvents")||(e.elemFile.on("change",function(){t(this).trigger("upload.change")}),i.elem.on("click",function(){e.isFile()||t(this).trigger("upload.start")}),i.drag&&i.elem.on("dragover",function(e){e.preventDefault(),t(this).trigger("upload.over")}).on("dragleave",function(e){t(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),t(this).trigger("upload.drop",e)}),i.bindAction.on("click",function(){t(this).trigger("upload.action")}),i.elem.data("haveEvents",!0))},a.render=function(e){var t=new p(e);return l.call(t)},e(r,a)}); -------------------------------------------------------------------------------- /resources/layui/lay/modules/util.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var t=layui.$,i={fixbar:function(e){var i,n,a="layui-fixbar",o="layui-fixbar-top",r=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"":e.bar1,e.bar2=e.bar2===!0?"":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,""],u=t(['
        ',e.bar1?'
      • '+c[0]+"
      • ":"",e.bar2?'
      • '+c[1]+"
      • ":"",'
      • '+c[2]+"
      • ","
      "].join("")),g=u.find("."+o),s=function(){var t=r.scrollTop();t>=e.showHeight?i||(g.show(),i=1):i&&(g.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&u.css(e.css),l.append(u),s(),u.find("li").on("click",function(){var i=t(this),n=i.attr("lay-type");"top"===n&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,n)}),r.on("scroll",function(){clearTimeout(n),n=setTimeout(function(){s()},100)}))},countdown:function(e,t,i){var n=this,a="function"==typeof t,o=new Date(e).getTime(),r=new Date(!t||a?(new Date).getTime():t).getTime(),l=o-r,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var u=setTimeout(function(){n.countdown(e,r+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,u),l<=0&&clearTimeout(u),u},timeAgo:function(e,t){var i=this,n=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>26784e5?(a=new Date(e),n[0][0]=i.digit(a.getFullYear(),4),n[0][1]=i.digit(a.getMonth()+1),n[0][2]=i.digit(a.getDate()),t||(n[1][0]=i.digit(a.getHours()),n[1][1]=i.digit(a.getMinutes()),n[1][2]=i.digit(a.getSeconds())),n[0].join("-")+" "+n[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=18e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var n=e.length;n/g,">").replace(/'/g,"'").replace(/"/g,""")},event:function(e,n,a){var o=t("body");return a=a||"click",n=i.event[e]=t.extend(!0,i.event[e],n)||{},i.event.UTIL_EVENT_CALLBACK=i.event.UTIL_EVENT_CALLBACK||{},o.off(a,"*["+e+"]",i.event.UTIL_EVENT_CALLBACK[e]),i.event.UTIL_EVENT_CALLBACK[e]=function(){var i=t(this),a=i.attr(e);"function"==typeof n[a]&&n[a].call(this,i)},o.on(a,"*["+e+"]",i.event.UTIL_EVENT_CALLBACK[e]),n}};!function(e,t,i){"$:nomunge";function n(){a=t[l](function(){o.each(function(){var t=e(this),i=t.width(),n=t.height(),a=e.data(this,u);(i!==a.w||n!==a.h)&&t.trigger(c,[a.w=i,a.h=n])}),n()},r[g])}var a,o=e([]),r=e.resize=e.extend(e.resize,{}),l="setTimeout",c="resize",u=c+"-special-event",g="delay",s="throttleWindow";r[g]=250,r[s]=!0,e.event.special[c]={setup:function(){if(!r[s]&&this[l])return!1;var t=e(this);o=o.add(t),e.data(this,u,{w:t.width(),h:t.height()}),1===o.length&&n()},teardown:function(){if(!r[s]&&this[l])return!1;var t=e(this);o=o.not(t),t.removeData(u),o.length||clearTimeout(a)},add:function(t){function n(t,n,o){var r=e(this),l=e.data(this,u)||{};l.w=n!==i?n:r.width(),l.h=o!==i?o:r.height(),a.apply(this,arguments)}if(!r[s]&&this[l])return!1;var a;return e.isFunction(t)?(a=t,n):(a=t.handler,void(t.handler=n))}}}(t,window),e("util",i)}); -------------------------------------------------------------------------------- /resources/layui/layui.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.5.6 MIT License By https://www.layui.com */ 2 | ;!function(e){"use strict";var t=document,n={modules:{},status:{},timeout:10,event:{}},r=function(){this.v="2.5.6"},o=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,n=t.scripts,r=n.length-1,o=r;o>0;o--)if("interactive"===n[o].readyState){e=n[o].src;break}return e||n[r].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),a=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},i="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",transfer:"modules/transfer",tree:"modules/tree",table:"modules/table",element:"modules/element",rate:"modules/rate",colorpicker:"modules/colorpicker",slider:"modules/slider",carousel:"modules/carousel",flow:"modules/flow",util:"modules/util",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};r.prototype.cache=n,r.prototype.define=function(e,t){var r=this,o="function"==typeof e,a=function(){var e=function(e,t){layui[e]=t,n.status[e]=!0};return"function"==typeof t&&t(function(r,o){e(r,o),n.callback[r]=function(){t(e)}}),this};return o&&(t=e,e=[]),!layui["layui.all"]&&layui["layui.mobile"]?a.call(r):(r.use(e,a),r)},r.prototype.use=function(e,r,l){function c(e,t){var r="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||r.test((e.currentTarget||e.srcElement).readyState))&&(n.modules[d]=t,y.removeChild(h),function o(){return++m>1e3*n.timeout/4?a(d+" is not a valid module"):void(n.status[d]?s():setTimeout(o,4))}())}function s(){l.push(layui[d]),e.length>1?p.use(e.slice(1),r,l):"function"==typeof r&&r.apply(layui,l)}var p=this,f=n.dir=n.dir?n.dir:o,y=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(p.each(e,function(t,n){"jquery"===n&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var d=e[0],m=0;if(l=l||[],n.host=n.host||(f.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[d]||!layui["layui.all"]&&layui["layui.mobile"]&&u[d])return s(),p;var v=(u[d]?f+"lay/":/^\{\/\}/.test(p.modules[d])?"":n.base||"")+(p.modules[d]||d)+".js";if(v=v.replace(/^\{\/\}/,""),!n.modules[d]&&layui[d]&&(n.modules[d]=v),n.modules[d])!function g(){return++m>1e3*n.timeout/4?a(d+" is not a valid module"):void("string"==typeof n.modules[d]&&n.status[d]?s():setTimeout(g,4))}();else{var h=t.createElement("script");h.async=!0,h.charset="utf-8",h.src=v+function(){var e=n.version===!0?n.v||(new Date).getTime():n.version||"";return e?"?v="+e:""}(),y.appendChild(h),!h.attachEvent||h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0||i?h.addEventListener("load",function(e){c(e,v)},!1):h.attachEvent("onreadystatechange",function(e){c(e,v)}),n.modules[d]=v}return p},r.prototype.getStyle=function(t,n){var r=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return r[r.getPropertyValue?"getPropertyValue":"getAttribute"](n)},r.prototype.link=function(e,r,o){var i=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof r&&(o=r);var c=(o||e).replace(/\.|\//g,""),s=u.id="layuicss-"+c,p=0;return u.rel="stylesheet",u.href=e+(n.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(s)||l.appendChild(u),"function"!=typeof r?i:(function f(){return++p>1e3*n.timeout/100?a(e+" timeout"):void(1989===parseInt(i.getStyle(t.getElementById(s),"width"))?function(){r()}():setTimeout(f,100))}(),i)},n.callback={},r.prototype.factory=function(e){if(layui[e])return"function"==typeof n.callback[e]?n.callback[e]:null},r.prototype.addcss=function(e,t,r){return layui.link(n.dir+"css/"+e,t,r)},r.prototype.img=function(e,t,n){var r=new Image;return r.src=e,r.complete?t(r):(r.onload=function(){r.onload=null,"function"==typeof t&&t(r)},void(r.onerror=function(e){r.onerror=null,"function"==typeof n&&n(e)}))},r.prototype.config=function(e){e=e||{};for(var t in e)n[t]=e[t];return this},r.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),r.prototype.extend=function(e){var t=this;e=e||{};for(var n in e)t[n]||t.modules[n]?a("模块名 "+n+" 已被占用"):t.modules[n]=e[n];return t},r.prototype.router=function(e){var t=this,e=e||location.hash,n={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,""),n.href="/"+e,e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),n.search[t[0]]=t[1]}():n.path.push(t)}),n):n},r.prototype.url=function(e){var t=this,n={pathname:function(){var t=e?function(){var t=(e.match(/\.[^.]+?\/.+/)||[])[0]||"";return t.replace(/^[^\/]+/,"").replace(/\?.+/,"")}():location.pathname;return t.replace(/^\//,"").split("/")}(),search:function(){var n={},r=(e?function(){var t=(e.match(/\?.+/)||[])[0]||"";return t.replace(/\#.+/,"")}():location.search).replace(/^\?+/,"").split("&");return t.each(r,function(e,t){var r=t.indexOf("="),o=function(){return r<0?t.substr(0,t.length):0!==r&&t.substr(0,r)}();o&&(n[o]=r>0?t.substr(r+1):null)}),n}(),hash:t.router(function(){return e?(e.match(/#.+/)||[])[0]||"":location.hash}())};return n},r.prototype.data=function(t,n,r){if(t=t||"layui",r=r||localStorage,e.JSON&&e.JSON.parse){if(null===n)return delete r[t];n="object"==typeof n?n:{key:n};try{var o=JSON.parse(r[t])}catch(a){var o={}}return"value"in n&&(o[n.key]=n.value),n.remove&&delete o[n.key],r[t]=JSON.stringify(o),n.key?o[n.key]:o}},r.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},r.prototype.device=function(t){var n=navigator.userAgent.toLowerCase(),r=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(n.match(t)||[])[1],e||!1},o={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:r("micromessenger")};return t&&!o[t]&&(o[t]=r(t)),o.android=/android/.test(n),o.ios="ios"===o.os,o.mobile=!(!o.android&&!o.ios),o},r.prototype.hint=function(){return{error:a}},r.prototype.each=function(e,t){var n,r=this;if("function"!=typeof t)return r;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;na?1:o 3 | 4 | 5 | 6 | 7 | 8 |
      9 | 10 |

      400 Bad Request

      11 |
      12 | 13 | 14 | {{end}} 15 | -------------------------------------------------------------------------------- /templates/500.html: -------------------------------------------------------------------------------- 1 | {{ define "templates/500.html" }} 2 | 3 | 4 | 5 | 6 | 7 | 8 |
      9 |

      500 Internal Server Error

      10 |
      11 | 12 | 13 | {{end}} 14 | -------------------------------------------------------------------------------- /templates/guestbook.html: -------------------------------------------------------------------------------- 1 | {{ define "templates/guestbook.html" }} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | Youtube视频&字幕下载 20 | 21 | 22 |
      23 |
      24 | 28 | 31 |
      32 |
      33 |
      34 |
      35 | 留言板 36 |
      37 |
      38 |
      39 |
      40 | 41 |
      42 |
      43 |
      44 |
      45 |
      46 | 称呼: 47 |
      48 |
      49 | 51 |
      52 |
      53 |
      54 |
      55 | 56 |
      57 |
      58 |
      59 | 60 | 61 |
      62 |
      63 |
      全部留言
      64 |
      65 |
      66 | {{range .}} 67 |
      68 |
      69 | 70 | {{.Content}} 71 | 72 |
      73 |
      74 | 75 | {{.NickName}} 76 | 77 | 78 | {{.Time.Format "2006-01-02"}} 79 | 80 |
      81 |
      82 | 83 |
      84 | {{end}} 85 |
      86 |
      87 | 88 | 89 |
      90 |
      91 | 99 |
      100 | 101 | 102 | {{end}} -------------------------------------------------------------------------------- /templates/index.tmpl: -------------------------------------------------------------------------------- 1 | {{ define "templates/index.html" }} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | Youtube视频&字幕下载 20 | 21 | 22 |
      23 |
      24 | 28 |
      29 |
      30 |
      31 |

      在线Youtube字幕视频下载

      32 |
      33 | 34 |

      35 | 下载youtube字幕和视频

      36 |
      37 |
      38 | 43 | 46 |
      47 |
      48 |
      49 |
        50 |
      1. 51 |

        将youtube视频链接粘贴至上方输入框以获取字幕和视频文件信息。


        52 |
      2. 53 |
      3. 54 |

        视频文件列表中,如无音视频编码则说明该文件为纯视频/纯音频。


        55 |
      4. 56 |
      57 |
      58 | 132 |
      133 |
      134 | 142 |
      143 | 144 | 145 | {{end}} -------------------------------------------------------------------------------- /templates/intro.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 |

      说明

      14 |

      这个网站是为了满足我在iPad上下载并观看带字幕的youtube视频的需求而写的。

      15 |

      在ipad上配合nPlayer使用,还算比较方便。

      16 |

      截图

      17 |

      视频下载的实现是使用的https://github.com/rylio/ytdl这个包,本质上解析对应的youtube页面,然后从中获取视频文件地址。不过这个包没有字幕下载,所以我在其基础上增加了解析字幕地址的功能。 18 |

      19 |

      由于获取视频没信息有使用代理池,直接访问youtube页面,如果使用量较大可能会触发访问限制,所以应该不能承载较大的访问量。

      20 |

      代码在Github,你也可以自己部署。 21 |

      22 |

       

      23 |

      更新日志

      24 |
      25 |

      2020-02-18

      26 |

      完成基本功能。

      27 | 28 | -------------------------------------------------------------------------------- /utils/util.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "fmt" 5 | "golang.org/x/text/language" 6 | "golang.org/x/text/language/display" 7 | "net/http" 8 | "net/url" 9 | "reflect" 10 | "regexp" 11 | "strings" 12 | ) 13 | 14 | func Copy(dst interface{}, src interface{}) (err error) { 15 | defer func() { 16 | if e := recover(); e != nil { 17 | err = fmt.Errorf("%v", e) 18 | } 19 | }() 20 | srcVal := reflect.ValueOf(src) 21 | if srcVal.Kind() == reflect.Ptr { 22 | srcVal = srcVal.Elem() 23 | } 24 | dstVal := reflect.ValueOf(dst).Elem() 25 | for i := 0; i < srcVal.NumField(); i++ { 26 | fieldName := srcVal.Type().Field(i).Name 27 | if v := dstVal.FieldByName(fieldName); !reflect.ValueOf(v).IsZero() { 28 | v.Set(srcVal.FieldByName(fieldName)) 29 | } 30 | } 31 | return nil 32 | } 33 | 34 | func Domain(url string) (domain string) { 35 | regStr := `([a-z0-9][-a-z0-9]{0,62})\.([a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$` 36 | reg := regexp.MustCompile(regStr) 37 | matches := reg.FindStringSubmatch(url) 38 | if len(matches) < 1 { 39 | return "" 40 | } 41 | return matches[1] 42 | } 43 | 44 | func ExtractVideoInfo(u *url.URL) (id string, kind string) { 45 | 46 | switch true { 47 | case strings.Contains(u.Host, "pornhub"): 48 | id = u.Query().Get("viewkey") 49 | return id, "pornhub" 50 | case strings.Contains(u.Host, "youtu"): 51 | return ExtractVideoID(u), "youtube" 52 | } 53 | return "", "" 54 | } 55 | 56 | // GetVideoInfoFromShortURL fetches video info from a short youtube url 57 | func ExtractVideoID(u *url.URL) string { 58 | switch u.Host { 59 | case "www.youtube.com", "youtube.com", "m.youtube.com": 60 | if u.Path == "/watch" { 61 | return u.Query().Get("v") 62 | } 63 | if strings.HasPrefix(u.Path, "/embed/") { 64 | return u.Path[7:] 65 | } 66 | case "youtu.be": 67 | if len(u.Path) > 1 { 68 | return u.Path[1:] 69 | } 70 | } 71 | return "" 72 | } 73 | 74 | func LanguageDisplay(lang string) string { 75 | tag, err := language.Parse(lang) 76 | if err != nil { 77 | return lang 78 | } 79 | return display.Chinese.Tags().Name(tag) 80 | } 81 | 82 | func GetFileSize(url string) (size int64, err error) { 83 | client := http.DefaultClient 84 | 85 | req, err := http.NewRequest(http.MethodHead, url, nil) 86 | if err != nil { 87 | return 0, nil 88 | } 89 | resp, err := client.Do(req) 90 | if err != nil { 91 | return 0, err 92 | } 93 | if resp.StatusCode/100 != 2 { 94 | return 0, fmt.Errorf("request failed:%v", resp.StatusCode) 95 | } 96 | return resp.ContentLength, nil 97 | 98 | } 99 | -------------------------------------------------------------------------------- /utils/util_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "fmt" 5 | "regexp" 6 | "testing" 7 | ) 8 | 9 | type A struct { 10 | F1 string 11 | F2 string 12 | F3 string 13 | } 14 | type B struct { 15 | F0 string 16 | F1 string 17 | F2 string 18 | } 19 | 20 | func TestCopy(t *testing.T) { 21 | a := &A{ 22 | "123", "234", "345", 23 | } 24 | b := &B{} 25 | err := Copy(b, a) 26 | if err != nil { 27 | t.Fatal(err) 28 | } 29 | t.Logf("\na:%+v\nb:%+v", a, b) 30 | } 31 | 32 | func TestDomain(t *testing.T) { 33 | var url = "www.youtube.com" 34 | 35 | domainPattern := `([a-z0-9][-a-z0-9]{0,62})\.` + 36 | `(com\.cn|com\.hk|` + 37 | `cn|com|net|edu|gov|biz|org|info|pro|name|xxx|xyz|be|` + 38 | `me|top|cc|tv|tt)` 39 | _=domainPattern 40 | reg := regexp.MustCompile(`([a-z0-9][-a-z0-9]{0,62})\.([a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$`) 41 | //reg := regexp.MustCompile(domainPattern) 42 | fmt.Println(reg.MatchString(url)) 43 | matches := reg.FindStringSubmatch(url) 44 | fmt.Println(matches) 45 | } 46 | --------------------------------------------------------------------------------