PageSourceSearch

https://angryjim.com/wp-content/plugins/se-html5-album-audio-player/js/niftyplayer/niftyplayer.js

js angryjim.com collected 2026-10-02 12:16:49 UTC 2,585 bytes, 101 lines download raw bytes

1// Script for NiftyPlayer 1.7, by tvst from varal.org
2// Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
3
4var FlashHelper =
5{
6	movieIsLoaded : function (theMovie)
7	{
8		if (typeof(theMovie) != "undefined") return theMovie.PercentLoaded() == 100;
9		else return
10		false;
11  },
12
13	getMovie : function (movieName)
14	{
15  	if (navigator.appName.indexOf ("Microsoft") !=-1) return window[movieName];
16	  else return document[movieName];
17	}
18};
19
20function niftyplayer(name)
21{
22	this.obj = FlashHelper.getMovie(name);
23
24	if (!FlashHelper.movieIsLoaded(this.obj)) return;
25
26	this.play = function () {
27		this.obj.TCallLabel('/','play');
28	};
29
30	this.stop = function () {
31		this.obj.TCallLabel('/','stop');
32	};
33
34	this.pause = function () {
35		this.obj.TCallLabel('/','pause');
36	};
37
38	this.playToggle = function () {
39		this.obj.TCallLabel('/','playToggle');
40	};
41
42	this.reset = function () {
43		this.obj.TCallLabel('/','reset');
44	};
45
46	this.load = function (url) {
47		this.obj.SetVariable('currentSong', url);
48		this.obj.TCallLabel('/','load');
49	};
50
51	this.loadAndPlay = function (url) {
52		this.load(url);
53		this.play();
54	};
55
56	this.getState = function () {
57		var ps = this.obj.GetVariable('playingState');
58		var ls = this.obj.GetVariable('loadingState');
59
60		// returns
61		//   'empty' if no file is loaded
62		//   'loading' if file is loading
63		//   'playing' if user has pressed play AND file has loaded
64		//   'stopped' if not empty and file is stopped
65		//   'paused' if file is paused
66		//   'finished' if file has finished playing
67		//   'error' if an error occurred
68		if (ps == 'playing')
69			if (ls == 'loaded') return ps;
70			else return ls;
71
72		if (ps == 'stopped')
73			if (ls == 'empty') return ls;
74			if (ls == 'error') return ls;
75			else return ps;
76
77		return ps;
78
79	};
80
81	this.getPlayingState = function () {
82		// returns 'playing', 'paused', 'stopped' or 'finished'
83		return this.obj.GetVariable('playingState');
84	};
85
86	this.getLoadingState = function () {
87		// returns 'empty', 'loading', 'loaded' or 'error'
88		return this.obj.GetVariable('loadingState');
89	};
90
91	this.registerEvent = function (eventName, action) {
92		// eventName is a string with one of the following values: onPlay, onStop, onPause, onError, onSongOver, onBufferingComplete, onBufferingStarted
93		// action is a string with the javascript code to run.
94		//
95		// example: niftyplayer('niftyPlayer1').registerEvent('onPlay', 'alert("playing!")');
96
97		this.obj.SetVariable(eventName, action);
98	};
99
100	return this;
101}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.