How to use play method in stryker-parent

Best JavaScript code snippet using stryker-parent

UserStore.js

Source:UserStore.js Github

copy

Full Screen

1import {action, observable} from 'mobx'2import I18n from "react-native-i18n";3import {removeCurrentMusic, saveLanguage, saveMusicRepeat} from "../util/Store";4import EventRegister, {ON_SLIDING_COMPLETE} from "../util/EventRegister";5export default class UserStore {6 @observable language = 'en'7 @observable music = {8 id: null,9 audioUrl: null,10 isPlay: false,11 timeTotal: 0,12 currentPosition: 0,13 volume: 0.6,14 musicDetail: []15 }16 @observable isRepeatAll = true17 @observable isEdit = false18 @observable nextOrder = []19 @observable listItemDownload = []20 @observable itemDownload = -121 @observable progressDownload = 022 @observable playlist = []23 @observable musicPlaylist = []24 @observable musicPlaylistDisplay = []25 @observable musicPlaylistPlay = []26 initMusic = () => {27 return {28 id: null,29 audioUrl: null,30 isPlay: false,31 timeTotal: 0,32 currentPosition: 0,33 volume: 0.6,34 music_id: null,35 musicDetail: []36 }37 }38 @action updateProgressDownload(progressDownload) {39 this.progressDownload = progressDownload40 }41 @action onEndMusicDemo() {42 this.music = this.initMusic()43 }44 @action updateItemDownload(itemDownload) {45 this.itemDownload = itemDownload46 }47 @action saveItemDownload(itemDownload, callback) {48 let listItemDownload = this.listItemDownload.slice()49 const indexAvailable = listItemDownload.findIndex(item => itemDownload.id === item.id)50 if (indexAvailable === -1) {51 this.listItemDownload = [...listItemDownload, itemDownload]52 callback(true)53 } else {54 callback(false)55 }56 }57 @action removeItemDownload(itemDownload) {58 let listItemDownload = this.listItemDownload.slice()59 this.listItemDownload = listItemDownload.filter(item => item.id !== itemDownload.id)60 }61 @action emptyItemDownload() {62 this.listItemDownload = []63 }64 @action initPlaylist(playlist, musicPlaylist, currentMusic) {65 let currentMusicActive = false66 playlist.forEach((item, index) => {67 if (currentMusic && currentMusic.playlist_id && item.is_active) {68 item.isSelect = item.id === currentMusic.playlist_id69 currentMusicActive = true70 if (item.id === currentMusic.playlist_id) this.isRepeatAll = item.is_repeat_all71 } else {72 item.isSelect = index === 073 if (index === 0) this.isRepeatAll = item.is_repeat_all74 }75 })76 this.playlist = playlist77 this.musicPlaylist = musicPlaylist78 let musicPlaylistInit = []79 if (musicPlaylist.length > 0) {80 musicPlaylistInit = musicPlaylist.filter((music, index) => {81 if (currentMusicActive) {82 return music.playlist.id === currentMusic.playlist_id83 }84 return music.playlist.id === playlist[0].id85 })86 // if (musicPlaylistInit.length > 0) this.music = this.convertMusicPlayObject(musicPlaylistInit[0], false)87 }88 if (currentMusicActive) {89 this.musicPlaylistPlay = musicPlaylistInit90 this.music = {91 ...currentMusic,92 isPlay: false93 }94 }95 this.musicPlaylistDisplay = musicPlaylistInit96 }97 @action changePlaylistName(name, playlistSelect) {98 let playlist = this.playlist.slice()99 playlist.forEach((item, index) => {100 if (item.id === playlistSelect.id) {101 playlist[index].name = name102 }103 })104 this.playlist = playlist105 }106 @action addMusicToPlaylist(music, playlistSelect) {107 let musicPlaylist = this.musicPlaylist.slice()108 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()109 let musicPlaylistPlay = this.musicPlaylistPlay.slice()110 const playlist = this.playlist.slice()111 const indexAvailable = musicPlaylist.findIndex(item => music.id === item.id)112 if (indexAvailable === -1) {113 // if (musicPlaylist.length === 0) {114 // this.music = this.convertMusicPlayObject(music, false)115 // }116 musicPlaylist = [music, ...musicPlaylist]117 // if (playlist[4].is_active) {118 const index = playlist.findIndex(item => item.isSelect)119 if (index !== -1) {120 if (playlist[index].id === playlistSelect.id) {121 musicPlaylistDisplay = [music, ...musicPlaylistDisplay]122 }123 if (musicPlaylistPlay.length > 0) {124 if (playlistSelect.id === musicPlaylistPlay[0].playlist.id) {125 musicPlaylistPlay = [music, ...musicPlaylistPlay]126 }127 }128 }129 // } else if (playlist[0].is_active) {130 // musicPlaylistDisplay = musicPlaylist131 // musicPlaylistPlay = musicPlaylist132 // }133 this.musicPlaylistDisplay = musicPlaylistDisplay134 this.musicPlaylistPlay = musicPlaylistPlay135 this.musicPlaylist = musicPlaylist136 }137 }138 @action changeSelectPlaylist(playlistSelect) {139 let playlist = this.playlist.slice()140 playlist.forEach(item => {141 item.isSelect = (item.id === playlistSelect.id)142 })143 this.playlist = playlist144 this.isRepeatAll = playlistSelect.is_repeat_all145 let musicPlaylist = this.musicPlaylist.slice()146 if (musicPlaylist.length > 0) {147 this.musicPlaylistDisplay = musicPlaylist.filter((music, index) => {148 return music.playlist.id === playlistSelect.id149 })150 }151 }152 @action toggleRepeat() {153 this.isRepeatAll = !this.isRepeatAll154 this.playlist.forEach(item => {155 if (item.isSelect) item.is_repeat_all = this.isRepeatAll156 })157 // saveMusicRepeat(this.isRepeatAll)158 }159 @action setAllRepeat(isRepeatAll) {160 this.isRepeatAll = isRepeatAll161 }162 @action switchEdit() {163 this.isEdit = !this.isEdit164 }165 @action changeLanguage(language) {166 this.language = language167 I18n.locale = language168 saveLanguage(language)169 }170 @action changeVolumeMusicPlaying(music) {171 if (music.id === this.music.id) this.music.volume = music.volume172 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()173 const indexDisplay = musicPlaylistDisplay.findIndex(element => element.id === music.id)174 if (indexDisplay !== -1) {175 musicPlaylistDisplay[indexDisplay].volume = music.volume176 }177 this.musicPlaylistDisplay = musicPlaylistDisplay178 }179 @action changeVolumeAudio(music) {180 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()181 const indexDisplay = musicPlaylistDisplay.findIndex(element => element.id === music.id)182 if (indexDisplay !== -1) {183 musicPlaylistDisplay[indexDisplay].volume = music.volume184 if (music.id === this.music.id) this.music.volume = music.volume185 }186 this.musicPlaylistDisplay = musicPlaylistDisplay187 let musicPlaylistPlay = this.musicPlaylistDisplay.slice()188 const indexPlay = musicPlaylistPlay.findIndex(element => element.id === music.id)189 if (indexPlay !== -1) {190 musicPlaylistPlay[indexPlay].volume = music.volume191 if (music.id === this.music.id) this.music.volume = music.volume192 }193 this.musicPlaylistPlay = musicPlaylistPlay194 let musicPlaylist = this.musicPlaylist.slice()195 const index = musicPlaylist.findIndex(element => element.id === music.id)196 if (index !== -1) {197 musicPlaylist[index].volume = music.volume198 if (music.id === this.music.id) this.music.volume = music.volume199 }200 this.musicPlaylist = musicPlaylist201 }202 convertMusicPlayObject = (music, isPlay) => {203 return {204 id: music.id,205 audioUrl: music.music.origin_url,206 isPlay,207 timeTotal: music.music.time_total || 0,208 currentPosition: 0,209 volume: music.volume,210 playlist_id: music.playlist.id,211 music_id: music.music.id,212 musicDetail: music.music.music_detail213 }214 }215 @action playAudio(item) {216 let musicPlaylist = this.musicPlaylist.slice()217 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()218 let musicPlaylistPlay = this.musicPlaylistPlay.slice()219 const prevIndexPlay = musicPlaylistPlay.findIndex(element => element.id === this.music.id)220 if (prevIndexPlay !== -1) musicPlaylistPlay[prevIndexPlay].isPlay = false221 const prevIndexDisplay = musicPlaylistDisplay.findIndex(element => element.id === this.music.id)222 if (prevIndexDisplay !== -1) musicPlaylistDisplay[prevIndexDisplay].isPlay = false223 const prevIndex = musicPlaylist.findIndex(element => element.id === this.music.id)224 if (prevIndex !== -1) musicPlaylist[prevIndex].isPlay = false225 if (musicPlaylistPlay.length > 0) {226 if (musicPlaylistDisplay[0].playlist.id === musicPlaylistPlay[0].playlist.id) {227 const indexPlay = musicPlaylistPlay.findIndex(element => element.id === item.id)228 // const indexDisplay = musicPlaylistDisplay.findIndex(element => element.id === item.id)229 const index = musicPlaylist.findIndex(element => element.id === item.id)230 if (indexPlay !== -1) {231 musicPlaylistPlay[indexPlay].isPlay = true232 musicPlaylistDisplay[indexPlay].isPlay = true233 musicPlaylist[index].isPlay = true234 if (musicPlaylistPlay[indexPlay].id === this.music.id) {235 this.music.isPlay = true236 } else {237 this.music = this.convertMusicPlayObject(musicPlaylistPlay[indexPlay], true)238 }239 this.musicPlaylistPlay = musicPlaylistPlay240 this.musicPlaylistDisplay = musicPlaylistDisplay241 this.musicPlaylist = musicPlaylist242 }243 } else {244 musicPlaylistPlay = this.musicPlaylistDisplay.slice()245 const indexPlay = musicPlaylistPlay.findIndex(element => element.id === item.id)246 // const indexDisplay = musicPlaylistDisplay.findIndex(element => element.id === item.id)247 const index = musicPlaylist.findIndex(element => element.id === item.id)248 if (indexPlay !== -1) {249 musicPlaylistPlay[indexPlay].isPlay = true250 musicPlaylistDisplay[indexPlay].isPlay = true251 musicPlaylist[index].isPlay = true252 this.music = this.convertMusicPlayObject(musicPlaylistPlay[indexPlay], true)253 this.musicPlaylistPlay = musicPlaylistPlay254 this.musicPlaylistDisplay = musicPlaylistDisplay255 this.musicPlaylist = musicPlaylist256 }257 }258 } else {259 musicPlaylistPlay = musicPlaylistDisplay260 const indexDisplay = musicPlaylistDisplay.findIndex(element => element.id === item.id)261 const index = musicPlaylist.findIndex(element => element.id === item.id)262 if (indexDisplay !== -1) {263 musicPlaylistPlay[indexDisplay].isPlay = true264 musicPlaylistDisplay[indexDisplay].isPlay = true265 musicPlaylist[index].isPlay = true266 this.music = this.convertMusicPlayObject(musicPlaylistPlay[indexDisplay], true)267 this.musicPlaylistPlay = musicPlaylistPlay268 this.musicPlaylistDisplay = musicPlaylistDisplay269 this.musicPlaylist = musicPlaylist270 }271 }272 }273 @action nextAudio(music, onEnd) {274 let musicPlaylistPlay = this.musicPlaylistPlay.slice()275 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()276 let musicPlaylist = this.musicPlaylist.slice()277 const indexPlay = musicPlaylistPlay.findIndex(element => element.id === music.id)278 const index = musicPlaylist.findIndex(element => element.id === music.id)279 if (indexPlay !== -1) {280 const isTheSameList = musicPlaylistDisplay.length > 0 && musicPlaylistDisplay[0].playlist.id === musicPlaylistPlay[0].playlist.id281 musicPlaylistPlay[indexPlay].isPlay = false282 if (isTheSameList) musicPlaylistDisplay[indexPlay].isPlay = false283 musicPlaylist[index].isPlay = false284 if (indexPlay < musicPlaylistPlay.length - 1) {285 this.music = this.convertMusicPlayObject(musicPlaylistPlay[indexPlay + 1], true)286 musicPlaylistPlay[indexPlay + 1].isPlay = true287 if (isTheSameList) musicPlaylistDisplay[indexPlay + 1].isPlay = true288 const nextIndex = musicPlaylist.findIndex(element => element.id === musicPlaylistPlay[indexPlay + 1].id)289 musicPlaylist[nextIndex].isPlay = true290 } else if (musicPlaylistPlay[0] && musicPlaylistPlay[0].playlist.is_repeat_all) {291 if (onEnd && onEnd.onEnd && musicPlaylistPlay.length === 1) {292 EventRegister.emit(ON_SLIDING_COMPLETE, 0)293 this.music.currentPosition = 0294 } else if (musicPlaylistPlay.length > 1) {295 this.music = this.convertMusicPlayObject(musicPlaylistPlay[0], true)296 musicPlaylistPlay[0].isPlay = true297 if (isTheSameList) musicPlaylistDisplay[0].isPlay = true298 const nextIndex = musicPlaylist.findIndex(element => element.id === musicPlaylistPlay[0].id)299 musicPlaylist[nextIndex].isPlay = true300 }301 } else if (onEnd && onEnd.onEnd) {302 // Last music303 this.music = this.initMusic()304 removeCurrentMusic()305 }306 this.musicPlaylistPlay = musicPlaylistPlay307 this.musicPlaylistDisplay = musicPlaylistDisplay308 this.musicPlaylist = musicPlaylist309 }310 }311 @action prevAudio(music) {312 let musicPlaylistPlay = this.musicPlaylistPlay.slice()313 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()314 let musicPlaylist = this.musicPlaylist.slice()315 const indexPlay = musicPlaylistPlay.findIndex(element => element.id === music.id)316 const index = musicPlaylist.findIndex(element => element.id === music.id)317 if (indexPlay !== -1 && indexPlay > 0) {318 const isTheSameList = musicPlaylistDisplay.length > 0 && musicPlaylistDisplay[0].playlist.id === musicPlaylistPlay[0].playlist.id319 musicPlaylistPlay[indexPlay].isPlay = false320 if (isTheSameList) musicPlaylistDisplay[indexPlay].isPlay = false321 musicPlaylist[index].isPlay = false322 this.music = this.convertMusicPlayObject(musicPlaylistPlay[indexPlay - 1], true)323 musicPlaylistPlay[indexPlay - 1].isPlay = true324 if (isTheSameList) musicPlaylistDisplay[indexPlay - 1].isPlay = true325 const nextIndex = musicPlaylist.findIndex(element => element.id === musicPlaylistPlay[indexPlay - 1].id)326 musicPlaylist[nextIndex].isPlay = true327 }328 this.musicPlaylistPlay = musicPlaylistPlay329 this.musicPlaylistDisplay = musicPlaylistDisplay330 this.musicPlaylist = musicPlaylist331 }332 @action playAudioDemo(music) {333 this.music.isPlay = false334 this.music = {335 ...music,336 currentPosition: 0,337 volume: 0.6,338 isDemo: true339 }340 }341 @action changePlay(isPlay, music) {342 if (music) {343 this.music = {344 ...music,345 isPlay: isPlay346 }347 } else {348 this.music.isPlay = isPlay349 }350 let musicPlaylistPlay = this.musicPlaylistPlay.slice()351 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()352 let musicPlaylist = this.musicPlaylist.slice()353 const indexPlay = musicPlaylistPlay.findIndex(element => element.id === this.music.id)354 const index = musicPlaylist.findIndex(element => element.id === this.music.id)355 if (indexPlay !== -1) {356 const isTheSameList = musicPlaylistDisplay.length > 0 && musicPlaylistDisplay[0].playlist.id === musicPlaylistPlay[0].playlist.id357 musicPlaylistPlay[indexPlay].isPlay = isPlay358 musicPlaylist[index].isPlay = isPlay359 if (isTheSameList) musicPlaylistDisplay[indexPlay].isPlay = isPlay360 this.musicPlaylistPlay = musicPlaylistPlay361 this.musicPlaylistDisplay = musicPlaylistDisplay362 this.musicPlaylist = musicPlaylist363 }364 }365 @action updateNextOrder(nextOrder) {366 if (nextOrder && nextOrder.length > 0) this.nextOrder = nextOrder367 }368 @action updateMusicByNewOrder = () => {369 let musicPlaylistPlay = this.musicPlaylistPlay.slice()370 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()371 let temp = []372 this.nextOrder.forEach((item, index) => {373 temp.push(musicPlaylistDisplay[parseInt(item)])374 })375 if (musicPlaylistPlay.length > 0) {376 if (musicPlaylistPlay[0].playlist.id === musicPlaylistDisplay[0].playlist.id) {377 this.musicPlaylistPlay = temp378 }379 }380 this.musicPlaylistDisplay = temp381 this.nextOrder = []382 }383 @action deleteMusic(music) {384 let musicPlaylist = this.musicPlaylist.slice()385 this.musicPlaylist = musicPlaylist.filter((item) => {386 return item.id !== music.id387 })388 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()389 this.musicPlaylistDisplay = musicPlaylistDisplay.filter((item) => {390 return item.id !== music.id391 })392 let musicPlaylistPlay = this.musicPlaylistPlay.slice()393 if (musicPlaylistPlay.length > 0) {394 this.musicPlaylistPlay = musicPlaylistPlay.filter((item) => {395 return item.id !== music.id396 })397 }398 if (music.id === this.music.id) {399 this.music = this.initMusic()400 }401 }402 @action updateCurrentPosition(currentPosition) {403 const comparePosition = currentPosition - this.music.currentPosition404 if (comparePosition < 2 && comparePosition > 0)405 this.music.currentPosition = currentPosition406 }407 @action replayMusic(isReplay) {408 this.music.isReplay = isReplay409 let musicPlaylistPlay = this.musicPlaylistPlay.slice()410 let musicPlaylistDisplay = this.musicPlaylistDisplay.slice()411 let musicPlaylist = this.musicPlaylist.slice()412 const indexPlay = musicPlaylistPlay.findIndex(element => element.id === this.music.id)413 const index = musicPlaylist.findIndex(element => element.id === this.music.id)414 if (indexPlay !== -1) {415 const isTheSameList = musicPlaylistDisplay.length > 0 && musicPlaylistDisplay[0].playlist.id === musicPlaylistPlay[0].playlist.id416 musicPlaylistPlay[indexPlay].isReplay = isReplay417 musicPlaylist[index].isReplay = isReplay418 if (isTheSameList) musicPlaylistDisplay[indexPlay].isReplay = isReplay419 this.musicPlaylistPlay = musicPlaylistPlay420 this.musicPlaylistDisplay = musicPlaylistDisplay421 this.musicPlaylist = musicPlaylist422 }423 }424 @action onChangeSeekBar(currentPosition, onChangeSlide) {425 this.music.onChangeSlide = onChangeSlide426 this.music.currentPosition = Math.floor(currentPosition)427 // this.music.isPlay = isPlay428 // let musicPlaylistPlay = this.musicPlaylistPlay.slice()429 // musicPlaylistPlay.forEach((item, index) => {430 // if (item.id === this.music.id) {431 // musicPlaylistPlay[index].isPlay = isPlay432 // }433 // })434 // this.musicPlaylistPlay = musicPlaylistPlay435 }436 @action setDuration(timeTotal) {437 this.music.timeTotal = timeTotal438 }439 @action setTimeTotalPlay(timeTotalPlay) {440 this.music.timeTotalPlay = timeTotalPlay441 }442 @action setTimePlay(timePlay) {443 this.music.timePlay = timePlay444 }...

Full Screen

Full Screen

skin.js

Source:skin.js Github

copy

Full Screen

1var getskins = [{2 "skin:skip": "VSG",3 "vsg-skins:skip": "vsg",4 ".vjs-control-bar[font-size]:px": "14",5 ".vjs-control-bar2[background-color]": "#000000",6 ".vjs-control-bar[background-color]:important": "rgba(0,0,0,0.3)",7 ".vjs-play-progress| .vjs-volume-level[background-color]": "#2483d5",8 ".vjs-control-bar[color]": "#ffffff",9 ".vjs-big-play-button[background-color]": "rgba(0,0,0,0.45)",10 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "rgba(36,131,213,0.9)",11 ".vjs-big-play-button[border-radius]:percent": "50",12 ".vjs-big-play-button[font-size]:em": "3.5",13 ".vjs-big-play-button[height]:emimportant": "2",14 ".vjs-big-play-button[line-height]:emimportant": "2",15 ".vjs-big-play-button[margin-top]:emimportant": "-1",16 "radius:skip": "2",17 ".vjs-loading-spinner[border-color]": "rgba(36,131,213,0.8)",18 "customcss:skip": ""19}, {20 "skin:skip": "Sublim",21 "vsg-skins:skip": "default",22 ".vjs-control-bar2[background-color]": "transparent",23 ".vjs-control-bar[background-color]:important": "rgba(0,0,0,0)",24 ".vjs-control-bar[color]": "#ffffff",25 ".vjs-play-progress| .vjs-volume-level[background-color]": "#cccccc",26 ".vjs-control-bar[font-size]:px": "18",27 ".vjs-big-play-button[background-color]": "rgba(255,255,255,0.25)",28 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "rgba(255,255,255,0.45)",29 ".vjs-big-play-button[font-size]:em": "3.5",30 ".vjs-big-play-button[border-radius]:percent": "35",31 ".vjs-big-play-button[height]:emimportant": "1.6",32 ".vjs-big-play-button[line-height]:emimportant": "1.6",33 ".vjs-big-play-button[margin-top]:emimportant": "-0.8",34 "radius:skip": "1.6",35 ".vjs-loading-spinner[border-color]": "rgba(255,255,255,0.7)",36 "customcss:skip": ".video-js .vjs-progress-holder {\r\n font-size: 1.7em;\r\nborder-radius: 10px;\r\n}\r\n.video-js .vjs-progress-holder .vjs-play-progress, .video-js .vjs-progress-holder .vjs-load-progress, .video-js .vjs-progress-holder .vjs-load-progress div, .video-js .vjs-slider,.vjs-volume-level {\r\n border-radius: 10px;\r\n}\r\n.video-js .vjs-load-progress {\r\n background: rgba(255,255,255,0.2);\r\n}"37}, {38 "skin:skip": "Magnified",39 "vsg-skins:skip": "vsg",40 ".vjs-control-bar[font-size]:px": "16",41 ".vjs-control-bar2[background-color]": "#fcfcfc",42 ".vjs-control-bar[background-color]:important": "rgba(252,252,252,0.19)",43 ".vjs-play-progress| .vjs-volume-level[background-color]": "#cccccc",44 ".vjs-control-bar[color]": "#ffffff",45 ".vjs-big-play-button[background-color]": "rgba(255,255,255,0.1)",46 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "rgba(255,255,255,0.23)",47 ".vjs-big-play-button[border-radius]:percent": "50",48 ".vjs-big-play-button[font-size]:em": "6",49 ".vjs-big-play-button[height]:emimportant": "2",50 ".vjs-big-play-button[line-height]:emimportant": "2",51 ".vjs-big-play-button[margin-top]:emimportant": "-1",52 "radius:skip": "2",53 ".vjs-loading-spinner[border-color]": "rgba(255,255,255,0.7)",54 "customcss:skip": ""55}, {56 "skin:skip": "SunRise",57 "vsg-skins:skip": "vsg",58 ".vjs-control-bar[font-size]:px": "14",59 ".vjs-control-bar2[background-color]": "#ebff04",60 ".vjs-control-bar[background-color]:important": "rgba(235,255,4,0.4)",61 ".vjs-play-progress| .vjs-volume-level[background-color]": "#cccccc",62 ".vjs-control-bar[color]": "#ffffff",63 ".vjs-big-play-button[background-color]": "rgba(235,255,4,0.4)",64 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "rgba(235,255,4,0.5)",65 ".vjs-big-play-button[border-radius]:percent": "50",66 ".vjs-big-play-button[font-size]:em": "4",67 ".vjs-big-play-button[height]:emimportant": "2",68 ".vjs-big-play-button[line-height]:emimportant": "2",69 ".vjs-big-play-button[margin-top]:emimportant": "-1",70 "radius:skip": "2",71 ".vjs-loading-spinner[border-color]": "rgba(255,255,255,0.7)",72 "customcss:skip": ""73}, {74 "skin:skip": "TechSkin",75 "vsg-skins:skip": "vsg",76 ".vjs-control-bar[font-size]:px": "14",77 ".vjs-control-bar2[background-color]": "#0e223d",78 ".vjs-control-bar[background-color]:important": "#0e223d",79 ".vjs-control-bar[color]": "#ffffff",80 ".vjs-play-progress| .vjs-volume-level[background-color]": "rgba(14,34,61,0.8)",81 ".vjs-big-play-button[background-color]": "rgba(14,34,61,0.7)",82 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "#0e223d",83 ".vjs-big-play-button[border-radius]:percent": "12",84 ".vjs-big-play-button[font-size]:em": "3.5",85 ".vjs-big-play-button[height]:emimportant": "1.4",86 ".vjs-big-play-button[line-height]:emimportant": "1.4",87 ".vjs-big-play-button[margin-top]:emimportant": "-0.7",88 "radius:skip": "1.4",89 ".vjs-loading-spinner[border-color]": "rgba(14,34,61,0.84)",90 "customcss:skip": ""91}, {92 "skin:skip": "Youtube",93 "vsg-skins:skip": "vsg",94 ".vjs-control-bar[font-size]:px": "12",95 ".vjs-control-bar2[background-color]": "#000000",96 ".vjs-control-bar[background-color]:important": "rgba(0,0,0,0.3)",97 ".vjs-play-progress| .vjs-volume-level[background-color]": "#cc181e",98 ".vjs-control-bar[color]": "#ffffff",99 ".vjs-big-play-button[background-color]": "rgba(0,0,0,0.5)",100 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "#cc181e",101 ".vjs-big-play-button[border-radius]:percent": "20",102 ".vjs-big-play-button[font-size]:em": "2.5",103 ".vjs-big-play-button[height]:emimportant": "1.4",104 ".vjs-big-play-button[line-height]:emimportant": "1.4",105 ".vjs-big-play-button[margin-top]:emimportant": "-0.7",106 "radius:skip": "1.4",107 ".vjs-loading-spinner[border-color]": "#cc181e",108 "customcss:skip": ".video-js .vjs-load-progress {\r\n background: rgba(255,255,255,0.3);\r\n}"109}, {110 "skin:skip": "Facebook Player",111 "vsg-skins:skip": "default",112 ".vjs-control-bar[font-size]:px": "18",113 ".vjs-control-bar2[background-color]": "transparent",114 ".vjs-control-bar[background-color]:important": "rgba(0,0,0,0)",115 ".vjs-control-bar[color]": "#ffffff",116 ".vjs-play-progress| .vjs-volume-level[background-color]": "#2483d5",117 ".vjs-big-play-button[background-color]": "rgba(0,0,0,0.35)",118 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "rgba(0,0,0,0.35)",119 ".vjs-big-play-button[border-radius]:percent": "50",120 ".vjs-big-play-button[font-size]:em": "3.5",121 ".vjs-big-play-button[height]:emimportant": "2",122 ".vjs-big-play-button[line-height]:emimportant": "2",123 ".vjs-big-play-button[margin-top]:emimportant": "-1",124 "radius:skip": "2",125 ".vjs-loading-spinner[border-color]": "rgba(255,255,255,0.7)",126 "customcss:skip": ".video-js .vjs-big-play-button {\r\n height: 2em !important;\r\n width: 2em !important;\r\n line-height: 1.9em !important;\r\n margin-top: -1em !important;\r\nmargin-left: -1em;\r\nborder-width:3px\r\n}\r\n .video-js .vjs-icon-play:before, .video-js .vjs-big-play-button:before {\r\n font-size: 50px;\r\n}\r\n.video-js .vjs-progress-holder {\r\n font-size: 1.7em;\r\nborder-radius: 10px;\r\n}\r\n.video-js .vjs-progress-holder .vjs-play-progress, .video-js .vjs-progress-holder .vjs-load-progress, .video-js .vjs-progress-holder .vjs-load-progress div, .video-js .vjs-slider,.vjs-volume-level {\r\n border-radius: 10px;\r\n}\r\n.video-js .vjs-load-progress {\r\n background: rgba(255,255,255,0.5);\r\n}"127}, {128 "skin:skip": "Twitter",129 "vsg-skins:skip": "default",130 ".vjs-control-bar2[background-color]": "transparent",131 ".vjs-control-bar[background-color]:important": "rgba(0,0,0,0)",132 ".vjs-control-bar[color]": "#ffffff",133 ".vjs-play-progress| .vjs-volume-level[background-color]": "#2c97de",134 ".vjs-control-bar[font-size]:px": "17",135 ".vjs-big-play-button[background-color]": "rgba(44,151,222,0.8)",136 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "rgba(44,151,222,0.9)",137 ".vjs-big-play-button[font-size]:em": "2.5",138 ".vjs-big-play-button[border-radius]:percent": "50",139 ".vjs-big-play-button[height]:emimportant": "2",140 ".vjs-big-play-button[line-height]:emimportant": "2",141 ".vjs-big-play-button[margin-top]:emimportant": "-1",142 "radius:skip": "2",143 ".vjs-loading-spinner[border-color]": "#2c97de",144 "customcss:skip": ".video-js .vjs-big-play-button {\r\n height: 2em !important;\r\n width: 2em !important;\r\n line-height: 1.7em !important;\r\n margin-top: -1em !important;\r\nmargin-left: -1em;\r\nborder-width:4px\r\n}\r\n .video-js .vjs-icon-play:before, .video-js .vjs-big-play-button:before {\r\n font-size: 40px;\r\n}\r\n.video-js .vjs-progress-holder {\r\n font-size: 1.7em;\r\nborder-radius: 10px;\r\n}\r\n.video-js .vjs-progress-holder .vjs-play-progress, .video-js .vjs-progress-holder .vjs-load-progress, .video-js .vjs-progress-holder .vjs-load-progress div, .video-js .vjs-slider,.vjs-volume-level {\r\n border-radius: 10px;\r\n}\r\n.video-js .vjs-load-progress {\r\n background: rgba(255,255,255,0.5);\r\n}\r\n.video-js, .video-js video, .vjs-poster, .video-js .vjs-tech {\r\n border-radius: 8px;\r\n}"145}, {146 "skin:skip": "Rotten Tomatoes",147 "vsg-skins:skip": "default",148 ".vjs-control-bar[font-size]:px": "11",149 ".vjs-control-bar2[background-color]": "#3a9425",150 ".vjs-control-bar[background-color]:important": "#3a9425",151 ".vjs-play-progress| .vjs-volume-level[background-color]": "#f3ec1a",152 ".vjs-control-bar[color]": "#ffffff",153 ".vjs-big-play-button[background-color]": "rgba(58,148,37,0.7)",154 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "#3a9425",155 ".vjs-big-play-button[border-radius]:percent": "15",156 ".vjs-big-play-button[font-size]:em": "3",157 ".vjs-big-play-button[height]:emimportant": "1.8",158 ".vjs-big-play-button[line-height]:emimportant": "1.8",159 ".vjs-big-play-button[margin-top]:emimportant": "-0.9",160 "radius:skip": "1.8",161 ".vjs-loading-spinner[border-color]": "#3a9425",162 "customcss:skip": ".video-js .vjs-slider {\r\n background-color: #3b3d41\r\n}\r\n.video-js .vjs-load-progress {\r\n background: rgba(252,249,133,0.7);\r\n}\r\n.video-js .vjs-big-play-button {\r\n color: #f3ec1a;\r\n border-color: #f3ec1a;\r\n}"163}, {164 "skin:skip": "twitch.tv",165 "vsg-skins:skip": "vsg",166 ".vjs-control-bar[font-size]:px": "12",167 ".vjs-control-bar2[background-color]": "#000000",168 ".vjs-control-bar[background-color]:important": "rgba(0,0,0,0.4)",169 ".vjs-control-bar[color]": "#ffffff",170 ".vjs-play-progress| .vjs-volume-level[background-color]": "#b99beb",171 ".vjs-big-play-button[background-color]": "rgba(0,0,0,0)",172 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "rgba(0,0,0,0)",173 ".vjs-big-play-button[border-radius]:percent": "0",174 ".vjs-big-play-button[font-size]:em": "8",175 ".vjs-big-play-button[height]:emimportant": "1",176 ".vjs-big-play-button[line-height]:emimportant": "1",177 ".vjs-big-play-button[margin-top]:emimportant": "-0.5",178 "radius:skip": "1",179 ".vjs-loading-spinner[border-color]": "#b99beb",180 "customcss:skip": ".video-js .vjs-load-progress {\r\n background: rgba(255,255,255,0.8);\r\n}\r\n.video-js .vjs-big-play-button:hover{\r\n color: #b99beb ;\r\n}\r\n.video-js .vjs-control:focus:before, .video-js .vjs-control:hover:before {\r\n color: #b99beb ;\r\n text-shadow:none\r\n}"181}, {182 "skin:skip": "Reset",183 "vsg-skins:skip": "default",184 ".vjs-control-bar2[background-color]": "#000000",185 ".vjs-control-bar[background-color]:important": "",186 ".vjs-control-bar[color]": "",187 ".vjs-play-progress| .vjs-volume-level[background-color]": "",188 ".vjs-control-bar[font-size]:px": "10",189 ".vjs-big-play-button[background-color]": "",190 "@hover .vjs-big-play-button|.vjs-big-play-button@focus|.vjs-big-play-button@active[background-color]": "",191 ".vjs-big-play-button[font-size]:em": "3",192 ".vjs-big-play-button[border-radius]:percent": "12",193 ".vjs-big-play-button[height]:emimportant": "1.7",194 ".vjs-big-play-button[line-height]:emimportant": "1.7",195 ".vjs-big-play-button[margin-top]:emimportant": "-0.85",196 "radius:skip": "1.7",197 ".vjs-loading-spinner[border-color]": "",198 "customcss:skip": ""...

Full Screen

Full Screen

ai.service.ts

Source:ai.service.ts Github

copy

Full Screen

1import { Injectable, OnDestroy } from '@angular/core';2import { Subject, Observable, zip, merge, of } from 'rxjs';3import { withLatestFrom, map, switchMap, filter, tap, startWith, takeUntil, share, scan, delay } from 'rxjs/operators';4import { CardService, Card } from '@mtg-devs/api';5import { TableZone, TableCardMoved } from '@mtg-devs/components';6import { AiPlayTemplate, AiPlay, AI_PLAY, AiPlayType } from './ai-model';7import { PlayTestAiHandStore } from '../store/play-test-ai-hand-store';8import { PlayTestBattlefieldStore } from '../store/play-test-battlefield-store';9import { PlayTestLandStore } from '../store/play-test-land-store';10@Injectable({ providedIn: 'root' })11export class AiService implements OnDestroy {12 private tickSub = new Subject<void>();13 private responseSub = new Subject<boolean>();14 private destroySub = new Subject<void>();15 private drawModuloSub = new Subject<number>();16 private hand$: Observable<AiPlayTemplate[]>;17 private playCard$: Observable<AiPlay | null>;18 private battlefield$: Observable<Card[]> = this.battlefield.get();19 private land$: Observable<Card[]> = this.land.get();20 private cardOnStack$: Observable<Card | null>;21 private resolvedPlay$: Observable<AiPlay>;22 private aiPlays: AiPlayTemplate[] = [];23 constructor(24 private cardService: CardService,25 private hand: PlayTestAiHandStore,26 private battlefield: PlayTestBattlefieldStore,27 private land: PlayTestLandStore28 ) {29 this.buildObservables();30 }31 tick(): void {32 this.tickSub.next();33 }34 respond(resolve: boolean): void {35 this.responseSub.next(resolve);36 }37 init(drawModulo: number, aiPlays: AiPlayTemplate[]): void {38 this.hand.clear();39 this.aiPlays = aiPlays;40 this.drawModuloSub.next(drawModulo);41 }42 getAiMovedCard(): Observable<TableCardMoved> {43 return this.resolvedPlay$.pipe(44 filter(play => play && play.template.type === AiPlayType.Interaction),45 map(play => {46 return {47 card: play.target,48 source: play.source,49 target: play.template.resolutionZone50 };51 })52 );53 }54 getCardOnStack(): Observable<Card | null> {55 return this.cardOnStack$;56 }57 getAiAddPermanent(): Observable<AiPlayTemplate> {58 return this.resolvedPlay$.pipe(59 filter(play => play && play.template.type === AiPlayType.Permanent),60 map(play => play.template)61 );62 }63 getAiHandSize(): Observable<number> {64 return this.hand.get().pipe(65 map(plays => plays.length)66 );67 }68 drawCard(amount: number = 1): void {69 while (amount--) {70 this.hand.add(this.getRandom(this.aiPlays));71 }72 }73 discardCard(amount: number = 1): void {74 while (amount--) {75 this.hand.pop();76 }77 }78 private buildObservables(): void {79 this.hand$ = this.hand.get().pipe(80 switchMap(plays => {81 if (plays.length === 0) {82 return of([]);83 }84 return zip(...plays.map(play => {85 return this.cardService.getCard(play.cardName).pipe(86 map(card => Object.assign(play, { card }))87 );88 }));89 })90 );91 this.playCard$ = this.tickSub.pipe(92 delay(0), // wait for stores to update at beginning of turn93 withLatestFrom(this.hand$, this.battlefield$, this.land$),94 map(([, cards, battlefield, land]) => this.findPlay(cards, battlefield, land)),95 share()96 );97 this.resolvedPlay$ = this.playCard$.pipe(98 filter(play => !!play),99 switchMap(card => this.responseSub.pipe(map(resolve => resolve ? card : null)))100 );101 this.cardOnStack$ = merge(this.responseSub, this.playCard$).pipe(102 map(response => (!response || typeof response === 'boolean') ? null : response.template.card),103 startWith(null as Card)104 );105 this.resolvedPlay$106 .pipe(takeUntil(this.destroySub))107 .subscribe(play => this.hand.remove(play.template));108 const drawCard$ = merge(this.drawModuloSub, this.tickSub).pipe(109 scan((acc, curr) => typeof curr === 'number' ? 0 : acc + 1, 0),110 withLatestFrom(this.drawModuloSub),111 filter(([counter, drawModulo]) => counter % drawModulo === 0)112 );113 drawCard$114 .pipe(takeUntil(this.destroySub))115 .subscribe(() => this.drawCard());116 }117 private findPlay(hand: AiPlayTemplate[], battlefield: Card[], land: Card[]): AiPlay | null {118 const interactions = hand.filter(play => play.type === AiPlayType.Interaction);119 const permanents = hand.filter(play => play.type === AiPlayType.Permanent);120 return this.findInteractionPlay(interactions, battlefield, land) || this.findPermanentPlay(permanents);121 }122 private findPermanentPlay(permanents: AiPlayTemplate[]): AiPlay | null {123 const play = this.getRandom(permanents);124 return play ? { template: play } : null;125 }126 private findInteractionPlay(hand: AiPlayTemplate[], battlefield: Card[], land: Card[]): AiPlay | null {127 const plays = [128 this.findInteractionPlayInZone(hand, battlefield, TableZone.Battlefield),129 this.findInteractionPlayInZone(hand, land, TableZone.Land)130 ];131 return plays132 .filter(play => !!play)133 .sort((a, b) => b.score - a.score)[0] || null;134 }135 private findInteractionPlayInZone(plays: AiPlayTemplate[], cards: Card[], zone: TableZone): AiPlay | null {136 const playsForZone = plays.filter(play => this.legalZone(play, zone));137 const optimalPlay = playsForZone.reduce((acc, curr) => {138 const target = this.legalTargetWithHighestCmc(curr, cards);139 if (!curr.card) {140 console.warn(`AI tried to play ${curr.cardName}, but found no such card in magic.`); // tslint:disable-line141 return acc;142 }143 if (target) {144 const score = target.convertedManaCost / (curr.card.convertedManaCost || 1);145 if (!acc || score > acc.score) {146 return {147 template: curr,148 source: zone,149 score,150 target151 };152 }153 }154 return acc;155 }, null as AiPlay | null);156 return optimalPlay;157 }158 private legalTargetWithHighestCmc(play: AiPlayTemplate, cards: Card[]): Card | null {159 const legalTargets = cards160 .filter(card => card.types.some(type => play.target.types.includes(type)))161 .sort((a, b) => b.convertedManaCost - a.convertedManaCost);162 return legalTargets[0] || null;163 }164 private legalZone(play: AiPlayTemplate, zone: TableZone): boolean {165 return play.target.zones.some(z => z === zone);166 }167 private getRandom(plays: AiPlayTemplate[]): AiPlayTemplate {168 return plays[Math.floor(Math.random() * plays.length)];169 }170 ngOnDestroy(): void {171 this.destroySub.next();172 this.destroySub.complete();173 }...

Full Screen

Full Screen

js-functions.js

Source:js-functions.js Github

copy

Full Screen

2 get() {},3 get(arg) {},4 set() {},5 set(arg) {},6 play() {},7 play(arg) {},8 'play'() {},9 'play'(arg) {},10 *play() {},11 *play(arg) {},12 async play() {},13 async play(arg) {},14 get play() {},15 set play(arg) {},16 *'play'() {},17 *'play'(arg) {},18 async 'play'() {},19 async 'play'(arg) {},20 get 'play'() {},21 set 'play'(arg) {},22 [Play.name()]() {},23 [Play.name()[]](arg) {},24 *[Play.name()]() {},25 *[Play.name()](arg) {},26 async [Play.name()]() {},27 async [Play.name()](arg) {},28 get [Play.name()]() {},29 set [Play.name()](arg) {},30 0() {},31 0(arg) {},32 *0() {},33 *0(arg) {},34 async 0() {},35 async 0(arg) {},36 get 0() {},37 set 0(arg) {},38 play: function() {},39 play: function(arg) {},40 play: function*() {},41 play: function*(arg) {},42 play: async function() {},43 play: async function(arg) {},44 play: async function*() {},45 play: async function*(arg) {},46 play: async () => {},47 play: async (arg) => {},48 play: async arg => {},49 play: () => {},50 play: (arg) => {},51 play: arg => {},52 "play": function() {},53 "play": function(arg) {},54 "play": function*() {},55 "play": function*(arg) {},56 "play": async function() {},57 "play": async function(arg) {},58 "play": async function*() {},59 "play": async function*(arg) {},60 "play": async () => {},61 "play": async (arg) => {},62 "play": async arg => {},63 "play": () => {},64 "play": (arg) => {},65 "play": arg => {},66 [play]: function() {},67 [play]: function(arg) {},68 [play]: function*() {},69 [play]: function*(arg) {},70 [play]: async function() {},71 [play]: async function(arg) {},72 [play]: async function*() {},73 [play]: async function*(arg) {},74 [play]: async () => {},75 [play]: async (arg) => {},76 [play]: async arg => {},77 [play]: () => {},78 [play]: (arg) => {},79 [play]: arg => {}80}81class Sound<T, T> extends Model<T, T> {82 get() {}83 get(arg) {}84 set() {}85 set(arg) {}86 *get() {}87 *get(arg) {}88 *set() {}89 *set(arg) {}90 async get() {}91 async get(arg) {}92 async set() {}93 async set(arg) {}94 static get() {}95 static get(arg) {}96 static set() {}97 static set(arg) {}98 static *get() {}99 static *get(arg) {}100 static *set() {}101 static *set(arg) {}102 static async get() {}103 static async get(arg) {}104 static async set() {}105 static async set(arg) {}106 static get get() {}107 static set set(arg) {}108 play() {}109 play(arg) {}110 'play'() {}111 'play'(arg) {}112 *play() {}113 *play(arg) {}114 *'play'() {}115 *'play'(arg) {}116 async play() {}117 async play(arg) {}118 get play() {}119 set play(arg) {}120 static play() {}121 static play(arg) {}122 static *play() {}123 static *play(arg) {}124 static async play() {}125 static async play(arg) {}126 static get play() {}127 static set play(arg) {}128 0() {}129 0(arg) {}130 *0() {}131 *0(arg) {}132 async 0() {}133 async 0(arg) {}134 get 0() {}135 set 0(arg) {}136 static 0() {}137 static 0(arg) {}138 static *0() {}139 static *0(arg) {}140 static async 0() {}141 static async 0(arg) {}142 [play]() {}143 [play](arg) {}144 *[play]() {}145 *[play](arg) {}146 async [play]() {}147 async [play](arg) {}148 get [play]() {}149 set [play](arg) {}150 static [play]() {}151 static [play](arg) {}152 static *[play]() {}153 static *[play](arg) {}154 static async [play]() {}155 static async [play](arg) {}156 static get [play]() {}157 static set [play](arg) {}158}159Sound160Sound()161Sound = {}162Sound.play163Sound[play]164Sound.play()165Sound[play]()166Sound.play = {}167Sound[play] = {}168Sound.prototype169Sound.prototype()170Sound.prototype = {}171Sound.prototype.play172Sound.prototype.play()173Sound.prototype[play]()174Sound.prototype.play =175Sound.prototype[play] =176Sound.play.repeat177Sound[play].repeat178Sound.play.repeat()179Sound[play].repeat()180Sound.play.repeat = {}181Sound[play].repeat = {}182Sound.prototype.play = function() {}183Sound.prototype.play = function(arg) {}184Sound.prototype.play = function*() {}185Sound.prototype.play = function*(arg) {}186Sound.prototype.play = async function() {}187Sound.prototype.play = async function(arg) {}188Sound.prototype.play = async function*() {}189Sound.prototype.play = async function*(arg) {}190Sound.prototype.play = async () => {}191Sound.prototype.play = async (arg) => {}192Sound.prototype.play = async arg => {}193Sound.prototype.play = () => {}194Sound.prototype.play = (arg) => {}195Sound.prototype.play = arg => {}196Sound.play = function() {}197Sound.play = function(arg) {}198Sound.play = function*() {}199Sound.play = function*(arg) {}200Sound.play = async function() {}201Sound.play = async function(arg) {}202Sound.play = async function*() {}203Sound.play = async function*(arg) {}204Sound.play = async () => {}205Sound.play = async (arg) => {}206Sound.play = async arg => {}207Sound.play = () => {}208Sound.play = (arg) => {}209Sound.play = arg => {}210play = function() {}211play = function(arg) {}212play = function*() {}213play = function*(arg) {}214play = async function() {}215play = async function(arg) {}216play = async function*() {}217play = async function*(arg) {}218play = async () => {}219play = async (arg) => {}220play = async arg => {}221play = () => {}222play = (arg) => {}223play = arg => {}224return function() {}225return function(arg) {}226return function*() {}227return function*(arg) {}228return async function() {}229return async function(arg) {}230return async function*() {}231return async function*(arg) {}232return async () => {}233return async (arg) => {}234return async arg => {}235return () => {}236return (arg) => {}237return arg => {}238return function play() {}239return function play(arg) {}240return function* play() {}241return function* play(arg) {}242return async function play() {}243return async function play(arg) {}244return async function* play() {}245return async function* play(arg) {}246yield genfunc;247yield* genfunc;248// Not matched as function definitions249Sound[play] = function(){}...

Full Screen

Full Screen

audioPlayer.js

Source:audioPlayer.js Github

copy

Full Screen

...3738function playAudio() {39 audio.src = playList[playNum].src;40 audio.currentTime = timeCurrent;41 audio.play();42}4344function removeClass() {45 btnPlay.classList.remove('pause');46 buttonsPlay[playNum].classList.remove('pause');47}4849function addClass() {50 btnPlay.classList.add('pause');51 buttonsPlay[playNum].classList.add('pause');52}5354export function toggleBtn() {55 if(!isPlay) {56 addClass();57 playAudio();58 isPlay = true;59 } else {60 removeClass();61 audio.pause();62 isPlay = false;63 }64}6566export function playTrack(index) {67 if(index != playNum) {68 timeCurrent = 0;69 }70 playItems[playNum].classList.remove('item-active');71 playNum = index;72 toggleBtn();73 playItems[playNum].classList.add('item-active');74}7576export function playNext() {77 removeClass();78 playNum++;79 if(playNum == playList.length) {80 playNum = 0;81 }82 addClass();83 isPlay = true;84 playAudio();85}8687export function playPrev() {88 removeClass();89 playNum--;90 if(playNum < 0) {91 playNum = playList.length-1;92 }93 addClass();94 isPlay = true;95 playAudio();96}9798export function playNextAudio() {99 audio.currentTime = 0;100 progress.value = 0;101 playItems[playNum].classList.remove('item-active');102 buttonsPlay[playNum].classList.remove('pause');103 playNum++;104 if(playNum == playList.length) {105 playNum = 0;106 }107 playItems[playNum].classList.add('item-active');108 buttonsPlay[playNum].classList.add('pause');109 audio.src = playList[playNum].src;110 audio.play();111}112113export function changeVolume() {114 const value = this.value;115 this.style.background = `linear-gradient(to right, #C5B358 0%, #C5B358 ${value}%, #fff ${value}%, #fff 100%)`;116 if(value == 0) {117 toggleSound();118 audio.volume = value / 100;119 } else {120 audio.volume = value / 100;121 btnSoundActive();122 audio.muted = false;123 }124} ...

Full Screen

Full Screen

views.py

Source:views.py Github

copy

Full Screen

1from django.http import Http404, HttpResponseRedirect2from django.core.urlresolvers import reverse3from django.shortcuts import render4from games.forms import PlayForm5from api.models import Game, Play, Post6from api.views import Week7from libs.gfycat import gfycat8def scoreboard(request, week_id='R_1'):9 wc_dict = week_choices_dict()10 context = {}11 context['week_choices_tuples'] = zip(wc_dict['week_choices'], wc_dict['week_choice_ids'])12 context['games'] = Week.games_for_weekid(week_id)13 return render(request, 'games/scoreboard.html', context)14def scoreboard_table(request, week_id):15 context = {'games': Week.games_for_weekid(week_id)}16 return render(request, 'games/scoreboard_table.html', context)17def game_detail(request, gamekey):18 try:19 game = Game.objects.get(gamekey=gamekey)20 except:21 raise Http40422 context = dict()23 if request.method == 'GET':24 if 'edit' in request.GET.keys():25 play_id = request.GET['play_id']26 play = Play.objects.get(id=play_id)27 play_form = PlayForm(game.away_team, game.home_team, instance=play)28 context['edit'] = True29 context['play'] = play30 else:31 play_form = PlayForm(game.away_team, game.home_team)32 if request.method == 'POST':33 if 'delete' in request.POST.keys():34 play_id = request.POST['play_id']35 play = Play.objects.get(id=play_id)36 play.delete()37 play_form = PlayForm(game.away_team, game.home_team)38 else:39 if 'edit' in request.POST.keys():40 print 'get form'41 play_id = request.POST['play_id']42 print play_id43 play = Play.objects.get(id=play_id)44 context['edit'] = True45 context['play'] = play46 play_form = PlayForm(game.away_team, game.home_team, request.POST, instance=play)47 else:48 play_form = PlayForm(game.away_team, game.home_team, request.POST)49 # check whether it's valid:50 if play_form.is_valid():51 # process the data in form.cleaned_data as required52 # ...53 # redirect to a new URL:54 play = play_form.save(commit=False)55 if play_form.cleaned_data['gfy_id']:56 mp4_url = gfycat().more(play_form.cleaned_data['gfy_id']).get('mp4Url')57 play.mp4_url = mp4_url58 play.gamekey = gamekey59 play.post = Post.objects.create(text=play.text)60 play.save()61 if 'edit' in context:62 return HttpResponseRedirect(reverse('game-detail', kwargs={'gamekey':gamekey}))63 play_form = PlayForm(game.away_team, game.home_team, instance=play)64 else:65 print 'not valid'66 print play_form.errors67 # return HttpResponseRedirect(reverse('game-detail', gamekey=gamekey))68 context['game'] = game69 context['plays'] = Play.objects.filter(gamekey=gamekey).order_by('-quarter', 'time')70 context['play_form'] = play_form71 print context72 return render(request, 'games/game_detail.html', context)73def week_choices_dict():74 return {75 "week_choices" : [76 "1",77 "2",78 "3",79 "4",80 "5",81 "6",82 "7",83 "8",84 "9",85 "10",86 "11",87 "12",88 "13",89 "14",90 "15",91 "16",92 "17"93 ],94 "week_choice_ids" : [95 "R_1",96 "R_2",97 "R_3",98 "R_4",99 "R_5",100 "R_6",101 "R_7",102 "R_8",103 "R_9",104 "R_10",105 "R_11",106 "R_12",107 "R_13",108 "R_14",109 "R_15",110 "R_16",111 "R_17",112 ]...

Full Screen

Full Screen

buzzer.py

Source:buzzer.py Github

copy

Full Screen

1from machine import Pin, PWM2from utime import sleep3from micropython import const4#notes5G3 = const(196)6C4 = const(262)7D4 = const(294)8E4 = const(330)9F4 = const(349)10G4 = const(392)11A4 = const(440)12B4 = const(494)13C5 = const(524)14rest = const(0)15#duration16whole = const(8)17half = const(4)18quarter = const(2)19eighth = const(1)20class buzzer():21 22 def __init__(self, pin):23 self.pin = PWM(Pin(pin))24 self.tempo = 12025 self.duty = 3276726 self.pin.duty_u16(0)27 28 def play_note(self, note, duration):29 if note == 0:30 sleep(((duration*(1/self.tempo))/2)*60)31 return32 self.pin.freq(note)33 self.pin.duty_u16(self.duty)34 sleep(((duration*(1/self.tempo))/2)*60)35 self.pin.duty_u16(0)36 sleep(0.01)37 38 def play_scale(self):39 self.play_note(C4, quarter)40 self.play_note(D4, quarter)41 self.play_note(E4, quarter)42 self.play_note(F4, quarter)43 self.play_note(G4, quarter)44 self.play_note(A4, quarter)45 self.play_note(B4, quarter)46 self.play_note(C5, quarter)47 self.play_note(C5, quarter)48 self.play_note(B4, quarter)49 self.play_note(A4, quarter)50 self.play_note(G4, quarter)51 self.play_note(F4, quarter)52 self.play_note(E4, quarter)53 self.play_note(D4, quarter)54 self.play_note(C4, quarter)55 56 def play_jingle(self):57 self.play_note(E4, quarter)58 self.play_note(E4, quarter)59 self.play_note(rest, quarter)60 self.play_note(E4, quarter)61 self.play_note(rest, quarter)62 self.play_note(C4, quarter)63 self.play_note(E4, quarter)64 self.play_note(rest, quarter)65 self.play_note(G4, quarter)66 self.play_note(rest, quarter)67 self.play_note(rest, half)68 self.play_note(G3, quarter)69 70 ...

Full Screen

Full Screen

playRoulette.py

Source:playRoulette.py Github

copy

Full Screen

1# let's play roulette2import PythonRoulette3reload(PythonRoulette)4from PythonRoulette import *5#import sys, os6## turn off print7#sys.stdout = open(os.devnull, 'w')8## restore print9#sys.stdout = sys.__stdout__ 10#play = roulette(rouletteStyle='American',bankAccount=100000.0)11#for i in range(0,1000000):12# play.roll(1,0)13# if play.bankAccount == 0.0:14# break15#play.rouletteStyle='American'16#play.roll(1,-1)17 18play = roulette(rouletteStyle='American', bankAccount=1000.0, betType='Color')19#play.roll(50,'Black')20# 21#play.betType = 'Straight'22#play.roll(100, -1)23play.rouletteStyle = 'French'24#play.betType = 'Color'25#play.roll(1,'Black')26#play.betType = 'Row'27#play.roll(5)28#play.betType = 'Split'29#play.roll(50,[1,9])30#play.betType = 'Street'31#play.roll(5,[1,2,-1])32#play.betType = 'Corner'33#play.roll(5,[1,0,2,36])34#play.betType = 'Line'35#play.roll(5,[-1,0,1,3,4,5])36#play.betType = 'Dozen'37#play.roll(5,[2,0,1,3,4,5,6,7,8,9,10,11])38#play.betType = 'Penta'39#play.roll(5, [1,2,3,4,-1])40#play.betType = 'EvenOdd'41#play.roll(5, 'Even')42play.betType ='MultiStraight'43play.roll(5,[-1,2])44## plot roll history45#import matplotlib.pyplot as plt46#bins = range(-1, 38)47#plt.figure()48#plt.hist(play.rollHistory, bins)49#plt.title('The roll histogram')50#plt.xlabel('Number rolled')51#plt.ylabel('Quantity of rolls')...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2stryker.play();3var stryker = require('stryker-child');4stryker.play();5var stryker = require('stryker-parent');6stryker.play();7delete require.cache[require.resolve('stryker-parent')];8var stryker = require('stryker-child');9stryker.play();10var stryker = require('stryker-parent');11stryker.play();12delete require.cache[require.resolve(module.parent.filename)];13var stryker = require('stryker-child');14stryker.play();15var stryker = require('stryker-parent');16stryker.play();

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2strykerParent.play();3module.exports = {4 play: function() {5 console.log('Playing!');6 }7};8{9}10var strykerParent = require('stryker-parent');11strykerParent.play();12var strykerChild = require('stryker-child');13module.exports = {14 play: function() {15 strykerChild.play();16 }17};18module.exports = {19 play: function() {20 console.log('Playing!');21 }22};23{24}25{26}

Full Screen

Using AI Code Generation

copy

Full Screen

1const stryker = require('stryker-parent');2stryker.play();3module.exports = {4 play: function () {5 console.log('Playing!');6 }7};8{9 "dependencies": {10 }11}12{13}

Full Screen

Using AI Code Generation

copy

Full Screen

1const stryker = require('stryker-parent');2module.exports = {3play: function (play) {4console.log(play);5}6};7{8}9module.exports = {10play: function (play) {11console.log(play);12}13};14{15}16module.exports = {17play: function (play) {18console.log(play);19}20};21{22}23module.exports = {24play: function (play) {25console.log(play);26}27};28{29}30module.exports = {31play: function (play) {32console.log(play);33}34};35{36}37module.exports = {38play: function (play) {39console.log(play);40}41};42{43}

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2strykerParent.play();3var strykerParent = require('stryker-parent');4strykerParent.play();5var strykerParent = require('stryker-parent');6strykerParent.play();7var strykerParent = require('stryker-parent');8strykerParent.play();9var strykerParent = require('stryker-parent');10strykerParent.play();11var strykerParent = require('stryker-parent');12strykerParent.play();13var strykerParent = require('stryker-parent');14strykerParent.play();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stryker-parent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful