├── README.md ├── d.js ├── dclient.js ├── djs.png ├── examples ├── .DS_Store ├── hackathon │ ├── .DS_Store │ ├── EXAMPLEREADME │ ├── app.js │ ├── node_modules │ │ ├── .DS_Store │ │ ├── .bin │ │ │ └── express │ │ ├── ejs │ │ ├── express │ │ ├── mongodb │ │ └── now │ ├── static │ │ ├── .DS_Store │ │ ├── d.js │ │ ├── master.css │ │ ├── nice.otf │ │ └── node_modules │ │ │ ├── .DS_Store │ │ │ ├── .bin │ │ │ └── express │ │ │ ├── djs │ │ │ ├── README.md │ │ │ ├── d.js │ │ │ └── package.json │ │ │ ├── ejs │ │ │ ├── express │ │ │ ├── mongodb │ │ │ └── now │ └── views │ │ ├── .DS_Store │ │ ├── d.js │ │ ├── index.ejs │ │ ├── porntable.ejs │ │ └── splash.ejs └── turntable │ ├── .DS_Store │ ├── app.js │ ├── node_modules │ ├── .DS_Store │ ├── .bin │ │ └── express │ ├── ejs │ ├── express │ ├── mongodb │ └── now │ ├── static │ ├── .DS_Store │ ├── bookfort.png │ ├── d.js │ ├── giggle.mp3 │ ├── js │ │ ├── .DS_Store │ │ ├── Jplayer.swf │ │ └── jquery.jplayer.min.js │ ├── mascot.png │ ├── master.css │ ├── nice.otf │ ├── node_modules │ │ ├── .DS_Store │ │ ├── .bin │ │ │ └── express │ │ ├── djs │ │ │ ├── README.md │ │ │ ├── d.js │ │ │ └── package.json │ │ ├── ejs │ │ ├── express │ │ ├── mongodb │ │ └── now │ ├── opening.mp3 │ └── skin │ │ ├── .DS_Store │ │ ├── jPlayer_blue.monday_extd.psd │ │ ├── jplayer.blue.monday.css │ │ ├── jplayer.blue.monday.jpg │ │ ├── jplayer.blue.monday.seeking.gif │ │ ├── jplayer.blue.monday.video.play.png │ │ └── spirites_blue.monday_2011.psd │ └── views │ ├── .DS_Store │ ├── d.js │ ├── index.ejs │ └── porntable.ejs └── package.json /README.md: -------------------------------------------------------------------------------- 1 | ###DJS makes media-sharing sites easy to make! 2 | 3 | Check out the github 4 | 5 | 6 | ##What is DJS? 7 | 8 | DJS is a Node.JS module built on top of Now and MongoDB. It is a media distribution framework. Simply spin up a Node server and plug DJS in and serve up all sorts of media in real-time with no server-side Javascript necessary. Media can mean anything from YouTube videos, pictures, and even webpages. We also support a public subscription model and groups, for discriminating customers. 9 | 10 | Install from npm 11 | ---------------- 12 | 13 | `npm install djs` or `npm install djs -g` for a global installation. You may have to also `npm install mongodb`. 14 | 15 | 16 | 17 | ##Public API 18 | 19 | ```javascript 20 | 21 | var server = express.createServer(...) 22 | var nowjs = require('now'); 23 | var everyone = nowjs.initialize(server, {socketio:{"log level": process.argv[2]}}); 24 | ... 25 | var dj = require('djs') 26 | dj.initialize(server, nowjs, everyone) 27 | 28 | ``` 29 | 30 | Note: Any arguments with * are optional 31 | 32 | #Bare Bones Server Side Functionality 33 | ------ 34 | 35 | now.SbroadcastMedia(mId, *roomId, callback) 36 | 37 | By default it tells all the clients to display whatever media is indicated by mId. Supplying the roomId will only display the media to users in that particular room. You must search for the mId you want using `SfindMedia`. The callback expects an argument `mediainfo`, which is a JSON object of this form. The callback has to be in the now space. 38 | 39 | ````javascript 40 | { 41 | path: path_to_media 42 | tags: [array, of, tags] 43 | metadata: JSON of your choice 44 | } 45 | ```` 46 | 47 | now.SfindMedia(searchQuery, callback) 48 | 49 | Crawls the database for media with the searchQuery as part of the tag and passes the result to the callback function as an array of JSON objects of this form: 50 | 51 | ````javascript 52 | { 53 | path: path_to_media 54 | tags: [array, of, tags] 55 | metadata: JSON of your choice 56 | } 57 | ```` 58 | 59 | now.SaddMedia(path, tags, metadata) 60 | 61 | Adds the media to the database. path is just the path to the media in question; tags is an array of strings. Metadata is a JSON object of your choice!!! 62 | 63 | now.SaddToRoom(roomId) 64 | 65 | Adds the user who calls this function to the room. If the room didn't exist before you made this call, you will create it. 66 | 67 | now.SleaveRoom(*roomId) 68 | 69 | By default, has the user who calls this function leave all the rooms, including the `everyone` namespace (i.e. a logout). When called with a roomId as an argument, has the user leave just that room. 70 | 71 | now.Sapply(functionName, *args, *roomId) 72 | 73 | By default, applies the callback function on all members of the `everyone` group, i.e. everybody who is on the server. Providing the optional `roomId` argument causes the callback to only be applied for members in the room. Note that the callback function must be in the now pocketspace. 74 | 75 | #Groups Server Side Functionality 76 | ----- 77 | now.SaddUser(uId) 78 | 79 | If you wish to use our groups functionality then you must let us know about the users in your system. Call this when you add a user to your own DB. 80 | 81 | now.SremoveUser(uId) 82 | 83 | Call this when you remove a user from your database. 84 | 85 | now.SloginUser(uId, *callback, *args) 86 | 87 | Call this when a user logs in to your application. This will put him back into all the groups that he was subscribed to. Optionally, you can have a callback be called after a user is logged out. Note that if you wish to provide arguments they must be an array of arguments to your callback. Also note that your callback function must be in the `everyone.now` pocketspace. 88 | 89 | The reason the callback is necessary is that login performs a database operation and so if you were to call Sapply on any group the user is logged in, the user won't receive the function since the user won't be added to the group for a while as database operations are expensive. 90 | 91 | now.SlogoutUser(uId) 92 | 93 | Call this when a user logs out of your application. This will remove him from the groups that he was subscribed to but we will remember to put him back in those groups when he logs back in. 94 | 95 | now.subscribeToGroup(uId, groupId) 96 | 97 | Subscribes a user to a group, and adds him to the group. 98 | 99 | now.unsubscribeToGroup(uId, groupId) 100 | 101 | Unsubscribes a user from a group, and removes him from the group. 102 | 103 | Keep in mind that these are different from NowJS groups because these groups will persist beyond client log-in and log-out. 104 | 105 | #Client Side Initialization 106 | 107 | 1. Include dclient.js on the client side. 108 | 2. Call initialize with a JSON object of this type: 109 | 110 | ````javascript 111 | initialize({ 112 | playback: playback(mediaInfo) 113 | }) 114 | ```` 115 | 116 | playback is your own provided function that takes mediaInfo as an argument. mediaInfo is of this form: 117 | 118 | ````javascript 119 | { 120 | path: path_to_media 121 | tags: [array, of, tags] 122 | metadata: JSON of your choice 123 | } 124 | ```` 125 | 126 | ##Quickest Start Guide (tl;dr) 127 | 1. Include djs server side. 128 | 2. Initialize the client playback function. 129 | 3. Be super productive. 130 | 131 | FAQ 132 | ------ 133 | **Q**: Did someone actually accidentally delete the entire codebase? 134 | 135 | A: No, he actually only deleted half of it. 136 | 137 | **Q**: What's up with the strange naming scheme? I don't like the C's and S's in front of your function names. 138 | 139 | A: It's because we've had trouble in the past writing code that utilized NowJS. Since it blurred the client server borders, we often got confused about whether functions were server-side or client-side, so to save us (and hopefully you!) from headaches we decided to do this. 140 | 141 | **Q**: What's the difference between rooms and groups? 142 | 143 | A: Rooms don't persist. If the server goes down, or the client disconnects, the client won't return to rooms they were connected to. Groups will persist. 144 | 145 | **Q**: What's up with your strange numbering scheme? Why does it start 146 | at 0.0.2? 147 | 148 | A: 0.0.0 was us claiming "djs" as a unique package name and 0.0.1 was us 149 | publishing something broken accidentally. Yes we realize we could have unpublished on npm but starting at 0.0.2 also lets us give the impression that we've already iterated once through a design cycle. 150 | 151 | Further Information 152 | ------------ 153 | We have two examples at the moment. They're both incredibly hacky, but they were also built in about 30 minutes from scratch each, which includes all the wayward Facebook browsing. Information on how to run them is included in READMEs present in each example folder. 154 | -------------------------------------------------------------------------------- /d.js: -------------------------------------------------------------------------------- 1 | var Db = require('mongodb').Db; 2 | var Connection = require('mongodb').Connection; 3 | var Server = require('mongodb').Server; 4 | 5 | var server 6 | var nowjs 7 | var everyone 8 | 9 | exports.initialize = function (theServer, nowObj, erryOne) { 10 | server = theServer 11 | nowjs = nowObj 12 | everyone = erryOne 13 | 14 | module.exports = everyone.now; 15 | 16 | var usercoll; 17 | var mediacoll; 18 | var db = new Db('djs', new Server("localhost", 27017, {}), {native_parser:false}); 19 | db.open(function(err, conn) { 20 | db = conn; 21 | db.collection('userinfo', function(err, coll) { 22 | usercoll = coll; 23 | }); 24 | db.collection('mediainfo', function(err, coll) { 25 | mediacoll = coll; 26 | }); 27 | }); 28 | 29 | everyone.now.SbroadcastMedia = function (mId, roomId) { 30 | var self = this 31 | if (roomId != undefined) { 32 | mediacoll.findOne({_id: new db.bson_serializer.ObjectID(mId)}, function (err, doc) { 33 | var room = nowjs.getGroup(roomId); 34 | room.now.playback(doc); 35 | }); 36 | } else { 37 | mediacoll.findOne({_id: new db.bson_serializer.ObjectID(mId)}, function (err, doc) { 38 | everyone.now.playback(doc); 39 | }); 40 | } 41 | } 42 | 43 | everyone.now.SgetCurrentMedia = function () { 44 | 45 | } 46 | 47 | everyone.now.SfindMedia = function (searchQuery, callback) { 48 | searchQuery = ("" + searchQuery).toLowerCase(); 49 | var self = this; 50 | if (searchQuery === "") { 51 | var cursor = mediacoll.find({}); 52 | cursor.toArray(function(err, array) { 53 | callback(array); 54 | }); 55 | } else { 56 | var cursor = mediacoll.find({tags: searchQuery}); 57 | cursor.toArray(function(err, array) { 58 | callback(array); 59 | }); 60 | } 61 | } 62 | 63 | everyone.now.SaddMedia = function (path, tags, metadata) { 64 | 65 | mediacoll.insert( 66 | { 67 | path: path, 68 | tags: tags, 69 | metadata: metadata 70 | }); 71 | } 72 | 73 | 74 | everyone.now.SaddToRoom = function (roomId) { 75 | var self = this; 76 | var group = nowjs.getGroup(roomId); 77 | group.addUser(self.user.clientId); 78 | 79 | } 80 | 81 | everyone.now.SleaveRoom = function (roomId) { 82 | var self = this; 83 | this.getGroups(function (groups) { 84 | if (roomId) { 85 | for (var i = groups.length; i--;) { 86 | if (groups[i] == roomId) { 87 | nowjs.getGroup(groups[i]).removeUser(self.user.clientId); 88 | } 89 | } 90 | } else { 91 | for (var i = groups.length; i--;) { 92 | nowjs.getGroup(groups[i]).removeUser(self.user.clientId); 93 | } 94 | } 95 | }); 96 | } 97 | 98 | everyone.now.Sapply = function (functionName, args, roomId) { 99 | var room 100 | var fn 101 | 102 | if (args === undefined && roomId === undefined) { //did not provide args or roomId 103 | roomId = "everyone" 104 | args = [] 105 | } else if (args instanceof Array && roomId === undefined) { //provided args 106 | roomId = "everyone" 107 | } else if (args instanceof String) { //provided roomId 108 | roomId = args 109 | args = [] 110 | } //provided errything 111 | var room = nowjs.getGroup(roomId); 112 | var fn = room.now[functionName] 113 | fn.apply(fn, args) 114 | } 115 | 116 | //groups prototypes 117 | everyone.now.SaddUser = function (uId) { 118 | var self = this; 119 | 120 | usercoll.insert( 121 | { 122 | uId: uId, 123 | groups: [ ] 124 | }); 125 | } 126 | 127 | everyone.now.SremoveUser = function (uId) { 128 | var self = this; 129 | 130 | usercoll.remove( 131 | { 132 | uId: uId 133 | }); 134 | } 135 | 136 | everyone.now.SloginUser = function (uId, callback, args) { 137 | var self = this; 138 | usercoll.findOne({uId: uId}, function (err,doc) { 139 | for( var i in doc.groups){ 140 | nowjs.getGroup(doc.groups[i]).addUser(self.user.clientId) 141 | } 142 | if (args) { 143 | var room = nowjs.getGroup('everyone') 144 | 145 | var fn = room.now[callback] 146 | fn.apply(fn, args) 147 | } else if (callback) { 148 | 149 | 150 | var room = nowjs.getGroup('everyone') 151 | var fn = room.now[callback] 152 | fn.apply(fn, []) 153 | } 154 | }); 155 | 156 | 157 | } 158 | 159 | everyone.now.SlogoutUser = function (uId, callback, args) { 160 | var self = this; 161 | usercoll.findOne({uId: uId}, function (err,doc) { 162 | for( var i in doc.groups){ 163 | nowjs.getGroup(doc.groups[i]).removeUser(self.user.clientId) 164 | } 165 | if (args) { 166 | var room = nowjs.getGroup('everyone') 167 | var fn = room.now[callback] 168 | fn.apply(fn, args) 169 | } else if (callback) { 170 | var room = nowjs.getGroup('everyone') 171 | var fn = room.now[callback] 172 | fn.apply(fn, []) 173 | } 174 | 175 | }); 176 | } 177 | 178 | everyone.now.subscribeToGroup = function (uId, groupId) { 179 | nowjs.getGroup(groupId).addUser(this.user.clientId); 180 | var self = this; 181 | usercoll.findOne({uId: uId}, function (err,doc) { 182 | var newdoc = doc.groups.push(groupId); 183 | usercoll.update({uId: uId}, doc, function (err, doc){ 184 | 185 | }); 186 | 187 | 188 | }); 189 | } 190 | 191 | everyone.now.unsubscribeFromGroup = function (uId, groupId){ 192 | nowjs.getGroup(groupId).removeUser(this.user.clientId); 193 | var self = this; 194 | usercoll.findOne({uId: uId}, function (err,doc) { 195 | var i = 0; 196 | while( doc.groups[i] != groupId && i < doc.groups.length ){ 197 | if (i == doc.groups.length-1){ 198 | return; 199 | } 200 | i = i + 1; 201 | } 202 | 203 | 204 | 205 | newdoc = doc.groups.splice(i,1); 206 | 207 | usercoll.update({groups: newdoc}, doc, function (err, doc){ 208 | 209 | }); 210 | }) 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /dclient.js: -------------------------------------------------------------------------------- 1 | var initialize = function(args) { 2 | now.playback = args.playback 3 | } 4 | 5 | -------------------------------------------------------------------------------- /djs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/djs.png -------------------------------------------------------------------------------- /examples/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/.DS_Store -------------------------------------------------------------------------------- /examples/hackathon/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/hackathon/.DS_Store -------------------------------------------------------------------------------- /examples/hackathon/EXAMPLEREADME: -------------------------------------------------------------------------------- 1 | How do I use this example??? 2 | 3 | Fire up app.js and navigate to two pages on two tabs: 4 | 5 | 1. localhost/: This is the client splash page. 6 | 2. localhost/admin: This is where you control the media distribution. The three boxes run as follows: 7 | a: link to media source. This can be: 8 | 1. The HTML for embedding a Soundcloud song on your page. 9 | 2. A direct link to an image 10 | 3. A link to an HTML5 YouTube video. 11 | b: A tag for the audio type. Can be: 12 | 1. mp3 13 | 2. pic 14 | 3. video 15 | c: A search term so you can find the media. 16 | 17 | On the admin page there is also a search bar where you can search for items by keywords. 18 | 19 | You can also just click "Find Media" to find all the media you have stored in your database. 20 | 21 | Simply click on whatever appears in the "RESULTS" div to play the media, which will show up both on the admin page and on the client page. 22 | -------------------------------------------------------------------------------- /examples/hackathon/app.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var dj = require('../../d'); 3 | var nowjs = require('now'); 4 | 5 | server = express.createServer(); 6 | 7 | var everyone = nowjs.initialize(server, {socketio:{"log level": process.argv[2]}}); 8 | 9 | dj.initialize(server, nowjs, everyone); 10 | 11 | server.set('view options', { 12 | layout: false 13 | }); 14 | 15 | server.set('view engine', 'ejs'); 16 | 17 | // Configuration 18 | server.use(express.errorHandler({ dumpExceptions: true, showStack: true })); 19 | server.set('views', __dirname + '/views'); 20 | server.use(express.static(__dirname + '/static')); 21 | 22 | 23 | 24 | server.get('/', function (req, res){ 25 | res.render("splash"); 26 | }); 27 | 28 | server.get('/admin', function (req, res) { 29 | res.render("porntable"); 30 | }) 31 | 32 | server.listen(80); 33 | console.log("Express server listening on port %d", server.address().port); 34 | -------------------------------------------------------------------------------- /examples/hackathon/node_modules/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/hackathon/node_modules/.DS_Store -------------------------------------------------------------------------------- /examples/hackathon/node_modules/.bin/express: -------------------------------------------------------------------------------- 1 | ../express/bin/express -------------------------------------------------------------------------------- /examples/hackathon/node_modules/ejs: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/ejs -------------------------------------------------------------------------------- /examples/hackathon/node_modules/express: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/express -------------------------------------------------------------------------------- /examples/hackathon/node_modules/mongodb: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/mongodb -------------------------------------------------------------------------------- /examples/hackathon/node_modules/now: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/now -------------------------------------------------------------------------------- /examples/hackathon/static/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/hackathon/static/.DS_Store -------------------------------------------------------------------------------- /examples/hackathon/static/d.js: -------------------------------------------------------------------------------- 1 | var initialize = function(args) { 2 | now.playback = args.playback 3 | } 4 | 5 | -------------------------------------------------------------------------------- /examples/hackathon/static/master.css: -------------------------------------------------------------------------------- 1 | @font-face { font-family: Nice; src: url('nice.otf'); } 2 | 3 | body { 4 | background: #222; 5 | color: #FFFFFF; 6 | text-align:center; 7 | margin:0 auto; 8 | } 9 | 10 | #title { 11 | margin-top: 40px; 12 | padding: 15px; 13 | height: 90px; 14 | font-size: 80px; 15 | text-shadow: 0 1px 1px #000; 16 | color: #fff; 17 | font-family: Nice; 18 | } -------------------------------------------------------------------------------- /examples/hackathon/static/nice.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/hackathon/static/nice.otf -------------------------------------------------------------------------------- /examples/hackathon/static/node_modules/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/hackathon/static/node_modules/.DS_Store -------------------------------------------------------------------------------- /examples/hackathon/static/node_modules/.bin/express: -------------------------------------------------------------------------------- 1 | ../express/bin/express -------------------------------------------------------------------------------- /examples/hackathon/static/node_modules/djs/README.md: -------------------------------------------------------------------------------- 1 | ###DJS makes media-sharing sites easy to make! 2 | 3 | Check out the github 4 | 5 | Install from npm (doesn't actually work yet) 6 | ---------------- 7 | 8 | `npm install djs` or `npm install djs -g` for a global installation. 9 | 10 | DJS is a Node.JS module built on top of Now and MongoDB 11 | 12 | ##Public API 13 | 14 | ```javascript 15 | 16 | var server = express.createServer(...) 17 | ... 18 | var dj = require('djs') 19 | dj.initialize(server) 20 | 21 | ``` 22 | 23 | Note: Any arguments with * are optional 24 | 25 | #Bare Bones Server Side Functionality 26 | ------ 27 | 28 | now.SbroadcastMedia(mId, *roomId, callback) 29 | 30 | By default it tells all the clients to display whatever media is indicated by mId. Supplying the roomId will only display the media to users in that particular room. You must search for the mId you want using `SfindMedia`. The callback expects an argument `mediainfo`, which is a JSON object of this form. The callback has to be in the now space. 31 | 32 | ````javascript 33 | { 34 | path: path_to_media 35 | tags: [array, of, tags] 36 | metadata: JSON of your choice 37 | } 38 | ```` 39 | 40 | now.SfindMedia(searchQuery, callback) 41 | 42 | Crawls the database for media with the searchQuery as part of the tag and passes the result to the callback function as an array of JSON objects of this form: 43 | 44 | ````javascript 45 | { 46 | path: path_to_media 47 | tags: [array, of, tags] 48 | metadata: JSON of your choice 49 | } 50 | ```` 51 | 52 | now.SaddMedia(path, tags, metadata) 53 | 54 | Adds the media to the database. path is just the path to the media in question; tags is an array of strings. Metadata is a JSON object of your choice!!! 55 | 56 | now.SaddToRoom(roomId) 57 | 58 | Adds the user who calls this function to the room. 59 | 60 | now.SleaveRoom(*roomId) 61 | 62 | By default, has the user who calls this function leave all the rooms, including the `everyone` namespace (i.e. a logout). When called with a roomId as an argument, has the user leave just that room. 63 | 64 | #Groups Server Side Functionality 65 | ----- 66 | now.SaddUser(uId) 67 | 68 | Adds a user into our personal database. 69 | 70 | now.SremoveUser(uId) 71 | 72 | Removes a user from our personal database. 73 | 74 | now.SloginUser(uId) 75 | 76 | Logs a user out of our personal database. 77 | 78 | now.subscribeToGroup(uId, groupId) 79 | 80 | Subscribes a user to a group. 81 | 82 | now.unsubscribeToGroup(uId, groupId) 83 | 84 | Unsubscribes a user from a group. 85 | 86 | Inserts a user into our personal userdatabase. 87 | 88 | #Client Side Initialization 89 | 90 | 1. Include d.js on the client side. 91 | 2. Call initialize with a JSON object of this type: 92 | ````javascript 93 | initialize({ 94 | playback: playback(mediaInfo) 95 | }) 96 | 97 | ```` 98 | playback is your own provided function that takes mediaInfo as an argument. mediaInfo is of this form: 99 | 100 | ````javascript 101 | { 102 | path: path_to_media 103 | tags: [array, of, tags] 104 | metadata: JSON of your choice 105 | } 106 | ```` 107 | 108 | ##Quickest Start Guide 109 | 1. Include djs server side. 110 | 2. Initialize the client stuff. 111 | 112 | FAQ 113 | ------ 114 | **Q**: Did someone actually accidentally delete the entire codebase? 115 | 116 | A: No, he actually only deleted half of it. 117 | 118 | **Q**: What's up with the strange naming scheme? I don't like the C's and S's in front of your function names. 119 | 120 | A: It's because we've had trouble in the past writing code that utilized NowJS. Since it blurred the client server borders, we often got confused about whether functions were server-side or client-side, so to save us (and hopefully you!) from headaches we decided to do this. 121 | 122 | Further Information 123 | ------------ 124 | Rainbow Dash is the best pony <3 125 | -------------------------------------------------------------------------------- /examples/hackathon/static/node_modules/djs/d.js: -------------------------------------------------------------------------------- 1 | var nowjs = require('now'); 2 | var Db = require('mongodb').Db; 3 | var Connection = require('mongodb').Connection; 4 | var Server = require('mongodb').Server; 5 | 6 | var server 7 | exports.initialize = function (theServer) { 8 | server = theServer 9 | var everyone = nowjs.initialize(server, {socketio:{"log level": process.argv[2]}}); 10 | 11 | module.exports = everyone.now; 12 | 13 | var usercoll; 14 | var mediacoll; 15 | var db = new Db('djs', new Server("localhost", 27017, {}), {native_parser:false}); 16 | db.open(function(err, conn) { 17 | db = conn; 18 | db.collection('userinfo', function(err, coll) { 19 | usercoll = coll; 20 | }); 21 | db.collection('mediainfo', function(err, coll) { 22 | mediacoll = coll; 23 | }); 24 | }); 25 | 26 | everyone.now.SbroadcastMedia = function (mId, roomId) { 27 | var self = this 28 | //usercoll.findOne({isKing: true}, function (err, doc) { 29 | // if (doc.uId == self.user.clientId) { 30 | if (roomId != undefined) { 31 | mediacoll.findOne({_id: new db.bson_serializer.ObjectID(mId)}, function (err, doc) { 32 | var room = nowjs.getGroup(roomId); 33 | room.now.playback(doc); 34 | //callback(doc) 35 | console.log(doc.metadata.t) 36 | }); 37 | } else { 38 | mediacoll.findOne({_id: new db.bson_serializer.ObjectID(mId)}, function (err, doc) { 39 | console.log(doc) 40 | everyone.now.playback(doc); 41 | console.log(doc.metadata.t) 42 | //callback(doc); 43 | }); 44 | } 45 | // } 46 | //}); 47 | } 48 | 49 | everyone.now.SgetCurrentMedia = function () { 50 | 51 | } 52 | 53 | everyone.now.SfindMedia = function (searchQuery, callback) { 54 | searchQuery = ("" + searchQuery).toLowerCase(); 55 | var self = this; 56 | if (searchQuery === "") { 57 | var cursor = mediacoll.find({}); 58 | cursor.toArray(function(err, array) { 59 | callback(array); 60 | }); 61 | } else { 62 | var cursor = mediacoll.find({tags: searchQuery}); 63 | cursor.toArray(function(err, array) { 64 | callback(array); 65 | }); 66 | } 67 | } 68 | 69 | everyone.now.SaddMedia = function (path, tags, metadata) { 70 | 71 | mediacoll.insert( 72 | { 73 | path: path, 74 | tags: tags, 75 | metadata: metadata 76 | }); 77 | } 78 | 79 | 80 | everyone.now.SaddToRoom = function (roomId) { 81 | var self = this; 82 | var group = nowjs.getGroup(roomId); 83 | group.addUser(self.user.clientId); 84 | 85 | } 86 | 87 | everyone.now.SleaveRoom = function (roomId) { 88 | var self = this; 89 | this.getGroups(function (groups) { 90 | if (roomId) { 91 | for (var i = groups.length; i--;) { 92 | if (groups[i] == roomId) { 93 | nowjs.getGroup(groups[i]).removeUser(self.user.clientId); 94 | } 95 | } 96 | } else { 97 | for (var i = groups.length; i--;) { 98 | nowjs.getGroup(groups[i]).removeUser(self.user.clientId); 99 | } 100 | } 101 | }); 102 | } 103 | 104 | everyone.now.Sapply = function (functionName, args, roomId) { 105 | console.log("huehuehue") 106 | var room 107 | var fn 108 | 109 | if (args === undefined && roomId === undefined) { //did not provide args or roomId 110 | console.log('nope') 111 | roomId = "everyone" 112 | args = [] 113 | } else if (args instanceof Array && roomId === undefined) { //provided args 114 | console.log('guaranteed') 115 | roomId = "everyone" 116 | } else if (args instanceof String) { //provided roomId 117 | console.log('nonono') 118 | roomId = args 119 | args = [] 120 | } //provided errything 121 | console.log(functionName + ' ' + args + ' ' + roomId) 122 | var room = nowjs.getGroup(roomId); 123 | var fn = room.now[functionName] 124 | fn.apply(fn, args) 125 | } 126 | 127 | //groups prototypes 128 | everyone.now.SaddUser = function (uId) { 129 | console.log("ADDING USER") 130 | var self = this; 131 | 132 | usercoll.insert( 133 | { 134 | uId: uId, 135 | groups: [ ] 136 | }); 137 | } 138 | 139 | everyone.now.SremoveUser = function (uId) { 140 | var self = this; 141 | 142 | usercoll.remove( 143 | { 144 | uId: uId 145 | }); 146 | } 147 | 148 | everyone.now.SloginUser = function (uId, callback, args) { 149 | var self = this; 150 | usercoll.findOne({uId: uId}, function (err,doc) { 151 | for( var i in doc.groups){ 152 | nowjs.getGroup(doc.groups[i]).addUser(self.user.clientId) 153 | } 154 | if (args) { 155 | var room = nowjs.getGroup('everyone') 156 | 157 | var fn = room.now[callback] 158 | fn.apply(fn, args) 159 | } else if (callback) { 160 | 161 | 162 | var room = nowjs.getGroup('everyone') 163 | var fn = room.now[callback] 164 | fn.apply(fn, []) 165 | } 166 | }); 167 | 168 | 169 | } 170 | 171 | everyone.now.SlogoutUser = function (uId, callback, args) { 172 | var self = this; 173 | usercoll.findOne({uId: uId}, function (err,doc) { 174 | for( var i in doc.groups){ 175 | nowjs.getGroup(doc.groups[i]).removeUser(self.user.clientId) 176 | } 177 | if (args) { 178 | var room = nowjs.getGroup('everyone') 179 | var fn = room.now[callback] 180 | fn.apply(fn, args) 181 | } else if (callback) { 182 | var room = nowjs.getGroup('everyone') 183 | var fn = room.now[callback] 184 | fn.apply(fn, []) 185 | } 186 | 187 | }); 188 | } 189 | 190 | everyone.now.subscribeToGroup = function (uId, groupId) { 191 | nowjs.getGroup(groupId).addUser(this.user.clientId); 192 | var self = this; 193 | usercoll.findOne({uId: uId}, function (err,doc) { 194 | var newdoc = doc.groups.push(groupId); 195 | usercoll.update({uId: uId}, doc, function (err, doc){ 196 | 197 | }); 198 | 199 | 200 | }); 201 | } 202 | 203 | everyone.now.unsubscribeFromGroup = function (uId, groupId){ 204 | nowjs.getGroup(groupId).removeUser(this.user.clientId); 205 | var self = this; 206 | usercoll.findOne({uId: uId}, function (err,doc) { 207 | var i = 0; 208 | while( doc.groups[i] != groupId && i < doc.groups.length ){ 209 | if (i == doc.groups.length-1){ 210 | return; 211 | } 212 | i = i + 1; 213 | } 214 | 215 | 216 | 217 | newdoc = doc.groups.splice(i,1); 218 | 219 | usercoll.update({groups: newdoc}, doc, function (err, doc){ 220 | 221 | }); 222 | }) 223 | } 224 | } 225 | -------------------------------------------------------------------------------- /examples/hackathon/static/node_modules/djs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Kevin Hwang (kevinhwang.net)", 3 | "name": "djs", 4 | "description": "A media sharing framework", 5 | "version": "0.0.0", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/khwang/DJS.git" 9 | }, 10 | "main": "d", 11 | "engines": { 12 | "node": "~v0.4.10" 13 | }, 14 | "dependencies": {}, 15 | "devDependencies": {} 16 | } 17 | -------------------------------------------------------------------------------- /examples/hackathon/static/node_modules/ejs: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/ejs -------------------------------------------------------------------------------- /examples/hackathon/static/node_modules/express: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/express -------------------------------------------------------------------------------- /examples/hackathon/static/node_modules/mongodb: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/mongodb -------------------------------------------------------------------------------- /examples/hackathon/static/node_modules/now: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/now -------------------------------------------------------------------------------- /examples/hackathon/views/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/hackathon/views/.DS_Store -------------------------------------------------------------------------------- /examples/hackathon/views/d.js: -------------------------------------------------------------------------------- 1 | var initialize = function(args) { 2 | now.playback = args.playback 3 | } 4 | 5 | -------------------------------------------------------------------------------- /examples/hackathon/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | Huehuehue 4 | 5 | 6 | 7 | 8 | 66 | 67 | 68 | 69 | 70 | 71 | Cool story bro 72 |
Populate me bitch
73 |
RESULTS
74 | 75 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /examples/hackathon/views/porntable.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | SO CLASSY 4 | 5 | 6 | 7 | 8 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
RESULTS
71 | 72 |
Nothing yet
73 | -------------------------------------------------------------------------------- /examples/hackathon/views/splash.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | SO CLASSY 4 | 5 | 6 | 7 | 8 | 9 | 10 | 64 | 65 | 66 | 67 | Fork me on GitHub 68 |
69 |
70 | -------------------------------------------------------------------------------- /examples/turntable/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/.DS_Store -------------------------------------------------------------------------------- /examples/turntable/app.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var dj = require('../../d'); 3 | var nowjs = require('now'); 4 | 5 | var djs 6 | 7 | server = express.createServer(); 8 | 9 | var everyone = nowjs.initialize(server, {socketio:{"log level": process.argv[2]}}); 10 | 11 | dj.initialize(server, nowjs, everyone); 12 | 13 | 14 | server.set('view options', { 15 | layout: false 16 | }); 17 | 18 | server.set('view engine', 'ejs'); 19 | 20 | // Configuration 21 | server.use(express.errorHandler({ dumpExceptions: true, showStack: true })); 22 | server.set('views', __dirname + '/views'); 23 | server.use(express.static(__dirname + '/static')); 24 | 25 | 26 | 27 | server.get('/', function (req, res){ 28 | res.render("index"); 29 | }); 30 | 31 | server.get('/admin', function (req, res){ 32 | res.render("porntable"); 33 | }); 34 | 35 | var numConnected = 0 36 | 37 | nowjs.on('connect', function () { 38 | numConnected++; 39 | everyone.now.setCounter(numConnected); 40 | }); 41 | 42 | nowjs.on('disconnect', function () { 43 | numConnected--; 44 | everyone.now.setCounter(numConnected); 45 | }); 46 | 47 | server.listen(80); 48 | console.log("Express server listening on port %d", server.address().port); 49 | -------------------------------------------------------------------------------- /examples/turntable/node_modules/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/node_modules/.DS_Store -------------------------------------------------------------------------------- /examples/turntable/node_modules/.bin/express: -------------------------------------------------------------------------------- 1 | ../express/bin/express -------------------------------------------------------------------------------- /examples/turntable/node_modules/ejs: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/ejs -------------------------------------------------------------------------------- /examples/turntable/node_modules/express: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/express -------------------------------------------------------------------------------- /examples/turntable/node_modules/mongodb: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/mongodb -------------------------------------------------------------------------------- /examples/turntable/node_modules/now: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/now -------------------------------------------------------------------------------- /examples/turntable/static/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/.DS_Store -------------------------------------------------------------------------------- /examples/turntable/static/bookfort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/bookfort.png -------------------------------------------------------------------------------- /examples/turntable/static/d.js: -------------------------------------------------------------------------------- 1 | var initialize = function(args) { 2 | now.playback = args.playback 3 | } 4 | 5 | -------------------------------------------------------------------------------- /examples/turntable/static/giggle.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/giggle.mp3 -------------------------------------------------------------------------------- /examples/turntable/static/js/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/js/.DS_Store -------------------------------------------------------------------------------- /examples/turntable/static/js/Jplayer.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/js/Jplayer.swf -------------------------------------------------------------------------------- /examples/turntable/static/js/jquery.jplayer.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jPlayer Plugin for jQuery JavaScript Library 3 | * http://www.jplayer.org 4 | * 5 | * Copyright (c) 2009 - 2011 Happyworm Ltd 6 | * Dual licensed under the MIT and GPL licenses. 7 | * - http://www.opensource.org/licenses/mit-license.php 8 | * - http://www.gnu.org/copyleft/gpl.html 9 | * 10 | * Author: Mark J Panaghiston 11 | * Version: 2.1.0 12 | * Date: 1st September 2011 13 | */ 14 | 15 | (function(b,f){b.fn.jPlayer=function(a){var c=typeof a==="string",d=Array.prototype.slice.call(arguments,1),e=this,a=!c&&d.length?b.extend.apply(null,[!0,a].concat(d)):a;if(c&&a.charAt(0)==="_")return e;c?this.each(function(){var c=b.data(this,"jPlayer"),h=c&&b.isFunction(c[a])?c[a].apply(c,d):c;if(h!==c&&h!==f)return e=h,!1}):this.each(function(){var c=b.data(this,"jPlayer");c?c.option(a||{}):b.data(this,"jPlayer",new b.jPlayer(a,this))});return e};b.jPlayer=function(a,c){if(arguments.length){this.element= 16 | b(c);this.options=b.extend(!0,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};b.jPlayer.emulateMethods="load play pause";b.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";b.jPlayer.emulateOptions="muted volume";b.jPlayer.reservedEvent="ready flashreset resize repeat error warning";b.jPlayer.event={ready:"jPlayer_ready",flashreset:"jPlayer_flashreset",resize:"jPlayer_resize",repeat:"jPlayer_repeat", 17 | click:"jPlayer_click",error:"jPlayer_error",warning:"jPlayer_warning",loadstart:"jPlayer_loadstart",progress:"jPlayer_progress",suspend:"jPlayer_suspend",abort:"jPlayer_abort",emptied:"jPlayer_emptied",stalled:"jPlayer_stalled",play:"jPlayer_play",pause:"jPlayer_pause",loadedmetadata:"jPlayer_loadedmetadata",loadeddata:"jPlayer_loadeddata",waiting:"jPlayer_waiting",playing:"jPlayer_playing",canplay:"jPlayer_canplay",canplaythrough:"jPlayer_canplaythrough",seeking:"jPlayer_seeking",seeked:"jPlayer_seeked", 18 | timeupdate:"jPlayer_timeupdate",ended:"jPlayer_ended",ratechange:"jPlayer_ratechange",durationchange:"jPlayer_durationchange",volumechange:"jPlayer_volumechange"};b.jPlayer.htmlEvent="loadstart,abort,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,ratechange".split(",");b.jPlayer.pause=function(){b.each(b.jPlayer.prototype.instances,function(a,b){b.data("jPlayer").status.srcSet&&b.jPlayer("pause")})};b.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0, 19 | sepHour:":",sepMin:":",sepSec:""};b.jPlayer.convertTime=function(a){var c=new Date(a*1E3),d=c.getUTCHours(),a=c.getUTCMinutes(),c=c.getUTCSeconds(),d=b.jPlayer.timeFormat.padHour&&d<10?"0"+d:d,a=b.jPlayer.timeFormat.padMin&&a<10?"0"+a:a,c=b.jPlayer.timeFormat.padSec&&c<10?"0"+c:c;return(b.jPlayer.timeFormat.showHour?d+b.jPlayer.timeFormat.sepHour:"")+(b.jPlayer.timeFormat.showMin?a+b.jPlayer.timeFormat.sepMin:"")+(b.jPlayer.timeFormat.showSec?c+b.jPlayer.timeFormat.sepSec:"")};b.jPlayer.uaBrowser= 20 | function(a){var a=a.toLowerCase(),b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,e=/(mozilla)(?:.*? rv:([\w.]+))?/,a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||a.indexOf("compatible")<0&&e.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};b.jPlayer.uaPlatform=function(a){var b=a.toLowerCase(),d=/(android)/,e=/(mobile)/,a=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(b)||[],b=/(ipad|playbook)/.exec(b)||!e.exec(b)&&d.exec(b)||[];a[1]&&(a[1]=a[1].replace(/\s/g, 21 | "_"));return{platform:a[1]||"",tablet:b[1]||""}};b.jPlayer.browser={};b.jPlayer.platform={};var i=b.jPlayer.uaBrowser(navigator.userAgent);if(i.browser)b.jPlayer.browser[i.browser]=!0,b.jPlayer.browser.version=i.version;i=b.jPlayer.uaPlatform(navigator.userAgent);if(i.platform)b.jPlayer.platform[i.platform]=!0,b.jPlayer.platform.mobile=!i.tablet,b.jPlayer.platform.tablet=!!i.tablet;b.jPlayer.prototype={count:0,version:{script:"2.1.0",needFlash:"2.1.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash", 22 | supplied:"mp3",preload:"metadata",volume:0.8,muted:!1,wmode:"opaque",backgroundColor:"#000000",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen", 23 | repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",noSolution:".jp-no-solution"},fullScreen:!1,autohide:{restored:!1,full:!0,fadeIn:200,fadeOut:600,hold:1E3},loop:!1,repeat:function(a){a.jPlayer.options.loop?b(this).unbind(".jPlayerRepeat").bind(b.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){b(this).jPlayer("play")}):b(this).unbind(".jPlayerRepeat")},nativeVideoControls:{},noFullScreen:{msie:/msie [0-6]/,ipad:/ipad.*?os [0-4]/,iphone:/iphone/,ipod:/ipod/,android_pad:/android [0-3](?!.*?mobile)/, 24 | android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,webos:/webos/,playbook:/playbook/},verticalVolume:!1,idPrefix:"jp",noConflict:"jQuery",emulateHtml:!1,errorAlerts:!1,warningAlerts:!1},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}}, 25 | optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:!0,format:{},formatType:"",waitForPlay:!0,waitForLoad:!0,srcSet:!1,video:!1,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,readyState:0,networkState:0,playbackRate:1,ended:0},internal:{ready:!1},solution:{html:!0,flash:!0},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:!0, 26 | media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:!0,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:!1,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:!1,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:!1,media:"audio"},fla:{codec:"audio/x-flv",flashCanPlay:!0,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:!0,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:!1, 27 | media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:!1,media:"video"},flv:{codec:"video/x-flv",flashCanPlay:!0,media:"video"}},_init:function(){var a=this;this.element.empty();this.status=b.extend({},this.status);this.internal=b.extend({},this.internal);this.internal.domNode=this.element.get(0);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css={};this.css.cs={};this.css.jq={};this.ancestorJq= 28 | [];this.options.volume=this._limitValue(this.options.volume,0,1);b.each(this.options.supplied.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.format[e]){var f=!1;b.each(a.formats,function(a,b){if(e===b)return f=!0,!1});f||a.formats.push(e)}});b.each(this.options.solution.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.solution[e]){var f=!1;b.each(a.solutions,function(a,b){if(e===b)return f=!0,!1});f||a.solutions.push(e)}});this.internal.instance= 29 | "jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")||this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=b.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=b.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:f});this.internal.video=b.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:f});this.internal.flash=b.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:f,swf:this.options.swfPath+ 30 | (this.options.swfPath.toLowerCase().slice(-4)!==".swf"?(this.options.swfPath&&this.options.swfPath.slice(-1)!=="/"?"/":"")+"Jplayer.swf":"")});this.internal.poster=b.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:f});b.each(b.jPlayer.event,function(b,c){a.options[b]!==f&&(a.element.bind(c+".jPlayer",a.options[b]),a.options[b]=f)});this.require.audio=!1;this.require.video=!1;b.each(this.formats,function(b,c){a.require[a.format[c].media]=!0});this.options=this.require.video?b.extend(!0, 31 | {},this.optionsVideo,this.options):b.extend(!0,{},this.optionsAudio,this.options);this._setSize();this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullScreen=this._uaBlocklist(this.options.noFullScreen);this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._restrictNativeVideoControls();this.htmlElement.poster=document.createElement("img");this.htmlElement.poster.id=this.internal.poster.id;this.htmlElement.poster.onload=function(){(!a.status.video|| 32 | a.status.waitForPlay)&&a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=b("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.internal.poster.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)});this.html.audio.available=!1;if(this.require.audio)this.htmlElement.audio=document.createElement("audio"),this.htmlElement.audio.id=this.internal.audio.id, 33 | this.html.audio.available=!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio);this.html.video.available=!1;if(this.require.video)this.htmlElement.video=document.createElement("video"),this.htmlElement.video.id=this.internal.video.id,this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video);this.flash.available=this._checkForFlash(10);this.html.canPlay={};this.flash.canPlay={};b.each(this.formats,function(b,c){a.html.canPlay[c]= 34 | a.html[a.format[c].media].available&&""!==a.htmlElement[a.format[c].media].canPlayType(a.format[c].codec);a.flash.canPlay[c]=a.format[c].flashCanPlay&&a.flash.available});this.html.desired=!1;this.flash.desired=!1;b.each(this.solutions,function(c,d){if(c===0)a[d].desired=!0;else{var e=!1,f=!1;b.each(a.formats,function(b,c){a[a.solutions[0]].canPlay[c]&&(a.format[c].media==="video"?f=!0:e=!0)});a[d].desired=a.require.audio&&!e||a.require.video&&!f}});this.html.support={};this.flash.support={};b.each(this.formats, 35 | function(b,c){a.html.support[c]=a.html.canPlay[c]&&a.html.desired;a.flash.support[c]=a.flash.canPlay[c]&&a.flash.desired});this.html.used=!1;this.flash.used=!1;b.each(this.solutions,function(c,d){b.each(a.formats,function(b,c){if(a[d].support[c])return a[d].used=!0,!1})});this._resetActive();this._resetGate();this._cssSelectorAncestor(this.options.cssSelectorAncestor);!this.html.used&&!this.flash.used?(this._error({type:b.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+ 36 | this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SOLUTION,hint:b.jPlayer.errorHint.NO_SOLUTION}),this.css.jq.noSolution.length&&this.css.jq.noSolution.show()):this.css.jq.noSolution.length&&this.css.jq.noSolution.hide();if(this.flash.used){var c,d="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+"&muted="+this.options.muted;if(b.browser.msie&&Number(b.browser.version)<=8){d=['','','','',''];c=document.createElement('');for(var e=0;e0?100*d/this.status.duration:0;typeof a.seekable==="object"&&a.seekable.length>0?(g=this.status.duration>0?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100,f=100*a.currentTime/a.seekable.end(a.seekable.length-1)):(g=100,f=e);b&&(e=f=d=0);this.status.seekPercent=g;this.status.currentPercentRelative=f;this.status.currentPercentAbsolute=e;this.status.currentTime=d;this.status.readyState=a.readyState;this.status.networkState=a.networkState;this.status.playbackRate= 50 | a.playbackRate;this.status.ended=a.ended},_resetStatus:function(){this.status=b.extend({},this.status,b.jPlayer.prototype.status)},_trigger:function(a,c,d){a=b.Event(a);a.jPlayer={};a.jPlayer.version=b.extend({},this.version);a.jPlayer.options=b.extend(!0,{},this.options);a.jPlayer.status=b.extend(!0,{},this.status);a.jPlayer.html=b.extend(!0,{},this.html);a.jPlayer.flash=b.extend(!0,{},this.flash);if(c)a.jPlayer.error=b.extend({},c);if(d)a.jPlayer.warning=b.extend({},d);this.element.trigger(a)}, 51 | jPlayerFlashEvent:function(a,c){if(a===b.jPlayer.event.ready)if(this.internal.ready){if(this.flash.gate){if(this.status.srcSet){var d=this.status.currentTime,e=this.status.paused;this.setMedia(this.status.media);d>0&&(e?this.pause(d):this.play(d))}this._trigger(b.jPlayer.event.flashreset)}}else this.internal.ready=!0,this.internal.flash.jq.css({width:"0px",height:"0px"}),this.version.flash=c.version,this.version.needFlash!==this.version.flash&&this._error({type:b.jPlayer.error.VERSION,context:this.version.flash, 52 | message:b.jPlayer.errorMsg.VERSION+this.version.flash,hint:b.jPlayer.errorHint.VERSION}),this._trigger(b.jPlayer.event.repeat),this._trigger(a);if(this.flash.gate)switch(a){case b.jPlayer.event.progress:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.timeupdate:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.play:this._seeked();this._updateButtons(!0);this._trigger(a);break;case b.jPlayer.event.pause:this._updateButtons(!1); 53 | this._trigger(a);break;case b.jPlayer.event.ended:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.click:this._trigger(a);break;case b.jPlayer.event.error:this.status.waitForLoad=!0;this.status.waitForPlay=!0;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.status.video&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media): 54 | this._flash_setAudio(this.status.media);this._updateButtons(!1);this._error({type:b.jPlayer.error.URL,context:c.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL});break;case b.jPlayer.event.seeking:this._seeking();this._trigger(a);break;case b.jPlayer.event.seeked:this._seeked();this._trigger(a);break;case b.jPlayer.event.ready:break;default:this._trigger(a)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative; 55 | this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration;this.status.readyState=4;this.status.networkState=0;this.status.playbackRate=1;this.status.ended=!1},_updateButtons:function(a){if(a!==f)this.status.paused=!a,this.css.jq.play.length&&this.css.jq.pause.length&&(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide()));this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&& 56 | (this.status.noFullScreen?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullScreen?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide()));this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+ 57 | "%");this.css.jq.playBar.length&&this.css.jq.playBar.width(this.status.currentPercentRelative+"%");this.css.jq.currentTime.length&&this.css.jq.currentTime.text(b.jPlayer.convertTime(this.status.currentTime));this.css.jq.duration.length&&this.css.jq.duration.text(b.jPlayer.convertTime(this.status.duration))},_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")}, 58 | _resetGate:function(){this.html.audio.gate=!1;this.html.video.gate=!1;this.flash.gate=!1},_resetActive:function(){this.html.active=!1;this.flash.active=!1},setMedia:function(a){var c=this,d=!1,e=this.status.media.poster!==a.poster;this._resetMedia();this._resetGate();this._resetActive();b.each(this.formats,function(e,f){var i=c.format[f].media==="video";b.each(c.solutions,function(b,e){if(c[e].support[f]&&c._validString(a[f])){var g=e==="html";i?(g?(c.html.video.gate=!0,c._html_setVideo(a),c.html.active= 59 | !0):(c.flash.gate=!0,c._flash_setVideo(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.show(),c.status.video=!0):(g?(c.html.audio.gate=!0,c._html_setAudio(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setAudio(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1);d=!0;return!1}});if(d)return!1});if(d){if((!this.status.nativeVideoControls||!this.html.video.gate)&&this._validString(a.poster))e?this.htmlElement.poster.src=a.poster:this.internal.poster.jq.show(); 60 | this.status.srcSet=!0;this.status.media=b.extend({},a);this._updateButtons(!1);this._updateInterface()}else this._error({type:b.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SUPPORT,hint:b.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus();this._updateButtons(!1);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);this.html.active?this._html_resetMedia():this.flash.active&& 61 | this._flash_resetMedia()},clearMedia:function(){this._resetMedia();this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia();this._resetGate();this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},play:function(a){a=typeof a==="number"?a:NaN;this.status.srcSet?this.html.active?this._html_play(a):this.flash.active&&this._flash_play(a):this._urlNotSetError("play")},videoPlay:function(){this.play()}, 62 | pause:function(a){a=typeof a==="number"?a:NaN;this.status.srcSet?this.html.active?this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},pauseOthers:function(){var a=this;b.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&&this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100); 63 | this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.options.muted=a;this.html.used&&this._html_mute(a);this.flash.used&&this._flash_mute(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateMute(a),this._updateVolume(this.options.volume),this._trigger(b.jPlayer.event.volumechange))},mute:function(a){a=a===f?!0:!!a;this._muted(a)},unmute:function(a){a=a===f?!0:!!a;this._muted(!a)},_updateMute:function(a){if(a=== 64 | f)a=this.options.muted;this.css.jq.mute.length&&this.css.jq.unmute.length&&(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){a=this._limitValue(a,0,1);this.options.volume=a;this.html.used&&this._html_volume(a);this.flash.used&&this._flash_volume(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateVolume(a),this._trigger(b.jPlayer.event.volumechange))}, 65 | volumeBar:function(a){if(this.css.jq.volumeBar.length){var b=this.css.jq.volumeBar.offset(),d=a.pageX-b.left,e=this.css.jq.volumeBar.width(),a=this.css.jq.volumeBar.height()-a.pageY+b.top,b=this.css.jq.volumeBar.height();this.options.verticalVolume?this.volume(a/b):this.volume(d/e)}this.options.muted&&this._muted(!1)},volumeBarValue:function(a){this.volumeBar(a)},_updateVolume:function(a){if(a===f)a=this.options.volume;a=this.options.muted?0:a;this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(), 66 | this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](a*100+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1);this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(a){var c= 67 | this;this.options.cssSelectorAncestor=a;this._removeUiClass();this.ancestorJq=a?b(a):[];a&&this.ancestorJq.length!==1&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT});this._addUiClass();b.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)})},_cssSelector:function(a,c){var d=this;typeof c==="string"?b.jPlayer.prototype.options.cssSelector[a]? 68 | (this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer"),this.options.cssSelector[a]=c,this.css.cs[a]=this.options.cssSelectorAncestor+" "+c,this.css.jq[a]=c?b(this.css.cs[a]):[],this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(c){d[a](c);b(this).blur();return!1}),c&&this.css.jq[a].length!==1&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.", 69 | hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:b.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_STRING,context:c,message:b.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:b.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar){var b=this.css.jq.seekBar.offset(),a=a.pageX-b.left,b=this.css.jq.seekBar.width(); 70 | this.playHead(100*a/b)}},playBar:function(a){this.seekBar(a)},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(a){if(this.options.loop!==a)this.options.loop=a,this._updateButtons(),this._trigger(b.jPlayer.event.repeat)},currentTime:function(){},duration:function(){},gui:function(){},noSolution:function(){},option:function(a,c){var d=a;if(arguments.length===0)return b.extend(!0,{},this.options);if(typeof a==="string"){var e=a.split(".");if(c===f){for(var d=b.extend(!0, 71 | {},this.options),g=0;g0?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);this.htmlElement.media.pause();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},100);return}a>0&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this;this._html_load();try{if(typeof this.htmlElement.media.seekable==="object"&&this.htmlElement.media.seekable.length>0)this.htmlElement.media.currentTime= 83 | a*this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1)/100;else if(this.htmlElement.media.duration>0&&!isNaN(this.htmlElement.media.duration))this.htmlElement.media.currentTime=a*this.htmlElement.media.duration/100;else throw"e";}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},100);return}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){if(this.status.waitForPlay)this.status.waitForPlay=!1,this.css.jq.videoPlay.length&& 84 | this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height}))},_html_volume:function(a){if(this.html.audio.available)this.htmlElement.audio.volume=a;if(this.html.video.available)this.htmlElement.video.volume=a},_html_mute:function(a){if(this.html.audio.available)this.htmlElement.audio.muted=a;if(this.html.video.available)this.htmlElement.video.muted=a},_flash_setAudio:function(a){var c=this;try{if(b.each(this.formats, 85 | function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4a":case "fla":c._getMovie().fl_setAudio_m4a(a[d]);break;case "mp3":c._getMovie().fl_setAudio_mp3(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),this.options.preload==="auto")this._flash_load(),this.status.waitForLoad=!1}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var c=this;try{if(b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4v":case "flv":c._getMovie().fl_setVideo_m4v(a[d])}c.status.src= 86 | a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),this.options.preload==="auto")this._flash_load(),this.status.waitForLoad=!1}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",height:"0px"});this._flash_pause(NaN)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad= 87 | !1;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}if(a>0)this.status.waitForLoad=!1,this._flash_checkWaitForPlay()},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){if(this.status.waitForPlay)this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&& 88 | (this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height}))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_checkForFlash:function(a){var b=!1,d;if(window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+a),b=!0}catch(e){}else navigator.plugins&& 89 | navigator.mimeTypes.length>0&&(d=navigator.plugins["Shockwave Flash"])&&navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")>=a&&(b=!0);return b},_validString:function(a){return a&&typeof a==="string"},_limitValue:function(a,b,d){return ad?d:a},_urlNotSetError:function(a){this._error({type:b.jPlayer.error.URL_NOT_SET,context:a,message:b.jPlayer.errorMsg.URL_NOT_SET,hint:b.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){var c;c=this.internal.ready?"FLASH_DISABLED": 90 | "FLASH";this._error({type:b.jPlayer.error[c],context:this.internal.flash.swf,message:b.jPlayer.errorMsg[c]+a.message,hint:b.jPlayer.errorHint[c]});this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(a){this._trigger(b.jPlayer.event.error,a);this.options.errorAlerts&&this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(b.jPlayer.event.warning,f,a);this.options.warningAlerts&&this._alert("Warning!"+ 91 | (a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)},_emulateHtmlBridge:function(){var a=this;b.each(b.jPlayer.emulateMethods.split(/\s+/g),function(b,d){a.internal.domNode[d]=function(b){a[d](b)}});b.each(b.jPlayer.event,function(c,d){var e=!0;b.each(b.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1});e&&a.element.bind(d+".jPlayer.jPlayerHtml", 92 | function(){a._emulateHtmlUpdate();var b=document.createEvent("Event");b.initEvent(c,!1,!0);a.internal.domNode.dispatchEvent(b)})})},_emulateHtmlUpdate:function(){var a=this;b.each(b.jPlayer.emulateStatus.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.status[d]});b.each(b.jPlayer.emulateOptions.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.options[d]})},_destroyHtmlBridge:function(){var a=this;this.element.unbind(".jPlayerHtml");b.each((b.jPlayer.emulateMethods+" "+b.jPlayer.emulateStatus+ 93 | " "+b.jPlayer.emulateOptions).split(/\s+/g),function(b,d){delete a.internal.domNode[d]})}};b.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};b.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ", 94 | NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+b.jPlayer.prototype.version.script+" needs Jplayer.swf version "+b.jPlayer.prototype.version.needFlash+" but found "};b.jPlayer.errorHint= 95 | {FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};b.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method", 96 | CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};b.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."};b.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.", 97 | CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}})(jQuery); -------------------------------------------------------------------------------- /examples/turntable/static/mascot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/mascot.png -------------------------------------------------------------------------------- /examples/turntable/static/master.css: -------------------------------------------------------------------------------- 1 | @font-face { font-family: Nice; src: url('nice.otf'); } 2 | 3 | body { 4 | background: #222; 5 | color: #FFFFFF; 6 | text-align:center; 7 | margin:0 auto; 8 | font-family: Nice; 9 | } 10 | 11 | #jp_container_1 { 12 | width: 420px ; 13 | margin-left: auto ; 14 | margin-right: auto ; 15 | } 16 | 17 | .button { 18 | border-top: 1px solid #96d1f8; 19 | background: #65a9d7; 20 | background: -webkit-gradient(linear, left top, left bottom, from(#3e779d), to(#65a9d7)); 21 | background: -webkit-linear-gradient(top, #3e779d, #65a9d7); 22 | background: -moz-linear-gradient(top, #3e779d, #65a9d7); 23 | background: -ms-linear-gradient(top, #3e779d, #65a9d7); 24 | background: -o-linear-gradient(top, #3e779d, #65a9d7); 25 | padding: 2.5px 5px; 26 | -webkit-border-radius: 8px; 27 | -moz-border-radius: 8px; 28 | border-radius: 8px; 29 | -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0; 30 | -moz-box-shadow: rgba(0,0,0,1) 0 1px 0; 31 | box-shadow: rgba(0,0,0,1) 0 1px 0; 32 | text-shadow: rgba(0,0,0,.4) 0 1px 0; 33 | color: white; 34 | text-decoration: none; 35 | vertical-align: middle; 36 | } 37 | .button:hover { 38 | border-top-color: #28597a; 39 | background: #28597a; 40 | color: #ccc; 41 | } 42 | .button:active { 43 | border-top-color: #1b435e; 44 | background: #1b435e; 45 | } 46 | 47 | #help { 48 | display: none; 49 | } -------------------------------------------------------------------------------- /examples/turntable/static/nice.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/nice.otf -------------------------------------------------------------------------------- /examples/turntable/static/node_modules/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/node_modules/.DS_Store -------------------------------------------------------------------------------- /examples/turntable/static/node_modules/.bin/express: -------------------------------------------------------------------------------- 1 | ../express/bin/express -------------------------------------------------------------------------------- /examples/turntable/static/node_modules/djs/README.md: -------------------------------------------------------------------------------- 1 | ###DJS makes media-sharing sites easy to make! 2 | 3 | Check out the github 4 | 5 | Install from npm (doesn't actually work yet) 6 | ---------------- 7 | 8 | `npm install djs` or `npm install djs -g` for a global installation. 9 | 10 | DJS is a Node.JS module built on top of Now and MongoDB 11 | 12 | ##Public API 13 | 14 | ```javascript 15 | 16 | var server = express.createServer(...) 17 | ... 18 | var dj = require('djs') 19 | dj.initialize(server) 20 | 21 | ``` 22 | 23 | Note: Any arguments with * are optional 24 | 25 | #Bare Bones Server Side Functionality 26 | ------ 27 | 28 | now.SbroadcastMedia(mId, *roomId, callback) 29 | 30 | By default it tells all the clients to display whatever media is indicated by mId. Supplying the roomId will only display the media to users in that particular room. You must search for the mId you want using `SfindMedia`. The callback expects an argument `mediainfo`, which is a JSON object of this form. The callback has to be in the now space. 31 | 32 | ````javascript 33 | { 34 | path: path_to_media 35 | tags: [array, of, tags] 36 | metadata: JSON of your choice 37 | } 38 | ```` 39 | 40 | now.SfindMedia(searchQuery, callback) 41 | 42 | Crawls the database for media with the searchQuery as part of the tag and passes the result to the callback function as an array of JSON objects of this form: 43 | 44 | ````javascript 45 | { 46 | path: path_to_media 47 | tags: [array, of, tags] 48 | metadata: JSON of your choice 49 | } 50 | ```` 51 | 52 | now.SaddMedia(path, tags, metadata) 53 | 54 | Adds the media to the database. path is just the path to the media in question; tags is an array of strings. Metadata is a JSON object of your choice!!! 55 | 56 | now.SaddToRoom(roomId) 57 | 58 | Adds the user who calls this function to the room. 59 | 60 | now.SleaveRoom(*roomId) 61 | 62 | By default, has the user who calls this function leave all the rooms, including the `everyone` namespace (i.e. a logout). When called with a roomId as an argument, has the user leave just that room. 63 | 64 | #Groups Server Side Functionality 65 | ----- 66 | now.SaddUser(uId) 67 | 68 | Adds a user into our personal database. 69 | 70 | now.SremoveUser(uId) 71 | 72 | Removes a user from our personal database. 73 | 74 | now.SloginUser(uId) 75 | 76 | Logs a user out of our personal database. 77 | 78 | now.subscribeToGroup(uId, groupId) 79 | 80 | Subscribes a user to a group. 81 | 82 | now.unsubscribeToGroup(uId, groupId) 83 | 84 | Unsubscribes a user from a group. 85 | 86 | Inserts a user into our personal userdatabase. 87 | 88 | #Client Side Initialization 89 | 90 | 1. Include d.js on the client side. 91 | 2. Call initialize with a JSON object of this type: 92 | ````javascript 93 | initialize({ 94 | playback: playback(mediaInfo) 95 | }) 96 | 97 | ```` 98 | playback is your own provided function that takes mediaInfo as an argument. mediaInfo is of this form: 99 | 100 | ````javascript 101 | { 102 | path: path_to_media 103 | tags: [array, of, tags] 104 | metadata: JSON of your choice 105 | } 106 | ```` 107 | 108 | ##Quickest Start Guide 109 | 1. Include djs server side. 110 | 2. Initialize the client stuff. 111 | 112 | FAQ 113 | ------ 114 | **Q**: Did someone actually accidentally delete the entire codebase? 115 | 116 | A: No, he actually only deleted half of it. 117 | 118 | **Q**: What's up with the strange naming scheme? I don't like the C's and S's in front of your function names. 119 | 120 | A: It's because we've had trouble in the past writing code that utilized NowJS. Since it blurred the client server borders, we often got confused about whether functions were server-side or client-side, so to save us (and hopefully you!) from headaches we decided to do this. 121 | 122 | Further Information 123 | ------------ 124 | Rainbow Dash is the best pony <3 125 | -------------------------------------------------------------------------------- /examples/turntable/static/node_modules/djs/d.js: -------------------------------------------------------------------------------- 1 | var nowjs = require('now'); 2 | var Db = require('mongodb').Db; 3 | var Connection = require('mongodb').Connection; 4 | var Server = require('mongodb').Server; 5 | 6 | var server 7 | exports.initialize = function (theServer) { 8 | server = theServer 9 | var everyone = nowjs.initialize(server, {socketio:{"log level": process.argv[2]}}); 10 | 11 | module.exports = everyone.now; 12 | 13 | var usercoll; 14 | var mediacoll; 15 | var db = new Db('djs', new Server("localhost", 27017, {}), {native_parser:false}); 16 | db.open(function(err, conn) { 17 | db = conn; 18 | db.collection('userinfo', function(err, coll) { 19 | usercoll = coll; 20 | }); 21 | db.collection('mediainfo', function(err, coll) { 22 | mediacoll = coll; 23 | }); 24 | }); 25 | 26 | everyone.now.SbroadcastMedia = function (mId, roomId) { 27 | var self = this 28 | //usercoll.findOne({isKing: true}, function (err, doc) { 29 | // if (doc.uId == self.user.clientId) { 30 | if (roomId != undefined) { 31 | mediacoll.findOne({_id: new db.bson_serializer.ObjectID(mId)}, function (err, doc) { 32 | var room = nowjs.getGroup(roomId); 33 | room.now.playback(doc); 34 | //callback(doc) 35 | console.log(doc.metadata.t) 36 | }); 37 | } else { 38 | mediacoll.findOne({_id: new db.bson_serializer.ObjectID(mId)}, function (err, doc) { 39 | console.log(doc) 40 | everyone.now.playback(doc); 41 | console.log(doc.metadata.t) 42 | //callback(doc); 43 | }); 44 | } 45 | // } 46 | //}); 47 | } 48 | 49 | everyone.now.SgetCurrentMedia = function () { 50 | 51 | } 52 | 53 | everyone.now.SfindMedia = function (searchQuery, callback) { 54 | searchQuery = ("" + searchQuery).toLowerCase(); 55 | var self = this; 56 | if (searchQuery === "") { 57 | var cursor = mediacoll.find({}); 58 | cursor.toArray(function(err, array) { 59 | callback(array); 60 | }); 61 | } else { 62 | var cursor = mediacoll.find({tags: searchQuery}); 63 | cursor.toArray(function(err, array) { 64 | callback(array); 65 | }); 66 | } 67 | } 68 | 69 | everyone.now.SaddMedia = function (path, tags, metadata) { 70 | 71 | mediacoll.insert( 72 | { 73 | path: path, 74 | tags: tags, 75 | metadata: metadata 76 | }); 77 | } 78 | 79 | 80 | everyone.now.SaddToRoom = function (roomId) { 81 | var self = this; 82 | var group = nowjs.getGroup(roomId); 83 | group.addUser(self.user.clientId); 84 | 85 | } 86 | 87 | everyone.now.SleaveRoom = function (roomId) { 88 | var self = this; 89 | this.getGroups(function (groups) { 90 | if (roomId) { 91 | for (var i = groups.length; i--;) { 92 | if (groups[i] == roomId) { 93 | nowjs.getGroup(groups[i]).removeUser(self.user.clientId); 94 | } 95 | } 96 | } else { 97 | for (var i = groups.length; i--;) { 98 | nowjs.getGroup(groups[i]).removeUser(self.user.clientId); 99 | } 100 | } 101 | }); 102 | } 103 | 104 | everyone.now.Sapply = function (functionName, args, roomId) { 105 | console.log("huehuehue") 106 | var room 107 | var fn 108 | 109 | if (args === undefined && roomId === undefined) { //did not provide args or roomId 110 | console.log('nope') 111 | roomId = "everyone" 112 | args = [] 113 | } else if (args instanceof Array && roomId === undefined) { //provided args 114 | console.log('guaranteed') 115 | roomId = "everyone" 116 | } else if (args instanceof String) { //provided roomId 117 | console.log('nonono') 118 | roomId = args 119 | args = [] 120 | } //provided errything 121 | console.log(functionName + ' ' + args + ' ' + roomId) 122 | var room = nowjs.getGroup(roomId); 123 | var fn = room.now[functionName] 124 | fn.apply(fn, args) 125 | } 126 | 127 | //groups prototypes 128 | everyone.now.SaddUser = function (uId) { 129 | console.log("ADDING USER") 130 | var self = this; 131 | 132 | usercoll.insert( 133 | { 134 | uId: uId, 135 | groups: [ ] 136 | }); 137 | } 138 | 139 | everyone.now.SremoveUser = function (uId) { 140 | var self = this; 141 | 142 | usercoll.remove( 143 | { 144 | uId: uId 145 | }); 146 | } 147 | 148 | everyone.now.SloginUser = function (uId, callback, args) { 149 | var self = this; 150 | usercoll.findOne({uId: uId}, function (err,doc) { 151 | for( var i in doc.groups){ 152 | nowjs.getGroup(doc.groups[i]).addUser(self.user.clientId) 153 | } 154 | if (args) { 155 | var room = nowjs.getGroup('everyone') 156 | 157 | var fn = room.now[callback] 158 | fn.apply(fn, args) 159 | } else if (callback) { 160 | 161 | 162 | var room = nowjs.getGroup('everyone') 163 | var fn = room.now[callback] 164 | fn.apply(fn, []) 165 | } 166 | }); 167 | 168 | 169 | } 170 | 171 | everyone.now.SlogoutUser = function (uId, callback, args) { 172 | var self = this; 173 | usercoll.findOne({uId: uId}, function (err,doc) { 174 | for( var i in doc.groups){ 175 | nowjs.getGroup(doc.groups[i]).removeUser(self.user.clientId) 176 | } 177 | if (args) { 178 | var room = nowjs.getGroup('everyone') 179 | var fn = room.now[callback] 180 | fn.apply(fn, args) 181 | } else if (callback) { 182 | var room = nowjs.getGroup('everyone') 183 | var fn = room.now[callback] 184 | fn.apply(fn, []) 185 | } 186 | 187 | }); 188 | } 189 | 190 | everyone.now.subscribeToGroup = function (uId, groupId) { 191 | nowjs.getGroup(groupId).addUser(this.user.clientId); 192 | var self = this; 193 | usercoll.findOne({uId: uId}, function (err,doc) { 194 | var newdoc = doc.groups.push(groupId); 195 | usercoll.update({uId: uId}, doc, function (err, doc){ 196 | 197 | }); 198 | 199 | 200 | }); 201 | } 202 | 203 | everyone.now.unsubscribeFromGroup = function (uId, groupId){ 204 | nowjs.getGroup(groupId).removeUser(this.user.clientId); 205 | var self = this; 206 | usercoll.findOne({uId: uId}, function (err,doc) { 207 | var i = 0; 208 | while( doc.groups[i] != groupId && i < doc.groups.length ){ 209 | if (i == doc.groups.length-1){ 210 | return; 211 | } 212 | i = i + 1; 213 | } 214 | 215 | 216 | 217 | newdoc = doc.groups.splice(i,1); 218 | 219 | usercoll.update({groups: newdoc}, doc, function (err, doc){ 220 | 221 | }); 222 | }) 223 | } 224 | } 225 | -------------------------------------------------------------------------------- /examples/turntable/static/node_modules/djs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Kevin Hwang (kevinhwang.net)", 3 | "name": "djs", 4 | "description": "A media sharing framework", 5 | "version": "0.0.0", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/khwang/DJS.git" 9 | }, 10 | "main": "d", 11 | "engines": { 12 | "node": "~v0.4.10" 13 | }, 14 | "dependencies": {}, 15 | "devDependencies": {} 16 | } 17 | -------------------------------------------------------------------------------- /examples/turntable/static/node_modules/ejs: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/ejs -------------------------------------------------------------------------------- /examples/turntable/static/node_modules/express: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/express -------------------------------------------------------------------------------- /examples/turntable/static/node_modules/mongodb: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/mongodb -------------------------------------------------------------------------------- /examples/turntable/static/node_modules/now: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/now -------------------------------------------------------------------------------- /examples/turntable/static/opening.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/opening.mp3 -------------------------------------------------------------------------------- /examples/turntable/static/skin/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/skin/.DS_Store -------------------------------------------------------------------------------- /examples/turntable/static/skin/jPlayer_blue.monday_extd.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/skin/jPlayer_blue.monday_extd.psd -------------------------------------------------------------------------------- /examples/turntable/static/skin/jplayer.blue.monday.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skin for jPlayer Plugin (jQuery JavaScript Library) 3 | * http://www.happyworm.com/jquery/jplayer 4 | * 5 | * Skin Name: Blue Monday 6 | * 7 | * Copyright (c) 2010-2011 Happyworm Ltd 8 | * Dual licensed under the MIT and GPL licenses. 9 | * - http://www.opensource.org/licenses/mit-license.php 10 | * - http://www.gnu.org/copyleft/gpl.html 11 | * 12 | * Author: Silvia Benvenuti 13 | * Skin Version: 4.0 (jPlayer 2.1.0) 14 | * Date: 1st September 2011 15 | */ 16 | 17 | div.jp-audio, 18 | div.jp-video { 19 | 20 | /* Edit the font-size to counteract inherited font sizing. 21 | * Eg. 1.25em = 1 / 0.8em 22 | */ 23 | 24 | font-size:1.25em; /* 1.25em for testing in site pages */ /* No parent CSS that can effect the size in the demos ZIP */ 25 | 26 | font-family:Verdana, Arial, sans-serif; 27 | line-height:1.6; 28 | color: #666; 29 | border:1px solid #009be3; 30 | background-color:#eee; 31 | position:relative; 32 | } 33 | div.jp-audio { 34 | width:420px; 35 | } 36 | div.jp-video-270p { 37 | width:480px; 38 | } 39 | div.jp-video-360p { 40 | width:640px; 41 | } 42 | div.jp-video-full { 43 | /* Rules for IE6 (full-screen) */ 44 | width:480px; 45 | height:270px; 46 | /* Rules for IE7 (full-screen) - Otherwise the relative container causes other page items that are not position:static (default) to appear over the video/gui. */ 47 | position:static !important; position:relative 48 | } 49 | 50 | div.jp-video-full div.jp-jplayer { 51 | top: 0; 52 | left: 0; 53 | position: fixed !important; position: relative; /* Rules for IE6 (full-screen) */ 54 | overflow: hidden; 55 | z-index:1000; 56 | } 57 | 58 | div.jp-video-full div.jp-gui { 59 | position: fixed !important; position: static; /* Rules for IE6 (full-screen) */ 60 | top: 0; 61 | left: 0; 62 | width:100%; 63 | height:100%; 64 | z-index:1000; 65 | } 66 | 67 | div.jp-video-full div.jp-interface { 68 | position: absolute !important; position: relative; /* Rules for IE6 (full-screen) */ 69 | bottom: 0; 70 | left: 0; 71 | z-index:1000; 72 | } 73 | 74 | div.jp-interface { 75 | position: relative; 76 | background-color:#eee; 77 | width:100%; 78 | } 79 | 80 | div.jp-audio div.jp-type-single div.jp-interface { 81 | height:80px; 82 | } 83 | div.jp-audio div.jp-type-playlist div.jp-interface { 84 | height:80px; 85 | } 86 | 87 | div.jp-video div.jp-interface { 88 | border-top:1px solid #009be3; 89 | } 90 | 91 | /* @group CONTROLS */ 92 | 93 | div.jp-controls-holder { 94 | clear: both; 95 | width:440px; 96 | margin:0 auto; 97 | position: relative; 98 | overflow:hidden; 99 | top:-8px; /* This negative value depends on the size of the text in jp-currentTime and jp-duration */ 100 | } 101 | 102 | div.jp-interface ul.jp-controls { 103 | list-style-type:none; 104 | margin:0; 105 | padding: 0; 106 | overflow:hidden; 107 | } 108 | 109 | div.jp-audio ul.jp-controls { 110 | width: 380px; 111 | padding:20px 20px 0 20px; 112 | } 113 | 114 | div.jp-video div.jp-type-single ul.jp-controls { 115 | width: 78px; 116 | margin-left: 200px; 117 | } 118 | 119 | div.jp-video div.jp-type-playlist ul.jp-controls { 120 | width: 134px; 121 | margin-left: 172px; 122 | } 123 | div.jp-video ul.jp-controls, 124 | div.jp-interface ul.jp-controls li { 125 | display:inline; 126 | float: left; 127 | } 128 | 129 | div.jp-interface ul.jp-controls a { 130 | display:block; 131 | overflow:hidden; 132 | text-indent:-9999px; 133 | } 134 | a.jp-play, 135 | a.jp-pause { 136 | width:40px; 137 | height:40px; 138 | } 139 | 140 | a.jp-play { 141 | background: url("jplayer.blue.monday.jpg") 0 0 no-repeat; 142 | } 143 | a.jp-play:hover { 144 | background: url("jplayer.blue.monday.jpg") -41px 0 no-repeat; 145 | } 146 | a.jp-pause { 147 | background: url("jplayer.blue.monday.jpg") 0 -42px no-repeat; 148 | display: none; 149 | } 150 | a.jp-pause:hover { 151 | background: url("jplayer.blue.monday.jpg") -41px -42px no-repeat; 152 | } 153 | 154 | a.jp-stop, a.jp-previous, a.jp-next { 155 | width:28px; 156 | height:28px; 157 | margin-top:6px; 158 | } 159 | 160 | a.jp-stop { 161 | background: url("jplayer.blue.monday.jpg") 0 -83px no-repeat; 162 | margin-left:10px; 163 | } 164 | 165 | a.jp-stop:hover { 166 | background: url("jplayer.blue.monday.jpg") -29px -83px no-repeat; 167 | } 168 | 169 | a.jp-previous { 170 | background: url("jplayer.blue.monday.jpg") 0 -112px no-repeat; 171 | } 172 | a.jp-previous:hover { 173 | background: url("jplayer.blue.monday.jpg") -29px -112px no-repeat; 174 | } 175 | 176 | a.jp-next { 177 | background: url("jplayer.blue.monday.jpg") 0 -141px no-repeat; 178 | } 179 | a.jp-next:hover { 180 | background: url("jplayer.blue.monday.jpg") -29px -141px no-repeat; 181 | } 182 | 183 | /* @end */ 184 | 185 | /* @group progress bar */ 186 | 187 | div.jp-progress { 188 | overflow:hidden; 189 | background-color: #ddd; 190 | } 191 | div.jp-audio div.jp-progress { 192 | position: absolute; 193 | top:32px; 194 | height:15px; 195 | } 196 | div.jp-audio div.jp-type-single div.jp-progress { 197 | left:110px; 198 | width:186px; 199 | } 200 | div.jp-audio div.jp-type-playlist div.jp-progress { 201 | left:166px; 202 | width:130px; 203 | } 204 | div.jp-video div.jp-progress { 205 | top:0px; 206 | left:0px; 207 | width:100%; 208 | height:10px; 209 | } 210 | div.jp-seek-bar { 211 | background: url("jplayer.blue.monday.jpg") 0 -202px repeat-x; 212 | width:0px; 213 | height:100%; 214 | cursor: pointer; 215 | } 216 | div.jp-play-bar { 217 | background: url("jplayer.blue.monday.jpg") 0 -218px repeat-x ; 218 | width:0px; 219 | height:100%; 220 | } 221 | 222 | /* The seeking class is added/removed inside jPlayer */ 223 | div.jp-seeking-bg { 224 | background: url("jplayer.blue.monday.seeking.gif"); 225 | } 226 | 227 | /* @end */ 228 | 229 | /* @group volume controls */ 230 | 231 | 232 | a.jp-mute, 233 | a.jp-unmute, 234 | a.jp-volume-max { 235 | width:18px; 236 | height:15px; 237 | margin-top:12px; 238 | } 239 | 240 | div.jp-audio div.jp-type-single a.jp-mute, 241 | div.jp-audio div.jp-type-single a.jp-unmute { 242 | margin-left: 210px; 243 | } 244 | 245 | div.jp-audio div.jp-type-playlist a.jp-mute, 246 | div.jp-audio div.jp-type-playlist a.jp-unmute { 247 | margin-left: 154px; 248 | } 249 | 250 | div.jp-audio a.jp-volume-max { 251 | margin-left: 56px; 252 | } 253 | 254 | div.jp-video a.jp-mute, 255 | div.jp-video a.jp-unmute, 256 | div.jp-video a.jp-volume-max { 257 | position: absolute; 258 | top:12px; 259 | margin-top:0; 260 | } 261 | 262 | div.jp-video a.jp-mute, 263 | div.jp-video a.jp-unmute { 264 | left: 50px; 265 | } 266 | 267 | div.jp-video a.jp-volume-max { 268 | left: 134px; 269 | } 270 | 271 | a.jp-mute { 272 | background: url("jplayer.blue.monday.jpg") 0 -170px no-repeat; 273 | } 274 | a.jp-mute:hover { 275 | background: url("jplayer.blue.monday.jpg") -19px -170px no-repeat; 276 | } 277 | a.jp-unmute { 278 | background: url("jplayer.blue.monday.jpg") -60px -170px no-repeat; 279 | display: none; 280 | } 281 | a.jp-unmute:hover { 282 | background: url("jplayer.blue.monday.jpg") -79px -170px no-repeat; 283 | } 284 | a.jp-volume-max { 285 | background: url("jplayer.blue.monday.jpg") 0 -186px no-repeat; 286 | } 287 | a.jp-volume-max:hover { 288 | background: url("jplayer.blue.monday.jpg") -19px -186px no-repeat; 289 | } 290 | 291 | div.jp-volume-bar { 292 | position: absolute; 293 | overflow:hidden; 294 | background: url("jplayer.blue.monday.jpg") 0 -250px repeat-x; 295 | width:46px; 296 | height:5px; 297 | cursor: pointer; 298 | } 299 | div.jp-audio div.jp-volume-bar { 300 | top:37px; 301 | left:330px; 302 | } 303 | div.jp-video div.jp-volume-bar { 304 | top:17px; 305 | left:72px; 306 | } 307 | div.jp-volume-bar-value { 308 | background: url("jplayer.blue.monday.jpg") 0 -256px repeat-x; 309 | width:0px; 310 | height:5px; 311 | } 312 | 313 | /* @end */ 314 | 315 | /* @group current time and duration */ 316 | 317 | div.jp-audio div.jp-time-holder { 318 | position:absolute; 319 | top:50px; 320 | } 321 | div.jp-audio div.jp-type-single div.jp-time-holder { 322 | left:110px; 323 | width:186px; 324 | } 325 | div.jp-audio div.jp-type-playlist div.jp-time-holder { 326 | left:166px; 327 | width:130px; 328 | } 329 | 330 | div.jp-current-time, 331 | div.jp-duration { 332 | width:60px; 333 | font-size:.64em; 334 | font-style:oblique; 335 | } 336 | div.jp-current-time { 337 | float: left; 338 | display:inline; 339 | } 340 | div.jp-duration { 341 | float: right; 342 | display:inline; 343 | text-align: right; 344 | } 345 | 346 | div.jp-video div.jp-current-time { 347 | margin-left:20px; 348 | } 349 | div.jp-video div.jp-duration { 350 | margin-right:20px; 351 | } 352 | 353 | /* @end */ 354 | 355 | /* @group playlist */ 356 | 357 | div.jp-title { 358 | font-weight:bold; 359 | text-align:center; 360 | } 361 | 362 | div.jp-title, 363 | div.jp-playlist { 364 | width:100%; 365 | background-color:#ccc; 366 | border-top:1px solid #009be3; 367 | } 368 | div.jp-type-single div.jp-title, 369 | div.jp-type-playlist div.jp-title, 370 | div.jp-type-single div.jp-playlist { 371 | border-top:none; 372 | } 373 | div.jp-title ul, 374 | div.jp-playlist ul { 375 | list-style-type:none; 376 | margin:0; 377 | padding:0 20px; 378 | font-size:.72em; 379 | } 380 | 381 | div.jp-title li { 382 | padding:5px 0; 383 | font-weight:bold; 384 | } 385 | div.jp-playlist li { 386 | padding:5px 0 4px 20px; 387 | border-bottom:1px solid #eee; 388 | } 389 | 390 | div.jp-playlist li div { 391 | display:inline; 392 | } 393 | 394 | /* Note that the first-child (IE6) and last-child (IE6/7/8) selectors do not work on IE */ 395 | 396 | div.jp-type-playlist div.jp-playlist li:last-child { 397 | padding:5px 0 5px 20px; 398 | border-bottom:none; 399 | } 400 | div.jp-type-playlist div.jp-playlist li.jp-playlist-current { 401 | list-style-type:square; 402 | list-style-position:inside; 403 | padding-left:7px; 404 | } 405 | div.jp-type-playlist div.jp-playlist a { 406 | color: #333; 407 | text-decoration: none; 408 | } 409 | div.jp-type-playlist div.jp-playlist a:hover { 410 | color:#0d88c1; 411 | } 412 | div.jp-type-playlist div.jp-playlist a.jp-playlist-current { 413 | color:#0d88c1; 414 | } 415 | 416 | div.jp-type-playlist div.jp-playlist a.jp-playlist-item-remove { 417 | float:right; 418 | display:inline; 419 | text-align:right; 420 | margin-right:10px; 421 | font-weight:bold; 422 | color:#666; 423 | } 424 | div.jp-type-playlist div.jp-playlist a.jp-playlist-item-remove:hover { 425 | color:#0d88c1; 426 | } 427 | div.jp-type-playlist div.jp-playlist span.jp-free-media { 428 | float:right; 429 | display:inline; 430 | text-align:right; 431 | margin-right:10px; 432 | } 433 | div.jp-type-playlist div.jp-playlist span.jp-free-media a{ 434 | color:#666; 435 | } 436 | div.jp-type-playlist div.jp-playlist span.jp-free-media a:hover{ 437 | color:#0d88c1; 438 | } 439 | span.jp-artist { 440 | font-size:.8em; 441 | color:#666; 442 | } 443 | 444 | /* @end */ 445 | 446 | div.jp-video-play { 447 | position:absolute; 448 | top:0; 449 | left:0; 450 | width:100%; 451 | cursor:pointer; 452 | background-color:rgba(0,0,0,0); /* Makes IE9 work with the active area over the whole video area. IE6/7/8 only have the button as active area. */ 453 | } 454 | div.jp-video-270p div.jp-video-play { 455 | height:270px; 456 | } 457 | div.jp-video-360p div.jp-video-play { 458 | height:360px; 459 | } 460 | div.jp-video-full div.jp-video-play { 461 | height:100%; 462 | z-index:1000; 463 | } 464 | a.jp-video-play-icon { 465 | position:relative; 466 | display:block; 467 | width: 112px; 468 | height: 100px; 469 | 470 | margin-left:-56px; 471 | margin-top:-50px; 472 | left:50%; 473 | top:50%; 474 | 475 | background: url("jplayer.blue.monday.video.play.png") 0 0 no-repeat; 476 | text-indent:-9999px; 477 | } 478 | div.jp-video-play:hover a.jp-video-play-icon { 479 | background: url("jplayer.blue.monday.video.play.png") 0 -100px no-repeat; 480 | } 481 | 482 | 483 | 484 | 485 | 486 | div.jp-jplayer audio, 487 | div.jp-jplayer { 488 | width:0px; 489 | height:0px; 490 | } 491 | 492 | div.jp-jplayer { 493 | background-color: #000000; 494 | } 495 | 496 | 497 | 498 | 499 | 500 | /* @group TOGGLES */ 501 | 502 | /* The audio toggles are nested inside jp-time-holder */ 503 | 504 | ul.jp-toggles { 505 | list-style-type:none; 506 | padding:0; 507 | margin:0 auto; 508 | overflow:hidden; 509 | } 510 | 511 | div.jp-audio .jp-type-single ul.jp-toggles { 512 | width:25px; 513 | } 514 | div.jp-audio .jp-type-playlist ul.jp-toggles { 515 | width:55px; 516 | margin: 0; 517 | position: absolute; 518 | left: 325px; 519 | top: 50px; 520 | } 521 | 522 | div.jp-video ul.jp-toggles { 523 | margin-top:10px; 524 | width:100px; 525 | } 526 | 527 | ul.jp-toggles li { 528 | display:block; 529 | float:right; 530 | } 531 | 532 | ul.jp-toggles li a { 533 | display:block; 534 | width:25px; 535 | height:18px; 536 | text-indent:-9999px; 537 | line-height:100%; /* need this for IE6 */ 538 | } 539 | 540 | a.jp-full-screen { 541 | background: url("jplayer.blue.monday.jpg") 0 -310px no-repeat; 542 | margin-left: 20px; 543 | } 544 | 545 | a.jp-full-screen:hover { 546 | background: url("jplayer.blue.monday.jpg") -30px -310px no-repeat; 547 | } 548 | 549 | a.jp-restore-screen { 550 | background: url("jplayer.blue.monday.jpg") -60px -310px no-repeat; 551 | margin-left: 20px; 552 | } 553 | 554 | a.jp-restore-screen:hover { 555 | background: url("jplayer.blue.monday.jpg") -90px -310px no-repeat; 556 | } 557 | 558 | a.jp-repeat { 559 | background: url("jplayer.blue.monday.jpg") 0 -290px no-repeat; 560 | } 561 | 562 | a.jp-repeat:hover { 563 | background: url("jplayer.blue.monday.jpg") -30px -290px no-repeat; 564 | } 565 | 566 | a.jp-repeat-off { 567 | background: url("jplayer.blue.monday.jpg") -60px -290px no-repeat; 568 | } 569 | 570 | a.jp-repeat-off:hover { 571 | background: url("jplayer.blue.monday.jpg") -90px -290px no-repeat; 572 | } 573 | 574 | a.jp-shuffle { 575 | background: url("jplayer.blue.monday.jpg") 0 -270px no-repeat; 576 | margin-left: 5px; 577 | } 578 | 579 | a.jp-shuffle:hover { 580 | background: url("jplayer.blue.monday.jpg") -30px -270px no-repeat; 581 | } 582 | 583 | a.jp-shuffle-off { 584 | background: url("jplayer.blue.monday.jpg") -60px -270px no-repeat; 585 | margin-left: 5px; 586 | } 587 | 588 | a.jp-shuffle-off:hover { 589 | background: url("jplayer.blue.monday.jpg") -90px -270px no-repeat; 590 | } 591 | 592 | 593 | /* @end */ 594 | 595 | /* @group NO SOLUTION error feedback */ 596 | 597 | .jp-no-solution { 598 | position:absolute; 599 | width:390px; 600 | margin-left:-202px; 601 | left:50%; 602 | top: 10px; 603 | 604 | padding:5px; 605 | font-size:.8em; 606 | background-color:#eee; 607 | border:2px solid #009be3; 608 | color:#000; 609 | display:none; 610 | } 611 | 612 | .jp-no-solution a { 613 | color:#000; 614 | } 615 | 616 | .jp-no-solution span { 617 | font-size:1em; 618 | display:block; 619 | text-align:center; 620 | font-weight:bold; 621 | } 622 | 623 | /* @end */ 624 | -------------------------------------------------------------------------------- /examples/turntable/static/skin/jplayer.blue.monday.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/skin/jplayer.blue.monday.jpg -------------------------------------------------------------------------------- /examples/turntable/static/skin/jplayer.blue.monday.seeking.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/skin/jplayer.blue.monday.seeking.gif -------------------------------------------------------------------------------- /examples/turntable/static/skin/jplayer.blue.monday.video.play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/skin/jplayer.blue.monday.video.play.png -------------------------------------------------------------------------------- /examples/turntable/static/skin/spirites_blue.monday_2011.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/static/skin/spirites_blue.monday_2011.psd -------------------------------------------------------------------------------- /examples/turntable/views/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catherinemarvin/DJS/1a7a79860abdcf056ef0406f4797dbf93ded1eeb/examples/turntable/views/.DS_Store -------------------------------------------------------------------------------- /examples/turntable/views/d.js: -------------------------------------------------------------------------------- 1 | var initialize = function(args) { 2 | now.playback = args.playback 3 | } 4 | 5 | -------------------------------------------------------------------------------- /examples/turntable/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | Totally not Turntable 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | Fork me on GitHub 99 | 100 | 101 | 102 | 103 |
104 | 105 | 106 | 145 |
146 |
147 | 148 | Find Media 149 |
150 |
151 |
Search results here
152 |
153 |
Number of people connected:
154 |
0
155 | 156 |
157 | Help! 158 |
159 |
160 |
Just click the "Find Media" button to get a list of the current media on the server, then click any of the buttons to change the media! 161 | 162 | -------------------------------------------------------------------------------- /examples/turntable/views/porntable.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | ADMIN PAGE OMG 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
haro
126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Kevin Hwang (kevinhwang.net)", 3 | "name": "djs", 4 | "description": "A media sharing framework", 5 | "version": "0.0.2", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/khwang/DJS.git" 9 | }, 10 | "main": "d", 11 | "engines": { 12 | "node": "~> v0.4.10" 13 | }, 14 | "dependencies": { 15 | "express" : ">= 1.2.0", 16 | "now" : ">= 0.7.0", 17 | "mongodb" : ">= 0.9.0", 18 | "ejs" : ">= 0.4.0"}, 19 | "devDependencies": { 20 | "express" : ">= 1.2.0", 21 | "now" : ">= 0.7.0", 22 | "mongodb" : ">= 0.9.0", 23 | "ejs" : ">= 0.4.0"} 24 | } 25 | --------------------------------------------------------------------------------