# HG changeset patch # User veltr # Date 1355501731 -3600 # Node ID 0cfd113f6a59cbc8c259ccd8c2d71aa4c4d6b184 # Parent 9409e6ebf891b90713d05e12b73dfffe4422a806 Removed Metadataplayer -- isn't used anymore diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/dailymotion.htm --- a/metadataplayer/dailymotion.htm Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ - - - - - - Metadataplayer test with Dailymotion - - - - - - - -

Metadataplayer test with Dailymotion

-
-
- - - diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/docs/architecture.fr.md --- a/metadataplayer/docs/architecture.fr.md Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,353 +0,0 @@ -# Architecture du Metadataplayer # - -ATTENTION ! -Cette documentation se réfère à la dernière version du Metadataplayer, disponible dans la branche **default** du repository -http://www.iri.centrepompidou.fr/dev/hg/metadataplayer - -## Bibliothèques extérieures ## - -Les bibliothèques utilisées par le Metadataplayer sont regroupées dans *src/libs* - -### LAB.js ### - -- **Fichier**: LAB.min.js -- **Licence**: MIT. -- **Rôle**: Charge les autres bibliothèques extérieures et les widgets. -- **Utilisé par**: Code principal. -- Du fait de ce mode de chargement, il s’agit de la seule bibliothèque nécessaire au moment de l’initialisation du code. -- **Site**: http://labjs.com/ - -### jQuery ### - -- **Fichier**: jquery.min.js -- **Licence**: Double, MIT et GPL. -- **Rôle**: Gère les actions du code sur la structure du document HTML (DOM) -- **Utilisé par**: Code principal et tous les widgets. -- **Site**: http://jquery.org/ - -### jQuery UI ### - -- **Fichiers**: jquery-ui.min.js et jquery-ui.css -- **Licence**: Double, MIT et GPL. -- **Rôle**: Fournit des éléments d’interface utilisateurs, tels que *Sliders* -- **Utilisé par**: Widgets, Controller (pour le volume) et Slider (pour le *Slider de progression*) -- **Site**: http://jqueryui.com/ - -### Underscore ### - -- **Fichier**: underscore-min.js -- **Licence**: MIT. -- **Rôle**: Fournit des fonctionnalités orientées programmation fonctionnelle pour manipuler tableaux, objets et fonctions. -- **Utilisé par**: Code principal et widgets. -- **Site**: http://documentcloud.github.com/underscore/ - -### Popcorn ### - -- **Fichier**: popcorn-complete.min.js -- **Licence**: MIT. -- **Rôle**: Fournit une gestion de la lecture de vidéos HTML5. -- **Utilisé par**: Players HTML5 et Youtube, ainsi que pour la communication avec le reste du Metadataplayer lorsque l’un de ces players est utilisé. -- **Site**: http://popcornjs.org/ - -### Mustache ### - -- **Fichier**: mustache.js -- **Licence**: MIT. -- **Rôle**: Permet de remplir des gabarits (*templates*) HTML. -- **Utilisé par**: widgets. -- **Site**: http://mustache.github.com/ - -### Raphael ### - -- **Fichier**: raphael-min.js -- **Licence**: MIT. -- **Rôle**: Fournit une interface de dessin vectoriel (utilise SVG ou VML selon les navigateurs) -- **Utilisé par**: Widgets Arrow et Sparkline -- **Site**: http://raphaeljs.com/ - -### ZeroClipboard ### - -- **Fichiers**: ZeroClipboard.js et ZeroClipboard.swf -- **Licence**: MIT. -- **Rôle**: Permet l’accès au presse-papiers (using Flash) -- **Utilisé par**: Widget Social -- **Site**: http://code.google.com/p/zeroclipboard/ - -### ktbs4js Tracemanager ### - -- **Fichier**: tracemanager.js -- **Licence**: LGPL. -- **Rôle**: Permet de s’interfacer avec le système de gestion de traces KTBS, créé par Olivier Aubert (Liris) -- **Utilisé par**: TraceWidget -- **Site**: http://github.com/oaubert/ktbs4js - -## Code principal (core) du Metadataplayer ## - -Dans la version *release* du metadataplayer, les fichiers Javascript et CSS sont répartis entre le *core* et les *widgets*. - -*LdtPlayer-core.js* est compilé à partir de plusieurs fichiers Javascript situés (sauf LAB.min.js) dans *src/js*: - -### header.js ### - -Contient les crédits du Metadataplayer, ainsi que les informations sur la licence (*CeCILL-C*) - -### LAB.js ### - -cf. Bibliothèques extérieures. - -### init.js ### - -Définit l’objet *IriSP*, qui sert d’espace de nommage pour tout le Metadataplayer. -Contient la classe *IriSP.Metadataplayer*, dont l’instanciation est la porte d’entrée principale du code. - -### pop.js ### - -Contient *IriSP.PopcornReplacement*, c’est à dire une version simplifiée de Popcorn pour communiquer avec des lecteurs vidéos non-supportés par Popcorn. -Au moment de la création de cette partie, l’interfaçage Popcorn-jwplayer n’était pas satisfaisant, à remplacer éventuellement par de vrais players/plugins pour Popcorn. - -### utils.js ### - -Contient quelques fonctions utilitaires, telles que *IriSP.loadCss*, qui est l’équivalent pour les fichiers CSS de LAB.js. - -### model.js ### - -Contient les classes de gestion du modèle de données Cinelab, regroupées sous l’espace de nommage *IriSP.Model*. - -### widgets.js ### - -Contient la classe de base *IriSP.Widgets.Widget*, qui fournit les fonctionnalités de base pour les widgets. - -### players ### - -Les fichiers de ce répertoire permettent d’interfacer le *Popcorn Replacement* (cf. *pop.js*) avec des lecteurs vidéo tiers. - -Existent actuellement: - -1. **player.jwplayer**, pour communiquer avec JwPlayer, utilisé pour lire des flux RTMP sur la plateforme *Ligne de temps* -2. **player.dailymotion**, pour lire des vidéos du *Youtube à la française* -3. **player.allocine**, pour le player de allocine.net -4. **player.mashup**, pour le player de bout à bout Flash créé par Thibaut Cavalié. -5. **player.htmlMashup**, pour le lecteur de bout à bout de vidéos HTML5 basé sur Popcorn. - -### serializers ### - -Les Sérialiseurs servent d’interface entre les formats de données utilisés pour les échanges avec les serveurs. - -Deux sérialiseurs existent à l’heure actuelle: - -1. **ldt**, pour lire les flux JSON fournis par la plateforme *Lignes de Temps*. -2. **ldt\_annotate**, pour communiquer avec l’API d’ajout d’annotations de la plateforme, dont le format est légèrement différent. - -## Widgets ## - -Les Widgets sont des modules, visibles ou non, permettant de rajouter des fonctionnalités au Metadataplayer. - -Situés dans le répertoire *src/widgets*, ils contiennent nécessairement un fichier de code *NomDuWidget.js* et, optionnellement un fichier de style *NomDuWidget.css* - -#### Options courantes #### - -- **metadata**, source de métadonnées, sous la forme { url: *URL de la source de données*, type: *Type de sérialiseur utilisé* } -- **container**, à utiliser seulement si le widget ne doit pas être aligné en dessous des autres widgets, pour spécifier l’ID de l’élément HTML dans lequel il doit être affiché. -- **annotation\_type**, dans les widgets affichant des annotations. Cette option peut prendre les valeurs suivantes: - - Chaîne de caractères: prend en compte les types d’annotations dont le titre contient la chaîne. Exemple: "chap" permet notamment d’afficher les annotations dans le type d’annotation "Chapitrage" - - Tableau de chaînes: pour prendre en compte plusieurs types d’annotations - - false: pour prendre en compte toutes les annotations du projet -- **requires**, qui permet d’encapsuler un widget dans un autre. - -Voici la liste des widgets actuellement disponibles, avec leurs options: - -### Annotation ### - -- **Rôle**: Affiche les informations relatives à une annotation au moment où celle-ci est jouée -- **Options**: - - **annotation\_type**: (défaut: "chapitrage"), cf. *Options courantes*, plus haut. - - **show\_top\_border**: (défaut: false), afficher ou non la bordure en haut du widget (au cas où il est utilisé sans/avec le widget *Arrow*) - - **site\_name**: "Lignes de Temps", nom du site à afficher lorsque l’on clique sur les boutons de partage pour réseaux sociaux. -- Utilise un fichier CSS: oui - -### AnnotationsList ### - -- **Rôle**: Affiche une liste d’annotations -- **Options**: - - **ajax\_url**: (défaut: false), spécifie un gabarit d’URL lorsque les annotations doivent être chargées par une API spécifique (API de segment). Dans l’URL, {{media}} sera remplacé par l’ID du média, {{begin}} par le *timecode* de début en millisecondes, {{end}} par le *timecode* de fin en millisecondes. Si le réglage est à *false*, les annotations affichées seront celles chargées à l’initialisation du Widget. Sur la plateforme *Lignes de Temps*, cette URL est http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=? - - **ajax\_granularity**: (défaut: 300000 ms = 5 minutes), spécifie la durée qui doit être chargée par l’API de segment, de part et d’autre du timecode courant (cf. ci-dessus) - - **default\_thumbnail**: imagette à afficher par défaut à côté d’une annotation lorsque l’annotation n’a pas d’imagette. - - **foreign\_url**: spécifie un gabarit d’URL lorsque l’annotation n’a pas d’information d’URL et que l’annotation est dans un autre projet. Dans l’URL, {{media}} sera remplacé par l’ID du média, {{project}} par l’ID du projet, {{annotationType}} par l’ID du type d’annotation, {{annotation}} par l’ID de l’annotation. Sur la plateforme *Lignes de temps*, cette URL est http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}} - - **annotation\_type**: (défaut: false), cf. *Options courantes*, plus haut. - - **refresh\_interval**: (défaut: 0), intervalle auquel le widget recharge en Ajax la liste des annotations (que l’on utilise l’API de segment ou non) - - **limit\_count**: (défaut: 10), nombre maximum d’annotations à afficher simultanément. - - **newest\_first**: (défaut: false), *true*: classe les annotations par ordre antéchronologique de création, *false*: classe les annotations par ordre chronologique de leur timecode vidéo. -- Utilise un fichier CSS: oui - -### Arrow ### - -- **Rôle**: Dessine la flèche indiquant la position de l’annotation -- **Options**: - - **arrow\_height**: (défaut: 16), hauteur en pixels de la flèche - - **arrow\_width**: (défaut: 24), largeur en pixels de la flèche - - **base\_height**: (défaut: 0), hauteur entre le bas de la flèche et le bas du widget. Nécessaire si l’on souhaite faire un widget aux bords arrondis. - - **base\_curve**: (défaut: 0), rayon de courbure des bords arrondis du widget. - - **fill\_url**: URL d’une image de remplissage pour le widget - - **fill\_color**: (défaut: "#ffffff" = blanc), couleur de remplissage du widget. Peut-être remplacé par un dégradé sous la forme angle en degrés-couleur de début-couleur de fin, ex: "90-#000-#fff" - - **stroke\_color**: (défaut: "#b7b7b7" = gris), couleur de la bordure du widget. - - **stroke\_width**: (défaut: 1.5), épaisseur en pixels de la bordure du widget. - - **animation\_speed**: (défaut: 20), vitesse de déplacement de la flèche. - - **pilot\_widget**: (défaut: "Annotation"), widget commandant la position de la flèche. -- Utilise la bibliothèque: Raphael -- Utilise un fichier CSS: non - -### Controller ### - -- **Rôle**: Boutons Lecture/Pause, Rechercher, Ouvrir l’annotateur et contrôle du volume -- **Options**: - - **disable\_annotate\_btn**: (défaut: false), permet de désactiver le bouton d’ouverture de l’annotateur s’il est à *true* - - **disable\_search\_btn**: (défaut: true), permet de désactiver le bouton de recherche d’annotations -- Utilise la bibliothèque: jQuery UI -- Utilise un fichier CSS: oui - -### CreateAnnotation ### - -- **Rôle**: Permet de créer une annotation en affichant un formulaire -- **Options**: - - **show\_title\_field**: (défaut: true), affiche un champ permettant de saisir le titre de l’annotation. - - **creator\_name**: nom d’utilisateur du créateur de l’annotation. - - **creator\_avatar**: URL de l’image de profil du créateur de l’annotation. - - **tags**: (défaut: false), liste des tags à afficher, sous la forme d’un tableau d’objets type [ { id: "tag-001", title: "" } ]. Si la valeur est false, affiche les tags les plus utilisés du projet. - - **max\_tags**: (défaut: 8), nombre de tags à afficher. - - **polemics**: boutons polémiques à afficher, sous la forme d’un tableau d’objets indiquant mot-clé à ajouter, couleur du fond du bouton, couleur du bouton, ex: [ { keyword: "++", background\_color: "#00a000", text\_color: "#ffffff" } ] - - **annotation\_type**: (défaut: "Contributions"), cf. *Options courantes*, plus haut. - - **api\_serializer**: (défaut: "ldt\_annotate"), sérialiseur à utiliser pour l’envoi des annotations. - - **api\_endpoint\_template**: URL de l’API, où {{id\}\} est remplacé par l’ID du projet, ex: "http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/annotations/{{id}}.json". - - **api\_method**: (défaut: "PUT"), méthode HTTP utilisée pour envoyer les annotations. La plateforme *Lignes de temps* utilise PUT, mais cette méthode devrait être réservée pour la création d’une ressource dont l’URL est connue à l’avance. - - **close\_widget\_timeout**: (défaut: 0), durée en millisecondes avant que le widget ne soit refermé après l’envoi d’une annotation. Si la valeur est 0, le widget ne se referme pas. -- Utilise un fichier CSS: oui - -### HelloWorld ### - -- **Rôle**: Widget d’exemple démontrant l’API de création de widgets -- **Options**: - - **text**: (défaut: "world"), texte à afficher après "Hello, " -- Utilise un fichier CSS: oui - -### Media ### - -- **Rôle**: Affiche le média en cours, ainsi que la liste des autres médias du projet. Utilisé principalement pour les mashups -- **Options**: - - **default\_thumbnail**: imagette à afficher par défaut à côté d’un média lorsque le média n’a pas d’imagette. - - **media\_url\_template**: spécifie un gabarit d’URL lorsque le média n’a pas d’information d’URL, par exemple: "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/" -- Utilise un fichier CSS: oui - -### Mediafragment ### - -- **Rôle**: Gère les URLs à la norme *Mediafragment*: change la position de la tête de lecture en fonction de l’URL et inversement. -- Une URL finissant par #id=*id de l’annotation* pointe sur une annotation, par #t=*temps en secondes* vers un timecode de la vidéo. -- Pas d’options -- Utilise un fichier CSS: non. - -### Polemic ### - -- **Rôle**: Affiche la *timeline polémique*, c’est à dire les tweets colorés en fonction de la syntaxe polémique. Selon le volume de tweets, deux modes de représentation existent: - - Avec un faible volume, les tweets sont des carrés dessinés individuellement. - - Avec un volume élevé, les colonnes présentent les volumes agrégés de tweets par couleur. -- **Options**: - - **element\_width**: (défaut: 5), largeur en pixels d’une tranche de tweets. - - **element\_height**: (défaut: 5), hauteur en pixels d’un tweet, en mode faible volume. - - **max\_elements**: (défaut: 15), nombre de tweets dans une colonne à partir duquel le mode de représentation change. - - **annotation\_type**: (défaut: "tweet"), cf. *Options courantes*, plus haut. - - **defaultcolor**: (défaut: "#585858" = gris), couleur des tweets qui n’ont pas d’annotation polémique. - - **foundcolor**: (défaut: "#fc00ff" = mauve), couleur d’affichage des tweets correspondant à un résultat de recherche. - - **polemics**: couleurs polémiques à afficher, en fonction d’une recherche de termes, type [ { keywords: [ "++" ], color: "#1D973D" } ] -- Utilise un fichier CSS: oui - -### Renkan ### - -- **Rôle**: Interface avec le projet *Renkan* -- Utilise les bibliothèques: jQuery Mousewheel, Backbone, Backbone Relational, Renkan-Publish -- Utilise un fichier CSS: oui - -### Segments ### - -- **Rôle**: Affiche le *chapitrage* du média, en horizontal. -- **Options**: - - **colors**: liste de couleurs à utiliser lorsque les annotations ne contiennent pas d’information de couleur. - - **height**: hauteur du widget -- Utilise un fichier CSS: oui - -### Slider ### - -- **Rôle**: Barre de progression et *Slider* indiquant la position de la tête de lecture vidéo et permettant de la déplacer. -- **Options**: - - **minimized\_height**: (défaut: 4), hauteur en pixels du *Slider* en mode minimisé - - **maximized\_height**: (défaut: 10), hauteur en pixels du *Slider* en mode maximisé (lorsque la souris passe dessus) - - **minimize\_timeout**: (défaut: 1500), durée en millisecondes avant que le *Slider* ne se minimise. À une valeur de 0, le *Slider* ne se minimise plus. -- Utilise la bibliothèque: jQuery UI -- Utilise un fichier CSS: oui - -### Social ### - -- **Role**: Affiche des boutons pour partager une URL sur les réseaux sociaux -- **Options**: - - **text**: un texte à afficher (dans le tweet, etc.) - - **url**: l’URL à partager - - **show_url**: Affiche un bouton pour copier-coller une URL. - - **show_twitter**: Affiche un bouton pour partager sur Twitter. - - **show_fb**: Affiche un bouton pour partager sur Facebook. - - **show_gplus**: Affiche un bouton pour partager sur Google+. - - **show_mail**: Affiche un bouton pour partager par e-mail. -- Utilise un fichier CSS: oui. -- Utilise la bibliothèque: ZeroClipboard - -### Sparkline ### - -- **Rôle**: Affiche une courbe indiquant l’évolution du volume d’annotations au cours du temps. -- **Options**: - - **annotation\_type**: cf. *Options courantes*, plus haut. - - **lineColor**: (défaut: "#7492b4" = gris-bleu), couleur de la courbe - - **fillColor**: (défaut: "#aeaeb8" = gris), couleur de la surface sous la courbe - - **lineWidth**: (défaut: 2), épaisseur en pixels de la courbe - - **slice\_count**: (défaut: 20), nombre des tranches horaires dans lesquelles les annotations sont réparties pour calculer la courbe - - **height**: (défaut: 50), hauteur en pixels de la courbe - - **margin**: (défaut: 5), marge en pixels au-dessus de la courbe -- Utilise la bibliothèque: Raphael -- Utilise un fichier CSS: non - -### Tagcloud ### - -- **Rôle**: Affiche un nuage de mots-clés -- **Options**: - - **include\_titles**: (défaut: true), utiliser le contenu du champ titre des annotations pour calculer le nuage de mots-clés. - - **include\_descriptions**: (défaut: true), utiliser le contenu du champ description des annotations pour calculer le nuage. - - **include\_tag\_texts**: (défaut: true), utiliser les textes des tags liés aux annotations pour calculer le nuage de mots-clés. - - **tag\_count**: (défaut: 30), nombre maximum de mots-clés à afficher. - - **stopword\_language**: (défaut: "fr"), code de langue correspondant à une liste de mots vides à exclure du nuage. - - **custom\_stopwords**: (défaut: []), liste de mots-vides à exclure du nuage. - - **exclude\_pattern**: (défaut: false), expression régulière à exclure du nuage. - - **annotation\_type**: (défaut: false), cf. *Options courantes*, plus haut. Concerne les annotations dont les contenus sont utilisés pour calculer le nuage. - - **segment\_annotation\_type**: (défaut: false), permet de définir la segmentation du nuage de mots-clés et de calculer un nuage pour chaque segment du type d’annotation choisi. Lorsque ce paramètre est à *false*, un seul nuage est calculé pour toute la durée de la vidéo. - - **min\_font\_size**: (défaut: 10), taille de caractères (en pixels) pour le mot le moins fréquent. - - **max\_font\_size**: (défaut: 26), taille de caractères (en pixels) pour le mot le plus fréquent. -- Utilise un fichier CSS: oui - -### Tooltip ### - -- **Rôle**: Affiche une infobulle, utilisé uniquement comme *widget inclus* dans d’autres widgets. -- Pas d’options -- Utilise un fichier CSS: oui - -### Trace ### - -- **Rôle**: Envoi des traces au serveur KTBS -- **Options**: - - **js\_console**: (défaut: false), écriture ou non des traces dans la console du navigateur. - - **url**: (défaut: "http://traces.advene.org:5000/"), URL du serveur de traces - - **requestmode**: (défaut: "GET"), méthode HTTP utilisée pour l’envoi des traces (seul *"GET"* permet le *cross-domain*). - - **syncmode**: (défaut: "sync"), envois groupés (mode *"delayed"*) ou non (*"sync"*) des traces -- Utilise la bibliothèque: ktbs4js tracemanager -- Utilise un fichier CSS: non. - -### Tweet ### - -- **Rôle**: Affiche furtivement le contenu d’un tweet -- **Options**: - - **hide_timeout**: (défaut: 5000), durée en millisecondes, avant que l’affichage du Tweet ne se referme - - **polemics**: identique au paramètre *polemics* du widget *Polemic* diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/docs/data-api.fr.md --- a/metadataplayer/docs/data-api.fr.md Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,304 +0,0 @@ -# API d’accès aux métadonnées # - -ATTENTION ! -Cette documentation se réfère à la dernière version du Metadataplayer, disponible dans la branche **default** du repository -http://www.iri.centrepompidou.fr/dev/hg/metadataplayer - -## Élément de base ## - - IriSP.Model.Element - -### Rôle ### - -Classe de base dont héritent les différents types d’objets utilisés dans le Metadataplayer: annotations, types d’annotations, médias, etc. - -### Instanciation ### - -**Element** fonctionne comme une classe abstraite est n’est jamais instancié directement. - -Néanmoins, tous les objets en héritant seront instanciés de la manière suivante : - - var myElement = new IriSP.Model.Element(id, source); - -- **id** est l’identifiant unique de l’élément. S’il est à *false*, un identifiant unique sera généré. -- **source** identifie la source de données dont provient l’élément (cf. Source de Données, *IriSP.Model.Source*, plus bas). - -### Propriétés ### - -#### type #### - -Type d’élément, surchargé par les classes qui héritent de l’élément de base: - -- **element** pour IriSP.Model.Element -- **media** pour IriSP.Model.Media -- **annotationType** pour IriSP.Model.AnnotationType -- **tag** pour IriSP.Model.Tag -- **annotation** pour IriSP.Model.Annotation -- **mashup** pour IriSP.Model.Mashup -- **mashedAnnotation** pour IriSP.Model.MashedAnnotation - -#### id #### - -Identifiant unique de l’élément - -#### title #### - -Titre de l’élément, par défaut une chaîne vide ("") - -#### description #### - -Description de l’élément, par défaut une chaîne vide ("") - -## Media ## - - IriSP.Model.Media - -### Rôle ### - -Représente un média (vidéo ou audio). - -Hérite de l’Élément de base - -### Propriétés ### - -#### video #### - -Il s’agit de l’URL de la vidéo à charger - -#### duration #### - -Il s’agit de la durée du média (telle que renseignée dans les métadonnées -- peut ne pas être égale à la durée telle que lue dans la fenêtre vidéo). - -Il s’agit d’un objet durée (cf. *IriSP.Model.Time* plus bas) - -### Méthodes ### - -#### getDuration #### - -Permet de spécifier la durée du média, en millisecondes - -#### getAnnotations #### - -Retourne la liste des annotations associées au média - -#### getAnnotationsByTypeTitle #### - -Retourne la liste des annotations associées au média et dont le type d’annotation (ou découpage, ou ligne, c.f. Type d’Annotation plus bas) correspond à l’argument de la fonction - -## Type d’Annotation ## - - IriSP.Model.AnnotationType - -### Rôle ### - -Représente un type d’annotation, correspondant également à ce qui peut être nommé découpage ou ligne dans *Lignes de Temps* - -Hérite de l’Élément de base. - -### Méthodes ### - -#### getAnnotations #### - -Retourne la liste des annotations associées au type d’annotation - -## Annotation ## - - IriSP.Model.Annotation - -### Rôle ### - -Représente une annotation, correspondant à un segment temporel (dont la durée peut être nulle) d’un média - -Hérite de l’Élément de base. - -### Propriétés ### - -#### begin #### - -Timecode de fin de l’annotation. Est un objet de type durée (cf. plus bas) - -#### begin #### - -Timecode de début de l’annotation. Est un objet de type durée (cf. plus bas) - -### Méthodes ### - -#### getMedia #### - -Retourne l’objet **Média** (*IriSP.Model.Media*) auquel se réfère l’annotation - -#### getAnnotationType #### - -Retourne l’objet **Type d’Annotation** (*IriSP.Model.AnnotationType*) auquel se réfère l’annotation - -#### getTags #### - -Retourne la liste (cf. Liste d’éléments *IriSP.Model.List*) des tags associés à l’annotation. - -#### getTagTexts #### - -## Mashup ## - - IriSP.Model.Mashup - -### Rôle ### - -Il s’agit d’un bout à bout, composé d’une liste de segments (définis par des annotations de durée non nulle) accolés les uns après les autres. - -### Méthodes ### - -**À compléter** - -## Liste d’éléments ## - - IriSP.Model.List - -### Rôle ### - -Etend les fonctionnalités des tableaux javascript (*Array*) pour lister des éléments (cf. types d’éléments ci-dessus). - -### Instanciation ### - - var myList = new IriSP.Model.List(directory); - -- **directory** est le répertoire de données auxquelles la liste permet d’accéder (cf. plus bas) - -### Méthodes ### - -#### Méthodes de parcours de liste #### - -Ces méthodes sont fournies grâce à la bibliothèque extérieure *underscore.js* et sont documentées sur http://documentcloud.github.com/underscore/ - -Il s’agit de: - -- **map**: Renvoie un tableau (*Array*) dont les éléments correspondent aux éléments de la liste, via une fonction passée en argument de map -- **forEach**: Itère une fonction sur la liste. -- **filter**: Ne renvoie que les éléments de la liste dont la valeur correspond au résultat d’une fonction. -- **sortBy**: Fonction de tri, par ordre croissant de la valeur retournée par la fonction passée en argument. - -#### searchByTitle, searchByDescription, searchByTextFields #### - -Méthodes retournant une nouvelle liste d’éléments, contenant les éléments de la liste dont respectivement le titre, la description ou les deux correspondent à l’argument de la méthode. - - myList.searchByTitle("texte"); // => un *IriSP.Model.List* contenant les éléments de myList dont le titre contient "texte" - -## Durée ## - - IriSP.Model.Time - -### Rôle ### - -Facilite la gestion des durées en millisecondes utilisées dans le Metadataplayer - -### Instanciation ### - - var myTime = new IriSP.Model.Time(ms); - -- **ms** est une durée en millisecondes - -### Méthodes ### - -#### getSeconds #### - -Renvoie la durée convertie en secondes - -#### toString #### - -Renvoie la durée au format (hh:)mm:ss - -#### setSeconds #### - -Permet d’affecter une durée en secondes - - myTime.setSeconds(12); // 12000 millisecondes - -## Source de données ## - - IriSP.Model.Source - -et - IriSP.Model.RemoteSource - -### Rôle ### - -Gère une source de données : fichier externe JSON, XML, etc. pour *IriSP.Model.RemoteSource*, projet créé à la volée pour *IriSP.Model.Source*. - -*IriSP.Model.RemoteSource* hérite de *IriSP.Model.Source* et ne diffère que par son implémentation de la méthode *get*. - -Sur la plateforme *Lignes de Temps*, il existe plusieurs API qui sont utilisées comme sources : - -- L’API projet, qui renvoie un fichier JSON contenant un projet LDT complet. -- L’API segment, qui renvoie toutes les annotations d’un média situées entre deux timecodes fournis en argument. -- L’API de publication d’annotation, qui demande l’envoi (par la méthode HTTP PUT) d’une liste d’annotation et renvoie celle-ci en retour, avec les identifiants des annotations en base de données. - -### Instanciation ### - - var config = { directory: myDirectory }; - var mySource = new IriSP.Model.Source(config); - -- **config** est un objet contenant les options de configuration: - - Il doit nécessairement contenir une propriété **directory**, désignant le répertoire de données (cf. plus bas). - - La propriété **serializer** doit désigner le *Sérialiseur* utilisé pour désérialiser les données importées ou sérialiser l’export. - - un *IriSP.Model.RemoteSource* doit également être appelé avec une propriété **url**, désignant l’URL de la source. - -Une Source ne doit pas être instanciée directement, ce rôle est donné aux répertoires de données, ce qui permet notamment d’éviter des accès multiples à une même URL. - -### Propriétés ### - -#### currentMedia #### - -*TODO: transférer dans un objet "Project"* - -Donne accès au média en cours du projet. Peut désigner un vrai média ou un mashup. - -### Méthodes ### - -#### get #### - -Permet de récupérer ou de rafraîchir, via Ajax, les données de la source. Pour un *IriSP.Model.Source* de base, n’a aucun effet. - -#### onLoad #### - -Permet d’exécuter une fonction, passée en argument, au chargement de la source. - -#### serialize, deSerialize #### - -Transforme les données de la source en données sérialisées, au format du sérialiseur associées à la source, et inversement. - -#### getAnnotations, getAnnotationTypes, getMedias, getTags, getMashups #### - -Retourne les listes respectives d’annotations, types d’annotations, médias, tags et mashups de la source. - -#### getAnnotationsByTypeTitle #### - -Retourne la liste des annotations dont le type d’annotation correspond à l’argument de la fonction. - -## Répertoire de données ## - - IriSP.Model.Directory - -### Rôle ### - -Gère l’instanciation des sources de données et la mise en cache de ces sources lorsque plusieurs appels à la même URLs sont faits. - -Permet également aux objets de plusieurs sources d’interagir entre eux. - -### Instanciation ### - - var myDirectory = new IriSP.Model.Directory - -### Méthodes ### - -#### newLocalSource #### - -Crée une nouvelle source non attachée à une URL. S’il faut exporter des données, un sérialiseur doit être passé en paramètres. - - var myConfig = { serializer: IriSP.serializers.ldt }; - var myLocalSource = myDirectory.newLocalSource(myConfig); - -#### remoteSource #### - -Crée ou récupère (si celle-ci existe déjà) une source attachée à une URL. Le sérialiseur est obligatoire. - - var myConfig = { url: "source-data.json", serializer: IriSP.serializers.ldt }; - var myLocalSource = myDirectory.remoteSource(myConfig); diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/docs/integration.fr.md --- a/metadataplayer/docs/integration.fr.md Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -# Intégration du Metadataplayer # - -ATTENTION ! -Cette documentation se réfère à la dernière version du Metadataplayer, disponible dans la branche **default** du repository -http://www.iri.centrepompidou.fr/dev/hg/metadataplayer - -## Chargement du script ## - -Le fichier *LdtPlayer-core.js* doit être référencé dans l'entête du fichier HTML - - - - Test d’intégration du Metadataplayer - - - -## Création d'un élément conteneur pour le Metadataplayer ## - - -
- -Le script doit se faire après le chargement de l’élément, soit en rajoutant un élément <*script*> en bas de page, soit en utilisant un événement de type *body.onload* ou, avec jQuery, *$(document).ready()* - - - - - - -

Metadataplayer test with JwPlayer

-
-
- - - diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/LAB.min.js --- a/metadataplayer/libs/LAB.min.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -/*! LAB.js (LABjs :: Loading And Blocking JavaScript) - v2.0.3 (c) Kyle Simpson - MIT License -*/ -(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b0){for(var a=0;a=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this); \ No newline at end of file diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/ZeroClipboard.js --- a/metadataplayer/libs/ZeroClipboard.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,311 +0,0 @@ -// Simple Set Clipboard System -// Author: Joseph Huckaby - -var ZeroClipboard = { - - version: "1.0.7", - clients: {}, // registered upload clients on page, indexed by id - moviePath: 'ZeroClipboard.swf', // URL to movie - nextId: 1, // ID of next movie - - $: function(thingy) { - // simple DOM lookup utility function - if (typeof(thingy) == 'string') thingy = document.getElementById(thingy); - if (!thingy.addClass) { - // extend element with a few useful methods - thingy.hide = function() { this.style.display = 'none'; }; - thingy.show = function() { this.style.display = ''; }; - thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; }; - thingy.removeClass = function(name) { - var classes = this.className.split(/\s+/); - var idx = -1; - for (var k = 0; k < classes.length; k++) { - if (classes[k] == name) { idx = k; k = classes.length; } - } - if (idx > -1) { - classes.splice( idx, 1 ); - this.className = classes.join(' '); - } - return this; - }; - thingy.hasClass = function(name) { - return !!this.className.match( new RegExp("\\s*" + name + "\\s*") ); - }; - } - return thingy; - }, - - setMoviePath: function(path) { - // set path to ZeroClipboard.swf - this.moviePath = path; - }, - - dispatch: function(id, eventName, args) { - // receive event from flash movie, send to client - var client = this.clients[id]; - if (client) { - client.receiveEvent(eventName, args); - } - }, - - register: function(id, client) { - // register new client to receive events - this.clients[id] = client; - }, - - getDOMObjectPosition: function(obj, stopObj) { - // get absolute coordinates for dom element - var info = { - left: 0, - top: 0, - width: obj.width ? obj.width : obj.offsetWidth, - height: obj.height ? obj.height : obj.offsetHeight - }; - - while (obj && (obj != stopObj)) { - info.left += obj.offsetLeft; - info.top += obj.offsetTop; - obj = obj.offsetParent; - } - - return info; - }, - - Client: function(elem) { - // constructor for new simple upload client - this.handlers = {}; - - // unique ID - this.id = ZeroClipboard.nextId++; - this.movieId = 'ZeroClipboardMovie_' + this.id; - - // register client with singleton to receive flash events - ZeroClipboard.register(this.id, this); - - // create movie - if (elem) this.glue(elem); - } -}; - -ZeroClipboard.Client.prototype = { - - id: 0, // unique ID for us - ready: false, // whether movie is ready to receive events or not - movie: null, // reference to movie object - clipText: '', // text to copy to clipboard - handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor - cssEffects: true, // enable CSS mouse effects on dom container - handlers: null, // user event handlers - - glue: function(elem, appendElem, stylesToAdd) { - // glue to DOM element - // elem can be ID or actual DOM element object - this.domElement = ZeroClipboard.$(elem); - - // float just above object, or zIndex 99 if dom element isn't set - var zIndex = 99; - if (this.domElement.style.zIndex) { - zIndex = parseInt(this.domElement.style.zIndex, 10) + 1; - } - - if (typeof(appendElem) == 'string') { - appendElem = ZeroClipboard.$(appendElem); - } - else if (typeof(appendElem) == 'undefined') { - appendElem = document.getElementsByTagName('body')[0]; - } - - // find X/Y position of domElement - var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem); - - // create floating DIV above element - this.div = document.createElement('div'); - var style = this.div.style; - style.position = 'absolute'; - style.left = '' + box.left + 'px'; - style.top = '' + box.top + 'px'; - style.width = '' + box.width + 'px'; - style.height = '' + box.height + 'px'; - style.zIndex = zIndex; - - if (typeof(stylesToAdd) == 'object') { - for (addedStyle in stylesToAdd) { - style[addedStyle] = stylesToAdd[addedStyle]; - } - } - - // style.backgroundColor = '#f00'; // debug - - appendElem.appendChild(this.div); - - this.div.innerHTML = this.getHTML( box.width, box.height ); - }, - - getHTML: function(width, height) { - // return HTML for movie - var html = ''; - var flashvars = 'id=' + this.id + - '&width=' + width + - '&height=' + height; - - if (navigator.userAgent.match(/MSIE/)) { - // IE gets an OBJECT tag - var protocol = location.href.match(/^https/i) ? 'https://' : 'http://'; - html += ''; - } - else { - // all other browsers get an EMBED tag - html += ''; - } - return html; - }, - - hide: function() { - // temporarily hide floater offscreen - if (this.div) { - this.div.style.left = '-2000px'; - } - }, - - show: function() { - // show ourselves after a call to hide() - this.reposition(); - }, - - destroy: function() { - // destroy control and floater - if (this.domElement && this.div) { - this.hide(); - this.div.innerHTML = ''; - - var body = document.getElementsByTagName('body')[0]; - try { body.removeChild( this.div ); } catch(e) {;} - - this.domElement = null; - this.div = null; - } - }, - - reposition: function(elem) { - // reposition our floating div, optionally to new container - // warning: container CANNOT change size, only position - if (elem) { - this.domElement = ZeroClipboard.$(elem); - if (!this.domElement) this.hide(); - } - - if (this.domElement && this.div) { - var box = ZeroClipboard.getDOMObjectPosition(this.domElement); - var style = this.div.style; - style.left = '' + box.left + 'px'; - style.top = '' + box.top + 'px'; - } - }, - - setText: function(newText) { - // set text to be copied to clipboard - this.clipText = newText; - if (this.ready) this.movie.setText(newText); - }, - - addEventListener: function(eventName, func) { - // add user event listener for event - // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - if (!this.handlers[eventName]) this.handlers[eventName] = []; - this.handlers[eventName].push(func); - }, - - setHandCursor: function(enabled) { - // enable hand cursor (true), or default arrow cursor (false) - this.handCursorEnabled = enabled; - if (this.ready) this.movie.setHandCursor(enabled); - }, - - setCSSEffects: function(enabled) { - // enable or disable CSS effects on DOM container - this.cssEffects = !!enabled; - }, - - receiveEvent: function(eventName, args) { - // receive event from flash - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - - // special behavior for certain events - switch (eventName) { - case 'load': - // movie claims it is ready, but in IE this isn't always the case... - // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function - this.movie = document.getElementById(this.movieId); - if (!this.movie) { - var self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 1 ); - return; - } - - // firefox on pc needs a "kick" in order to set these in certain cases - if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) { - var self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 100 ); - this.ready = true; - return; - } - - this.ready = true; - this.movie.setText( this.clipText ); - this.movie.setHandCursor( this.handCursorEnabled ); - break; - - case 'mouseover': - if (this.domElement && this.cssEffects) { - this.domElement.addClass('hover'); - if (this.recoverActive) this.domElement.addClass('active'); - } - break; - - case 'mouseout': - if (this.domElement && this.cssEffects) { - this.recoverActive = false; - if (this.domElement.hasClass('active')) { - this.domElement.removeClass('active'); - this.recoverActive = true; - } - this.domElement.removeClass('hover'); - } - break; - - case 'mousedown': - if (this.domElement && this.cssEffects) { - this.domElement.addClass('active'); - } - break; - - case 'mouseup': - if (this.domElement && this.cssEffects) { - this.domElement.removeClass('active'); - this.recoverActive = false; - } - break; - } // switch eventName - - if (this.handlers[eventName]) { - for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) { - var func = this.handlers[eventName][idx]; - - if (typeof(func) == 'function') { - // actual function reference - func(this, args); - } - else if ((typeof(func) == 'object') && (func.length == 2)) { - // PHP style object + method, i.e. [myObject, 'myMethod'] - func[0][ func[1] ](this, args); - } - else if (typeof(func) == 'string') { - // name of function - window[func](this, args); - } - } // foreach event handler defined - } // user defined handler for event - } - -}; diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/ZeroClipboard.swf Binary file metadataplayer/libs/ZeroClipboard.swf has changed diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/backbone-relational.js --- a/metadataplayer/libs/backbone-relational.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1687 +0,0 @@ -/** - * Backbone-relational.js 0.6.0 - * (c) 2011 Paul Uithol - * - * Backbone-relational may be freely distributed under the MIT license; see the accompanying LICENSE.txt. - * For details and documentation: https://github.com/PaulUithol/Backbone-relational. - * Depends on Backbone (and thus on Underscore as well): https://github.com/documentcloud/backbone. - */ -( function( undefined ) { - "use strict"; - - /** - * CommonJS shim - **/ - var _, Backbone, exports; - if ( typeof window === 'undefined' ) { - _ = require( 'underscore' ); - Backbone = require( 'backbone' ); - exports = module.exports = Backbone; - } - else { - _ = window._; - Backbone = window.Backbone; - exports = window; - } - - Backbone.Relational = { - showWarnings: true - }; - - /** - * Semaphore mixin; can be used as both binary and counting. - **/ - Backbone.Semaphore = { - _permitsAvailable: null, - _permitsUsed: 0, - - acquire: function() { - if ( this._permitsAvailable && this._permitsUsed >= this._permitsAvailable ) { - throw new Error( 'Max permits acquired' ); - } - else { - this._permitsUsed++; - } - }, - - release: function() { - if ( this._permitsUsed === 0 ) { - throw new Error( 'All permits released' ); - } - else { - this._permitsUsed--; - } - }, - - isLocked: function() { - return this._permitsUsed > 0; - }, - - setAvailablePermits: function( amount ) { - if ( this._permitsUsed > amount ) { - throw new Error( 'Available permits cannot be less than used permits' ); - } - this._permitsAvailable = amount; - } - }; - - /** - * A BlockingQueue that accumulates items while blocked (via 'block'), - * and processes them when unblocked (via 'unblock'). - * Process can also be called manually (via 'process'). - */ - Backbone.BlockingQueue = function() { - this._queue = []; - }; - _.extend( Backbone.BlockingQueue.prototype, Backbone.Semaphore, { - _queue: null, - - add: function( func ) { - if ( this.isBlocked() ) { - this._queue.push( func ); - } - else { - func(); - } - }, - - process: function() { - while ( this._queue && this._queue.length ) { - this._queue.shift()(); - } - }, - - block: function() { - this.acquire(); - }, - - unblock: function() { - this.release(); - if ( !this.isBlocked() ) { - this.process(); - } - }, - - isBlocked: function() { - return this.isLocked(); - } - }); - /** - * Global event queue. Accumulates external events ('add:', 'remove:' and 'update:') - * until the top-level object is fully initialized (see 'Backbone.RelationalModel'). - */ - Backbone.Relational.eventQueue = new Backbone.BlockingQueue(); - - /** - * Backbone.Store keeps track of all created (and destruction of) Backbone.RelationalModel. - * Handles lookup for relations. - */ - Backbone.Store = function() { - this._collections = []; - this._reverseRelations = []; - this._subModels = []; - this._modelScopes = [ exports ]; - }; - _.extend( Backbone.Store.prototype, Backbone.Events, { - addModelScope: function( scope ) { - this._modelScopes.push( scope ); - }, - - /** - * Add a set of subModelTypes to the store, that can be used to resolve the '_superModel' - * for a model later in 'setupSuperModel'. - * - * @param {Backbone.RelationalModel} subModelTypes - * @param {Backbone.RelationalModel} superModelType - */ - addSubModels: function( subModelTypes, superModelType ) { - this._subModels.push({ - 'superModelType': superModelType, - 'subModels': subModelTypes - }); - }, - - /** - * Check if the given modelType is registered as another model's subModel. If so, add it to the super model's - * '_subModels', and set the modelType's '_superModel', '_subModelTypeName', and '_subModelTypeAttribute'. - * - * @param {Backbone.RelationalModel} modelType - */ - setupSuperModel: function( modelType ) { - _.find( this._subModels, function( subModelDef ) { - return _.find( subModelDef.subModels, function( subModelTypeName, typeValue ) { - var subModelType = this.getObjectByName( subModelTypeName ); - - if ( modelType === subModelType ) { - // Set 'modelType' as a child of the found superModel - subModelDef.superModelType._subModels[ typeValue ] = modelType; - - // Set '_superModel', '_subModelTypeValue', and '_subModelTypeAttribute' on 'modelType'. - modelType._superModel = subModelDef.superModelType; - modelType._subModelTypeValue = typeValue; - modelType._subModelTypeAttribute = subModelDef.superModelType.prototype.subModelTypeAttribute; - return true; - } - }, this ); - }, this ); - }, - - /** - * Add a reverse relation. Is added to the 'relations' property on model's prototype, and to - * existing instances of 'model' in the store as well. - * @param {Object} relation - * @param {Backbone.RelationalModel} relation.model - * @param {String} relation.type - * @param {String} relation.key - * @param {String|Object} relation.relatedModel - */ - addReverseRelation: function( relation ) { - var exists = _.any( this._reverseRelations, function( rel ) { - return _.all( relation, function( val, key ) { - return val === rel[ key ]; - }); - }); - - if ( !exists && relation.model && relation.type ) { - this._reverseRelations.push( relation ); - - var addRelation = function( model, relation ) { - if ( !model.prototype.relations ) { - model.prototype.relations = []; - } - model.prototype.relations.push( relation ); - - _.each( model._subModels, function( subModel ) { - addRelation( subModel, relation ); - }, this ); - }; - - addRelation( relation.model, relation ); - - this.retroFitRelation( relation ); - } - }, - - /** - * Add a 'relation' to all existing instances of 'relation.model' in the store - * @param {Object} relation - */ - retroFitRelation: function( relation ) { - var coll = this.getCollection( relation.model ); - coll.each( function( model ) { - if ( !( model instanceof relation.model ) ) { - return; - } - - new relation.type( model, relation ); - }, this); - }, - - /** - * Find the Store's collection for a certain type of model. - * @param {Backbone.RelationalModel} model - * @return {Backbone.Collection} A collection if found (or applicable for 'model'), or null - */ - getCollection: function( model ) { - if ( model instanceof Backbone.RelationalModel ) { - model = model.constructor; - } - - var rootModel = model; - while ( rootModel._superModel ) { - rootModel = rootModel._superModel; - } - - var coll = _.detect( this._collections, function( c ) { - return c.model === rootModel; - }); - - if ( !coll ) { - coll = this._createCollection( rootModel ); - } - - return coll; - }, - - /** - * Find a type on the global object by name. Splits name on dots. - * @param {String} name - * @return {Object} - */ - getObjectByName: function( name ) { - var parts = name.split( '.' ), - type = null; - - _.find( this._modelScopes, function( scope ) { - type = _.reduce( parts, function( memo, val ) { - return memo[ val ]; - }, scope ); - - if ( type && type !== scope ) { - return true; - } - }, this ); - - return type; - }, - - _createCollection: function( type ) { - var coll; - - // If 'type' is an instance, take its constructor - if ( type instanceof Backbone.RelationalModel ) { - type = type.constructor; - } - - // Type should inherit from Backbone.RelationalModel. - if ( type.prototype instanceof Backbone.RelationalModel ) { - coll = new Backbone.Collection(); - coll.model = type; - - this._collections.push( coll ); - } - - return coll; - }, - - /** - * Find the attribute that is to be used as the `id` on a given object - * @param type - * @param {String|Number|Object|Backbone.RelationalModel} item - * @return {String|Number} - */ - resolveIdForItem: function( type, item ) { - var id = _.isString( item ) || _.isNumber( item ) ? item : null; - - if ( id === null ) { - if ( item instanceof Backbone.RelationalModel ) { - id = item.id; - } - else if ( _.isObject( item ) ) { - id = item[ type.prototype.idAttribute ]; - } - } - - // Make all falsy values `null` (except for 0, which could be an id.. see '/issues/179') - if ( !id && id !== 0 ) { - id = null; - } - - return id; - }, - - /** - * - * @param type - * @param {String|Number|Object|Backbone.RelationalModel} item - */ - find: function( type, item ) { - var id = this.resolveIdForItem( type, item ); - var coll = this.getCollection( type ); - - // Because the found object could be of any of the type's superModel - // types, only return it if it's actually of the type asked for. - if ( coll ) { - var obj = coll.get( id ); - - if ( obj instanceof type ) { - return obj; - } - } - - return null; - }, - - /** - * Add a 'model' to it's appropriate collection. Retain the original contents of 'model.collection'. - * @param {Backbone.RelationalModel} model - */ - register: function( model ) { - var coll = this.getCollection( model ); - - if ( coll ) { - if ( coll.get( model ) ) { - throw new Error( "Cannot instantiate more than one Backbone.RelationalModel with the same id per type!" ); - } - - var modelColl = model.collection; - coll.add( model ); - model.bind( 'destroy', this.unregister, this ); - model.collection = modelColl; - } - }, - - /** - * Explicitly update a model's id in it's store collection - * @param {Backbone.RelationalModel} model - */ - update: function( model ) { - var coll = this.getCollection( model ); - coll._onModelEvent( 'change:' + model.idAttribute, model, coll ); - }, - - /** - * Remove a 'model' from the store. - * @param {Backbone.RelationalModel} model - */ - unregister: function( model ) { - model.unbind( 'destroy', this.unregister ); - var coll = this.getCollection( model ); - coll && coll.remove( model ); - } - }); - Backbone.Relational.store = new Backbone.Store(); - - /** - * The main Relation class, from which 'HasOne' and 'HasMany' inherit. Internally, 'relational:' events - * are used to regulate addition and removal of models from relations. - * - * @param {Backbone.RelationalModel} instance - * @param {Object} options - * @param {string} options.key - * @param {Backbone.RelationalModel.constructor} options.relatedModel - * @param {Boolean|String} [options.includeInJSON=true] Serialize the given attribute for related model(s)' in toJSON, or just their ids. - * @param {Boolean} [options.createModels=true] Create objects from the contents of keys if the object is not found in Backbone.store. - * @param {Object} [options.reverseRelation] Specify a bi-directional relation. If provided, Relation will reciprocate - * the relation to the 'relatedModel'. Required and optional properties match 'options', except that it also needs - * {Backbone.Relation|String} type ('HasOne' or 'HasMany'). - */ - Backbone.Relation = function( instance, options ) { - this.instance = instance; - // Make sure 'options' is sane, and fill with defaults from subclasses and this object's prototype - options = _.isObject( options ) ? options : {}; - this.reverseRelation = _.defaults( options.reverseRelation || {}, this.options.reverseRelation ); - this.reverseRelation.type = !_.isString( this.reverseRelation.type ) ? this.reverseRelation.type : - Backbone[ this.reverseRelation.type ] || Backbone.Relational.store.getObjectByName( this.reverseRelation.type ); - this.model = options.model || this.instance.constructor; - this.options = _.defaults( options, this.options, Backbone.Relation.prototype.options ); - - this.key = this.options.key; - this.keySource = this.options.keySource || this.key; - this.keyDestination = this.options.keyDestination || this.keySource || this.key; - - // 'exports' should be the global object where 'relatedModel' can be found on if given as a string. - this.relatedModel = this.options.relatedModel; - if ( _.isString( this.relatedModel ) ) { - this.relatedModel = Backbone.Relational.store.getObjectByName( this.relatedModel ); - } - - if ( !this.checkPreconditions() ) { - return false; - } - - if ( instance ) { - this.keyContents = this.instance.get( this.keySource ); - - // Explicitly clear 'keySource', to prevent a leaky abstraction if 'keySource' differs from 'key'. - if ( this.key !== this.keySource ) { - this.instance.unset( this.keySource, { silent: true } ); - } - - // Add this Relation to instance._relations - this.instance._relations.push( this ); - } - - // Add the reverse relation on 'relatedModel' to the store's reverseRelations - if ( !this.options.isAutoRelation && this.reverseRelation.type && this.reverseRelation.key ) { - Backbone.Relational.store.addReverseRelation( _.defaults( { - isAutoRelation: true, - model: this.relatedModel, - relatedModel: this.model, - reverseRelation: this.options // current relation is the 'reverseRelation' for it's own reverseRelation - }, - this.reverseRelation // Take further properties from this.reverseRelation (type, key, etc.) - ) ); - } - - _.bindAll( this, '_modelRemovedFromCollection', '_relatedModelAdded', '_relatedModelRemoved' ); - - if ( instance ) { - this.initialize(); - - // When a model in the store is destroyed, check if it is 'this.instance'. - Backbone.Relational.store.getCollection( this.instance ) - .bind( 'relational:remove', this._modelRemovedFromCollection ); - - // When 'relatedModel' are created or destroyed, check if it affects this relation. - Backbone.Relational.store.getCollection( this.relatedModel ) - .bind( 'relational:add', this._relatedModelAdded ) - .bind( 'relational:remove', this._relatedModelRemoved ); - } - }; - // Fix inheritance :\ - Backbone.Relation.extend = Backbone.Model.extend; - // Set up all inheritable **Backbone.Relation** properties and methods. - _.extend( Backbone.Relation.prototype, Backbone.Events, Backbone.Semaphore, { - options: { - createModels: true, - includeInJSON: true, - isAutoRelation: false - }, - - instance: null, - key: null, - keyContents: null, - relatedModel: null, - reverseRelation: null, - related: null, - - _relatedModelAdded: function( model, coll, options ) { - // Allow 'model' to set up it's relations, before calling 'tryAddRelated' - // (which can result in a call to 'addRelated' on a relation of 'model') - var dit = this; - model.queue( function() { - dit.tryAddRelated( model, options ); - }); - }, - - _relatedModelRemoved: function( model, coll, options ) { - this.removeRelated( model, options ); - }, - - _modelRemovedFromCollection: function( model ) { - if ( model === this.instance ) { - this.destroy(); - } - }, - - /** - * Check several pre-conditions. - * @return {Boolean} True if pre-conditions are satisfied, false if they're not. - */ - checkPreconditions: function() { - var i = this.instance, - k = this.key, - m = this.model, - rm = this.relatedModel, - warn = Backbone.Relational.showWarnings && typeof console !== 'undefined'; - - if ( !m || !k || !rm ) { - warn && console.warn( 'Relation=%o; no model, key or relatedModel (%o, %o, %o)', this, m, k, rm ); - return false; - } - // Check if the type in 'model' inherits from Backbone.RelationalModel - if ( !( m.prototype instanceof Backbone.RelationalModel ) ) { - warn && console.warn( 'Relation=%o; model does not inherit from Backbone.RelationalModel (%o)', this, i ); - return false; - } - // Check if the type in 'relatedModel' inherits from Backbone.RelationalModel - if ( !( rm.prototype instanceof Backbone.RelationalModel ) ) { - warn && console.warn( 'Relation=%o; relatedModel does not inherit from Backbone.RelationalModel (%o)', this, rm ); - return false; - } - // Check if this is not a HasMany, and the reverse relation is HasMany as well - if ( this instanceof Backbone.HasMany && this.reverseRelation.type === Backbone.HasMany ) { - warn && console.warn( 'Relation=%o; relation is a HasMany, and the reverseRelation is HasMany as well.', this ); - return false; - } - - // Check if we're not attempting to create a duplicate relationship - if ( i && i._relations.length ) { - var exists = _.any( i._relations, function( rel ) { - var hasReverseRelation = this.reverseRelation.key && rel.reverseRelation.key; - return rel.relatedModel === rm && rel.key === k && - ( !hasReverseRelation || this.reverseRelation.key === rel.reverseRelation.key ); - }, this ); - - if ( exists ) { - warn && console.warn( 'Relation=%o between instance=%o.%s and relatedModel=%o.%s already exists', - this, i, k, rm, this.reverseRelation.key ); - return false; - } - } - - return true; - }, - - /** - * Set the related model(s) for this relation - * @param {Backbone.Mode|Backbone.Collection} related - * @param {Object} [options] - */ - setRelated: function( related, options ) { - this.related = related; - - this.instance.acquire(); - this.instance.set( this.key, related, _.defaults( options || {}, { silent: true } ) ); - this.instance.release(); - }, - - /** - * Determine if a relation (on a different RelationalModel) is the reverse - * relation of the current one. - * @param {Backbone.Relation} relation - * @return {Boolean} - */ - _isReverseRelation: function( relation ) { - if ( relation.instance instanceof this.relatedModel && this.reverseRelation.key === relation.key && - this.key === relation.reverseRelation.key ) { - return true; - } - return false; - }, - - /** - * Get the reverse relations (pointing back to 'this.key' on 'this.instance') for the currently related model(s). - * @param {Backbone.RelationalModel} [model] Get the reverse relations for a specific model. - * If not specified, 'this.related' is used. - * @return {Backbone.Relation[]} - */ - getReverseRelations: function( model ) { - var reverseRelations = []; - // Iterate over 'model', 'this.related.models' (if this.related is a Backbone.Collection), or wrap 'this.related' in an array. - var models = !_.isUndefined( model ) ? [ model ] : this.related && ( this.related.models || [ this.related ] ); - _.each( models , function( related ) { - _.each( related.getRelations(), function( relation ) { - if ( this._isReverseRelation( relation ) ) { - reverseRelations.push( relation ); - } - }, this ); - }, this ); - - return reverseRelations; - }, - - /** - * Rename options.silent to options.silentChange, so events propagate properly. - * (for example in HasMany, from 'addRelated'->'handleAddition') - * @param {Object} [options] - * @return {Object} - */ - sanitizeOptions: function( options ) { - options = options ? _.clone( options ) : {}; - if ( options.silent ) { - options.silentChange = true; - delete options.silent; - } - return options; - }, - - /** - * Rename options.silentChange to options.silent, so events are silenced as intended in Backbone's - * original functions. - * @param {Object} [options] - * @return {Object} - */ - unsanitizeOptions: function( options ) { - options = options ? _.clone( options ) : {}; - if ( options.silentChange ) { - options.silent = true; - delete options.silentChange; - } - return options; - }, - - // Cleanup. Get reverse relation, call removeRelated on each. - destroy: function() { - Backbone.Relational.store.getCollection( this.instance ) - .unbind( 'relational:remove', this._modelRemovedFromCollection ); - - Backbone.Relational.store.getCollection( this.relatedModel ) - .unbind( 'relational:add', this._relatedModelAdded ) - .unbind( 'relational:remove', this._relatedModelRemoved ); - - _.each( this.getReverseRelations(), function( relation ) { - relation.removeRelated( this.instance ); - }, this ); - } - }); - - Backbone.HasOne = Backbone.Relation.extend({ - options: { - reverseRelation: { type: 'HasMany' } - }, - - initialize: function() { - _.bindAll( this, 'onChange' ); - - this.instance.bind( 'relational:change:' + this.key, this.onChange ); - - var model = this.findRelated( { silent: true } ); - this.setRelated( model ); - - // Notify new 'related' object of the new relation. - _.each( this.getReverseRelations(), function( relation ) { - relation.addRelated( this.instance ); - }, this ); - }, - - findRelated: function( options ) { - var item = this.keyContents; - var model = null; - - if ( item instanceof this.relatedModel ) { - model = item; - } - else if ( item || item === 0 ) { // since 0 can be a valid `id` as well - model = this.relatedModel.findOrCreate( item, { create: this.options.createModels } ); - } - - return model; - }, - - /** - * If the key is changed, notify old & new reverse relations and initialize the new relation - */ - onChange: function( model, attr, options ) { - // Don't accept recursive calls to onChange (like onChange->findRelated->findOrCreate->initializeRelations->addRelated->onChange) - if ( this.isLocked() ) { - return; - } - this.acquire(); - options = this.sanitizeOptions( options ); - - // 'options._related' is set by 'addRelated'/'removeRelated'. If it is set, the change - // is the result of a call from a relation. If it's not, the change is the result of - // a 'set' call on this.instance. - var changed = _.isUndefined( options._related ); - var oldRelated = changed ? this.related : options._related; - - if ( changed ) { - this.keyContents = attr; - - // Set new 'related' - if ( attr instanceof this.relatedModel ) { - this.related = attr; - } - else if ( attr ) { - var related = this.findRelated( options ); - this.setRelated( related ); - } - else { - this.setRelated( null ); - } - } - - // Notify old 'related' object of the terminated relation - if ( oldRelated && this.related !== oldRelated ) { - _.each( this.getReverseRelations( oldRelated ), function( relation ) { - relation.removeRelated( this.instance, options ); - }, this ); - } - - // Notify new 'related' object of the new relation. Note we do re-apply even if this.related is oldRelated; - // that can be necessary for bi-directional relations if 'this.instance' was created after 'this.related'. - // In that case, 'this.instance' will already know 'this.related', but the reverse might not exist yet. - _.each( this.getReverseRelations(), function( relation ) { - relation.addRelated( this.instance, options ); - }, this); - - // Fire the 'update:' event if 'related' was updated - if ( !options.silentChange && this.related !== oldRelated ) { - var dit = this; - Backbone.Relational.eventQueue.add( function() { - dit.instance.trigger( 'update:' + dit.key, dit.instance, dit.related, options ); - }); - } - this.release(); - }, - - /** - * If a new 'this.relatedModel' appears in the 'store', try to match it to the last set 'keyContents' - */ - tryAddRelated: function( model, options ) { - if ( this.related ) { - return; - } - options = this.sanitizeOptions( options ); - - var item = this.keyContents; - if ( item || item === 0 ) { // since 0 can be a valid `id` as well - var id = Backbone.Relational.store.resolveIdForItem( this.relatedModel, item ); - if ( !_.isNull( id ) && model.id === id ) { - this.addRelated( model, options ); - } - } - }, - - addRelated: function( model, options ) { - if ( model !== this.related ) { - var oldRelated = this.related || null; - this.setRelated( model ); - this.onChange( this.instance, model, { _related: oldRelated } ); - } - }, - - removeRelated: function( model, options ) { - if ( !this.related ) { - return; - } - - if ( model === this.related ) { - var oldRelated = this.related || null; - this.setRelated( null ); - this.onChange( this.instance, model, { _related: oldRelated } ); - } - } - }); - - Backbone.HasMany = Backbone.Relation.extend({ - collectionType: null, - - options: { - reverseRelation: { type: 'HasOne' }, - collectionType: Backbone.Collection, - collectionKey: true, - collectionOptions: {} - }, - - initialize: function() { - _.bindAll( this, 'onChange', 'handleAddition', 'handleRemoval', 'handleReset' ); - this.instance.bind( 'relational:change:' + this.key, this.onChange ); - - // Handle a custom 'collectionType' - this.collectionType = this.options.collectionType; - if ( _.isString( this.collectionType ) ) { - this.collectionType = Backbone.Relational.store.getObjectByName( this.collectionType ); - } - if ( !this.collectionType.prototype instanceof Backbone.Collection ){ - throw new Error( 'collectionType must inherit from Backbone.Collection' ); - } - - // Handle cases where a model/relation is created with a collection passed straight into 'attributes' - if ( this.keyContents instanceof Backbone.Collection ) { - this.setRelated( this._prepareCollection( this.keyContents ) ); - } - else { - this.setRelated( this._prepareCollection() ); - } - - this.findRelated( { silent: true } ); - }, - - _getCollectionOptions: function() { - return _.isFunction( this.options.collectionOptions ) ? - this.options.collectionOptions( this.instance ) : - this.options.collectionOptions; - }, - - /** - * Bind events and setup collectionKeys for a collection that is to be used as the backing store for a HasMany. - * If no 'collection' is supplied, a new collection will be created of the specified 'collectionType' option. - * @param {Backbone.Collection} [collection] - */ - _prepareCollection: function( collection ) { - if ( this.related ) { - this.related - .unbind( 'relational:add', this.handleAddition ) - .unbind( 'relational:remove', this.handleRemoval ) - .unbind( 'relational:reset', this.handleReset ) - } - - if ( !collection || !( collection instanceof Backbone.Collection ) ) { - collection = new this.collectionType( [], this._getCollectionOptions() ); - } - - collection.model = this.relatedModel; - - if ( this.options.collectionKey ) { - var key = this.options.collectionKey === true ? this.options.reverseRelation.key : this.options.collectionKey; - - if ( collection[ key ] && collection[ key ] !== this.instance ) { - if ( Backbone.Relational.showWarnings && typeof console !== 'undefined' ) { - console.warn( 'Relation=%o; collectionKey=%s already exists on collection=%o', this, key, this.options.collectionKey ); - } - } - else if ( key ) { - collection[ key ] = this.instance; - } - } - - collection - .bind( 'relational:add', this.handleAddition ) - .bind( 'relational:remove', this.handleRemoval ) - .bind( 'relational:reset', this.handleReset ); - - return collection; - }, - - findRelated: function( options ) { - if ( this.keyContents ) { - var models = []; - - if ( this.keyContents instanceof Backbone.Collection ) { - models = this.keyContents.models; - } - else { - // Handle cases the an API/user supplies just an Object/id instead of an Array - this.keyContents = _.isArray( this.keyContents ) ? this.keyContents : [ this.keyContents ]; - - // Try to find instances of the appropriate 'relatedModel' in the store - _.each( this.keyContents, function( item ) { - var model = null; - if ( item instanceof this.relatedModel ) { - model = item; - } - else if ( item || item === 0 ) { // since 0 can be a valid `id` as well - model = this.relatedModel.findOrCreate( item, { create: this.options.createModels } ); - } - - if ( model && !this.related.getByCid( model ) && !this.related.get( model ) ) { - models.push( model ); - } - }, this ); - } - - // Add all found 'models' in on go, so 'add' will only be called once (and thus 'sort', etc.) - if ( models.length ) { - options = this.unsanitizeOptions( options ); - this.related.add( models, options ); - } - } - }, - - /** - * If the key is changed, notify old & new reverse relations and initialize the new relation - */ - onChange: function( model, attr, options ) { - options = this.sanitizeOptions( options ); - this.keyContents = attr; - - // Notify old 'related' object of the terminated relation - _.each( this.getReverseRelations(), function( relation ) { - relation.removeRelated( this.instance, options ); - }, this ); - - // Replace 'this.related' by 'attr' if it is a Backbone.Collection - if ( attr instanceof Backbone.Collection ) { - this._prepareCollection( attr ); - this.related = attr; - } - // Otherwise, 'attr' should be an array of related object ids. - // Re-use the current 'this.related' if it is a Backbone.Collection, and remove any current entries. - // Otherwise, create a new collection. - else { - var coll; - - if ( this.related instanceof Backbone.Collection ) { - coll = this.related; - coll.remove( coll.models ); - } - else { - coll = this._prepareCollection(); - } - - this.setRelated( coll ); - this.findRelated( options ); - } - - // Notify new 'related' object of the new relation - _.each( this.getReverseRelations(), function( relation ) { - relation.addRelated( this.instance, options ); - }, this ); - - var dit = this; - Backbone.Relational.eventQueue.add( function() { - !options.silentChange && dit.instance.trigger( 'update:' + dit.key, dit.instance, dit.related, options ); - }); - }, - - tryAddRelated: function( model, options ) { - options = this.sanitizeOptions( options ); - if ( !this.related.getByCid( model ) && !this.related.get( model ) ) { - // Check if this new model was specified in 'this.keyContents' - var item = _.any( this.keyContents, function( item ) { - var id = Backbone.Relational.store.resolveIdForItem( this.relatedModel, item ); - return !_.isNull( id ) && id === model.id; - }, this ); - - if ( item ) { - this.related.add( model, options ); - } - } - }, - - /** - * When a model is added to a 'HasMany', trigger 'add' on 'this.instance' and notify reverse relations. - * (should be 'HasOne', must set 'this.instance' as their related). - */ - handleAddition: function( model, coll, options ) { - //console.debug('handleAddition called; args=%o', arguments); - // Make sure the model is in fact a valid model before continuing. - // (it can be invalid as a result of failing validation in Backbone.Collection._prepareModel) - if ( !( model instanceof Backbone.Model ) ) { - return; - } - - options = this.sanitizeOptions( options ); - - _.each( this.getReverseRelations( model ), function( relation ) { - relation.addRelated( this.instance, options ); - }, this ); - - // Only trigger 'add' once the newly added model is initialized (so, has it's relations set up) - var dit = this; - Backbone.Relational.eventQueue.add( function() { - !options.silentChange && dit.instance.trigger( 'add:' + dit.key, model, dit.related, options ); - }); - }, - - /** - * When a model is removed from a 'HasMany', trigger 'remove' on 'this.instance' and notify reverse relations. - * (should be 'HasOne', which should be nullified) - */ - handleRemoval: function( model, coll, options ) { - //console.debug('handleRemoval called; args=%o', arguments); - if ( !( model instanceof Backbone.Model ) ) { - return; - } - - options = this.sanitizeOptions( options ); - - _.each( this.getReverseRelations( model ), function( relation ) { - relation.removeRelated( this.instance, options ); - }, this ); - - var dit = this; - Backbone.Relational.eventQueue.add( function() { - !options.silentChange && dit.instance.trigger( 'remove:' + dit.key, model, dit.related, options ); - }); - }, - - handleReset: function( coll, options ) { - options = this.sanitizeOptions( options ); - - var dit = this; - Backbone.Relational.eventQueue.add( function() { - !options.silentChange && dit.instance.trigger( 'reset:' + dit.key, dit.related, options ); - }); - }, - - addRelated: function( model, options ) { - var dit = this; - options = this.unsanitizeOptions( options ); - model.queue( function() { // Queued to avoid errors for adding 'model' to the 'this.related' set twice - if ( dit.related && !dit.related.getByCid( model ) && !dit.related.get( model ) ) { - dit.related.add( model, options ); - } - }); - }, - - removeRelated: function( model, options ) { - options = this.unsanitizeOptions( options ); - if ( this.related.getByCid( model ) || this.related.get( model ) ) { - this.related.remove( model, options ); - } - } - }); - - /** - * A type of Backbone.Model that also maintains relations to other models and collections. - * New events when compared to the original: - * - 'add:' (model, related collection, options) - * - 'remove:' (model, related collection, options) - * - 'update:' (model, related model or collection, options) - */ - Backbone.RelationalModel = Backbone.Model.extend({ - relations: null, // Relation descriptions on the prototype - _relations: null, // Relation instances - _isInitialized: false, - _deferProcessing: false, - _queue: null, - - subModelTypeAttribute: 'type', - subModelTypes: null, - - constructor: function( attributes, options ) { - // Nasty hack, for cases like 'model.get( ).add( item )'. - // Defer 'processQueue', so that when 'Relation.createModels' is used we: - // a) Survive 'Backbone.Collection.add'; this takes care we won't error on "can't add model to a set twice" - // (by creating a model from properties, having the model add itself to the collection via one of - // it's relations, then trying to add it to the collection). - // b) Trigger 'HasMany' collection events only after the model is really fully set up. - // Example that triggers both a and b: "p.get('jobs').add( { company: c, person: p } )". - var dit = this; - if ( options && options.collection ) { - this._deferProcessing = true; - - var processQueue = function( model ) { - if ( model === dit ) { - dit._deferProcessing = false; - dit.processQueue(); - options.collection.unbind( 'relational:add', processQueue ); - } - }; - options.collection.bind( 'relational:add', processQueue ); - - // So we do process the queue eventually, regardless of whether this model really gets added to 'options.collection'. - _.defer( function() { - processQueue( dit ); - }); - } - - this._queue = new Backbone.BlockingQueue(); - this._queue.block(); - Backbone.Relational.eventQueue.block(); - - Backbone.Model.apply( this, arguments ); - - // Try to run the global queue holding external events - Backbone.Relational.eventQueue.unblock(); - }, - - /** - * Override 'trigger' to queue 'change' and 'change:*' events - */ - trigger: function( eventName ) { - if ( eventName.length > 5 && 'change' === eventName.substr( 0, 6 ) ) { - var dit = this, args = arguments; - Backbone.Relational.eventQueue.add( function() { - Backbone.Model.prototype.trigger.apply( dit, args ); - }); - } - else { - Backbone.Model.prototype.trigger.apply( this, arguments ); - } - - return this; - }, - - /** - * Initialize Relations present in this.relations; determine the type (HasOne/HasMany), then creates a new instance. - * Invoked in the first call so 'set' (which is made from the Backbone.Model constructor). - */ - initializeRelations: function() { - this.acquire(); // Setting up relations often also involve calls to 'set', and we only want to enter this function once - this._relations = []; - - _.each( this.relations, function( rel ) { - var type = !_.isString( rel.type ) ? rel.type : Backbone[ rel.type ] || Backbone.Relational.store.getObjectByName( rel.type ); - if ( type && type.prototype instanceof Backbone.Relation ) { - new type( this, rel ); // Also pushes the new Relation into _relations - } - else { - Backbone.Relational.showWarnings && typeof console !== 'undefined' && console.warn( 'Relation=%o; missing or invalid type!', rel ); - } - }, this ); - - this._isInitialized = true; - this.release(); - this.processQueue(); - }, - - /** - * When new values are set, notify this model's relations (also if options.silent is set). - * (Relation.setRelated locks this model before calling 'set' on it to prevent loops) - */ - updateRelations: function( options ) { - if ( this._isInitialized && !this.isLocked() ) { - _.each( this._relations, function( rel ) { - // Update from data in `rel.keySource` if set, or `rel.key` otherwise - var val = this.attributes[ rel.keySource ] || this.attributes[ rel.key ]; - if ( rel.related !== val ) { - this.trigger( 'relational:change:' + rel.key, this, val, options || {} ); - } - }, this ); - } - }, - - /** - * Either add to the queue (if we're not initialized yet), or execute right away. - */ - queue: function( func ) { - this._queue.add( func ); - }, - - /** - * Process _queue - */ - processQueue: function() { - if ( this._isInitialized && !this._deferProcessing && this._queue.isBlocked() ) { - this._queue.unblock(); - } - }, - - /** - * Get a specific relation. - * @param key {string} The relation key to look for. - * @return {Backbone.Relation} An instance of 'Backbone.Relation', if a relation was found for 'key', or null. - */ - getRelation: function( key ) { - return _.detect( this._relations, function( rel ) { - if ( rel.key === key ) { - return true; - } - }, this ); - }, - - /** - * Get all of the created relations. - * @return {Backbone.Relation[]} - */ - getRelations: function() { - return this._relations; - }, - - /** - * Retrieve related objects. - * @param key {string} The relation key to fetch models for. - * @param [options] {Object} Options for 'Backbone.Model.fetch' and 'Backbone.sync'. - * @param [update=false] {boolean} Whether to force a fetch from the server (updating existing models). - * @return {jQuery.when[]} An array of request objects - */ - fetchRelated: function( key, options, update ) { - options || ( options = {} ); - var setUrl, - requests = [], - rel = this.getRelation( key ), - keyContents = rel && rel.keyContents, - toFetch = keyContents && _.select( _.isArray( keyContents ) ? keyContents : [ keyContents ], function( item ) { - var id = Backbone.Relational.store.resolveIdForItem( rel.relatedModel, item ); - return !_.isNull( id ) && ( update || !Backbone.Relational.store.find( rel.relatedModel, id ) ); - }, this ); - - if ( toFetch && toFetch.length ) { - // Create a model for each entry in 'keyContents' that is to be fetched - var models = _.map( toFetch, function( item ) { - var model; - - if ( _.isObject( item ) ) { - model = rel.relatedModel.build( item ); - } - else { - var attrs = {}; - attrs[ rel.relatedModel.prototype.idAttribute ] = item; - model = rel.relatedModel.build( attrs ); - } - - return model; - }, this ); - - // Try if the 'collection' can provide a url to fetch a set of models in one request. - if ( rel.related instanceof Backbone.Collection && _.isFunction( rel.related.url ) ) { - setUrl = rel.related.url( models ); - } - - // An assumption is that when 'Backbone.Collection.url' is a function, it can handle building of set urls. - // To make sure it can, test if the url we got by supplying a list of models to fetch is different from - // the one supplied for the default fetch action (without args to 'url'). - if ( setUrl && setUrl !== rel.related.url() ) { - var opts = _.defaults( - { - error: function() { - var args = arguments; - _.each( models, function( model ) { - model.trigger( 'destroy', model, model.collection, options ); - options.error && options.error.apply( model, args ); - }); - }, - url: setUrl - }, - options, - { add: true } - ); - - requests = [ rel.related.fetch( opts ) ]; - } - else { - requests = _.map( models, function( model ) { - var opts = _.defaults( - { - error: function() { - model.trigger( 'destroy', model, model.collection, options ); - options.error && options.error.apply( model, arguments ); - } - }, - options - ); - return model.fetch( opts ); - }, this ); - } - } - - return requests; - }, - - set: function( key, value, options ) { - Backbone.Relational.eventQueue.block(); - - // Duplicate backbone's behavior to allow separate key/value parameters, instead of a single 'attributes' object - var attributes; - if ( _.isObject( key ) || key == null ) { - attributes = key; - options = value; - } - else { - attributes = {}; - attributes[ key ] = value; - } - - var result = Backbone.Model.prototype.set.apply( this, arguments ); - - // Ideal place to set up relations :) - if ( !this._isInitialized && !this.isLocked() ) { - this.constructor.initializeModelHierarchy(); - - Backbone.Relational.store.register( this ); - - this.initializeRelations(); - } - // Update the 'idAttribute' in Backbone.store if; we don't want it to miss an 'id' update due to {silent:true} - else if ( attributes && this.idAttribute in attributes ) { - Backbone.Relational.store.update( this ); - } - - if ( attributes ) { - this.updateRelations( options ); - } - - // Try to run the global queue holding external events - Backbone.Relational.eventQueue.unblock(); - - return result; - }, - - unset: function( attribute, options ) { - Backbone.Relational.eventQueue.block(); - - var result = Backbone.Model.prototype.unset.apply( this, arguments ); - this.updateRelations( options ); - - // Try to run the global queue holding external events - Backbone.Relational.eventQueue.unblock(); - - return result; - }, - - clear: function( options ) { - Backbone.Relational.eventQueue.block(); - - var result = Backbone.Model.prototype.clear.apply( this, arguments ); - this.updateRelations( options ); - - // Try to run the global queue holding external events - Backbone.Relational.eventQueue.unblock(); - - return result; - }, - - /** - * Override 'change', so the change will only execute after 'set' has finised (relations are updated), - * and 'previousAttributes' will be available when the event is fired. - */ - change: function( options ) { - var dit = this, args = arguments; - Backbone.Relational.eventQueue.add( function() { - Backbone.Model.prototype.change.apply( dit, args ); - }); - }, - - clone: function() { - var attributes = _.clone( this.attributes ); - if ( !_.isUndefined( attributes[ this.idAttribute ] ) ) { - attributes[ this.idAttribute ] = null; - } - - _.each( this.getRelations(), function( rel ) { - delete attributes[ rel.key ]; - }); - - return new this.constructor( attributes ); - }, - - /** - * Convert relations to JSON, omits them when required - */ - toJSON: function() { - // If this Model has already been fully serialized in this branch once, return to avoid loops - if ( this.isLocked() ) { - return this.id; - } - - this.acquire(); - var json = Backbone.Model.prototype.toJSON.call( this ); - - if ( this.constructor._superModel && !( this.constructor._subModelTypeAttribute in json ) ) { - json[ this.constructor._subModelTypeAttribute ] = this.constructor._subModelTypeValue; - } - - _.each( this._relations, function( rel ) { - var value = json[ rel.key ]; - - if ( rel.options.includeInJSON === true) { - if ( value && _.isFunction( value.toJSON ) ) { - json[ rel.keyDestination ] = value.toJSON(); - } - else { - json[ rel.keyDestination ] = null; - } - } - else if ( _.isString( rel.options.includeInJSON ) ) { - if ( value instanceof Backbone.Collection ) { - json[ rel.keyDestination ] = value.pluck( rel.options.includeInJSON ); - } - else if ( value instanceof Backbone.Model ) { - json[ rel.keyDestination ] = value.get( rel.options.includeInJSON ); - } - else { - json[ rel.keyDestination ] = null; - } - } - else if ( _.isArray( rel.options.includeInJSON ) ) { - if ( value instanceof Backbone.Collection ) { - var valueSub = []; - value.each( function( model ) { - var curJson = {}; - _.each( rel.options.includeInJSON, function( key ) { - curJson[ key ] = model.get( key ); - }); - valueSub.push( curJson ); - }); - json[ rel.keyDestination ] = valueSub; - } - else if ( value instanceof Backbone.Model ) { - var valueSub = {}; - _.each( rel.options.includeInJSON, function( key ) { - valueSub[ key ] = value.get( key ); - }); - json[ rel.keyDestination ] = valueSub; - } - else { - json[ rel.keyDestination ] = null; - } - } - else { - delete json[ rel.key ]; - } - - if ( rel.keyDestination !== rel.key ) { - delete json[ rel.key ]; - } - }); - - this.release(); - return json; - } - }, - { - setup: function( superModel ) { - // We don't want to share a relations array with a parent, as this will cause problems with - // reverse relations. - this.prototype.relations = ( this.prototype.relations || [] ).slice( 0 ); - - this._subModels = {}; - this._superModel = null; - - // If this model has 'subModelTypes' itself, remember them in the store - if ( this.prototype.hasOwnProperty( 'subModelTypes' ) ) { - Backbone.Relational.store.addSubModels( this.prototype.subModelTypes, this ); - } - // The 'subModelTypes' property should not be inherited, so reset it. - else { - this.prototype.subModelTypes = null; - } - - // Initialize all reverseRelations that belong to this new model. - _.each( this.prototype.relations, function( rel ) { - if ( !rel.model ) { - rel.model = this; - } - - if ( rel.reverseRelation && rel.model === this ) { - var preInitialize = true; - if ( _.isString( rel.relatedModel ) ) { - /** - * The related model might not be defined for two reasons - * 1. it never gets defined, e.g. a typo - * 2. it is related to itself - * In neither of these cases do we need to pre-initialize reverse relations. - */ - var relatedModel = Backbone.Relational.store.getObjectByName( rel.relatedModel ); - preInitialize = relatedModel && ( relatedModel.prototype instanceof Backbone.RelationalModel ); - } - - var type = !_.isString( rel.type ) ? rel.type : Backbone[ rel.type ] || Backbone.Relational.store.getObjectByName( rel.type ); - if ( preInitialize && type && type.prototype instanceof Backbone.Relation ) { - new type( null, rel ); - } - } - }, this ); - - return this; - }, - - /** - * Create a 'Backbone.Model' instance based on 'attributes'. - * @param {Object} attributes - * @param {Object} [options] - * @return {Backbone.Model} - */ - build: function( attributes, options ) { - var model = this; - - // 'build' is a possible entrypoint; it's possible no model hierarchy has been determined yet. - this.initializeModelHierarchy(); - - // Determine what type of (sub)model should be built if applicable. - // Lookup the proper subModelType in 'this._subModels'. - if ( this._subModels && this.prototype.subModelTypeAttribute in attributes ) { - var subModelTypeAttribute = attributes[ this.prototype.subModelTypeAttribute ]; - var subModelType = this._subModels[ subModelTypeAttribute ]; - if ( subModelType ) { - model = subModelType; - } - } - - return new model( attributes, options ); - }, - - initializeModelHierarchy: function() { - // If we're here for the first time, try to determine if this modelType has a 'superModel'. - if ( _.isUndefined( this._superModel ) || _.isNull( this._superModel ) ) { - Backbone.Relational.store.setupSuperModel( this ); - - // If a superModel has been found, copy relations from the _superModel if they haven't been - // inherited automatically (due to a redefinition of 'relations'). - // Otherwise, make sure we don't get here again for this type by making '_superModel' false so we fail - // the isUndefined/isNull check next time. - if ( this._superModel ) { - // - if ( this._superModel.prototype.relations ) { - var supermodelRelationsExist = _.any( this.prototype.relations, function( rel ) { - return rel.model && rel.model !== this; - }, this ); - - if ( !supermodelRelationsExist ) { - this.prototype.relations = this._superModel.prototype.relations.concat( this.prototype.relations ); - } - } - } - else { - this._superModel = false; - } - } - - // If we came here through 'build' for a model that has 'subModelTypes', and not all of them have been resolved yet, try to resolve each. - if ( this.prototype.subModelTypes && _.keys( this.prototype.subModelTypes ).length !== _.keys( this._subModels ).length ) { - _.each( this.prototype.subModelTypes, function( subModelTypeName ) { - var subModelType = Backbone.Relational.store.getObjectByName( subModelTypeName ); - subModelType && subModelType.initializeModelHierarchy(); - }); - } - }, - - /** - * Find an instance of `this` type in 'Backbone.Relational.store'. - * - If `attributes` is a string or a number, `findOrCreate` will just query the `store` and return a model if found. - * - If `attributes` is an object, the model will be updated with `attributes` if found. - * Otherwise, a new model is created with `attributes` (unless `options.create` is explicitly set to `false`). - * @param {Object|String|Number} attributes Either a model's id, or the attributes used to create or update a model. - * @param {Object} [options] - * @param {Boolean} [options.create=true] - * @return {Backbone.RelationalModel} - */ - findOrCreate: function( attributes, options ) { - // Try to find an instance of 'this' model type in the store - var model = Backbone.Relational.store.find( this, attributes ); - - // If we found an instance, update it with the data in 'item'; if not, create an instance - // (unless 'options.create' is false). - if ( _.isObject( attributes ) ) { - if ( model ) { - model.set( model.parse ? model.parse( attributes ) : attributes, options ); - } - else if ( !options || ( options && options.create !== false ) ) { - model = this.build( attributes, options ); - } - } - - return model; - } - }); - _.extend( Backbone.RelationalModel.prototype, Backbone.Semaphore ); - - /** - * Override Backbone.Collection._prepareModel, so objects will be built using the correct type - * if the collection.model has subModels. - */ - Backbone.Collection.prototype.__prepareModel = Backbone.Collection.prototype._prepareModel; - Backbone.Collection.prototype._prepareModel = function ( model, options ) { - options || (options = {}); - if ( !( model instanceof Backbone.Model ) ) { - var attrs = model; - options.collection = this; - - if ( typeof this.model.findOrCreate !== 'undefined' ) { - model = this.model.findOrCreate( attrs, options ); - } - else { - model = new this.model( attrs, options ); - } - - if ( !model._validate( model.attributes, options ) ) { - model = false; - } - } - else if ( !model.collection ) { - model.collection = this; - } - - return model; - } - - /** - * Override Backbone.Collection.add, so objects fetched from the server multiple times will - * update the existing Model. Also, trigger 'relational:add'. - */ - var add = Backbone.Collection.prototype.__add = Backbone.Collection.prototype.add; - Backbone.Collection.prototype.add = function( models, options ) { - options || (options = {}); - if ( !_.isArray( models ) ) { - models = [ models ]; - } - - var modelsToAdd = []; - - //console.debug( 'calling add on coll=%o; model=%o, options=%o', this, models, options ); - _.each( models, function( model ) { - if ( !( model instanceof Backbone.Model ) ) { - // `_prepareModel` attempts to find `model` in Backbone.store through `findOrCreate`, - // and sets the new properties on it if is found. Otherwise, a new model is instantiated. - model = Backbone.Collection.prototype._prepareModel.call( this, model, options ); - } - - if ( model instanceof Backbone.Model && !this.get( model ) && !this.getByCid( model ) ) { - modelsToAdd.push( model ); - } - }, this ); - - - // Add 'models' in a single batch, so the original add will only be called once (and thus 'sort', etc). - if ( modelsToAdd.length ) { - add.call( this, modelsToAdd, options ); - - _.each( modelsToAdd, function( model ) { - this.trigger( 'relational:add', model, this, options ); - }, this ); - } - - return this; - }; - - /** - * Override 'Backbone.Collection.remove' to trigger 'relational:remove'. - */ - var remove = Backbone.Collection.prototype.__remove = Backbone.Collection.prototype.remove; - Backbone.Collection.prototype.remove = function( models, options ) { - options || (options = {}); - if ( !_.isArray( models ) ) { - models = [ models ]; - } - else { - models = models.slice( 0 ); - } - - //console.debug('calling remove on coll=%o; models=%o, options=%o', this, models, options ); - _.each( models, function( model ) { - model = this.getByCid( model ) || this.get( model ); - - if ( model instanceof Backbone.Model ) { - remove.call( this, model, options ); - this.trigger('relational:remove', model, this, options); - } - }, this ); - - return this; - }; - - /** - * Override 'Backbone.Collection.reset' to trigger 'relational:reset'. - */ - var reset = Backbone.Collection.prototype.__reset = Backbone.Collection.prototype.reset; - Backbone.Collection.prototype.reset = function( models, options ) { - reset.call( this, models, options ); - this.trigger( 'relational:reset', this, options ); - - return this; - }; - - /** - * Override 'Backbone.Collection.sort' to trigger 'relational:reset'. - */ - var sort = Backbone.Collection.prototype.__sort = Backbone.Collection.prototype.sort; - Backbone.Collection.prototype.sort = function( options ) { - sort.call( this, options ); - this.trigger( 'relational:reset', this, options ); - - return this; - }; - - /** - * Override 'Backbone.Collection.trigger' so 'add', 'remove' and 'reset' events are queued until relations - * are ready. - */ - var trigger = Backbone.Collection.prototype.__trigger = Backbone.Collection.prototype.trigger; - Backbone.Collection.prototype.trigger = function( eventName ) { - if ( eventName === 'add' || eventName === 'remove' || eventName === 'reset' ) { - var dit = this, args = arguments; - - if (eventName === 'add') { - args = _.toArray(args); - // the fourth argument in case of a regular add is the option object. - // we need to clone it, as it could be modified while we wait on the eventQueue to be unblocked - if (_.isObject(args[3])) { - args[3] = _.clone(args[3]); - } - } - - Backbone.Relational.eventQueue.add( function() { - trigger.apply( dit, args ); - }); - } - else { - trigger.apply( this, arguments ); - } - - return this; - }; - - // Override .extend() to automatically call .setup() - Backbone.RelationalModel.extend = function( protoProps, classProps ) { - var child = Backbone.Model.extend.apply( this, arguments ); - - child.setup( this ); - - return child; - }; -})(); diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/backbone.js --- a/metadataplayer/libs/backbone.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1431 +0,0 @@ -// Backbone.js 0.9.2 - -// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. -// Backbone may be freely distributed under the MIT license. -// For all details and documentation: -// http://backbonejs.org - -(function(){ - - // Initial Setup - // ------------- - - // Save a reference to the global object (`window` in the browser, `global` - // on the server). - var root = this; - - // Save the previous value of the `Backbone` variable, so that it can be - // restored later on, if `noConflict` is used. - var previousBackbone = root.Backbone; - - // Create a local reference to slice/splice. - var slice = Array.prototype.slice; - var splice = Array.prototype.splice; - - // The top-level namespace. All public Backbone classes and modules will - // be attached to this. Exported for both CommonJS and the browser. - var Backbone; - if (typeof exports !== 'undefined') { - Backbone = exports; - } else { - Backbone = root.Backbone = {}; - } - - // Current version of the library. Keep in sync with `package.json`. - Backbone.VERSION = '0.9.2'; - - // Require Underscore, if we're on the server, and it's not already present. - var _ = root._; - if (!_ && (typeof require !== 'undefined')) _ = require('underscore'); - - // For Backbone's purposes, jQuery, Zepto, or Ender owns the `$` variable. - var $ = root.jQuery || root.Zepto || root.ender; - - // Set the JavaScript library that will be used for DOM manipulation and - // Ajax calls (a.k.a. the `$` variable). By default Backbone will use: jQuery, - // Zepto, or Ender; but the `setDomLibrary()` method lets you inject an - // alternate JavaScript library (or a mock library for testing your views - // outside of a browser). - Backbone.setDomLibrary = function(lib) { - $ = lib; - }; - - // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable - // to its previous owner. Returns a reference to this Backbone object. - Backbone.noConflict = function() { - root.Backbone = previousBackbone; - return this; - }; - - // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option - // will fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and - // set a `X-Http-Method-Override` header. - Backbone.emulateHTTP = false; - - // Turn on `emulateJSON` to support legacy servers that can't deal with direct - // `application/json` requests ... will encode the body as - // `application/x-www-form-urlencoded` instead and will send the model in a - // form param named `model`. - Backbone.emulateJSON = false; - - // Backbone.Events - // ----------------- - - // Regular expression used to split event strings - var eventSplitter = /\s+/; - - // A module that can be mixed in to *any object* in order to provide it with - // custom events. You may bind with `on` or remove with `off` callback functions - // to an event; trigger`-ing an event fires all callbacks in succession. - // - // var object = {}; - // _.extend(object, Backbone.Events); - // object.on('expand', function(){ alert('expanded'); }); - // object.trigger('expand'); - // - var Events = Backbone.Events = { - - // Bind one or more space separated events, `events`, to a `callback` - // function. Passing `"all"` will bind the callback to all events fired. - on: function(events, callback, context) { - - var calls, event, node, tail, list; - if (!callback) return this; - events = events.split(eventSplitter); - calls = this._callbacks || (this._callbacks = {}); - - // Create an immutable callback list, allowing traversal during - // modification. The tail is an empty object that will always be used - // as the next node. - while (event = events.shift()) { - list = calls[event]; - node = list ? list.tail : {}; - node.next = tail = {}; - node.context = context; - node.callback = callback; - calls[event] = {tail: tail, next: list ? list.next : node}; - } - - return this; - }, - - // Remove one or many callbacks. If `context` is null, removes all callbacks - // with that function. If `callback` is null, removes all callbacks for the - // event. If `events` is null, removes all bound callbacks for all events. - off: function(events, callback, context) { - var event, calls, node, tail, cb, ctx; - - // No events, or removing *all* events. - if (!(calls = this._callbacks)) return; - if (!(events || callback || context)) { - delete this._callbacks; - return this; - } - - // Loop through the listed events and contexts, splicing them out of the - // linked list of callbacks if appropriate. - events = events ? events.split(eventSplitter) : _.keys(calls); - while (event = events.shift()) { - node = calls[event]; - delete calls[event]; - if (!node || !(callback || context)) continue; - // Create a new list, omitting the indicated callbacks. - tail = node.tail; - while ((node = node.next) !== tail) { - cb = node.callback; - ctx = node.context; - if ((callback && cb !== callback) || (context && ctx !== context)) { - this.on(event, cb, ctx); - } - } - } - - return this; - }, - - // Trigger one or many events, firing all bound callbacks. Callbacks are - // passed the same arguments as `trigger` is, apart from the event name - // (unless you're listening on `"all"`, which will cause your callback to - // receive the true name of the event as the first argument). - trigger: function(events) { - var event, node, calls, tail, args, all, rest; - if (!(calls = this._callbacks)) return this; - all = calls.all; - events = events.split(eventSplitter); - rest = slice.call(arguments, 1); - - // For each event, walk through the linked list of callbacks twice, - // first to trigger the event, then to trigger any `"all"` callbacks. - while (event = events.shift()) { - if (node = calls[event]) { - tail = node.tail; - while ((node = node.next) !== tail) { - node.callback.apply(node.context || this, rest); - } - } - if (node = all) { - tail = node.tail; - args = [event].concat(rest); - while ((node = node.next) !== tail) { - node.callback.apply(node.context || this, args); - } - } - } - - return this; - } - - }; - - // Aliases for backwards compatibility. - Events.bind = Events.on; - Events.unbind = Events.off; - - // Backbone.Model - // -------------- - - // Create a new model, with defined attributes. A client id (`cid`) - // is automatically generated and assigned for you. - var Model = Backbone.Model = function(attributes, options) { - var defaults; - attributes || (attributes = {}); - if (options && options.parse) attributes = this.parse(attributes); - if (defaults = getValue(this, 'defaults')) { - attributes = _.extend({}, defaults, attributes); - } - if (options && options.collection) this.collection = options.collection; - this.attributes = {}; - this._escapedAttributes = {}; - this.cid = _.uniqueId('c'); - this.changed = {}; - this._silent = {}; - this._pending = {}; - this.set(attributes, {silent: true}); - // Reset change tracking. - this.changed = {}; - this._silent = {}; - this._pending = {}; - this._previousAttributes = _.clone(this.attributes); - this.initialize.apply(this, arguments); - }; - - // Attach all inheritable methods to the Model prototype. - _.extend(Model.prototype, Events, { - - // A hash of attributes whose current and previous value differ. - changed: null, - - // A hash of attributes that have silently changed since the last time - // `change` was called. Will become pending attributes on the next call. - _silent: null, - - // A hash of attributes that have changed since the last `'change'` event - // began. - _pending: null, - - // The default name for the JSON `id` attribute is `"id"`. MongoDB and - // CouchDB users may want to set this to `"_id"`. - idAttribute: 'id', - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // Return a copy of the model's `attributes` object. - toJSON: function(options) { - return _.clone(this.attributes); - }, - - // Get the value of an attribute. - get: function(attr) { - return this.attributes[attr]; - }, - - // Get the HTML-escaped value of an attribute. - escape: function(attr) { - var html; - if (html = this._escapedAttributes[attr]) return html; - var val = this.get(attr); - return this._escapedAttributes[attr] = _.escape(val == null ? '' : '' + val); - }, - - // Returns `true` if the attribute contains a value that is not null - // or undefined. - has: function(attr) { - return this.get(attr) != null; - }, - - // Set a hash of model attributes on the object, firing `"change"` unless - // you choose to silence it. - set: function(key, value, options) { - var attrs, attr, val; - - // Handle both `"key", value` and `{key: value}` -style arguments. - if (_.isObject(key) || key == null) { - attrs = key; - options = value; - } else { - attrs = {}; - attrs[key] = value; - } - - // Extract attributes and options. - options || (options = {}); - if (!attrs) return this; - if (attrs instanceof Model) attrs = attrs.attributes; - if (options.unset) for (attr in attrs) attrs[attr] = void 0; - - // Run validation. - if (!this._validate(attrs, options)) return false; - - // Check for changes of `id`. - if (this.idAttribute in attrs) this.id = attrs[this.idAttribute]; - - var changes = options.changes = {}; - var now = this.attributes; - var escaped = this._escapedAttributes; - var prev = this._previousAttributes || {}; - - // For each `set` attribute... - for (attr in attrs) { - val = attrs[attr]; - - // If the new and current value differ, record the change. - if (!_.isEqual(now[attr], val) || (options.unset && _.has(now, attr))) { - delete escaped[attr]; - (options.silent ? this._silent : changes)[attr] = true; - } - - // Update or delete the current value. - options.unset ? delete now[attr] : now[attr] = val; - - // If the new and previous value differ, record the change. If not, - // then remove changes for this attribute. - if (!_.isEqual(prev[attr], val) || (_.has(now, attr) != _.has(prev, attr))) { - this.changed[attr] = val; - if (!options.silent) this._pending[attr] = true; - } else { - delete this.changed[attr]; - delete this._pending[attr]; - } - } - - // Fire the `"change"` events. - if (!options.silent) this.change(options); - return this; - }, - - // Remove an attribute from the model, firing `"change"` unless you choose - // to silence it. `unset` is a noop if the attribute doesn't exist. - unset: function(attr, options) { - (options || (options = {})).unset = true; - return this.set(attr, null, options); - }, - - // Clear all attributes on the model, firing `"change"` unless you choose - // to silence it. - clear: function(options) { - (options || (options = {})).unset = true; - return this.set(_.clone(this.attributes), options); - }, - - // Fetch the model from the server. If the server's representation of the - // model differs from its current attributes, they will be overriden, - // triggering a `"change"` event. - fetch: function(options) { - options = options ? _.clone(options) : {}; - var model = this; - var success = options.success; - options.success = function(resp, status, xhr) { - if (!model.set(model.parse(resp, xhr), options)) return false; - if (success) success(model, resp); - }; - options.error = Backbone.wrapError(options.error, model, options); - return (this.sync || Backbone.sync).call(this, 'read', this, options); - }, - - // Set a hash of model attributes, and sync the model to the server. - // If the server returns an attributes hash that differs, the model's - // state will be `set` again. - save: function(key, value, options) { - var attrs, current; - - // Handle both `("key", value)` and `({key: value})` -style calls. - if (_.isObject(key) || key == null) { - attrs = key; - options = value; - } else { - attrs = {}; - attrs[key] = value; - } - options = options ? _.clone(options) : {}; - - // If we're "wait"-ing to set changed attributes, validate early. - if (options.wait) { - if (!this._validate(attrs, options)) return false; - current = _.clone(this.attributes); - } - - // Regular saves `set` attributes before persisting to the server. - var silentOptions = _.extend({}, options, {silent: true}); - if (attrs && !this.set(attrs, options.wait ? silentOptions : options)) { - return false; - } - - // After a successful server-side save, the client is (optionally) - // updated with the server-side state. - var model = this; - var success = options.success; - options.success = function(resp, status, xhr) { - var serverAttrs = model.parse(resp, xhr); - if (options.wait) { - delete options.wait; - serverAttrs = _.extend(attrs || {}, serverAttrs); - } - if (!model.set(serverAttrs, options)) return false; - if (success) { - success(model, resp); - } else { - model.trigger('sync', model, resp, options); - } - }; - - // Finish configuring and sending the Ajax request. - options.error = Backbone.wrapError(options.error, model, options); - var method = this.isNew() ? 'create' : 'update'; - var xhr = (this.sync || Backbone.sync).call(this, method, this, options); - if (options.wait) this.set(current, silentOptions); - return xhr; - }, - - // Destroy this model on the server if it was already persisted. - // Optimistically removes the model from its collection, if it has one. - // If `wait: true` is passed, waits for the server to respond before removal. - destroy: function(options) { - options = options ? _.clone(options) : {}; - var model = this; - var success = options.success; - - var triggerDestroy = function() { - model.trigger('destroy', model, model.collection, options); - }; - - if (this.isNew()) { - triggerDestroy(); - return false; - } - - options.success = function(resp) { - if (options.wait) triggerDestroy(); - if (success) { - success(model, resp); - } else { - model.trigger('sync', model, resp, options); - } - }; - - options.error = Backbone.wrapError(options.error, model, options); - var xhr = (this.sync || Backbone.sync).call(this, 'delete', this, options); - if (!options.wait) triggerDestroy(); - return xhr; - }, - - // Default URL for the model's representation on the server -- if you're - // using Backbone's restful methods, override this to change the endpoint - // that will be called. - url: function() { - var base = getValue(this, 'urlRoot') || getValue(this.collection, 'url') || urlError(); - if (this.isNew()) return base; - return base + (base.charAt(base.length - 1) == '/' ? '' : '/') + encodeURIComponent(this.id); - }, - - // **parse** converts a response into the hash of attributes to be `set` on - // the model. The default implementation is just to pass the response along. - parse: function(resp, xhr) { - return resp; - }, - - // Create a new model with identical attributes to this one. - clone: function() { - return new this.constructor(this.attributes); - }, - - // A model is new if it has never been saved to the server, and lacks an id. - isNew: function() { - return this.id == null; - }, - - // Call this method to manually fire a `"change"` event for this model and - // a `"change:attribute"` event for each changed attribute. - // Calling this will cause all objects observing the model to update. - change: function(options) { - options || (options = {}); - var changing = this._changing; - this._changing = true; - - // Silent changes become pending changes. - for (var attr in this._silent) this._pending[attr] = true; - - // Silent changes are triggered. - var changes = _.extend({}, options.changes, this._silent); - this._silent = {}; - for (var attr in changes) { - this.trigger('change:' + attr, this, this.get(attr), options); - } - if (changing) return this; - - // Continue firing `"change"` events while there are pending changes. - while (!_.isEmpty(this._pending)) { - this._pending = {}; - this.trigger('change', this, options); - // Pending and silent changes still remain. - for (var attr in this.changed) { - if (this._pending[attr] || this._silent[attr]) continue; - delete this.changed[attr]; - } - this._previousAttributes = _.clone(this.attributes); - } - - this._changing = false; - return this; - }, - - // Determine if the model has changed since the last `"change"` event. - // If you specify an attribute name, determine if that attribute has changed. - hasChanged: function(attr) { - if (!arguments.length) return !_.isEmpty(this.changed); - return _.has(this.changed, attr); - }, - - // Return an object containing all the attributes that have changed, or - // false if there are no changed attributes. Useful for determining what - // parts of a view need to be updated and/or what attributes need to be - // persisted to the server. Unset attributes will be set to undefined. - // You can also pass an attributes object to diff against the model, - // determining if there *would be* a change. - changedAttributes: function(diff) { - if (!diff) return this.hasChanged() ? _.clone(this.changed) : false; - var val, changed = false, old = this._previousAttributes; - for (var attr in diff) { - if (_.isEqual(old[attr], (val = diff[attr]))) continue; - (changed || (changed = {}))[attr] = val; - } - return changed; - }, - - // Get the previous value of an attribute, recorded at the time the last - // `"change"` event was fired. - previous: function(attr) { - if (!arguments.length || !this._previousAttributes) return null; - return this._previousAttributes[attr]; - }, - - // Get all of the attributes of the model at the time of the previous - // `"change"` event. - previousAttributes: function() { - return _.clone(this._previousAttributes); - }, - - // Check if the model is currently in a valid state. It's only possible to - // get into an *invalid* state if you're using silent changes. - isValid: function() { - return !this.validate(this.attributes); - }, - - // Run validation against the next complete set of model attributes, - // returning `true` if all is well. If a specific `error` callback has - // been passed, call that instead of firing the general `"error"` event. - _validate: function(attrs, options) { - if (options.silent || !this.validate) return true; - attrs = _.extend({}, this.attributes, attrs); - var error = this.validate(attrs, options); - if (!error) return true; - if (options && options.error) { - options.error(this, error, options); - } else { - this.trigger('error', this, error, options); - } - return false; - } - - }); - - // Backbone.Collection - // ------------------- - - // Provides a standard collection class for our sets of models, ordered - // or unordered. If a `comparator` is specified, the Collection will maintain - // its models in sort order, as they're added and removed. - var Collection = Backbone.Collection = function(models, options) { - options || (options = {}); - if (options.model) this.model = options.model; - if (options.comparator) this.comparator = options.comparator; - this._reset(); - this.initialize.apply(this, arguments); - if (models) this.reset(models, {silent: true, parse: options.parse}); - }; - - // Define the Collection's inheritable methods. - _.extend(Collection.prototype, Events, { - - // The default model for a collection is just a **Backbone.Model**. - // This should be overridden in most cases. - model: Model, - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // The JSON representation of a Collection is an array of the - // models' attributes. - toJSON: function(options) { - return this.map(function(model){ return model.toJSON(options); }); - }, - - // Add a model, or list of models to the set. Pass **silent** to avoid - // firing the `add` event for every new model. - add: function(models, options) { - var i, index, length, model, cid, id, cids = {}, ids = {}, dups = []; - options || (options = {}); - models = _.isArray(models) ? models.slice() : [models]; - - // Begin by turning bare objects into model references, and preventing - // invalid models or duplicate models from being added. - for (i = 0, length = models.length; i < length; i++) { - if (!(model = models[i] = this._prepareModel(models[i], options))) { - throw new Error("Can't add an invalid model to a collection"); - } - cid = model.cid; - id = model.id; - if (cids[cid] || this._byCid[cid] || ((id != null) && (ids[id] || this._byId[id]))) { - dups.push(i); - continue; - } - cids[cid] = ids[id] = model; - } - - // Remove duplicates. - i = dups.length; - while (i--) { - models.splice(dups[i], 1); - } - - // Listen to added models' events, and index models for lookup by - // `id` and by `cid`. - for (i = 0, length = models.length; i < length; i++) { - (model = models[i]).on('all', this._onModelEvent, this); - this._byCid[model.cid] = model; - if (model.id != null) this._byId[model.id] = model; - } - - // Insert models into the collection, re-sorting if needed, and triggering - // `add` events unless silenced. - this.length += length; - index = options.at != null ? options.at : this.models.length; - splice.apply(this.models, [index, 0].concat(models)); - if (this.comparator) this.sort({silent: true}); - if (options.silent) return this; - for (i = 0, length = this.models.length; i < length; i++) { - if (!cids[(model = this.models[i]).cid]) continue; - options.index = i; - model.trigger('add', model, this, options); - } - return this; - }, - - // Remove a model, or a list of models from the set. Pass silent to avoid - // firing the `remove` event for every model removed. - remove: function(models, options) { - var i, l, index, model; - options || (options = {}); - models = _.isArray(models) ? models.slice() : [models]; - for (i = 0, l = models.length; i < l; i++) { - model = this.getByCid(models[i]) || this.get(models[i]); - if (!model) continue; - delete this._byId[model.id]; - delete this._byCid[model.cid]; - index = this.indexOf(model); - this.models.splice(index, 1); - this.length--; - if (!options.silent) { - options.index = index; - model.trigger('remove', model, this, options); - } - this._removeReference(model); - } - return this; - }, - - // Add a model to the end of the collection. - push: function(model, options) { - model = this._prepareModel(model, options); - this.add(model, options); - return model; - }, - - // Remove a model from the end of the collection. - pop: function(options) { - var model = this.at(this.length - 1); - this.remove(model, options); - return model; - }, - - // Add a model to the beginning of the collection. - unshift: function(model, options) { - model = this._prepareModel(model, options); - this.add(model, _.extend({at: 0}, options)); - return model; - }, - - // Remove a model from the beginning of the collection. - shift: function(options) { - var model = this.at(0); - this.remove(model, options); - return model; - }, - - // Get a model from the set by id. - get: function(id) { - if (id == null) return void 0; - return this._byId[id.id != null ? id.id : id]; - }, - - // Get a model from the set by client id. - getByCid: function(cid) { - return cid && this._byCid[cid.cid || cid]; - }, - - // Get the model at the given index. - at: function(index) { - return this.models[index]; - }, - - // Return models with matching attributes. Useful for simple cases of `filter`. - where: function(attrs) { - if (_.isEmpty(attrs)) return []; - return this.filter(function(model) { - for (var key in attrs) { - if (attrs[key] !== model.get(key)) return false; - } - return true; - }); - }, - - // Force the collection to re-sort itself. You don't need to call this under - // normal circumstances, as the set will maintain sort order as each item - // is added. - sort: function(options) { - options || (options = {}); - if (!this.comparator) throw new Error('Cannot sort a set without a comparator'); - var boundComparator = _.bind(this.comparator, this); - if (this.comparator.length == 1) { - this.models = this.sortBy(boundComparator); - } else { - this.models.sort(boundComparator); - } - if (!options.silent) this.trigger('reset', this, options); - return this; - }, - - // Pluck an attribute from each model in the collection. - pluck: function(attr) { - return _.map(this.models, function(model){ return model.get(attr); }); - }, - - // When you have more items than you want to add or remove individually, - // you can reset the entire set with a new list of models, without firing - // any `add` or `remove` events. Fires `reset` when finished. - reset: function(models, options) { - models || (models = []); - options || (options = {}); - for (var i = 0, l = this.models.length; i < l; i++) { - this._removeReference(this.models[i]); - } - this._reset(); - this.add(models, _.extend({silent: true}, options)); - if (!options.silent) this.trigger('reset', this, options); - return this; - }, - - // Fetch the default set of models for this collection, resetting the - // collection when they arrive. If `add: true` is passed, appends the - // models to the collection instead of resetting. - fetch: function(options) { - options = options ? _.clone(options) : {}; - if (options.parse === undefined) options.parse = true; - var collection = this; - var success = options.success; - options.success = function(resp, status, xhr) { - collection[options.add ? 'add' : 'reset'](collection.parse(resp, xhr), options); - if (success) success(collection, resp); - }; - options.error = Backbone.wrapError(options.error, collection, options); - return (this.sync || Backbone.sync).call(this, 'read', this, options); - }, - - // Create a new instance of a model in this collection. Add the model to the - // collection immediately, unless `wait: true` is passed, in which case we - // wait for the server to agree. - create: function(model, options) { - var coll = this; - options = options ? _.clone(options) : {}; - model = this._prepareModel(model, options); - if (!model) return false; - if (!options.wait) coll.add(model, options); - var success = options.success; - options.success = function(nextModel, resp, xhr) { - if (options.wait) coll.add(nextModel, options); - if (success) { - success(nextModel, resp); - } else { - nextModel.trigger('sync', model, resp, options); - } - }; - model.save(null, options); - return model; - }, - - // **parse** converts a response into a list of models to be added to the - // collection. The default implementation is just to pass it through. - parse: function(resp, xhr) { - return resp; - }, - - // Proxy to _'s chain. Can't be proxied the same way the rest of the - // underscore methods are proxied because it relies on the underscore - // constructor. - chain: function () { - return _(this.models).chain(); - }, - - // Reset all internal state. Called when the collection is reset. - _reset: function(options) { - this.length = 0; - this.models = []; - this._byId = {}; - this._byCid = {}; - }, - - // Prepare a model or hash of attributes to be added to this collection. - _prepareModel: function(model, options) { - options || (options = {}); - if (!(model instanceof Model)) { - var attrs = model; - options.collection = this; - model = new this.model(attrs, options); - if (!model._validate(model.attributes, options)) model = false; - } else if (!model.collection) { - model.collection = this; - } - return model; - }, - - // Internal method to remove a model's ties to a collection. - _removeReference: function(model) { - if (this == model.collection) { - delete model.collection; - } - model.off('all', this._onModelEvent, this); - }, - - // Internal method called every time a model in the set fires an event. - // Sets need to update their indexes when models change ids. All other - // events simply proxy through. "add" and "remove" events that originate - // in other collections are ignored. - _onModelEvent: function(event, model, collection, options) { - if ((event == 'add' || event == 'remove') && collection != this) return; - if (event == 'destroy') { - this.remove(model, options); - } - if (model && event === 'change:' + model.idAttribute) { - delete this._byId[model.previous(model.idAttribute)]; - this._byId[model.id] = model; - } - this.trigger.apply(this, arguments); - } - - }); - - // Underscore methods that we want to implement on the Collection. - var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find', - 'detect', 'filter', 'select', 'reject', 'every', 'all', 'some', 'any', - 'include', 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex', - 'toArray', 'size', 'first', 'initial', 'rest', 'last', 'without', 'indexOf', - 'shuffle', 'lastIndexOf', 'isEmpty', 'groupBy']; - - // Mix in each Underscore method as a proxy to `Collection#models`. - _.each(methods, function(method) { - Collection.prototype[method] = function() { - return _[method].apply(_, [this.models].concat(_.toArray(arguments))); - }; - }); - - // Backbone.Router - // ------------------- - - // Routers map faux-URLs to actions, and fire events when routes are - // matched. Creating a new one sets its `routes` hash, if not set statically. - var Router = Backbone.Router = function(options) { - options || (options = {}); - if (options.routes) this.routes = options.routes; - this._bindRoutes(); - this.initialize.apply(this, arguments); - }; - - // Cached regular expressions for matching named param parts and splatted - // parts of route strings. - var namedParam = /:\w+/g; - var splatParam = /\*\w+/g; - var escapeRegExp = /[-[\]{}()+?.,\\^$|#\s]/g; - - // Set up all inheritable **Backbone.Router** properties and methods. - _.extend(Router.prototype, Events, { - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // Manually bind a single named route to a callback. For example: - // - // this.route('search/:query/p:num', 'search', function(query, num) { - // ... - // }); - // - route: function(route, name, callback) { - Backbone.history || (Backbone.history = new History); - if (!_.isRegExp(route)) route = this._routeToRegExp(route); - if (!callback) callback = this[name]; - Backbone.history.route(route, _.bind(function(fragment) { - var args = this._extractParameters(route, fragment); - callback && callback.apply(this, args); - this.trigger.apply(this, ['route:' + name].concat(args)); - Backbone.history.trigger('route', this, name, args); - }, this)); - return this; - }, - - // Simple proxy to `Backbone.history` to save a fragment into the history. - navigate: function(fragment, options) { - Backbone.history.navigate(fragment, options); - }, - - // Bind all defined routes to `Backbone.history`. We have to reverse the - // order of the routes here to support behavior where the most general - // routes can be defined at the bottom of the route map. - _bindRoutes: function() { - if (!this.routes) return; - var routes = []; - for (var route in this.routes) { - routes.unshift([route, this.routes[route]]); - } - for (var i = 0, l = routes.length; i < l; i++) { - this.route(routes[i][0], routes[i][1], this[routes[i][1]]); - } - }, - - // Convert a route string into a regular expression, suitable for matching - // against the current location hash. - _routeToRegExp: function(route) { - route = route.replace(escapeRegExp, '\\$&') - .replace(namedParam, '([^\/]+)') - .replace(splatParam, '(.*?)'); - return new RegExp('^' + route + '$'); - }, - - // Given a route, and a URL fragment that it matches, return the array of - // extracted parameters. - _extractParameters: function(route, fragment) { - return route.exec(fragment).slice(1); - } - - }); - - // Backbone.History - // ---------------- - - // Handles cross-browser history management, based on URL fragments. If the - // browser does not support `onhashchange`, falls back to polling. - var History = Backbone.History = function() { - this.handlers = []; - _.bindAll(this, 'checkUrl'); - }; - - // Cached regex for cleaning leading hashes and slashes . - var routeStripper = /^[#\/]/; - - // Cached regex for detecting MSIE. - var isExplorer = /msie [\w.]+/; - - // Has the history handling already been started? - History.started = false; - - // Set up all inheritable **Backbone.History** properties and methods. - _.extend(History.prototype, Events, { - - // The default interval to poll for hash changes, if necessary, is - // twenty times a second. - interval: 50, - - // Gets the true hash value. Cannot use location.hash directly due to bug - // in Firefox where location.hash will always be decoded. - getHash: function(windowOverride) { - var loc = windowOverride ? windowOverride.location : window.location; - var match = loc.href.match(/#(.*)$/); - return match ? match[1] : ''; - }, - - // Get the cross-browser normalized URL fragment, either from the URL, - // the hash, or the override. - getFragment: function(fragment, forcePushState) { - if (fragment == null) { - if (this._hasPushState || forcePushState) { - fragment = window.location.pathname; - var search = window.location.search; - if (search) fragment += search; - } else { - fragment = this.getHash(); - } - } - if (!fragment.indexOf(this.options.root)) fragment = fragment.substr(this.options.root.length); - return fragment.replace(routeStripper, ''); - }, - - // Start the hash change handling, returning `true` if the current URL matches - // an existing route, and `false` otherwise. - start: function(options) { - if (History.started) throw new Error("Backbone.history has already been started"); - History.started = true; - - // Figure out the initial configuration. Do we need an iframe? - // Is pushState desired ... is it available? - this.options = _.extend({}, {root: '/'}, this.options, options); - this._wantsHashChange = this.options.hashChange !== false; - this._wantsPushState = !!this.options.pushState; - this._hasPushState = !!(this.options.pushState && window.history && window.history.pushState); - var fragment = this.getFragment(); - var docMode = document.documentMode; - var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7)); - - if (oldIE) { - this.iframe = $('': -"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
',o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&&l)?" ":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)? -r:s};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+= -(h||!(j&&l)?" ":"")+o;k+="
";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a, -"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a, -b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!= -"string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay)); -return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&& -arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.13";window["DP_jQuery_"+z]=d})(jQuery); -;/* - * jQuery UI Progressbar 1.8.13 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); -this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* -this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.13"})})(jQuery); -;/* - * jQuery UI Effects 1.8.13 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/ - */ -jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], -16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, -a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= -a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", -"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, -0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, -211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, -d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easding:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; -f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, -[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.13",save:function(c,a){for(var b=0;b").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}); -c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c, -a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments); -a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%", -"pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d* -((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/= -e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/= -e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ -e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); -;/* - * jQuery UI Effects Fade 1.8.13 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fade - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Fold 1.8.13 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fold - * - * Depends: - * jquery.effects.core.js - */ -(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], -10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); -;/* - * jQuery UI Effects Highlight 1.8.13 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Highlight - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& -this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Pulsate 1.8.13 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Pulsate - * - * Depends: - * jquery.effects.core.js - */ -(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); -b.dequeue()})})}})(jQuery); -; \ No newline at end of file diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/jquery.min.js --- a/metadataplayer/libs/jquery.min.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -/*! jQuery v1.7.1 jquery.com | jquery.org/license */ -(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; -f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() -{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/jquery.mousewheel.min.js --- a/metadataplayer/libs/jquery.mousewheel.min.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.6 - * - * Requires: 1.2.2+ - */ -(function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery) diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/json2.js --- a/metadataplayer/libs/json2.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,487 +0,0 @@ -/* - json2.js - 2011-10-19 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, regexp: true */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -var JSON; -if (!JSON) { - JSON = {}; -} - -(function () { - 'use strict'; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - if (typeof Date.prototype.toJSON !== 'function') { - - Date.prototype.toJSON = function (key) { - - return isFinite(this.valueOf()) - ? this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z' - : null; - }; - - String.prototype.toJSON = - Number.prototype.toJSON = - Boolean.prototype.toJSON = function (key) { - return this.valueOf(); - }; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' - ? c - : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; - } - - - function str(key, holder) { - -// Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 - ? '[]' - : gap - ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' - : '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - if (typeof rep[i] === 'string') { - k = rep[i]; - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 - ? '{}' - : gap - ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' - : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value, replacer, space) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } - - -// If the JSON object does not yet have a parse method, give it one. - - if (typeof JSON.parse !== 'function') { - JSON.parse = function (text, reviver) { - -// The parse method takes a text and an optional reviver function, and returns -// a JavaScript value if the text is a valid JSON text. - - var j; - - function walk(holder, key) { - -// The walk method is used to recursively walk the resulting structure so -// that modifications can be made. - - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - } - - -// Parsing happens in four stages. In the first stage, we replace certain -// Unicode characters with escape sequences. JavaScript handles many characters -// incorrectly, either silently deleting them, or treating them as line endings. - - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - -// In the second stage, we run the text against regular expressions that look -// for non-JSON patterns. We are especially concerned with '()' and 'new' -// because they can cause invocation, and '=' because it can cause mutation. -// But just to be safe, we want to reject all unexpected forms. - -// We split the second stage into 4 regexp operations in order to work around -// crippling inefficiencies in IE's and Safari's regexp engines. First we -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we -// replace all simple value tokens with ']' characters. Third, we delete all -// open brackets that follow a colon or comma or that begin the text. Finally, -// we look to see that the remaining characters are only whitespace or ']' or -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ - .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') - .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - -// In the third stage we use the eval function to compile the text into a -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity -// in JavaScript: it can begin a block or an object literal. We wrap the text -// in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - -// In the optional fourth stage, we recursively walk the new structure, passing -// each name/value pair to a reviver function for possible transformation. - - return typeof reviver === 'function' - ? walk({'': j}, '') - : j; - } - -// If the text is not JSON parseable, then a SyntaxError is thrown. - - throw new SyntaxError('JSON.parse'); - }; - } -}()); diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/jwplayer.js --- a/metadataplayer/libs/jwplayer.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -if(typeof jwplayer=="undefined"){var jwplayer=function(a){if(jwplayer.api){return jwplayer.api.selectPlayer(a)}};var $jw=jwplayer;jwplayer.version="5.9.2156";jwplayer.vid=document.createElement("video");jwplayer.audio=document.createElement("audio");jwplayer.source=document.createElement("source");(function(b){b.utils=function(){};b.utils.typeOf=function(d){var c=typeof d;if(c==="object"){if(d){if(d instanceof Array){c="array"}}else{c="null"}}return c};b.utils.extend=function(){var c=b.utils.extend["arguments"];if(c.length>1){for(var e=1;e-1){return c.substr(c.lastIndexOf(".")+1,c.length).toLowerCase()}return};b.utils.html=function(c,d){c.innerHTML=d};b.utils.wrap=function(c,d){if(c.parentNode){c.parentNode.replaceChild(d,c)}d.appendChild(c)};b.utils.ajax=function(g,f,c){var e;if(window.XMLHttpRequest){e=new XMLHttpRequest()}else{e=new ActiveXObject("Microsoft.XMLHTTP")}e.onreadystatechange=function(){if(e.readyState===4){if(e.status===200){if(f){if(!b.utils.exists(e.responseXML)){try{if(window.DOMParser){var h=(new DOMParser()).parseFromString(e.responseText,"text/xml");if(h){e=b.utils.extend({},e,{responseXML:h})}}else{h=new ActiveXObject("Microsoft.XMLDOM");h.async="false";h.loadXML(e.responseText);e=b.utils.extend({},e,{responseXML:h})}}catch(j){if(c){c(g)}}}f(e)}}else{if(c){c(g)}}}};try{e.open("GET",g,true);e.send(null)}catch(d){if(c){c(g)}}return e};b.utils.load=function(d,e,c){d.onreadystatechange=function(){if(d.readyState===4){if(d.status===200){if(e){e()}}else{if(c){c()}}}}};b.utils.find=function(d,c){return d.getElementsByTagName(c)};b.utils.append=function(c,d){c.appendChild(d)};b.utils.isIE=function(){return((!+"\v1")||(typeof window.ActiveXObject!="undefined"))};b.utils.userAgentMatch=function(d){var c=navigator.userAgent.toLowerCase();return(c.match(d)!==null)};b.utils.isIOS=function(){return b.utils.userAgentMatch(/iP(hone|ad|od)/i)};b.utils.isIPad=function(){return b.utils.userAgentMatch(/iPad/i)};b.utils.isIPod=function(){return b.utils.userAgentMatch(/iP(hone|od)/i)};b.utils.isAndroid=function(){return b.utils.userAgentMatch(/android/i)};b.utils.isLegacyAndroid=function(){return b.utils.userAgentMatch(/android 2.[012]/i)};b.utils.isBlackberry=function(){return b.utils.userAgentMatch(/blackberry/i)};b.utils.isMobile=function(){return b.utils.userAgentMatch(/(iP(hone|ad|od))|android/i)};b.utils.getFirstPlaylistItemFromConfig=function(c){var d={};var e;if(c.playlist&&c.playlist.length){e=c.playlist[0]}else{e=c}d.file=e.file;d.levels=e.levels;d.streamer=e.streamer;d.playlistfile=e.playlistfile;d.provider=e.provider;if(!d.provider){if(d.file&&(d.file.toLowerCase().indexOf("youtube.com")>-1||d.file.toLowerCase().indexOf("youtu.be")>-1)){d.provider="youtube"}if(d.streamer&&d.streamer.toLowerCase().indexOf("rtmp://")==0){d.provider="rtmp"}if(e.type){d.provider=e.type.toLowerCase()}}if(d.provider=="audio"){d.provider="sound"}return d};b.utils.getOuterHTML=function(c){if(c.outerHTML){return c.outerHTML}else{try{return new XMLSerializer().serializeToString(c)}catch(d){return""}}};b.utils.setOuterHTML=function(f,e){if(f.outerHTML){f.outerHTML=e}else{var g=document.createElement("div");g.innerHTML=e;var c=document.createRange();c.selectNodeContents(g);var d=c.extractContents();f.parentNode.insertBefore(d,f);f.parentNode.removeChild(f)}};b.utils.hasFlash=function(){if(typeof navigator.plugins!="undefined"&&typeof navigator.plugins["Shockwave Flash"]!="undefined"){return true}if(typeof window.ActiveXObject!="undefined"){try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash");return true}catch(c){}}return false};b.utils.getPluginName=function(c){if(c.lastIndexOf("/")>=0){c=c.substring(c.lastIndexOf("/")+1,c.length)}if(c.lastIndexOf("-")>=0){c=c.substring(0,c.lastIndexOf("-"))}if(c.lastIndexOf(".swf")>=0){c=c.substring(0,c.lastIndexOf(".swf"))}if(c.lastIndexOf(".js")>=0){c=c.substring(0,c.lastIndexOf(".js"))}return c};b.utils.getPluginVersion=function(c){if(c.lastIndexOf("-")>=0){if(c.lastIndexOf(".js")>=0){return c.substring(c.lastIndexOf("-")+1,c.lastIndexOf(".js"))}else{if(c.lastIndexOf(".swf")>=0){return c.substring(c.lastIndexOf("-")+1,c.lastIndexOf(".swf"))}else{return c.substring(c.lastIndexOf("-")+1)}}}return""};b.utils.getAbsolutePath=function(j,h){if(!b.utils.exists(h)){h=document.location.href}if(!b.utils.exists(j)){return undefined}if(a(j)){return j}var k=h.substring(0,h.indexOf("://")+3);var g=h.substring(k.length,h.indexOf("/",k.length+1));var d;if(j.indexOf("/")===0){d=j.split("/")}else{var e=h.split("?")[0];e=e.substring(k.length+g.length+1,e.lastIndexOf("/"));d=e.split("/").concat(j.split("/"))}var c=[];for(var f=0;f0&&(c<0||(c>e)))}b.utils.pluginPathType={ABSOLUTE:"ABSOLUTE",RELATIVE:"RELATIVE",CDN:"CDN"};b.utils.getPluginPathType=function(d){if(typeof d!="string"){return}d=d.split("?")[0];var e=d.indexOf("://");if(e>0){return b.utils.pluginPathType.ABSOLUTE}var c=d.indexOf("/");var f=b.utils.extension(d);if(e<0&&c<0&&(!f||!isNaN(f))){return b.utils.pluginPathType.CDN}return b.utils.pluginPathType.RELATIVE};b.utils.mapEmpty=function(c){for(var d in c){return false}return true};b.utils.mapLength=function(d){var c=0;for(var e in d){c++}return c};b.utils.log=function(d,c){if(typeof console!="undefined"&&typeof console.log!="undefined"){if(c){console.log(d,c)}else{console.log(d)}}};b.utils.css=function(d,g,c){if(b.utils.exists(d)){for(var e in g){try{if(typeof g[e]==="undefined"){continue}else{if(typeof g[e]=="number"&&!(e=="zIndex"||e=="opacity")){if(isNaN(g[e])){continue}if(e.match(/color/i)){g[e]="#"+b.utils.strings.pad(g[e].toString(16),6)}else{g[e]=Math.ceil(g[e])+"px"}}}d.style[e]=g[e]}catch(f){}}}};b.utils.isYouTube=function(c){return(c.indexOf("youtube.com")>-1||c.indexOf("youtu.be")>-1)};b.utils.transform=function(e,d,c,g,h){if(!b.utils.exists(d)){d=1}if(!b.utils.exists(c)){c=1}if(!b.utils.exists(g)){g=0}if(!b.utils.exists(h)){h=0}if(d==1&&c==1&&g==0&&h==0){e.style.webkitTransform="";e.style.MozTransform="";e.style.OTransform=""}else{var f="scale("+d+","+c+") translate("+g+"px,"+h+"px)";e.style.webkitTransform=f;e.style.MozTransform=f;e.style.OTransform=f}};b.utils.stretch=function(k,q,p,g,n,h){if(typeof p=="undefined"||typeof g=="undefined"||typeof n=="undefined"||typeof h=="undefined"){return}var d=p/n;var f=g/h;var m=0;var l=0;var e=false;var c={};if(q.parentElement){q.parentElement.style.overflow="hidden"}b.utils.transform(q);switch(k.toUpperCase()){case b.utils.stretching.NONE:c.width=n;c.height=h;c.top=(g-c.height)/2;c.left=(p-c.width)/2;break;case b.utils.stretching.UNIFORM:if(d>f){c.width=n*f;c.height=h*f;if(c.width/p>0.95){e=true;d=Math.ceil(100*p/c.width)/100;f=1;c.width=p}}else{c.width=n*d;c.height=h*d;if(c.height/g>0.95){e=true;d=1;f=Math.ceil(100*g/c.height)/100;c.height=g}}c.top=(g-c.height)/2;c.left=(p-c.width)/2;break;case b.utils.stretching.FILL:if(d>f){c.width=n*d;c.height=h*d}else{c.width=n*f;c.height=h*f}c.top=(g-c.height)/2;c.left=(p-c.width)/2;break;case b.utils.stretching.EXACTFIT:c.width=n;c.height=h;var o=Math.round((n/2)*(1-1/d));var j=Math.round((h/2)*(1-1/f));e=true;c.top=c.left=0;break;default:break}if(e){b.utils.transform(q,d,f,o,j)}b.utils.css(q,c)};b.utils.stretching={NONE:"NONE",FILL:"FILL",UNIFORM:"UNIFORM",EXACTFIT:"EXACTFIT"};b.utils.deepReplaceKeyName=function(k,e,c){switch(b.utils.typeOf(k)){case"array":for(var g=0;g0);break;case"object":return(c!==null);case"undefined":return false}return true};b.utils.empty=function(c){if(typeof c.hasChildNodes=="function"){while(c.hasChildNodes()){c.removeChild(c.firstChild)}}};b.utils.parseDimension=function(c){if(typeof c=="string"){if(c===""){return 0}else{if(c.lastIndexOf("%")>-1){return c}else{return parseInt(c.replace("px",""),10)}}}return c};b.utils.getDimensions=function(c){if(c&&c.style){return{x:b.utils.parseDimension(c.style.left),y:b.utils.parseDimension(c.style.top),width:b.utils.parseDimension(c.style.width),height:b.utils.parseDimension(c.style.height)}}else{return{}}};b.utils.getElementWidth=function(c){if(!c){return null}else{if(c==document.body){return b.utils.parentNode(c).clientWidth}else{if(c.clientWidth>0){return c.clientWidth}else{if(c.style){return b.utils.parseDimension(c.style.width)}else{return null}}}}};b.utils.getElementHeight=function(c){if(!c){return null}else{if(c==document.body){return b.utils.parentNode(c).clientHeight}else{if(c.clientHeight>0){return c.clientHeight}else{if(c.style){return b.utils.parseDimension(c.style.height)}else{return null}}}}};b.utils.timeFormat=function(c){str="00:00";if(c>0){str=Math.floor(c/60)<10?"0"+Math.floor(c/60)+":":Math.floor(c/60)+":";str+=Math.floor(c%60)<10?"0"+Math.floor(c%60):Math.floor(c%60)}return str};b.utils.useNativeFullscreen=function(){return(navigator&&navigator.vendor&&navigator.vendor.indexOf("Apple")==0)};b.utils.parentNode=function(c){if(!c){return docuemnt.body}else{if(c.parentNode){return c.parentNode}else{if(c.parentElement){return c.parentElement}else{return c}}}};b.utils.getBoundingClientRect=function(c){if(typeof c.getBoundingClientRect=="function"){return c.getBoundingClientRect()}else{return{left:c.offsetLeft+document.body.scrollLeft,top:c.offsetTop+document.body.scrollTop,width:c.offsetWidth,height:c.offsetHeight}}};b.utils.translateEventResponse=function(e,c){var g=b.utils.extend({},c);if(e==b.api.events.JWPLAYER_FULLSCREEN&&!g.fullscreen){g.fullscreen=g.message=="true"?true:false;delete g.message}else{if(typeof g.data=="object"){g=b.utils.extend(g,g.data);delete g.data}else{if(typeof g.metadata=="object"){b.utils.deepReplaceKeyName(g.metadata,["__dot__","__spc__","__dsh__"],["."," ","-"])}}}var d=["position","duration","offset"];for(var f in d){if(g[d[f]]){g[d[f]]=Math.round(g[d[f]]*1000)/1000}}return g};b.utils.saveCookie=function(c,d){document.cookie="jwplayer."+c+"="+d+"; path=/"};b.utils.getCookies=function(){var f={};var e=document.cookie.split("; ");for(var d=0;d0){_listeners[type][listenerIndex].count=_listeners[type][listenerIndex].count-1}}}}}for(var globalListenerIndex=0;globalListenerIndex<_globallisteners.length;globalListenerIndex++){try{_globallisteners[globalListenerIndex].listener(data)}catch(err){jwplayer.utils.log("There was an error while handling a listener: "+err.toString(),_globallisteners[globalListenerIndex].listener)}if(_globallisteners[globalListenerIndex]){if(_globallisteners[globalListenerIndex].count===1){delete _globallisteners[globalListenerIndex]}else{if(_globallisteners[globalListenerIndex].count>0){_globallisteners[globalListenerIndex].count=_globallisteners[globalListenerIndex].count-1}}}}}}})(jwplayer);(function(a){var b={};a.utils.animations=function(){};a.utils.animations.transform=function(c,d){c.style.webkitTransform=d;c.style.MozTransform=d;c.style.OTransform=d;c.style.msTransform=d};a.utils.animations.transformOrigin=function(c,d){c.style.webkitTransformOrigin=d;c.style.MozTransformOrigin=d;c.style.OTransformOrigin=d;c.style.msTransformOrigin=d};a.utils.animations.rotate=function(c,d){a.utils.animations.transform(c,["rotate(",d,"deg)"].join(""))};a.utils.cancelAnimation=function(c){delete b[c.id]};a.utils.fadeTo=function(m,f,e,j,h,d){if(b[m.id]!=d&&a.utils.exists(d)){return}if(m.style.opacity==f){return}var c=new Date().getTime();if(d>c){setTimeout(function(){a.utils.fadeTo(m,f,e,j,0,d)},d-c)}if(m.style.display=="none"){m.style.display="block"}if(!a.utils.exists(j)){j=m.style.opacity===""?1:m.style.opacity}if(m.style.opacity==f&&m.style.opacity!==""&&a.utils.exists(d)){if(f===0){m.style.display="none"}return}if(!a.utils.exists(d)){d=c;b[m.id]=d}if(!a.utils.exists(h)){h=0}var k=(e>0)?((c-d)/(e*1000)):0;k=k>1?1:k;var l=f-j;var g=j+(k*l);if(g>1){g=1}else{if(g<0){g=0}}m.style.opacity=g;if(h>0){b[m.id]=d+h*1000;a.utils.fadeTo(m,f,e,j,0,b[m.id]);return}setTimeout(function(){a.utils.fadeTo(m,f,e,j,0,d)},10)}})(jwplayer);(function(a){a.utils.arrays=function(){};a.utils.arrays.indexOf=function(c,d){for(var b=0;b-1){c.splice(b,1)}}})(jwplayer);(function(a){a.utils.extensionmap={"3gp":{html5:"video/3gpp",flash:"video"},"3gpp":{html5:"video/3gpp"},"3g2":{html5:"video/3gpp2",flash:"video"},"3gpp2":{html5:"video/3gpp2"},flv:{flash:"video"},f4a:{html5:"audio/mp4"},f4b:{html5:"audio/mp4",flash:"video"},f4v:{html5:"video/mp4",flash:"video"},mov:{html5:"video/quicktime",flash:"video"},m4a:{html5:"audio/mp4",flash:"video"},m4b:{html5:"audio/mp4"},m4p:{html5:"audio/mp4"},m4v:{html5:"video/mp4",flash:"video"},mp4:{html5:"video/mp4",flash:"video"},rbs:{flash:"sound"},aac:{html5:"audio/aac",flash:"video"},mp3:{html5:"audio/mp3",flash:"sound"},ogg:{html5:"audio/ogg"},oga:{html5:"audio/ogg"},ogv:{html5:"video/ogg"},webm:{html5:"video/webm"},m3u8:{html5:"audio/x-mpegurl"},gif:{flash:"image"},jpeg:{flash:"image"},jpg:{flash:"image"},swf:{flash:"image"},png:{flash:"image"},wav:{html5:"audio/x-wav"}}})(jwplayer);(function(e){e.utils.mediaparser=function(){};var g={element:{width:"width",height:"height",id:"id","class":"className",name:"name"},media:{src:"file",preload:"preload",autoplay:"autostart",loop:"repeat",controls:"controls"},source:{src:"file",type:"type",media:"media","data-jw-width":"width","data-jw-bitrate":"bitrate"},video:{poster:"image"}};var f={};e.utils.mediaparser.parseMedia=function(j){return d(j)};function c(k,j){if(!e.utils.exists(j)){j=g[k]}else{e.utils.extend(j,g[k])}return j}function d(n,j){if(f[n.tagName.toLowerCase()]&&!e.utils.exists(j)){return f[n.tagName.toLowerCase()](n)}else{j=c("element",j);var o={};for(var k in j){if(k!="length"){var m=n.getAttribute(k);if(e.utils.exists(m)){o[j[k]]=m}}}var l=n.style["#background-color"];if(l&&!(l=="transparent"||l=="rgba(0, 0, 0, 0)")){o.screencolor=l}return o}}function h(n,k){k=c("media",k);var l=[];var j=e.utils.selectors("source",n);for(var m in j){if(!isNaN(m)){l.push(a(j[m]))}}var o=d(n,k);if(e.utils.exists(o.file)){l[0]={file:o.file}}o.levels=l;return o}function a(l,k){k=c("source",k);var j=d(l,k);j.width=j.width?j.width:0;j.bitrate=j.bitrate?j.bitrate:0;return j}function b(l,k){k=c("video",k);var j=h(l,k);return j}f.media=h;f.audio=h;f.source=a;f.video=b})(jwplayer);(function(a){a.utils.loaderstatus={NEW:"NEW",LOADING:"LOADING",ERROR:"ERROR",COMPLETE:"COMPLETE"};a.utils.scriptloader=function(c){var d=a.utils.loaderstatus.NEW;var b=new a.events.eventdispatcher();a.utils.extend(this,b);this.load=function(){if(d==a.utils.loaderstatus.NEW){d=a.utils.loaderstatus.LOADING;var e=document.createElement("script");e.onload=function(f){d=a.utils.loaderstatus.COMPLETE;b.sendEvent(a.events.COMPLETE)};e.onerror=function(f){d=a.utils.loaderstatus.ERROR;b.sendEvent(a.events.ERROR)};e.onreadystatechange=function(){if(e.readyState=="loaded"||e.readyState=="complete"){d=a.utils.loaderstatus.COMPLETE;b.sendEvent(a.events.COMPLETE)}};document.getElementsByTagName("head")[0].appendChild(e);e.src=c}};this.getStatus=function(){return d}}})(jwplayer);(function(a){a.utils.selectors=function(b,e){if(!a.utils.exists(e)){e=document}b=a.utils.strings.trim(b);var c=b.charAt(0);if(c=="#"){return e.getElementById(b.substr(1))}else{if(c=="."){if(e.getElementsByClassName){return e.getElementsByClassName(b.substr(1))}else{return a.utils.selectors.getElementsByTagAndClass("*",b.substr(1))}}else{if(b.indexOf(".")>0){var d=b.split(".");return a.utils.selectors.getElementsByTagAndClass(d[0],d[1])}else{return e.getElementsByTagName(b)}}}return null};a.utils.selectors.getElementsByTagAndClass=function(e,h,g){var j=[];if(!a.utils.exists(g)){g=document}var f=g.getElementsByTagName(e);for(var d=0;d5||b.length==0){return b}else{return Number(b)}}}}};a.utils.strings.seconds=function(d){d=d.replace(",",".");var b=d.split(":");var c=0;if(d.substr(-1)=="s"){c=Number(d.substr(0,d.length-1))}else{if(d.substr(-1)=="m"){c=Number(d.substr(0,d.length-1))*60}else{if(d.substr(-1)=="h"){c=Number(d.substr(0,d.length-1))*3600}else{if(b.length>1){c=Number(b[b.length-1]);c+=Number(b[b.length-2])*60;if(b.length==3){c+=Number(b[b.length-3])*3600}}else{c=Number(d)}}}}return c};a.utils.strings.xmlAttribute=function(b,c){for(var d=0;d=0){return"boolean"}else{if(d.test(f)){return"color"}else{if(!isNaN(parseInt(f,10))&&parseInt(f,10).toString().length==f.length){return"integer"}else{if(!isNaN(parseFloat(f))&&parseFloat(f).toString().length==f.length){return"float"}}}}return"string"}function e(g,f){if(!c.utils.exists(f)){return g}switch(f){case"color":if(g.length>0){return a(g)}return null;case"integer":return parseInt(g,10);case"float":return parseFloat(g);case"boolean":if(g.toLowerCase()=="true"){return true}else{if(g=="1"){return true}}return false}return g}function a(f){switch(f.toLowerCase()){case"blue":return parseInt("0000FF",16);case"green":return parseInt("00FF00",16);case"red":return parseInt("FF0000",16);case"cyan":return parseInt("00FFFF",16);case"magenta":return parseInt("FF00FF",16);case"yellow":return parseInt("FFFF00",16);case"black":return parseInt("000000",16);case"white":return parseInt("FFFFFF",16);default:f=f.replace(/(#|0x)?([0-9A-F]{3,6})$/gi,"$2");if(f.length==3){f=f.charAt(0)+f.charAt(0)+f.charAt(1)+f.charAt(1)+f.charAt(2)+f.charAt(2)}return parseInt(f,16)}return parseInt("000000",16)}})(jwplayer);(function(a){a.utils.parsers=function(){};a.utils.parsers.localName=function(b){if(!b){return""}else{if(b.localName){return b.localName}else{if(b.baseName){return b.baseName}else{return""}}}};a.utils.parsers.textContent=function(b){if(!b){return""}else{if(b.textContent){return b.textContent}else{if(b.text){return b.text}else{return""}}}}})(jwplayer);(function(a){a.utils.parsers.jwparser=function(){};a.utils.parsers.jwparser.PREFIX="jwplayer";a.utils.parsers.jwparser.parseEntry=function(c,d){for(var b=0;b-1){d.file=d.link}}return d};a.utils.parsers.jwparser.getProvider=function(c){if(c.type){return c.type}else{if(c.file.indexOf("youtube.com/w")>-1||c.file.indexOf("youtube.com/v")>-1||c.file.indexOf("youtu.be/")>-1){return"youtube"}else{if(c.streamer&&c.streamer.indexOf("rtmp")==0){return"rtmp"}else{if(c.streamer&&c.streamer.indexOf("http")==0){return"http"}else{var b=a.utils.strings.extension(c.file);if(extensions.hasOwnProperty(b)){return extensions[b]}}}}}return""}})(jwplayer);(function(a){a.utils.parsers.mediaparser=function(){};a.utils.parsers.mediaparser.PREFIX="media";a.utils.parsers.mediaparser.parseGroup=function(d,f){var e=false;for(var c=0;c0){f=a.utils.parsers.mediaparser.parseGroup(d.childNodes[c],f)}if(a.utils.strings.xmlAttribute(d.childNodes[c],"width")||a.utils.strings.xmlAttribute(d.childNodes[c],"bitrate")||a.utils.strings.xmlAttribute(d.childNodes[c],"url")){if(!f.levels){f.levels=[]}f.levels.push({width:a.utils.strings.xmlAttribute(d.childNodes[c],"width"),bitrate:a.utils.strings.xmlAttribute(d.childNodes[c],"bitrate"),file:a.utils.strings.xmlAttribute(d.childNodes[c],"url")})}break;case"title":f.title=a.utils.parsers.textContent(d.childNodes[c]);break;case"description":f.description=a.utils.parsers.textContent(d.childNodes[c]);break;case"keywords":f.tags=a.utils.parsers.textContent(d.childNodes[c]);break;case"thumbnail":f.image=a.utils.strings.xmlAttribute(d.childNodes[c],"url");break;case"credit":f.author=a.utils.parsers.textContent(d.childNodes[c]);break;case"player":var b=d.childNodes[c].url;if(b.indexOf("youtube.com")>=0||b.indexOf("youtu.be")>=0){e=true;f.file=a.utils.strings.xmlAttribute(d.childNodes[c],"url")}break;case"group":a.utils.parsers.mediaparser.parseGroup(d.childNodes[c],f);break}}}return f}})(jwplayer);(function(b){b.utils.parsers.rssparser=function(){};b.utils.parsers.rssparser.parse=function(f){var c=[];for(var e=0;e0){k=b;j=a.utils.loaderstatus.COMPLETE;c.sendEvent(a.events.COMPLETE);return}j=a.utils.loaderstatus.LOADING;var m=new a.utils.scriptloader(e());m.addEventListener(a.events.COMPLETE,g);m.addEventListener(a.events.ERROR,f);m.load()}};this.registerPlugin=function(o,n,m){if(l){clearTimeout(l);l=undefined}if(n&&m){k=m;h=n}else{if(typeof n=="string"){k=n}else{if(typeof n=="function"){h=n}else{if(!n&&!m){k=o}}}}j=a.utils.loaderstatus.COMPLETE;c.sendEvent(a.events.COMPLETE)};this.getStatus=function(){return j};this.getPluginName=function(){return a.utils.getPluginName(b)};this.getFlashPath=function(){if(k){switch(a.utils.getPluginPathType(k)){case a.utils.pluginPathType.ABSOLUTE:return k;case a.utils.pluginPathType.RELATIVE:if(b.lastIndexOf(".swf")>0){return a.utils.getAbsolutePath(k,window.location.href)}return a.utils.getAbsolutePath(k,e());case a.utils.pluginPathType.CDN:if(k.indexOf("-")>-1){return k+"h"}return k+"-h"}}return null};this.getJS=function(){return h};this.getPluginmode=function(){if(typeof k!="undefined"&&typeof h!="undefined"){return a.plugins.pluginmodes.HYBRID}else{if(typeof k!="undefined"){return a.plugins.pluginmodes.FLASH}else{if(typeof h!="undefined"){return a.plugins.pluginmodes.JAVASCRIPT}}}};this.getNewInstance=function(n,m,o){return new h(n,m,o)};this.getURL=function(){return b}}})(jwplayer);(function(a){a.plugins.pluginloader=function(h,e){var g={};var k=a.utils.loaderstatus.NEW;var d=false;var b=false;var c=new a.events.eventdispatcher();a.utils.extend(this,c);function f(){if(!b){b=true;k=a.utils.loaderstatus.COMPLETE;c.sendEvent(a.events.COMPLETE)}}function j(){if(!b){var m=0;for(plugin in g){var l=g[plugin].getStatus();if(l==a.utils.loaderstatus.LOADING||l==a.utils.loaderstatus.NEW){m++}}if(m==0){f()}}}this.setupPlugins=function(n,l,s){var m={length:0,plugins:{}};var p={length:0,plugins:{}};for(var o in g){var q=g[o].getPluginName();if(g[o].getFlashPath()){m.plugins[g[o].getFlashPath()]=l.plugins[o];m.plugins[g[o].getFlashPath()].pluginmode=g[o].getPluginmode();m.length++}if(g[o].getJS()){var r=document.createElement("div");r.id=n.id+"_"+q;r.style.position="absolute";r.style.zIndex=p.length+10;p.plugins[q]=g[o].getNewInstance(n,l.plugins[o],r);p.length++;if(typeof p.plugins[q].resize!="undefined"){n.onReady(s(p.plugins[q],r,true));n.onResize(s(p.plugins[q],r))}}}n.plugins=p.plugins;return m};this.load=function(){k=a.utils.loaderstatus.LOADING;d=true;for(var l in e){if(a.utils.exists(l)){g[l]=h.addPlugin(l);g[l].addEventListener(a.events.COMPLETE,j);g[l].addEventListener(a.events.ERROR,j)}}for(l in g){g[l].load()}d=false;j()};this.pluginFailed=function(){f()};this.getStatus=function(){return k}}})(jwplayer);(function(b){var a=[];b.api=function(d){this.container=d;this.id=d.id;var m={};var t={};var p={};var c=[];var g=undefined;var k=false;var h=[];var r=undefined;var o=b.utils.getOuterHTML(d);var s={};var j={};this.getBuffer=function(){return this.callInternal("jwGetBuffer")};this.getContainer=function(){return this.container};function e(v,u){return function(A,w,x,y){if(v.renderingMode=="flash"||v.renderingMode=="html5"){var z;if(w){j[A]=w;z="jwplayer('"+v.id+"').callback('"+A+"')"}else{if(!w&&j[A]){delete j[A]}}g.jwDockSetButton(A,z,x,y)}return u}}this.getPlugin=function(u){var w=this;var v={};if(u=="dock"){return b.utils.extend(v,{setButton:e(w,v),show:function(){w.callInternal("jwDockShow");return v},hide:function(){w.callInternal("jwDockHide");return v},onShow:function(x){w.componentListener("dock",b.api.events.JWPLAYER_COMPONENT_SHOW,x);return v},onHide:function(x){w.componentListener("dock",b.api.events.JWPLAYER_COMPONENT_HIDE,x);return v}})}else{if(u=="controlbar"){return b.utils.extend(v,{show:function(){w.callInternal("jwControlbarShow");return v},hide:function(){w.callInternal("jwControlbarHide");return v},onShow:function(x){w.componentListener("controlbar",b.api.events.JWPLAYER_COMPONENT_SHOW,x);return v},onHide:function(x){w.componentListener("controlbar",b.api.events.JWPLAYER_COMPONENT_HIDE,x);return v}})}else{if(u=="display"){return b.utils.extend(v,{show:function(){w.callInternal("jwDisplayShow");return v},hide:function(){w.callInternal("jwDisplayHide");return v},onShow:function(x){w.componentListener("display",b.api.events.JWPLAYER_COMPONENT_SHOW,x);return v},onHide:function(x){w.componentListener("display",b.api.events.JWPLAYER_COMPONENT_HIDE,x);return v}})}else{return this.plugins[u]}}}};this.callback=function(u){if(j[u]){return j[u]()}};this.getDuration=function(){return this.callInternal("jwGetDuration")};this.getFullscreen=function(){return this.callInternal("jwGetFullscreen")};this.getHeight=function(){return this.callInternal("jwGetHeight")};this.getLockState=function(){return this.callInternal("jwGetLockState")};this.getMeta=function(){return this.getItemMeta()};this.getMute=function(){return this.callInternal("jwGetMute")};this.getPlaylist=function(){var v=this.callInternal("jwGetPlaylist");if(this.renderingMode=="flash"){b.utils.deepReplaceKeyName(v,["__dot__","__spc__","__dsh__"],["."," ","-"])}for(var u=0;u0){this.callInternal.apply(this,h.shift())}};this.getItemMeta=function(){return s};this.getCurrentItem=function(){return this.callInternal("jwGetPlaylistIndex")};function n(w,y,x){var u=[];if(!y){y=0}if(!x){x=w.length-1}for(var v=y;v<=x;v++){u.push(w[v])}return u}return this};b.api.selectPlayer=function(d){var c;if(!b.utils.exists(d)){d=0}if(d.nodeType){c=d}else{if(typeof d=="string"){c=document.getElementById(d)}}if(c){var e=b.api.playerById(c.id);if(e){return e}else{return b.api.addPlayer(new b.api(c))}}else{if(typeof d=="number"){return b.getPlayers()[d]}}return null};b.api.events={API_READY:"jwplayerAPIReady",JWPLAYER_READY:"jwplayerReady",JWPLAYER_FULLSCREEN:"jwplayerFullscreen",JWPLAYER_RESIZE:"jwplayerResize",JWPLAYER_ERROR:"jwplayerError",JWPLAYER_MEDIA_BEFOREPLAY:"jwplayerMediaBeforePlay",JWPLAYER_MEDIA_BEFORECOMPLETE:"jwplayerMediaBeforeComplete",JWPLAYER_COMPONENT_SHOW:"jwplayerComponentShow",JWPLAYER_COMPONENT_HIDE:"jwplayerComponentHide",JWPLAYER_MEDIA_BUFFER:"jwplayerMediaBuffer",JWPLAYER_MEDIA_BUFFER_FULL:"jwplayerMediaBufferFull",JWPLAYER_MEDIA_ERROR:"jwplayerMediaError",JWPLAYER_MEDIA_LOADED:"jwplayerMediaLoaded",JWPLAYER_MEDIA_COMPLETE:"jwplayerMediaComplete",JWPLAYER_MEDIA_SEEK:"jwplayerMediaSeek",JWPLAYER_MEDIA_TIME:"jwplayerMediaTime",JWPLAYER_MEDIA_VOLUME:"jwplayerMediaVolume",JWPLAYER_MEDIA_META:"jwplayerMediaMeta",JWPLAYER_MEDIA_MUTE:"jwplayerMediaMute",JWPLAYER_PLAYER_STATE:"jwplayerPlayerState",JWPLAYER_PLAYLIST_LOADED:"jwplayerPlaylistLoaded",JWPLAYER_PLAYLIST_ITEM:"jwplayerPlaylistItem",JWPLAYER_INSTREAM_CLICK:"jwplayerInstreamClicked",JWPLAYER_INSTREAM_DESTROYED:"jwplayerInstreamDestroyed"};b.api.events.state={BUFFERING:"BUFFERING",IDLE:"IDLE",PAUSED:"PAUSED",PLAYING:"PLAYING"};b.api.playerById=function(d){for(var c=0;c=0){var c=document.getElementById(a[f].id);if(document.getElementById(a[f].id+"_wrapper")){c=document.getElementById(a[f].id+"_wrapper")}if(c){if(d){b.utils.setOuterHTML(c,d)}else{var h=document.createElement("div");var e=c.id;if(c.id.indexOf("_wrapper")==c.id.length-8){newID=c.id.substring(0,c.id.length-8)}h.setAttribute("id",e);c.parentNode.replaceChild(h,c)}}a.splice(f,1)}return null};b.getPlayers=function(){return a.slice(0)}})(jwplayer);var _userPlayerReady=(typeof playerReady=="function")?playerReady:undefined;playerReady=function(b){var a=jwplayer.api.playerById(b.id);if(a){a.playerReady(b)}else{jwplayer.api.selectPlayer(b.id).playerReady(b)}if(_userPlayerReady){_userPlayerReady.call(this,b)}};(function(a){a.api.instream=function(c,j,n,q){var h=c;var b=j;var g=n;var k=q;var e={};var p={};function f(){h.callInternal("jwLoadInstream",n,q)}function m(r,s){b.jwInstreamAddEventListener(s,'function(dat) { jwplayer("'+h.id+'").dispatchInstreamEvent("'+s+'", dat); }')}function d(r,s){if(!e[r]){e[r]=[];m(b,r)}e[r].push(s);return this}function o(r,s){if(!p[r]){p[r]=[];d(a.api.events.JWPLAYER_PLAYER_STATE,l(r))}p[r].push(s);return this}function l(r){return function(t){var s=t.newstate,v=t.oldstate;if(s==r){var u=p[s];if(u){for(var w=0;w-1){return parseInt(l)}}return l}var g=["playlist","dock","controlbar","logo","display"];function f(l){var o={};switch(k.typeOf(l.plugins)){case"object":for(var n in l.plugins){o[k.getPluginName(n)]=n}break;case"string":var p=l.plugins.split(",");for(var m=0;m-1){var p=q.split(".");var o=p[0];var q=p[1];if(k.isInArray(g,o)){d(m,"components",o,q)}else{if(n[o]){d(m,"plugins",n[o],q)}}}}return m};e.embed.config=function(l,v){var u=k.extend({},l);var s;if(c(u.playlist)){s=u.playlist;delete u.playlist}u=e.embed.deserialize(u);u.height=j(u.height);u.width=j(u.width);if(typeof u.plugins=="string"){var m=u.plugins.split(",");if(typeof u.plugins!="object"){u.plugins={}}for(var q=0;q-1)){return true}if(!l||(l&&l=="video")){var m=a.utils.extension(j);if(m&&a.utils.extensionmap[m]){return true}}return false}}})(jwplayer);(function(a){a.embed.flash=function(f,g,l,e,j){function m(o,n,p){var q=document.createElement("param");q.setAttribute("name",n);q.setAttribute("value",p);o.appendChild(q)}function k(o,p,n){return function(q){if(n){document.getElementById(j.id+"_wrapper").appendChild(p)}var s=document.getElementById(j.id).getPluginConfig("display");o.resize(s.width,s.height);var r={left:s.x,top:s.y};a.utils.css(p,r)}}function d(p){if(!p){return{}}var r={};for(var o in p){var n=p[o];for(var q in n){r[o+"."+q]=n[q]}}return r}function h(q,p){if(q[p]){var s=q[p];for(var o in s){var n=s[o];if(typeof n=="string"){if(!q[o]){q[o]=n}}else{for(var r in n){if(!q[o+"."+r]){q[o+"."+r]=n[r]}}}}delete q[p]}}function b(q){if(!q){return{}}var t={},s=[];for(var n in q){var p=a.utils.getPluginName(n);var o=q[n];s.push(n);for(var r in o){t[p+"."+r]=o[r]}}t.plugins=s.join(",");return t}function c(p){var n=p.netstreambasepath?"":"netstreambasepath="+encodeURIComponent(window.location.href.split("#")[0])+"&";for(var o in p){if(typeof(p[o])=="object"){n+=o+"="+encodeURIComponent("[[JSON]]"+a.utils.strings.jsonToString(p[o]))+"&"}else{n+=o+"="+encodeURIComponent(p[o])+"&"}}return n.substring(0,n.length-1)}this.embed=function(){l.id=j.id;var A;var r=a.utils.extend({},l);var o=r.width;var y=r.height;if(f.id+"_wrapper"==f.parentNode.id){A=document.getElementById(f.id+"_wrapper")}else{A=document.createElement("div");A.id=f.id+"_wrapper";a.utils.wrap(f,A);a.utils.css(A,{position:"relative",width:o,height:y})}var p=e.setupPlugins(j,r,k);if(p.length>0){a.utils.extend(r,b(p.plugins))}else{delete r.plugins}var s=["height","width","modes","events"];for(var v=0;v';w+='';w+='';w+='';w+='';w+='';w+='';w+="";a.utils.setOuterHTML(f,w);u=document.getElementById(f.id)}else{var t=document.createElement("object");t.setAttribute("type","application/x-shockwave-flash");t.setAttribute("data",g.src);t.setAttribute("width","100%");t.setAttribute("height","100%");t.setAttribute("bgcolor","#000000");t.setAttribute("id",f.id);t.setAttribute("name",f.id);t.setAttribute("tabindex",0);m(t,"allowfullscreen","true");m(t,"allowscriptaccess","always");m(t,"seamlesstabbing","true");m(t,"wmode",q);m(t,"flashvars",c(r));f.parentNode.replaceChild(t,f);u=t}j.container=u;j.setPlayer(u,"flash")};this.supportsConfig=function(){if(a.utils.hasFlash()){if(l){var o=a.utils.getFirstPlaylistItemFromConfig(l);if(typeof o.file=="undefined"&&typeof o.levels=="undefined"){return true}else{if(o.file){return flashCanPlay(o.file,o.provider)}else{if(o.levels&&o.levels.length){for(var n=0;n0){j.skin=j.skin.replace(/\.zip/i,".xml")}var l=new (a.html5(c)).setup(j);f.container=document.getElementById(f.id);f.setPlayer(l,"html5")}else{return null}};this.supportsConfig=function(){if(!!a.vid.canPlayType){if(b){var j=a.utils.getFirstPlaylistItemFromConfig(b);if(typeof j.file=="undefined"&&typeof j.levels=="undefined"){return true}else{if(j.file){return html5CanPlay(a.vid,j.file,j.provider,j.playlistfile)}else{if(j.levels&&j.levels.length){for(var h=0;h0){f=c.getElementWidth(c.parentNode(M))*parseInt(P.replace("%"),"")/100}else{f=P}if(typeof Y=="string"&&Y.indexOf("%")>0){q=c.getElementHeight(c.parentNode(M))*parseInt(Y.replace("%"),"")/100}else{q=Y}var T={top:0,bottom:0,left:0,right:0,width:f,height:q,position:"absolute"};b(m,T);var Z={};var W;try{W=h.plugins.object.display.getDisplayElement()}catch(V){}if(W){Z.width=c.parseDimension(W.style.width);Z.height=c.parseDimension(W.style.height)}var X=c.extend({},T,Z,{zIndex:_instreamArea.style.zIndex,display:_instreamArea.style.display});b(_instreamArea,X);b(M,{height:q,width:f});var U=t(E,S);if(U.length>0){B+=U.length;var R=U.indexOf("playlist"),Q=U.indexOf("controlbar");if(R>=0&&Q>=0){U[R]=U.splice(Q,1,U[R])[0]}t(o,U,true)}x=c.getElementWidth(m);J=c.getElementHeight(m)}else{if(!y()){t(d,S,true)}}j()}function t(W,S,T){var U=[];for(var R=0;R-1)}function y(){if(k.jwGetState()!=a.api.events.state.IDLE&&!A&&(h.getMedia()&&h.getMedia().getDisplayElement()&&h.getMedia().getDisplayElement().webkitSupportsFullscreen)&&c.useNativeFullscreen()){return true}return false}this.setupInstream=function(P,Q){c.css(_instreamArea,{display:"block",position:"absolute"});m.style.display="none";_instreamArea.appendChild(P);r=Q;N=true};var z=this.destroyInstream=function(){_instreamArea.style.display="none";_instreamArea.innerHTML="";m.style.display="block";r=null;N=false;C(h.width,h.height)}};a.html5.view.positions={TOP:"TOP",RIGHT:"RIGHT",BOTTOM:"BOTTOM",LEFT:"LEFT",OVER:"OVER",NONE:"NONE"}})(jwplayer);(function(a){var b={backgroundcolor:"",margin:10,font:"Arial,sans-serif",fontsize:10,fontcolor:parseInt("000000",16),fontstyle:"normal",fontweight:"bold",buttoncolor:parseInt("ffffff",16),position:a.html5.view.positions.BOTTOM,idlehide:false,hideplaylistcontrols:false,forcenextprev:false,layout:{left:{position:"left",elements:[{name:"play",type:"button"},{name:"divider",type:"divider"},{name:"prev",type:"button"},{name:"divider",type:"divider"},{name:"next",type:"button"},{name:"divider",type:"divider"},{name:"elapsed",type:"text"}]},center:{position:"center",elements:[{name:"time",type:"slider"}]},right:{position:"right",elements:[{name:"duration",type:"text"},{name:"blank",type:"button"},{name:"divider",type:"divider"},{name:"mute",type:"button"},{name:"volume",type:"slider"},{name:"divider",type:"divider"},{name:"fullscreen",type:"button"}]}}};_utils=a.utils;_css=_utils.css;_hide=function(c){_css(c,{display:"none"})};_show=function(c){_css(c,{display:"block"})};a.html5.controlbar=function(m,X){window.controlbar=this;var l=m;var D=_utils.extend({},b,l.skin.getComponentSettings("controlbar"),X);if(D.position==a.html5.view.positions.NONE||typeof a.html5.view.positions[D.position]=="undefined"){return}if(_utils.mapLength(l.skin.getComponentLayout("controlbar"))>0){D.layout=l.skin.getComponentLayout("controlbar")}var af;var Q;var ae;var E;var w="none";var h;var k;var ag;var g;var f;var z;var R={};var q=false;var c={};var ab;var j=false;var p;var d;var U=false;var G=false;var H;var Z=new a.html5.eventdispatcher();_utils.extend(this,Z);function K(){if(!ab){ab=l.skin.getSkinElement("controlbar","background");if(!ab){ab={width:0,height:0,src:null}}}return ab}function O(){ae=0;E=0;Q=0;if(!q){var ao={height:K().height,backgroundColor:D.backgroundcolor};af=document.createElement("div");af.id=l.id+"_jwplayer_controlbar";_css(af,ao)}var an=(l.skin.getSkinElement("controlbar","capLeft"));var am=(l.skin.getSkinElement("controlbar","capRight"));if(an){y("capLeft","left",false,af)}ac("background",af,{position:"absolute",height:K().height,left:(an?an.width:0),zIndex:0},"img");if(K().src){R.background.src=K().src}ac("elements",af,{position:"relative",height:K().height,zIndex:1});if(am){y("capRight","right",false,af)}}this.getDisplayElement=function(){return af};this.resize=function(ao,am){S();_utils.cancelAnimation(af);f=ao;z=am;if(G!=l.jwGetFullscreen()){G=l.jwGetFullscreen();if(!G){Y()}d=undefined}var an=x();J({id:l.id,duration:ag,position:k});v({id:l.id,bufferPercent:g});return an};this.show=function(){if(j){j=false;_show(af);V()}};this.hide=function(){if(!j){j=true;_hide(af);ad()}};function r(){var an=["timeSlider","volumeSlider","timeSliderRail","volumeSliderRail"];for(var ao in an){var am=an[ao];if(typeof R[am]!="undefined"){c[am]=_utils.getBoundingClientRect(R[am])}}}var e;function Y(am){if(j){return}clearTimeout(p);if(D.position==a.html5.view.positions.OVER||l.jwGetFullscreen()){switch(l.jwGetState()){case a.api.events.state.PAUSED:case a.api.events.state.IDLE:if(af&&af.style.opacity<1&&(!D.idlehide||_utils.exists(am))){e=false;setTimeout(function(){if(!e){W()}},100)}if(D.idlehide){p=setTimeout(function(){A()},2000)}break;default:e=true;if(am){W()}p=setTimeout(function(){A()},2000);break}}else{W()}}function A(){if(!j){ad();if(af.style.opacity==1){_utils.cancelAnimation(af);_utils.fadeTo(af,0,0.1,1,0)}}}function W(){if(!j){V();if(af.style.opacity==0){_utils.cancelAnimation(af);_utils.fadeTo(af,1,0.1,0,0)}}}function I(am){return function(){if(U&&d!=am){d=am;Z.sendEvent(am,{component:"controlbar",boundingRect:P()})}}}var V=I(a.api.events.JWPLAYER_COMPONENT_SHOW);var ad=I(a.api.events.JWPLAYER_COMPONENT_HIDE);function P(){if(D.position==a.html5.view.positions.OVER||l.jwGetFullscreen()){return _utils.getDimensions(af)}else{return{x:0,y:0,width:0,height:0}}}function ac(aq,ap,ao,am){var an;if(!q){if(!am){am="div"}an=document.createElement(am);R[aq]=an;an.id=af.id+"_"+aq;ap.appendChild(an)}else{an=document.getElementById(af.id+"_"+aq)}if(_utils.exists(ao)){_css(an,ao)}return an}function N(){if(l.jwGetHeight()<=40){D.layout=_utils.clone(D.layout);for(var am=0;am0||ap.indexOf("divider")===0){var ar={height:"100%",position:aq?aq:"relative",display:"block","float":"left",styleFloat:"left",cssFloat:"left"};if((ap.indexOf("next")===0||ap.indexOf("prev")===0)&&(l.jwGetPlaylist().length<2||D.hideplaylistcontrols.toString()=="true")){if(D.forcenextprev.toString()!="true"){an=false;ar.display="none"}}var ax;if(ap.indexOf("Text")>0){ap.innerhtml="00:00";ar.font=D.fontsize+"px/"+(K().height+1)+"px "+D.font;ar.color=D.fontcolor;ar.textAlign="center";ar.fontWeight=D.fontweight;ar.fontStyle=D.fontstyle;ar.cursor="default";if(ao){ar.background="url("+ao.src+") no-repeat center";ar.backgroundSize="100% "+K().height+"px"}ar.padding="0 5px"}else{if(ap.indexOf("divider")===0){if(am){if(!isNaN(parseInt(am))){ax=parseInt(am)}}else{if(ao){var au=l.skin.getSkinElement("controlbar",ao);if(au){ar.background="url("+au.src+") repeat-x center left";ax=au.width}}else{ar.background="url("+l.skin.getSkinElement("controlbar","divider").src+") repeat-x center left";ax=l.skin.getSkinElement("controlbar","divider").width}}}else{ar.background="url("+l.skin.getSkinElement("controlbar",ap).src+") repeat-x center left";ax=l.skin.getSkinElement("controlbar",ap).width}}if(at=="left"){if(an){ae+=ax}}else{if(at=="right"){if(an){E+=ax}}}if(_utils.typeOf(aw)=="undefined"){aw=R.elements}ar.width=ax;if(q){_css(R[ap],ar)}else{var av=ac(ap,aw,ar);if(_utils.exists(l.skin.getSkinElement("controlbar",ap+"Over"))){av.onmouseover=function(ay){av.style.backgroundImage=["url(",l.skin.getSkinElement("controlbar",ap+"Over").src,")"].join("")};av.onmouseout=function(ay){av.style.backgroundImage=["url(",l.skin.getSkinElement("controlbar",ap).src,")"].join("")}}if(ap.indexOf("divider")==0){av.setAttribute("class","divider")}av.innerHTML=" "}}}function F(){l.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,B);l.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_ITEM,t);l.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_BUFFER,v);l.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,s);l.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_TIME,J);l.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_MUTE,ak);l.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_VOLUME,n);l.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_COMPLETE,M)}function B(){if(!D.hideplaylistcontrols){if(l.jwGetPlaylist().length>1||D.forcenextprev.toString()=="true"){_show(R.nextButton);_show(R.prevButton)}else{_hide(R.nextButton);_hide(R.prevButton)}x();ah()}}function t(am){ag=l.jwGetPlaylist()[am.index].duration;J({id:l.id,duration:ag,position:0});v({id:l.id,bufferProgress:0})}function ah(){J({id:l.id,duration:l.jwGetDuration(),position:0});v({id:l.id,bufferProgress:0});ak({id:l.id,mute:l.jwGetMute()});s({id:l.id,newstate:a.api.events.state.IDLE});n({id:l.id,volume:l.jwGetVolume()})}function T(ao,ap,an){if(q){return}if(_utils.exists(l.skin.getSkinElement("controlbar",ao))){var am=R[ao];if(_utils.exists(am)){_css(am,{cursor:"pointer"});if(ap=="fullscreen"){am.onmouseup=function(aq){aq.stopPropagation();l.jwSetFullscreen(!l.jwGetFullscreen())}}else{am.onmouseup=function(aq){aq.stopPropagation();if(_utils.exists(an)){l[ap](an)}else{l[ap]()}}}}}}function aa(am){if(q){return}var an=R[am+"Slider"];_css(R.elements,{cursor:"pointer"});_css(an,{cursor:"pointer"});an.onmousedown=function(ao){w=am};an.onmouseup=function(ao){ao.stopPropagation();aj(ao.pageX)};an.onmousemove=function(ao){if(w=="time"){h=true;var ap=ao.pageX-c[am+"Slider"].left-window.pageXOffset;_css(R[w+"SliderThumb"],{left:ap})}}}function aj(an){h=false;var am;if(w=="time"){am=an-c.timeSliderRail.left+window.pageXOffset;var ap=am/c.timeSliderRail.width*ag;if(ap<0){ap=0}else{if(ap>ag){ap=ag-3}}if(l.jwGetState()==a.api.events.state.PAUSED||l.jwGetState()==a.api.events.state.IDLE){l.jwPlay()}l.jwSeek(ap)}else{if(w=="volume"){am=an-c.volumeSliderRail.left-window.pageXOffset;var ao=Math.round(am/c.volumeSliderRail.width*100);if(ao<10){ao=0}else{if(ao>100){ao=100}}if(l.jwGetMute()){l.jwSetMute(false)}l.jwSetVolume(ao)}}w="none"}function v(an){if(_utils.exists(an.bufferPercent)){g=an.bufferPercent}if(c.timeSliderRail){var ap=l.skin.getSkinElement("controlbar","timeSliderCapLeft");var ao=c.timeSliderRail.width;var am=isNaN(Math.round(ao*g/100))?0:Math.round(ao*g/100);_css(R.timeSliderBuffer,{width:am,left:ap?ap.width:0})}}function ak(am){if(am.mute){_hide(R.muteButton);_show(R.unmuteButton);_hide(R.volumeSliderProgress)}else{_show(R.muteButton);_hide(R.unmuteButton);_show(R.volumeSliderProgress)}}function s(am){if(am.newstate==a.api.events.state.BUFFERING||am.newstate==a.api.events.state.PLAYING){_show(R.pauseButton);_hide(R.playButton)}else{_hide(R.pauseButton);_show(R.playButton)}Y();if(am.newstate==a.api.events.state.IDLE){_hide(R.timeSliderBuffer);_hide(R.timeSliderProgress);_hide(R.timeSliderThumb);J({id:l.id,duration:l.jwGetDuration(),position:0})}else{_show(R.timeSliderBuffer);if(am.newstate!=a.api.events.state.BUFFERING){_show(R.timeSliderProgress);_show(R.timeSliderThumb)}}}function M(am){v({bufferPercent:0});J(_utils.extend(am,{position:0,duration:ag}))}function J(aq){if(_utils.exists(aq.position)){k=aq.position}var am=false;if(_utils.exists(aq.duration)&&aq.duration!=ag){ag=aq.duration;am=true}var ao=(k===ag===0)?0:k/ag;var at=c.timeSliderRail;if(at){var an=isNaN(Math.round(at.width*ao))?0:Math.round(at.width*ao);var ar=l.skin.getSkinElement("controlbar","timeSliderCapLeft");var ap=an+(ar?ar.width:0);if(R.timeSliderProgress){_css(R.timeSliderProgress,{width:an,left:ar?ar.width:0});if(!h){if(R.timeSliderThumb){R.timeSliderThumb.style.left=ap+"px"}}}}if(R.durationText){R.durationText.innerHTML=_utils.timeFormat(ag)}if(R.elapsedText){R.elapsedText.innerHTML=_utils.timeFormat(k)}if(am){x()}}function o(){var am=R.elements.childNodes;var ar,ap;for(var ao=0;ao0?l.id.replace("_instream",""):l.id);H=document.getElementById(an);H.addEventListener("mousemove",Y)}catch(am){_utils.log("Could not add mouse listeners to controlbar: "+am)}}function u(){O();N();r();q=true;F();D.idlehide=(D.idlehide.toString().toLowerCase()=="true");if(D.position==a.html5.view.positions.OVER&&D.idlehide){af.style.opacity=0;U=true}else{af.style.opacity=1;setTimeout((function(){U=true;V()}),1)}S();ah()}u();return this}})(jwplayer);(function(b){var a=["width","height","state","playlist","item","position","buffer","duration","volume","mute","fullscreen"];var c=b.utils;b.html5.controller=function(o,K,f,h){var n=o,m=f,j=h,y=K,M=true,G=-1,A=false,d=false,P,C=[],q=false;var D=(c.exists(m.config.debug)&&(m.config.debug.toString().toLowerCase()=="console")),N=new b.html5.eventdispatcher(y.id,D);c.extend(this,N);function L(T){if(q){N.sendEvent(T.type,T)}else{C.push(T)}}function s(T){if(!q){q=true;N.sendEvent(b.api.events.JWPLAYER_READY,T);if(b.utils.exists(window.playerReady)){playerReady(T)}if(b.utils.exists(window[f.config.playerReady])){window[f.config.playerReady](T)}while(C.length>0){var V=C.shift();N.sendEvent(V.type,V)}if(f.config.autostart&&!b.utils.isIOS()){O()}while(x.length>0){var U=x.shift();B(U.method,U.arguments)}}}m.addGlobalListener(L);m.addEventListener(b.api.events.JWPLAYER_MEDIA_BUFFER_FULL,function(){m.getMedia().play()});m.addEventListener(b.api.events.JWPLAYER_MEDIA_TIME,function(T){if(T.position>=m.playlist[m.item].start&&G>=0){m.playlist[m.item].start=G;G=-1}});m.addEventListener(b.api.events.JWPLAYER_MEDIA_COMPLETE,function(T){setTimeout(E,25)});m.addEventListener(b.api.events.JWPLAYER_PLAYLIST_LOADED,O);m.addEventListener(b.api.events.JWPLAYER_FULLSCREEN,p);function F(){try{P=F;if(!A){A=true;N.sendEvent(b.api.events.JWPLAYER_MEDIA_BEFOREPLAY);A=false;if(d){d=false;P=null;return}}v(m.item);if(m.playlist[m.item].levels[0].file.length>0){if(M||m.state==b.api.events.state.IDLE){m.getMedia().load(m.playlist[m.item]);M=false}else{if(m.state==b.api.events.state.PAUSED){m.getMedia().play()}}}return true}catch(T){N.sendEvent(b.api.events.JWPLAYER_ERROR,T);P=null}return false}function e(){try{if(m.playlist[m.item].levels[0].file.length>0){switch(m.state){case b.api.events.state.PLAYING:case b.api.events.state.BUFFERING:if(m.getMedia()){m.getMedia().pause()}break;default:if(A){d=true}}}return true}catch(T){N.sendEvent(b.api.events.JWPLAYER_ERROR,T)}return false}function z(T){try{if(m.playlist[m.item].levels[0].file.length>0){if(typeof T!="number"){T=parseFloat(T)}switch(m.state){case b.api.events.state.IDLE:if(G<0){G=m.playlist[m.item].start;m.playlist[m.item].start=T}if(!A){F()}break;case b.api.events.state.PLAYING:case b.api.events.state.PAUSED:case b.api.events.state.BUFFERING:m.seek(T);break}}return true}catch(U){N.sendEvent(b.api.events.JWPLAYER_ERROR,U)}return false}function w(T){P=null;if(!c.exists(T)){T=true}try{if((m.state!=b.api.events.state.IDLE||T)&&m.getMedia()){m.getMedia().stop(T)}if(A){d=true}return true}catch(U){N.sendEvent(b.api.events.JWPLAYER_ERROR,U)}return false}function k(){try{if(m.playlist[m.item].levels[0].file.length>0){if(m.config.shuffle){v(S())}else{if(m.item+1==m.playlist.length){v(0)}else{v(m.item+1)}}}if(m.state!=b.api.events.state.IDLE){var U=m.state;m.state=b.api.events.state.IDLE;N.sendEvent(b.api.events.JWPLAYER_PLAYER_STATE,{oldstate:U,newstate:b.api.events.state.IDLE})}F();return true}catch(T){N.sendEvent(b.api.events.JWPLAYER_ERROR,T)}return false}function I(){try{if(m.playlist[m.item].levels[0].file.length>0){if(m.config.shuffle){v(S())}else{if(m.item===0){v(m.playlist.length-1)}else{v(m.item-1)}}}if(m.state!=b.api.events.state.IDLE){var U=m.state;m.state=b.api.events.state.IDLE;N.sendEvent(b.api.events.JWPLAYER_PLAYER_STATE,{oldstate:U,newstate:b.api.events.state.IDLE})}F();return true}catch(T){N.sendEvent(b.api.events.JWPLAYER_ERROR,T)}return false}function S(){var T=null;if(m.playlist.length>1){while(!c.exists(T)){T=Math.floor(Math.random()*m.playlist.length);if(T==m.item){T=null}}}else{T=0}return T}function H(U){if(!m.playlist||!m.playlist[U]){return false}try{if(m.playlist[U].levels[0].file.length>0){var V=m.state;if(V!==b.api.events.state.IDLE){if(m.playlist[m.item]&&m.playlist[m.item].provider==m.playlist[U].provider){w(false)}else{w()}}v(U);F()}return true}catch(T){N.sendEvent(b.api.events.JWPLAYER_ERROR,T)}return false}function v(T){if(!m.playlist[T]){return}m.setActiveMediaProvider(m.playlist[T]);if(m.item!=T){m.item=T;M=true;N.sendEvent(b.api.events.JWPLAYER_PLAYLIST_ITEM,{index:T})}}function g(U){try{v(m.item);var V=m.getMedia();switch(typeof(U)){case"number":V.volume(U);break;case"string":V.volume(parseInt(U,10));break}m.setVolume(U);return true}catch(T){N.sendEvent(b.api.events.JWPLAYER_ERROR,T)}return false}function r(U){try{v(m.item);var V=m.getMedia();if(typeof U=="undefined"){V.mute(!m.mute);m.setMute(!m.mute)}else{if(U.toString().toLowerCase()=="true"){V.mute(true);m.setMute(true)}else{V.mute(false);m.setMute(false)}}return true}catch(T){N.sendEvent(b.api.events.JWPLAYER_ERROR,T)}return false}function J(U,T){try{m.width=U;m.height=T;j.resize(U,T);N.sendEvent(b.api.events.JWPLAYER_RESIZE,{width:m.width,height:m.height});return true}catch(V){N.sendEvent(b.api.events.JWPLAYER_ERROR,V)}return false}function u(U,V){try{if(typeof U=="undefined"){U=!m.fullscreen}if(typeof V=="undefined"){V=true}if(U!=m.fullscreen){m.fullscreen=(U.toString().toLowerCase()=="true");j.fullscreen(m.fullscreen);if(V){N.sendEvent(b.api.events.JWPLAYER_FULLSCREEN,{fullscreen:m.fullscreen})}N.sendEvent(b.api.events.JWPLAYER_RESIZE,{width:m.width,height:m.height})}return true}catch(T){N.sendEvent(b.api.events.JWPLAYER_ERROR,T)}return false}function R(T){try{w();if(A){d=false}m.loadPlaylist(T);if(m.playlist[m.item].provider){v(m.item);if(m.config.autostart.toString().toLowerCase()=="true"&&!c.isIOS()&&!A){F()}return true}else{return false}}catch(U){N.sendEvent(b.api.events.JWPLAYER_ERROR,U)}return false}function O(T){if(!c.isIOS()){v(m.item);if(m.config.autostart.toString().toLowerCase()=="true"&&!c.isIOS()){F()}}}function p(T){u(T.fullscreen,false)}function t(){try{return m.getMedia().detachMedia()}catch(T){return null}}function l(){try{var T=m.getMedia().attachMedia();if(typeof P=="function"){P()}}catch(U){return null}}b.html5.controller.repeatoptions={LIST:"LIST",ALWAYS:"ALWAYS",SINGLE:"SINGLE",NONE:"NONE"};function E(){if(m.state!=b.api.events.state.IDLE){return}P=E;switch(m.config.repeat.toUpperCase()){case b.html5.controller.repeatoptions.SINGLE:F();break;case b.html5.controller.repeatoptions.ALWAYS:if(m.item==m.playlist.length-1&&!m.config.shuffle){H(0)}else{k()}break;case b.html5.controller.repeatoptions.LIST:if(m.item==m.playlist.length-1&&!m.config.shuffle){w();v(0)}else{k()}break;default:w();break}}var x=[];function Q(T){return function(){if(q){B(T,arguments)}else{x.push({method:T,arguments:arguments})}}}function B(V,U){var T=[];for(i=0;i
";else if(g.plugin.debug)throw Error("Did not receive data from server."); -},false)};return{_setup:function(f){var h=f.containerid=g.guid(),p=d[h]=document.createElement("div"),o=a[h]=document.getElementById(f.target);if(!o&&g.plugin.debug)throw Error("Target container could not be found.");p.style.display="none";p.innerHTML="";o.appendChild(p);b[h]={htmlString:f.playlist||"Unknown Source"||f.album||"Unknown Source"};c(f)},start:function(f,h){var p=h.containerid,o=d[p];o.innerHTML=b[p].htmlString;o.style.display="inline"},end:function(f,h){container=d[h.containerid];container.style.display= -"none";container.innerHTML=""},_teardown:function(f){f=f.containerid;var h=a[f];b[f]&&delete b[f];h&&h.removeChild(d[f]);delete a[f];delete d[f]}}}(),{manifest:{about:{name:"Popcorn Rdio Plugin",version:"0.1",author:"Denise Rigato"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"rdio",artist:{elem:"input",type:"text",label:"Artist"},album:{elem:"input",type:"text",label:"Album"},person:{elem:"input",type:"text",label:"Person"},id:{elem:"input", -type:"text",label:"Id"},playlist:{elem:"input",type:"text",label:"Playlist"}}}})})(Popcorn);(function(g){var b=0,d=function(a,c){var f=a.container=document.createElement("div"),h=f.style,p=a.media,o=function(){var l=a.position();h.fontSize="18px";h.width=p.offsetWidth+"px";h.top=l.top+p.offsetHeight-f.offsetHeight-40+"px";h.left=l.left+"px";setTimeout(o,10)};f.id=c||g.guid();h.position="absolute";h.color="white";h.textShadow="black 2px 2px 6px";h.fontWeight="bold";h.textAlign="center";o();a.media.parentNode.appendChild(f);return f};g.plugin("subtitle",{manifest:{about:{name:"Popcorn Subtitle Plugin", -version:"0.1",author:"Scott Downe",website:"http://scottdowne.wordpress.com/"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"subtitle-container",text:{elem:"input",type:"text",label:"Text"}}},_setup:function(a){var c=document.createElement("div");c.id="subtitle-"+b++;c.style.display="none";!this.container&&(!a.target||a.target==="subtitle-container")&&d(this);a.container=a.target&&a.target!=="subtitle-container"?document.getElementById(a.target)|| -d(this,a.target):this.container;document.getElementById(a.container.id)&&document.getElementById(a.container.id).appendChild(c);a.innerContainer=c;a.showSubtitle=function(){a.innerContainer.innerHTML=a.text||""}},start:function(a,c){c.innerContainer.style.display="inline";c.showSubtitle(c,c.text)},end:function(a,c){c.innerContainer.style.display="none";c.innerContainer.innerHTML=""},_teardown:function(a){a.container.removeChild(a.innerContainer)}})})(Popcorn);(function(g){var b=[],d=function(){this.name="";this.contains={};this.toString=function(){var a=[],c;for(c in this.contains)this.contains.hasOwnProperty(c)&&a.push(" "+this.contains[c]);return a.toString()}};g.plugin("tagthisperson",function(){return{_setup:function(a){var c=false;if(!document.getElementById(a.target)&&g.plugin.debug)throw Error("target container doesn't exist");for(var f=0;f ":"";c._p.contains[c.person]+=c.href?" "+c.person+"":c.person;document.getElementById(c.target).innerHTML=c._p.toString()},end:function(a,c){delete c._p.contains[c.person];document.getElementById(c.target).innerHTML=c._p.toString()}}}(),{about:{name:"Popcorn tagthisperson Plugin",version:"0.1",author:"@annasob",website:"annasob.wordpress.com"},options:{start:{elem:"input",type:"text", -label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"tagthisperson-container",person:{elem:"input",type:"text",label:"Name"},image:{elem:"input",type:"url",label:"Image Src",optional:true},href:{elem:"input",type:"url",label:"URL",optional:true}}})})(Popcorn);(function(g){var b=false;g.plugin("twitter",{manifest:{about:{name:"Popcorn Twitter Plugin",version:"0.1",author:"Scott Downe",website:"http://scottdowne.wordpress.com/"},options:{start:{elem:"input",type:"number",label:"In"},end:{elem:"input",type:"number",label:"Out"},src:{elem:"input",type:"text",label:"Source"},target:"twitter-container",height:{elem:"input",type:"number",label:"Height",optional:true},width:{elem:"input",type:"number",label:"Width",optional:true}}},_setup:function(d){if(!window.TWTR&& -!b){b=true;g.getScript("//widgets.twimg.com/j/2/widget.js")}var a=document.getElementById(d.target);d.container=document.createElement("div");d.container.setAttribute("id",g.guid());d.container.style.display="none";if(!a&&g.plugin.debug)throw Error("target container doesn't exist");a&&a.appendChild(d.container);var c=d.src||"";a=d.width||250;var f=d.height||200,h=/^@/.test(c),p={version:2,id:d.container.getAttribute("id"),rpp:30,width:a,height:f,interval:6E3,theme:{shell:{background:"#ffffff",color:"#000000"}, -tweets:{background:"#ffffff",color:"#444444",links:"#1985b5"}},features:{loop:true,timestamp:true,avatars:true,hashtags:true,toptweets:true,live:true,scrollbar:false,behavior:"default"}},o=function(l){if(window.TWTR)if(h){p.type="profile";(new TWTR.Widget(p)).render().setUser(c).start()}else{p.type="search";p.search=c;p.subject=c;(new TWTR.Widget(p)).render().start()}else setTimeout(function(){o(l)},1)};o(this)},start:function(d,a){a.container.style.display="inline"},end:function(d,a){a.container.style.display= -"none"},_teardown:function(d){document.getElementById(d.target)&&document.getElementById(d.target).removeChild(d.container)}})})(Popcorn);(function(g){g.plugin("webpage",{manifest:{about:{name:"Popcorn Webpage Plugin",version:"0.1",author:"@annasob",website:"annasob.wordpress.com"},options:{id:{elem:"input",type:"text",label:"Id",optional:true},start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},src:{elem:"input",type:"url",label:"Src"},target:"iframe-container"}},_setup:function(b){var d=document.getElementById(b.target);b.src=b.src.replace(/^(https?:)?(\/\/)?/,"//");b._iframe=document.createElement("iframe"); -b._iframe.setAttribute("width","100%");b._iframe.setAttribute("height","100%");b._iframe.id=b.id;b._iframe.src=b.src;b._iframe.style.display="none";if(!d&&g.plugin.debug)throw Error("target container doesn't exist");d&&d.appendChild(b._iframe)},start:function(b,d){d._iframe.src=d.src;d._iframe.style.display="inline"},end:function(b,d){d._iframe.style.display="none"},_teardown:function(b){document.getElementById(b.target)&&document.getElementById(b.target).removeChild(b._iframe)}})})(Popcorn);var wikiCallback; -(function(g){g.plugin("wikipedia",{manifest:{about:{name:"Popcorn Wikipedia Plugin",version:"0.1",author:"@annasob",website:"annasob.wordpress.com"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},lang:{elem:"input",type:"text",label:"Language",optional:true},src:{elem:"input",type:"url",label:"Src"},title:{elem:"input",type:"text",label:"Title",optional:true},numberofwords:{elem:"input",type:"text",label:"Num Of Words",optional:true},target:"wikipedia-container"}}, -_setup:function(b){var d,a=g.guid();if(!b.lang)b.lang="en";b.numberofwords=b.numberofwords||200;window["wikiCallback"+a]=function(c){b._link=document.createElement("a");b._link.setAttribute("href",b.src);b._link.setAttribute("target","_blank");b._link.innerHTML=b.title||c.parse.displaytitle;b._desc=document.createElement("p");d=c.parse.text["*"].substr(c.parse.text["*"].indexOf("

"));d=d.replace(/((<(.|\n)+?>)|(\((.*?)\) )|(\[(.*?)\]))/g,"");d=d.split(" ");b._desc.innerHTML=d.slice(0,d.length>= -b.numberofwords?b.numberofwords:d.length).join(" ")+" ...";b._fired=true};if(b.src)g.getScript("//"+b.lang+".wikipedia.org/w/api.php?action=parse&props=text&page="+b.src.slice(b.src.lastIndexOf("/")+1)+"&format=json&callback=wikiCallback"+a);else if(g.plugin.debug)throw Error("Wikipedia plugin needs a 'src'");},start:function(b,d){var a=function(){if(d._fired){if(d._link&&d._desc)if(document.getElementById(d.target)){document.getElementById(d.target).appendChild(d._link);document.getElementById(d.target).appendChild(d._desc); -d._added=true}}else setTimeout(function(){a()},13)};a()},end:function(b,d){if(d._added){document.getElementById(d.target).removeChild(d._link);document.getElementById(d.target).removeChild(d._desc)}},_teardown:function(b){if(b._added){b._link.parentNode&&document.getElementById(b.target).removeChild(b._link);b._desc.parentNode&&document.getElementById(b.target).removeChild(b._desc);delete b.target}}})})(Popcorn);(function(g){var b={text:function(d){var a=d.post,c=document.createElement("a"),f=document.createTextNode(a.title),h=document.createElement("div");c.setAttribute("href",a.post_url);c.appendChild(f);h.appendChild(c);h.innerHTML+=a.body;d._container.appendChild(h)},photo:function(d){for(var a=d.width||250,c=-1,f=[d.post.photos.length],h=[d.post.photos.length],p=document.createElement("div"),o=document.createElement("img"),l=d.post,i=0,r=l.photos.length;i";o.setAttribute("src",h[a]);o.setAttribute("alt","Pic"+a);p.appendChild(o);p.innerHTML+="
"}p.innerHTML+="
"+l.caption;d._container.appendChild(p)},audio:function(d){var a= -document.createElement("div"),c=document.createElement("a"),f=d.post;if(f.artist){var h=document.createElement("img");a.innerHTML+="Artist: "+f.artist+"
";c.setAttribute("href",f.source_url);h.setAttribute("src",f.album_art);h.setAttribute("alt",f.album);c.appendChild(h);a.appendChild(c);a.innerHTML+="


"+f.track_number+" - "+f.track_name+"
"}else{h=document.createTextNode(f.source_title);c.setAttribute("href",f.source_url);c.appendChild(h);a.appendChild(c);a.innerHTML+="
"}a.innerHTML+= -f.player+" "+f.plays+"plays
"+f.caption;d._container.appendChild(a)},video:function(d){for(var a=d.width||400,c=-1,f=d.post,h=document.createElement("div"),p,o=0,l=f.player.length;o"+f.caption;d._container.appendChild(h)}, -chat:function(d){var a=d.post,c,f=document.createElement("div");f.innerHTML+=""+a.title+"

";for(var h=0,p=a.dialogue.length;h"}d._container.appendChild(f)},quote:function(d){var a=document.createElement("div"),c=document.createElement("a"),f=d.post,h=document.createTextNode(f.text);c.setAttribute("href",f.post_url);c.appendChild(h);a.appendChild(c);a.innerHTML+="

Source: "+f.source+""; -d._container.appendChild(a)},link:function(d){var a=document.createElement("div"),c=document.createElement("a"),f=d.post,h=document.createTextNode(f.title);c.setAttribute("href",f.post_url);c.appendChild(h);a.appendChild(c);a.innerHTML+="
"+f.description;d._container.appendChild(a)},answer:function(d){var a=document.createElement("div"),c=document.createElement("a"),f=d.post,h=document.createTextNode(f.asking_name);a.innerHTML="Inquirer: ";c.setAttribute("href",f.asking_url);c.appendChild(h); -a.appendChild(c);a.innerHTML+="

Question: "+f.question+"
Answer: "+f.answer;d._container.appendChild(a)}};g.plugin("tumblr",{manifest:{about:{name:"Popcorn Tumblr Plugin",version:"0.1",author:"Matthew Schranz, @mjschranz",website:"mschranz.wordpress.com"},options:{requestType:{elem:"select",options:["INFO","AVATAR","BLOGPOST"],label:"Type_Of_Plugin"},target:"tumblr-container",start:{elem:"input",type:"number",label:"Start_Time"},end:{elem:"input",type:"number",label:"End_Time"},base_hostname:{elem:"input", -type:"text",label:"User_Name"},api_key:{elem:"input",type:"text",label:"Application_Key",optional:true},size:{elem:"select",options:[16,24,30,40,48,64,96,128,512],label:"avatarSize",optional:true},blogId:{elem:"input",type:"number",label:"Blog_ID",optional:true},width:{elem:"input",type:"number",label:"Photo_Width",optional:true}}},_setup:function(d){var a=document.getElementById(d.target),c,f,h=this;d.requestType=d.requestType.toLowerCase();(!d.base_hostname||!d.api_key&&(d.requestType==="info"|| -d.requestType==="blogpost"))&&g.error("Must provide a blog URL to the plugin and an api_key for Blog Info and Blog Post requests.");!(["info","avatar","blogpost"].indexOf(d.requestType)>-1)&&g.error("Invalid tumblr plugin type.");d.requestType==="blogpost"&&d.blogId===undefined&&g.error("Error. BlogId required for blogpost requests");!a&&g.plugin.debug&&g.error("Target Tumblr container doesn't exist.");c=d.base_hostname.slice(d.base_hostname.indexOf("/")+2,d.base_hostname.length);f=d.base_hostname.slice(0, -d.base_hostname.indexOf("/")+2);c=f==="http://"||f==="https://"?c:d.base_hostname;if(c.indexOf("/")>-1)c=c.slice(0,c.indexOf("/"));d.base_hostname=c;d._container=document.createElement("div");d._container.id="tumblrdiv-"+g.guid();if(d.requestType==="avatar")d._container.innerHTML="BlogAvatar";else{c=d.requestType==="blogpost"?"posts":"info";c="http://api.tumblr.com/v2/blog/"+d.base_hostname+"/"+c+"?api_key="+d.api_key+ -"&id="+d.blogId+"&jsonp=tumblrCallBack";this.listen("tumblrError",function(p){g.error(p)});g.getJSONP(c,function(p){if(p.meta.msg==="OK"){var o=document.createElement("div");if(d.requestType==="blogpost"){d.post=p.response.posts[0];var l=d.post.type;p=d.post.tags;o.innerHTML="Date Published: "+d.post.date.slice(0,d.post.date.indexOf(" "))+"
";if(p.length!==0){o.innerHTML+="Tags: "+p[0];for(var i=1,r=p.length;iapikey";if(!a&&g.plugin.debug)throw"target container doesn't exist";a&&a.appendChild(b._container)}if(!a&& -g.plugin.debug)throw Error("target container doesn't exist");a&&a.appendChild(b._container);b._container.style.display="none"},start:function(b,d){d._container.style.display="block"},end:function(b,d){d._container.style.display="none"},_teardown:function(b){var d=document.getElementById(b.target);d&&d.removeChild(b._container)}})})(Popcorn);(function(g){g.plugin("mustache",function(b){var d,a,c,f;g.getScript("http://mustache.github.com/extras/mustache.js");var h=!!b.dynamic,p=typeof b.template,o=typeof b.data,l=document.getElementById(b.target);if(!l&&g.plugin.debug)throw Error("target container doesn't exist");b.container=l||document.createElement("div");if(p==="function")if(h)c=b.template;else f=b.template(b);else if(p==="string")f=b.template;else if(g.plugin.debug)throw Error("Mustache Plugin Error: options.template must be a String or a Function."); -else f="";if(o==="function")if(h)d=b.data;else a=b.data(b);else if(o==="string")a=JSON.parse(b.data);else if(o==="object")a=b.data;else if(g.plugin.debug)throw Error("Mustache Plugin Error: options.data must be a String, Object, or Function.");else a="";return{start:function(i,r){var k=function(){if(window.Mustache){if(d)a=d(r);if(c)f=c(r);var j=Mustache.to_html(f,a).replace(/^\s*/mg,"");r.container.innerHTML=j}else setTimeout(function(){k()},10)};k()},end:function(i,r){r.container.innerHTML=""}, -_teardown:function(){d=a=c=f=null}}},{about:{name:"Popcorn Mustache Plugin",version:"0.1",author:"David Humphrey (@humphd)",website:"http://vocamus.net/dave"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"mustache-container",template:{elem:"input",type:"text",label:"Template"},data:{elem:"input",type:"text",label:"Data"},dynamic:{elem:"input",type:"text",label:"Dynamic",optional:true}}})})(Popcorn);(function(g){function b(a,c){if(a.map)a.map.div.style.display=c;else setTimeout(function(){b(a,c)},10)}var d=1;g.plugin("openmap",function(a){var c,f,h,p,o,l,i,r,k=document.getElementById(a.target);c=document.createElement("div");c.id="openmapdiv"+d;c.style.width="100%";c.style.height="100%";d++;if(!k&&g.plugin.debug)throw Error("target container doesn't exist");k&&k.appendChild(c);r=function(){if(window.OpenLayers){if(a.location){location=new OpenLayers.LonLat(0,0);g.getJSONP("//tinygeocoder.com/create-api.php?q="+ -a.location+"&callback=jsonp",function(v){f=new OpenLayers.LonLat(v[1],v[0]);a.map.setCenter(f)})}else f=new OpenLayers.LonLat(a.lng,a.lat);a.type=a.type||"ROADMAP";if(a.type==="SATELLITE"){a.map=new OpenLayers.Map({div:c,maxResolution:0.28125,tileSize:new OpenLayers.Size(512,512)});var j=new OpenLayers.Layer.WorldWind("LANDSAT","//worldwind25.arc.nasa.gov/tile/tile.aspx",2.25,4,{T:"105"});a.map.addLayer(j);p=new OpenLayers.Projection("EPSG:4326");h=new OpenLayers.Projection("EPSG:4326")}else if(a.type=== -"TERRAIN"){p=new OpenLayers.Projection("EPSG:4326");h=new OpenLayers.Projection("EPSG:4326");a.map=new OpenLayers.Map({div:c,projection:h});j=new OpenLayers.Layer.WMS("USGS Terraserver","//terraserver-usa.org/ogcmap.ashx?",{layers:"DRG"});a.map.addLayer(j)}else{h=new OpenLayers.Projection("EPSG:900913");p=new OpenLayers.Projection("EPSG:4326");f=f.transform(p,h);a.map=new OpenLayers.Map({div:c,projection:h,displayProjection:p});j=new OpenLayers.Layer.OSM;a.map.addLayer(j)}if(a.map)a.map.div.style.display= -"none"}else setTimeout(function(){r()},50)};r();return{_setup:function(j){window.OpenLayers||g.getScript("//openlayers.org/api/OpenLayers.js");var v=function(){if(j.map){j.zoom=j.zoom||2;if(j.zoom&&typeof j.zoom!=="number")j.zoom=+j.zoom;j.map.setCenter(f,j.zoom);if(j.markers){var w=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]),n=function(u){clickedFeature=u.feature;if(clickedFeature.attributes.text){i=new OpenLayers.Popup.FramedCloud("featurePopup",clickedFeature.geometry.getBounds().getCenterLonLat(), -new OpenLayers.Size(120,250),clickedFeature.attributes.text,null,true,function(){l.unselect(this.feature)});clickedFeature.popup=i;i.feature=clickedFeature;j.map.addPopup(i)}},y=function(u){feature=u.feature;if(feature.popup){i.feature=null;j.map.removePopup(feature.popup);feature.popup.destroy();feature.popup=null}},C=function(u){g.getJSONP("//tinygeocoder.com/create-api.php?q="+u.location+"&callback=jsonp",function(x){x=(new OpenLayers.Geometry.Point(x[1],x[0])).transform(p,h);var A=OpenLayers.Util.extend({}, -w);if(!u.size||isNaN(u.size))u.size=14;A.pointRadius=u.size;A.graphicOpacity=1;A.externalGraphic=u.icon;x=new OpenLayers.Feature.Vector(x,null,A);if(u.text)x.attributes={text:u.text};o.addFeatures([x])})};o=new OpenLayers.Layer.Vector("Point Layer",{style:w});j.map.addLayer(o);for(var e=0,m=j.markers.length;e
"+d.text+"
"+d.innerHTML;return{start:function(p,o){c.style.display="block";if(o.direction==="down")f.scrollTop=f.scrollHeight},end:function(){c.style.display="none"},_teardown:function(){f&&c&&f.removeChild(c)&&!f.firstChild&&a.removeChild(f)}}},{about:{name:"Popcorn Timeline Plugin",version:"0.1",author:"David Seifried @dcseifried",website:"dseifried.wordpress.com"}, -options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"feed-container",title:{elem:"input",type:"text",label:"title"},text:{elem:"input",type:"text",label:"text"},innerHTML:{elem:"input",type:"text",label:"innerHTML",optional:true},direction:{elem:"input",type:"text",label:"direction",optional:true}}})})(Popcorn);(function(g,b){var d={};g.plugin("documentcloud",{manifest:{about:{name:"Popcorn Document Cloud Plugin",version:"0.1",author:"@humphd, @ChrisDeCairos",website:"http://vocamus.net/dave"},options:{start:{elem:"input",type:"text",label:"In"},end:{elem:"input",type:"text",label:"Out"},target:"documentcloud-container",width:{elem:"input",type:"text",label:"Width",optional:true},height:{elem:"input",type:"text",label:"Height",optional:true},src:{elem:"input",type:"text",label:"PDF URL"},preload:{elem:"input", -type:"boolean",label:"Preload",optional:true},page:{elem:"input",type:"number",label:"Page Number",optional:true},aid:{elem:"input",type:"number",label:"Annotation Id",optional:true}}},_setup:function(a){function c(){function i(u){a._key=u.api.getId();a._changeView=function(x){a.aid?x.pageSet.showAnnotation(x.api.getAnnotation(a.aid)):x.api.setCurrentPage(a.page)}}function r(){d[a._key]={num:1,id:a._containerId};h.loaded=true}h.loaded=false;var k=a.url.replace(/\.html$/,".js"),j=a.target,v=b.getElementById(j), -w=b.createElement("div"),n=g.position(v),y=a.width||n.width;n=a.height||n.height;var C=a.sidebar||true,e=a.text||true,m=a.pdf||true,q=a.showAnnotations||true,s=a.zoom||700,t=a.search||true;if(!function(u){var x=false;g.forEach(h.viewers,function(A){if(A.api.getSchema().canonicalURL===u){i(A);A=d[a._key];a._containerId=A.id;A.num+=1;x=true;h.loaded=true}});return x}(a.url)){w.id=a._containerId=g.guid(j);j="#"+w.id;v.appendChild(w);p.trigger("documentready");h.load(k,{width:y,height:n,sidebar:C,text:e, -pdf:m,showAnnotations:q,zoom:s,search:t,container:j,afterLoad:a.page||a.aid?function(u){i(u);a._changeView(u);w.style.visibility="hidden";u.elements.pages.hide();r()}:function(u){i(u);r();w.style.visibility="hidden";u.elements.pages.hide()}})}}function f(){window.DV.loaded?c():setTimeout(f,25)}var h=window.DV=window.DV||{},p=this;if(h.loading)f();else{h.loading=true;h.recordHit="//www.documentcloud.org/pixel.gif";var o=b.createElement("link"),l=b.getElementsByTagName("head")[0];o.rel="stylesheet"; -o.type="text/css";o.media="screen";o.href="//s3.documentcloud.org/viewer/viewer-datauri.css";l.appendChild(o);h.loaded=false;g.getScript("http://s3.documentcloud.org/viewer/viewer.js",function(){h.loading=false;c()})}},start:function(a,c){var f=b.getElementById(c._containerId),h=DV.viewers[c._key];(c.page||c.aid)&&h&&c._changeView(h);if(f&&h){f.style.visibility="visible";h.elements.pages.show()}},end:function(a,c){var f=b.getElementById(c._containerId);if(f&&DV.viewers[c._key]){f.style.visibility= -"hidden";DV.viewers[c._key].elements.pages.hide()}},_teardown:function(a){var c=b.getElementById(a._containerId);if((a=a._key)&&DV.viewers[a]&&--d[a].num===0){for(DV.viewers[a].api.unload();c.hasChildNodes();)c.removeChild(c.lastChild);c.parentNode.removeChild(c)}}})})(Popcorn,window.document);(function(g){g.parser("parseJSON","JSON",function(b){var d={title:"",remote:"",data:[]};g.forEach(b.data,function(a){d.data.push(a)});return d})})(Popcorn);(function(g){g.parser("parseSBV",function(b){var d={title:"",remote:"",data:[]},a=[],c=0,f=0,h=function(k){k=k.split(":");var j=k.length-1,v;try{v=parseInt(k[j-1],10)*60+parseFloat(k[j],10);if(j===2)v+=parseInt(k[0],10)*3600}catch(w){throw"Bad cue";}return v},p=function(k,j){var v={};v[k]=j;return v};b=b.text.split(/(?:\r\n|\r|\n)/gm);for(f=b.length;c");a.push(p("subtitle",o))}catch(r){for(;c< -f&&b[c];)c++}for(;c[\t ]*/);l.start=i(p[0]); -h=p[1].indexOf(" ");if(h!==-1)p[1]=p[1].substr(0,h);for(l.end=i(p[1]);c/g,">");l.text=l.text.replace(/<(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)(\/?)>/gi,"<$1$3$7>");l.text=l.text.replace(/\\N/gi,"
");a.push(r("subtitle",l))}d.data=a;return d})})(Popcorn);(function(g){function b(c,f){var h=c.substr(10).split(","),p;p={start:d(h[f.start]),end:d(h[f.end])};if(p.start===-1||p.end===-1)throw"Invalid time";var o=k.call(i,/\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}/gi,""),l=o.replace,i;i=h.length;k=[];for(var r=f.text;r");return p}function d(c){var f=c.split(":");if(c.length!==10||f.length<3)return-1;return parseInt(f[0],10)*3600+parseInt(f[1],10)*60+parseFloat(f[2],10)}function a(c, -f){var h={};h[c]=f;return h}g.parser("parseSSA",function(c){var f={title:"",remote:"",data:[]},h=[],p=0,o;c=c.text.split(/(?:\r\n|\r|\n)/gm);for(o=c.length;p=2)return parseInt(r[0],10)*3600+parseInt(r[k-1],10)*60+parseFloat(r[k],10);for(r=l.length-1;r>=0;r--)if(l[r]<="9"&&l[r]>="0")break;r++;k=l.substr(r);i=i||0;if(k==="h")k=3600;else if(k==="m")k=60;else if(k==="s")k=1;else if(k==="ms")k=0.0010;else return-1;return parseFloat(l.substr(0,r))*k+i},p=function(l,i){var r={};r[l]=i;return r},o=function(l, -i){for(var r=l.firstChild,k;r;){if(r.nodeType===1)if(r.nodeName==="p"){k=r;var j=i,v={};v.text=k.textContent.replace(/^[\s]+|[\s]+$/gm,"").replace(/(?:\r\n|\r|\n)/gm,"
");v.id=k.getAttribute("xml:id")||k.getAttribute("id");v.start=h(k.getAttribute("begin"),j);v.end=h(k.getAttribute("end"),j);v.target=f;if(v.end<0){v.end=h(k.getAttribute("duration"),0);if(v.end>=0)v.end+=v.start;else v.end=Number.MAX_VALUE}k=v;d.data.push(p("subtitle",k));c++}else if(r.nodeName==="div"){k=h(r.getAttribute("begin")); -if(k<0)k=i;o(r,k)}r=r.nextSibling}};if(!b.xml||!b.xml.documentElement||!(a=b.xml.documentElement.firstChild))return d;for(;a.nodeName!=="body";)a=a.nextSibling;f="";o(a,0);return d})})(Popcorn);(function(g){g.parser("parseTTXT",function(b){var d={title:"",remote:"",data:[]},a=function(o){o=o.split(":");var l=0;try{return parseFloat(o[0],10)*60*60+parseFloat(o[1],10)*60+parseFloat(o[2],10)}catch(i){l=0}return l},c=function(o,l){var i={};i[o]=l;return i};b=b.xml.lastChild.lastChild;for(var f=Number.MAX_VALUE,h=[];b;){if(b.nodeType===1&&b.nodeName==="TextSample"){var p={};p.start=a(b.getAttribute("sampleTime"));p.text=b.getAttribute("text");if(p.text){p.end=f-0.0010;h.push(c("subtitle",p))}f= -p.start}b=b.previousSibling}d.data=h.reverse();return d})})(Popcorn);(function(g){function b(a){var c=a.split(":");a=a.length;var f;if(a!==12&&a!==9)throw"Bad cue";a=c.length-1;try{f=parseInt(c[a-1],10)*60+parseFloat(c[a],10);if(a===2)f+=parseInt(c[0],10)*3600}catch(h){throw"Bad cue";}return f}function d(a,c){var f={};f[a]=c;return f}g.parser("parseVTT",function(a){var c={title:"",remote:"",data:[]},f=[],h=0,p=0,o,l;a=a.text.split(/(?:\r\n|\r|\n)/gm);p=a.length;if(p===0||a[0]!=="WEBVTT")return c;for(h++;h")===-1)throw"Bad cue";i=r.replace(/--\>/," --\> ").split(/[\t ]+/);if(i.length<2)throw"Bad cue";k.id=r;k.start=b(i[0]);k.end=b(i[2]);for(l=k;h");f.push(d("subtitle",l))}catch(j){for(h=h;h'+l.user.name+" at "+function(i){var r=h(i/60);i=p(i%60);return r+"."+(i<10?"0":"")+i}(l.start)+" "+function(i){function r(k,j){return k+" "+j+(k>1?"s":"")+" ago"}i=((new Date).getTime()-i.getTime())/1E3;if(i< -60)return r(p(i),"second");i/=60;if(i<60)return r(p(i),"minute");i/=60;if(i<24)return r(p(i),"hour");i/=24;if(i<30)return r(p(i),"day");if(i<365)return r(p(i/30),"month");return r(p(i/365),"year")}(l.date)+"
"+l.text+""}function c(l){if(b.swfobject&&b.soundcloud){var i={enable_api:true,object_id:l._playerId,url:l.src,show_comments:!l._options.api.key&&!l._options.api.commentdiv},r={id:l._playerId,name:l._playerId},k=document.createElement("div");k.setAttribute("id",l._playerId);l._container.appendChild(k); -swfobject.embedSWF("http://player.soundcloud.com/player.swf",l._playerId,l.offsetWidth,l.height,"9.0.0","expressInstall.swf",i,{allowscriptaccess:"always",wmode:"transparent"},r)}else setTimeout(function(){c(l)},15)}var f=Math.abs,h=Math.floor,p=Math.round,o={};g.soundcloud=function(l,i,r){g.getScript("http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js");g.getScript("http://popcornjs.org/code/players/soundcloud/lib/soundcloud.player.api.js",function(){var k=1;soundcloud.addEventListener("onPlayerReady", -function(j,v){var w=o[j.api_getFlashId()];w.swfObj=j;w.duration=j.api_getTrackDuration();w.currentTime=j.api_getTrackPosition();w.volume=w.previousVolume=j.api_getVolume()/100;w._mediaId=v.mediaId;w.dispatchEvent("load");w.dispatchEvent("canplay");w.dispatchEvent("durationchange");w.timeupdate()});soundcloud.addEventListener("onMediaStart",function(j){j=o[j.api_getFlashId()];j.played=1;j.dispatchEvent("playing")});soundcloud.addEventListener("onMediaPlay",function(j){if(k)k=0;else o[j.api_getFlashId()].dispatchEvent("play")}); -soundcloud.addEventListener("onMediaPause",function(j){o[j.api_getFlashId()].dispatchEvent("pause")});soundcloud.addEventListener("onMediaBuffering",function(j){j=o[j.api_getFlashId()];j.dispatchEvent("progress");if(j.readyState===0){j.readyState=3;j.dispatchEvent("readystatechange")}});soundcloud.addEventListener("onMediaDoneBuffering",function(j){o[j.api_getFlashId()].dispatchEvent("canplaythrough")});soundcloud.addEventListener("onMediaEnd",function(j){j=o[j.api_getFlashId()];j.paused=1;j.dispatchEvent("ended")}); -soundcloud.addEventListener("onMediaSeek",function(j){var v=o[j.api_getFlashId()];v.setCurrentTime(j.api_getTrackPosition());v.paused&&v.dispatchEvent("timeupdate")});soundcloud.addEventListener("onPlayerError",function(j){o[j.api_getFlashId()].dispatchEvent("error")})});return new g.soundcloud.init(l,i,r)};g.soundcloud.init=function(){function l(i){var r=i._options,k=i._container,j=k.getBoundingClientRect();i.width=r.width||d(k,"width")||"100%";i.height=r.height||d(k,"height")||"81px";i.src=r.src; -i.autoplay=r.autoplay;if(parseFloat(i.height,10)!==81)i.height="81px";i.offsetLeft=j.left;i.offsetTop=j.top;i.offsetHeight=parseFloat(i.height,10);i.offsetWidth=parseFloat(i.width,10);if(/[\d]+%/.test(i.width)){r=d(k,"width");i._container.style.width=i.width;i.offsetWidth=i._container.offsetWidth;i._container.style.width=r}if(/[\d]+%/.test(i.height)){r=d(k,"height");i._container.style.height=i.height;i.offsetHeight=i._container.offsetHeight;i._container.style.height=r}}return function(i,r,k){if(i)if(r){if(/file/.test(location.protocol))throw"Must run from a web server!"; -}else throw"Must supply a source!";else throw"Must supply an id!";if(!(this._container=document.getElementById(i)))throw"Could not find that container in the DOM!";k=k||{};k.api=k.api||{};k.target=i;k.src=r;k.api.commentformat=k.api.commentformat||a;this._mediaId=0;this._listeners={};this._playerId=g.guid(k.target);this._containerId=k.target;this._options=k;this._comments=[];this._popcorn=null;l(this);this.duration=0;this.volume=1;this.ended=this.currentTime=0;this.paused=1;this.readyState=0;this.playbackRate= -1;this.left=this.top=0;this.autoplay=null;this.played=0;this.addEventListener("load",function(){var j=this.getBoundingClientRect();this.top=j.top;this.left=j.left;this.offsetWidth=this.swfObj.offsetWidth;this.offsetHeight=this.swfObj.offsetHeight;this.offsetLeft=this.swfObj.offsetLeft;this.offsetTop=this.swfObj.offsetTop});o[this._playerId]=this;c(this)}}();g.soundcloud.init.prototype=g.soundcloud.prototype;g.extend(g.soundcloud.prototype,{setVolume:function(l){if(!(!l&&l!==0)){if(l<0)l=-l;if(l>1)l%= -1;this.volume=this.previousVolume=l;this.swfObj.api_setVolume(l*100);this.dispatchEvent("volumechange")}},setCurrentTime:function(l){if(!(!l&&l!==0)){this.currentTime=this.previousCurrentTime=l;this.ended=l>=this.duration;this.dispatchEvent("seeked")}},play:function(){if(this.swfObj){if(this.paused){this.paused=0;this.swfObj.api_play()}}else this.addEventListener("load",this.play)},pause:function(){if(this.swfObj){if(!this.paused){this.paused=1;this.swfObj.api_pause()}}else this.addEventListener("load", -this.pause)},mute:function(){if(this.swfObj)if(this.muted())if(this.paused)this.setVolume(this.oldVol);else this.volume=this.oldVol;else{this.oldVol=this.volume;if(this.paused)this.setVolume(0);else this.volume=0}else this.addEventListener("load",this.mute)},muted:function(){return this.volume===0},load:function(){if(this.swfObj){this.play();this.pause()}else this.addEventListener("load",this.load)},addEventListener:function(l,i){this._listeners[l]||(this._listeners[l]=[]);this._listeners[l].push(i); -return i},dispatchEvent:function(l){var i=this;l=l.type||l;l==="play"&&this.paused||l==="pause"&&!this.paused?this[l]():g.forEach(this._listeners[l],function(r){r.call(i)})},timeupdate:function(){var l=this,i=this.swfObj.api_getVolume()/100;if(f(this.currentTime-this.previousCurrentTime)>0.25)this.swfObj.api_seekTo(this.currentTime);else this.previousCurrentTime=this.currentTime=this.swfObj.api_getTrackPosition();if(i!==this.previousVolume)this.setVolume(i);else this.volume!==this.previousVolume&& -this.setVolume(this.volume);this.paused||this.dispatchEvent("timeupdate");l.ended||setTimeout(function(){l.timeupdate.call(l)},33)},getBoundingClientRect:function(){var l;if(this.swfObj){l=this.swfObj.getBoundingClientRect();return{bottom:l.bottom,left:l.left,right:l.right,top:l.top,width:l.width||l.right-l.left,height:l.height||l.bottom-l.top}}else{tmp=this._container.getBoundingClientRect();return{left:tmp.left,top:tmp.top,width:this.offsetWidth,height:this.offsetHeight,bottom:tmp.top+this.width, -right:tmp.top+this.height}}},registerPopcornWithPlayer:function(l){if(this.swfObj){this._popcorn=l;var i=this._options.api;if(i.key&&i.commentdiv){var r=this;g.xhr({url:"http://api.soundcloud.com/tracks/"+r._mediaId+"/comments.js?consumer_key="+i.key,success:function(k){g.forEach(k.json,function(j){r.addComment({start:j.timestamp/1E3,date:new Date(j.created_at),text:j.body,user:{name:j.user.username,profile:j.user.permalink_url,avatar:j.user.avatar_url}})})}})}}else this.addEventListener("load",function(){this.registerPopcornWithPlayer(l)})}}); -g.extend(g.soundcloud.prototype,{addComment:function(l,i){var r=this,k={start:l.start||0,date:l.date||new Date,text:l.text||"",user:{name:l.user.name||"",profile:l.user.profile||"",avatar:l.user.avatar||""},display:function(){return(i||r._options.api.commentformat)(k)}};this._comments.push(k);this._popcorn&&this._popcorn.subtitle({start:k.start,target:this._options.api.commentdiv,display:"inline",language:"en",text:k.display()})}})})(Popcorn,window);(function(){vimeo_player_loaded=function(g){vimeo_player_loaded[g]&&vimeo_player_loaded[g]()};vimeo_player_loaded.seek={};vimeo_player_loaded.loadProgress={};vimeo_player_loaded.play={};vimeo_player_loaded.pause={};Popcorn.player("vimeo",{_canPlayType:function(g,b){return/(?:http:\/\/www\.|http:\/\/|www\.|\.|^)(vimeo)/.test(b)&&g.toLowerCase()!=="video"},_setup:function(g){var b=this,d,a=document.createElement("div"),c=0,f=false,h=0,p,o;a.id=b.id+Popcorn.guid();b.appendChild(a);o=b.style.width?""+ -b.offsetWidth:"560";p=b.style.height?""+b.offsetHeight:"315";var l=function(){var i;i=b.src;var r=0,k=false;vimeo_player_loaded[a.id]=function(){d=document.getElementById(a.id);vimeo_player_loaded.seek[a.id]=function(w){if(w!==c){c=w;b.dispatchEvent("seeked");b.dispatchEvent("timeupdate")}};vimeo_player_loaded.play[a.id]=function(){if(b.paused){b.paused=false;b.dispatchEvent("play");b.dispatchEvent("playing");j()}};vimeo_player_loaded.pause[a.id]=function(){if(!b.paused){b.paused=true;b.dispatchEvent("pause")}}; -vimeo_player_loaded.loadProgress[a.id]=function(w){if(!k){k=true;b.dispatchEvent("loadstart")}w.percent===100&&b.dispatchEvent("canplaythrough")};d.api_addEventListener("seek","vimeo_player_loaded.seek."+a.id);d.api_addEventListener("loadProgress","vimeo_player_loaded.loadProgress."+a.id);d.api_addEventListener("play","vimeo_player_loaded.play."+a.id);d.api_addEventListener("pause","vimeo_player_loaded.pause."+a.id);var j=function(){if(!b.paused){c=d.api_getCurrentTime();b.dispatchEvent("timeupdate"); -setTimeout(j,10)}},v=function(){var w=d.api_getVolume()===0,n=d.api_getVolume();if(f!==w){f=w;b.dispatchEvent("volumechange")}if(h!==n){h=n;b.dispatchEvent("volumechange")}setTimeout(v,250)};b.play=function(){b.paused=false;b.dispatchEvent("play");b.dispatchEvent("playing");j();d.api_play()};b.pause=function(){if(!b.paused){b.paused=true;b.dispatchEvent("pause");d.api_pause()}};Popcorn.player.defineProperty(b,"currentTime",{set:function(w){if(!w)return c;c=+w;b.dispatchEvent("seeked");b.dispatchEvent("timeupdate"); -d.api_seekTo(c);return c},get:function(){return c}});Popcorn.player.defineProperty(b,"muted",{set:function(w){if(d.api_getVolume()===0!==w)if(w){r=d.api_getVolume();d.api_setVolume(0)}else d.api_setVolume(r)},get:function(){return d.api_getVolume()===0}});Popcorn.player.defineProperty(b,"volume",{set:function(w){if(!w||typeof w!=="number"||w<0||w>1)return d.api_getVolume()/100;if(d.api_getVolume()!==w){d.api_setVolume(w*100);h=d.api_getVolume();b.dispatchEvent("volumechange")}return d.api_getVolume()/ -100},get:function(){return d.api_getVolume()/100}});b.dispatchEvent("loadedmetadata");b.dispatchEvent("loadeddata");b.duration=d.api_getDuration();b.dispatchEvent("durationchange");v();b.readyState=4;b.dispatchEvent("canplaythrough")};i=/\d+$/.exec(i);i={clip_id:i?i[0]:0,api:1,js_swf_id:a.id};Popcorn.extend(i,g);swfobject.embedSWF("//vimeo.com/moogaloop.swf",a.id,o,p,"9.0.0","expressInstall.swf",i,{allowscriptaccess:"always",allowfullscreen:"true",wmode:"transparent"},{})};window.swfobject?l():Popcorn.getScript("//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js", -l)}})})();var onYouTubePlayerReady=function(g){onYouTubePlayerReady[g]&&onYouTubePlayerReady[g]()};onYouTubePlayerReady.stateChangeEventHandler={};onYouTubePlayerReady.onErrorEventHandler={}; -Popcorn.player("youtube",{_canPlayType:function(g,b){return/(?:http:\/\/www\.|http:\/\/|www\.|\.|^)(youtu)/.test(b)&&g.toLowerCase()!=="video"},_setup:function(g){var b=this,d=false,a=document.createElement("div"),c=0,f=0,h=true,p=false,o=false,l=100;b.paused=undefined;a.id=b.id+Popcorn.guid();g._container=a;b.appendChild(a);var i=function(){var r,k,j,v,w;onYouTubePlayerReady[a.id]=function(){g.youtubeObject=document.getElementById(a.id);onYouTubePlayerReady.stateChangeEventHandler[a.id]=function(C){if(!g.destroyed)if(C=== -2)if(p&&f===c&&f!==g.youtubeObject.getCurrentTime()){p=false;g.youtubeObject.seekTo(c)}else{c=g.youtubeObject.getCurrentTime();b.dispatchEvent("timeupdate");!b.paused&&b.pause()}else if(C===1&&!h)b.paused&&b.play();else if(C===-1)g.youtubeObject.playVideo();else if(C===1&&h){h=false;if(b.paused===true)b.pause();else if(b.paused===false)b.play();else if(d)b.play();else d||b.pause();b.duration=g.youtubeObject.getDuration();b.dispatchEvent("durationchange");y();b.dispatchEvent("loadedmetadata");b.dispatchEvent("loadeddata"); -b.readyState=4;b.dispatchEvent("canplaythrough")}else C===0&&b.dispatchEvent("ended")};onYouTubePlayerReady.onErrorEventHandler[a.id]=function(C){[2,100,101,150].indexOf(C)!==-1&&b.dispatchEvent("error")};g.youtubeObject.addEventListener("onStateChange","onYouTubePlayerReady.stateChangeEventHandler."+a.id);g.youtubeObject.addEventListener("onError","onYouTubePlayerReady.onErrorEventHandler."+a.id);var n=function(){if(!g.destroyed)if(!b.paused){c=g.youtubeObject.getCurrentTime();b.dispatchEvent("timeupdate"); -setTimeout(n,10)}},y=function(){if(!g.destroyed){if(o!==g.youtubeObject.isMuted()){o=g.youtubeObject.isMuted();b.dispatchEvent("volumechange")}if(l!==g.youtubeObject.getVolume()){l=g.youtubeObject.getVolume();b.dispatchEvent("volumechange")}setTimeout(y,250)}};b.play=function(){if(!g.destroyed){if(b.paused!==false||g.youtubeObject.getPlayerState()!==1){b.paused=false;b.dispatchEvent("play");b.dispatchEvent("playing")}n();g.youtubeObject.playVideo()}};b.pause=function(){if(!g.destroyed)if(b.paused!== -true||g.youtubeObject.getPlayerState()!==2){b.paused=true;b.dispatchEvent("pause");g.youtubeObject.pauseVideo()}};Popcorn.player.defineProperty(b,"currentTime",{set:function(C){c=f=+C;p=true;if(g.destroyed)return c;b.dispatchEvent("seeked");b.dispatchEvent("timeupdate");g.youtubeObject.seekTo(c);return c},get:function(){return c}});Popcorn.player.defineProperty(b,"muted",{set:function(C){if(g.destroyed)return C;if(g.youtubeObject.isMuted()!==C){C?g.youtubeObject.mute():g.youtubeObject.unMute();o= -g.youtubeObject.isMuted();b.dispatchEvent("volumechange")}return g.youtubeObject.isMuted()},get:function(){if(g.destroyed)return 0;return g.youtubeObject.isMuted()}});Popcorn.player.defineProperty(b,"volume",{set:function(C){if(g.destroyed)return C;if(g.youtubeObject.getVolume()/100!==C){g.youtubeObject.setVolume(C*100);l=g.youtubeObject.getVolume();b.dispatchEvent("volumechange")}return g.youtubeObject.getVolume()/100},get:function(){if(g.destroyed)return 0;return g.youtubeObject.getVolume()/100}})}; -g.controls=+g.controls===0||+g.controls===1?g.controls:1;g.annotations=+g.annotations===1||+g.annotations===3?g.annotations:1;r={playerapiid:a.id};k=/^.*(?:\/|v=)(.{11})/.exec(b.src)[1];w=(b.src.split("?")[1]||"").replace(/v=.{11}/,"");d=/autoplay=1/.test(w);j=b.style.width?""+b.offsetWidth:"560";v=b.style.height?""+b.offsetHeight:"315";k={id:a.id,"data-youtube-player":"//www.youtube.com/e/"+k+"?"+w+"&enablejsapi=1&playerapiid="+a.id+"&version=3"};swfobject.embedSWF(k["data-youtube-player"],a.id, -j,v,"8",undefined,r,{wmode:"transparent",allowScriptAccess:"always"},k)};window.swfobject?i():Popcorn.getScript("//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",i)},_teardown:function(g){g.destroyed=true;g.youtubeObject.stopVideo();g.youtubeObject.clearVideo();this.removeChild(document.getElementById(g._container.id))}}); diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/raphael-min.js --- a/metadataplayer/libs/raphael-min.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -// ┌────────────────────────────────────────────────────────────────────┐ \\ -// │ Raphaël 2.1.0 - JavaScript Vector Library │ \\ -// ├────────────────────────────────────────────────────────────────────┤ \\ -// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ -// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\ -// ├────────────────────────────────────────────────────────────────────┤ \\ -// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\ -// └────────────────────────────────────────────────────────────────────┘ \\ - -(function(a){var b="0.3.4",c="hasOwnProperty",d=/[\.\/]/,e="*",f=function(){},g=function(a,b){return a-b},h,i,j={n:{}},k=function(a,b){var c=j,d=i,e=Array.prototype.slice.call(arguments,2),f=k.listeners(a),l=0,m=!1,n,o=[],p={},q=[],r=h,s=[];h=a,i=0;for(var t=0,u=f.length;tf*b.top){e=b.percents[y],p=b.percents[y-1]||0,t=t/b.top*(e-p),o=b.percents[y+1],j=b.anim[e];break}f&&d.attr(b.anim[b.percents[y]])}if(!!j){if(!k){for(var A in j)if(j[g](A))if(U[g](A)||d.paper.customAttributes[g](A)){u[A]=d.attr(A),u[A]==null&&(u[A]=T[A]),v[A]=j[A];switch(U[A]){case C:w[A]=(v[A]-u[A])/t;break;case"colour":u[A]=a.getRGB(u[A]);var B=a.getRGB(v[A]);w[A]={r:(B.r-u[A].r)/t,g:(B.g-u[A].g)/t,b:(B.b-u[A].b)/t};break;case"path":var D=bR(u[A],v[A]),E=D[1];u[A]=D[0],w[A]=[];for(y=0,z=u[A].length;yd)return d;while(cf?c=e:d=e,e=(d-c)/2+c}return e}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function m(a){return((i*a+h)*a+g)*a}var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;return n(a,1/(200*f))}function cq(){return this.x+q+this.y+q+this.width+" × "+this.height}function cp(){return this.x+q+this.y}function cb(a,b,c,d,e,f){a!=null?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function bH(b,c,d){b=a._path2curve(b),c=a._path2curve(c);var e,f,g,h,i,j,k,l,m,n,o=d?0:[];for(var p=0,q=b.length;p=0&&y<=1&&A>=0&&A<=1&&(d?n++:n.push({x:x.x,y:x.y,t1:y,t2:A}))}}return n}function bF(a,b){return bG(a,b,1)}function bE(a,b){return bG(a,b)}function bD(a,b,c,d,e,f,g,h){if(!(x(a,c)x(e,g)||x(b,d)x(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(!k)return;var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(n<+y(a,c).toFixed(2)||n>+x(a,c).toFixed(2)||n<+y(e,g).toFixed(2)||n>+x(e,g).toFixed(2)||o<+y(b,d).toFixed(2)||o>+x(b,d).toFixed(2)||o<+y(f,h).toFixed(2)||o>+x(f,h).toFixed(2))return;return{x:l,y:m}}}function bC(a,b,c,d,e,f,g,h,i){if(!(i<0||bB(a,b,c,d,e,f,g,h)n)k/=2,l+=(m1?1:i<0?0:i;var j=i/2,k=12,l=[-0.1252,.1252,-0.3678,.3678,-0.5873,.5873,-0.7699,.7699,-0.9041,.9041,-0.9816,.9816],m=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],n=0;for(var o=0;od;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function bx(){return this.hex}function bv(a,b,c){function d(){var e=Array.prototype.slice.call(arguments,0),f=e.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];if(h[g](f)){bu(i,f);return c?c(h[f]):h[f]}i.length>=1e3&&delete h[i.shift()],i.push(f),h[f]=a[m](b,e);return c?c(h[f]):h[f]}return d}function bu(a,b){for(var c=0,d=a.length;c',bl=bk.firstChild,bl.style.behavior="url(#default#VML)";if(!bl||typeof bl.adj!="object")return a.type=p;bk=null}a.svg=!(a.vml=a.type=="VML"),a._Paper=j,a.fn=k=j.prototype=a.prototype,a._id=0,a._oid=0,a.is=function(a,b){b=v.call(b);if(b=="finite")return!M[g](+a);if(b=="array")return a instanceof Array;return b=="null"&&a===null||b==typeof a&&a!==null||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||H.call(a).slice(8,-1).toLowerCase()==b},a.angle=function(b,c,d,e,f,g){if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return(180+w.atan2(-i,-h)*180/B+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)},a.rad=function(a){return a%360*B/180},a.deg=function(a){return a*180/B%360},a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,E)){var e=b.length;while(e--)if(z(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(fb-d)return c-f+b}return c};var bn=a.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=w.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)});a.setWindow=function(b){eve("raphael.setWindow",a,h.win,b),h.win=b,h.doc=h.win.document,a._engine.initWin&&a._engine.initWin(h.win)};var bo=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write(""),e.close(),d=e.body}catch(f){d=createPopup().document.body}var g=d.createTextRange();bo=bv(function(a){try{d.style.color=r(a).replace(c,p);var b=g.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=h.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",h.doc.body.appendChild(i),bo=bv(function(a){i.style.color=a;return h.doc.defaultView.getComputedStyle(i,p).getPropertyValue("color")})}return bo(b)},bp=function(){return"hsb("+[this.h,this.s,this.b]+")"},bq=function(){return"hsl("+[this.h,this.s,this.l]+")"},br=function(){return this.hex},bs=function(b,c,d){c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b&&(d=b.b,c=b.g,b=b.r);if(c==null&&a.is(b,D)){var e=a.getRGB(b);b=e.r,c=e.g,d=e.b}if(b>1||c>1||d>1)b/=255,c/=255,d/=255;return[b,c,d]},bt=function(b,c,d,e){b*=255,c*=255,d*=255;var f={r:b,g:c,b:d,hex:a.rgb(b,c,d),toString:br};a.is(e,"finite")&&(f.opacity=e);return f};a.color=function(b){var c;a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b?(c=a.hsb2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b?(c=a.hsl2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):(a.is(b,"string")&&(b=a.getRGB(b)),a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b?(c=a.rgb2hsl(b),b.h=c.h,b.s=c.s,b.l=c.l,c=a.rgb2hsb(b),b.v=c.b):(b={hex:"none"},b.r=b.g=b.b=b.h=b.s=b.v=b.l=-1)),b.toString=br;return b},a.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;a=a%360/60,i=c*b,h=i*(1-z(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h);if(a>1||b>1||c>1)a/=360,b/=100,c/=100;a*=360;var e,f,g,h,i;a=a%360/60,i=2*b*(c<.5?c:1-c),h=i*(1-z(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.rgb2hsb=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;f=x(a,b,c),g=f-y(a,b,c),d=g==0?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=g==0?0:g/f;return{h:d,s:e,b:f,toString:bp}},a.rgb2hsl=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;g=x(a,b,c),h=y(a,b,c),i=g-h,d=i==0?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=i==0?0:f<.5?i/(2*f):i/(2-2*f);return{h:d,s:e,l:f,toString:bq}},a._path2string=function(){return this.join(",").replace(Y,"$1")};var bw=a._preload=function(a,b){var c=h.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,h.doc.body.removeChild(this)},c.onerror=function(){h.doc.body.removeChild(this)},h.doc.body.appendChild(c),c.src=a};a.getRGB=bv(function(b){if(!b||!!((b=r(b)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:bx};!X[g](b.toLowerCase().substring(0,2))&&b.charAt()!="#"&&(b=bo(b));var c,d,e,f,h,i,j,k=b.match(L);if(k){k[2]&&(f=R(k[2].substring(5),16),e=R(k[2].substring(3,5),16),d=R(k[2].substring(1,3),16)),k[3]&&(f=R((i=k[3].charAt(3))+i,16),e=R((i=k[3].charAt(2))+i,16),d=R((i=k[3].charAt(1))+i,16)),k[4]&&(j=k[4][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),k[1].toLowerCase().slice(0,4)=="rgba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100));if(k[5]){j=k[5][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,f,h)}if(k[6]){j=k[6][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsla"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,f,h)}k={r:d,g:e,b:f,toString:bx},k.hex="#"+(16777216|f|e<<8|d<<16).toString(16).slice(1),a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx}},a),a.hsb=bv(function(b,c,d){return a.hsb2rgb(b,c,d).hex}),a.hsl=bv(function(b,c,d){return a.hsl2rgb(b,c,d).hex}),a.rgb=bv(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b}));return c.hex},a.getColor.reset=function(){delete this.start},a.parsePathString=function(b){if(!b)return null;var c=bz(b);if(c.arr)return bJ(c.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];a.is(b,E)&&a.is(b[0],E)&&(e=bJ(b)),e.length||r(b).replace(Z,function(a,b,c){var f=[],g=b.toLowerCase();c.replace(_,function(a,b){b&&f.push(+b)}),g=="m"&&f.length>2&&(e.push([b][n](f.splice(0,2))),g="l",b=b=="m"?"l":"L");if(g=="r")e.push([b][n](f));else while(f.length>=d[g]){e.push([b][n](f.splice(0,d[g])));if(!d[g])break}}),e.toString=a._path2string,c.arr=bJ(e);return e},a.parseTransformString=bv(function(b){if(!b)return null;var c={r:3,s:4,t:2,m:6},d=[];a.is(b,E)&&a.is(b[0],E)&&(d=bJ(b)),d.length||r(b).replace($,function(a,b,c){var e=[],f=v.call(b);c.replace(_,function(a,b){b&&e.push(+b)}),d.push([b][n](e))}),d.toString=a._path2string;return d});var bz=function(a){var b=bz.ps=bz.ps||{};b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[g](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])});return b[a]};a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3),l=A(j,2),m=i*i,n=m*i,o=k*a+l*3*i*c+j*3*i*i*e+n*g,p=k*b+l*3*i*d+j*3*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,x=j*e+i*g,y=j*f+i*h,z=90-w.atan2(q-s,r-t)*180/B;(q>s||r=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},a.isBBoxIntersect=function(b,c){var d=a.isPointInsideBBox;return d(c,b.x,b.y)||d(c,b.x2,b.y)||d(c,b.x,b.y2)||d(c,b.x2,b.y2)||d(b,c.x,c.y)||d(b,c.x2,c.y)||d(b,c.x,c.y2)||d(b,c.x2,c.y2)||(b.xc.x||c.xb.x)&&(b.yc.y||c.yb.y)},a.pathIntersection=function(a,b){return bH(a,b)},a.pathIntersectionNumber=function(a,b){return bH(a,b,1)},a.isPointInsidePath=function(b,c,d){var e=a.pathBBox(b);return a.isPointInsideBBox(e,c,d)&&bH(b,[["M",c,d],["H",e.x2+10]],1)%2==1},a._removedFactory=function(a){return function(){eve("raphael.log",null,"Raphaël: you are calling to method “"+a+"” of removed object",a)}};var bI=a.pathBBox=function(a){var b=bz(a);if(b.bbox)return b.bbox;if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=bR(a);var c=0,d=0,e=[],f=[],g;for(var h=0,i=a.length;h1&&(v=w.sqrt(v),c=v*c,d=v*d);var x=c*c,y=d*d,A=(f==g?-1:1)*w.sqrt(z((x*y-x*u*u-y*t*t)/(x*u*u+y*t*t))),C=A*c*u/d+(a+h)/2,D=A*-d*t/c+(b+i)/2,E=w.asin(((b-D)/d).toFixed(9)),F=w.asin(((i-D)/d).toFixed(9));E=aF&&(E=E-B*2),!g&&F>E&&(F=F-B*2)}else E=j[0],F=j[1],C=j[2],D=j[3];var G=F-E;if(z(G)>k){var H=F,I=h,J=i;F=E+k*(g&&F>E?1:-1),h=C+c*w.cos(F),i=D+d*w.sin(F),m=bO(h,i,c,d,e,0,g,I,J,[F,H,C,D])}G=F-E;var K=w.cos(E),L=w.sin(E),M=w.cos(F),N=w.sin(F),O=w.tan(G/4),P=4/3*c*O,Q=4/3*d*O,R=[a,b],S=[a+P*L,b-Q*K],T=[h+P*N,i-Q*M],U=[h,i];S[0]=2*R[0]-S[0],S[1]=2*R[1]-S[1];if(j)return[S,T,U][n](m);m=[S,T,U][n](m).join()[s](",");var V=[];for(var W=0,X=m.length;W"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y)),i=f-2*d+b-(h-2*f+d),j=2*(d-b)-2*(f-d),k=b-d,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y));return{min:{x:y[m](0,p),y:y[m](0,o)},max:{x:x[m](0,p),y:x[m](0,o)}}}),bR=a._path2curve=bv(function(a,b){var c=!b&&bz(a);if(!b&&c.curve)return bJ(c.curve);var d=bL(a),e=b&&bL(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][n](bO[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][n](bN(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][n](bN(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](bM(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](bM(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](bM(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](bM(b.x,b.y,b.X,b.Y))}return a},i=function(a,b){if(a[b].length>7){a[b].shift();var c=a[b];while(c.length)a.splice(b++,0,["C"][n](c.splice(0,6)));a.splice(b,1),l=x(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],l=x(d.length,e&&e.length||0))};for(var k=0,l=x(d.length,e&&e.length||0);ke){if(c&&!l.start){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),k+=["C"+m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k,k=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!b&&!c){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j,g=+i[5],h=+i[6]}k+=i.shift()+i}l.end=k,m=b?n:c?l:a.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cu=ct(1),cv=ct(),cw=ct(0,1);a.getTotalLength=cu,a.getPointAtLength=cv,a.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return cw(a,b).end;var d=cw(a,c,1);return b?cw(d,b).end:d},cl.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return cu(this.attrs.path)}},cl.getPointAtLength=function(a){if(this.type=="path")return cv(this.attrs.path,a)},cl.getSubpath=function(b,c){if(this.type=="path")return a.getSubpath(this.attrs.path,b,c)};var cx=a.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,1.7)},">":function(a){return A(a,.48)},"<>":function(a){var b=.48-a/1.04,c=w.sqrt(.1734+b*b),d=c-b,e=A(z(d),1/3)*(d<0?-1:1),f=-c-b,g=A(z(f),1/3)*(f<0?-1:1),h=e+g+.5;return(1-h)*3*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==!!a)return a;return A(2,-10*a)*w.sin((a-.075)*2*B/.3)+1},bounce:function(a){var b=7.5625,c=2.75,d;a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375);return d}};cx.easeIn=cx["ease-in"]=cx["<"],cx.easeOut=cx["ease-out"]=cx[">"],cx.easeInOut=cx["ease-in-out"]=cx["<>"],cx["back-in"]=cx.backIn,cx["back-out"]=cx.backOut;var cy=[],cz=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},cA=function(){var b=+(new Date),c=0;for(;c1&&!d.next){for(s in k)k[g](s)&&(r[s]=d.totalOrigin[s]);d.el.attr(r),cE(d.anim,d.el,d.anim.percents[0],null,d.totalOrigin,d.repeat-1)}d.next&&!d.stop&&cE(d.anim,d.el,d.next,null,d.totalOrigin,d.repeat)}}a.svg&&m&&m.paper&&m.paper.safari(),cy.length&&cz(cA)},cB=function(a){return a>255?255:a<0?0:a};cl.animateWith=function(b,c,d,e,f,g){var h=this;if(h.removed){g&&g.call(h);return h}var i=d instanceof cD?d:a.animation(d,e,f,g),j,k;cE(i,h,i.percents[0],null,h.attr());for(var l=0,m=cy.length;l.5)*2-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&n!=.5&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/);if(j=="linear"){var t=e.shift();t=-d(t);if(isNaN(t))return null;var u=[0,0,f.cos(a.rad(t)),f.sin(a.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(e);if(!w)return null;k=k.replace(/[\(\)\s,\xb0#]/g,"_"),b.gradient&&k!=b.gradient.id&&(p.defs.removeChild(b.gradient),delete b.gradient);if(!b.gradient){s=q(j+"Gradient",{id:k}),b.gradient=s,q(s,j=="radial"?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:b.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;x1?G.opacity/100:G.opacity});case"stroke":G=a.getRGB(p),i.setAttribute(o,G.hex),o=="stroke"&&G[b]("opacity")&&q(i,{"stroke-opacity":G.opacity>1?G.opacity/100:G.opacity}),o=="stroke"&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":(d.type=="circle"||d.type=="ellipse"||c(p).charAt()!="r")&&r(d,p);break;case"opacity":k.gradient&&!k[b]("stroke-opacity")&&q(i,{"stroke-opacity":p>1?p/100:p});case"fill-opacity":if(k.gradient){H=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),H&&(I=H.getElementsByTagName("stop"),q(I[I.length-1],{"stop-opacity":p}));break};default:o=="font-size"&&(p=e(p,10)+"px");var J=o.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[J]=p,d._.dirty=1,i.setAttribute(o,p)}}y(d,f),i.style.visibility=m},x=1.2,y=function(d,f){if(d.type=="text"&&!!(f[b]("text")||f[b]("font")||f[b]("font-size")||f[b]("x")||f[b]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(a._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[b]("text")){g.text=f.text;while(h.firstChild)h.removeChild(h.firstChild);var j=c(f.text).split("\n"),k=[],m;for(var n=0,o=j.length;n"));var $=X.getBoundingClientRect();t.W=m.w=($.right-$.left)/Y,t.H=m.h=($.bottom-$.top)/Y,t.X=m.x,t.Y=m.y+t.H/2,("x"in i||"y"in i)&&(t.path.v=a.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));var _=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var ba=0,bb=_.length;ba.25&&(c=e.sqrt(.25-i(b-.5,2))*((c>.5)*2-1)+.5),m=b+n+c);return o}),f=f.split(/\s*\-\s*/);if(l=="linear"){var p=f.shift();p=-d(p);if(isNaN(p))return null}var q=a._parseDots(f);if(!q)return null;b=b.shape||b.node;if(q.length){b.removeChild(g),g.on=!0,g.method="none",g.color=q[0].color,g.color2=q[q.length-1].color;var r=[];for(var s=0,t=q.length;s')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e,f=b.width,g=b.x,h=b.y;if(!c)throw new Error("VML container not found.");var i=new a._Paper,j=i.canvas=a._g.doc.createElement("div"),k=j.style;g=g||0,h=h||0,f=f||512,d=d||342,i.width=f,i.height=d,f==+f&&(f+="px"),d==+d&&(d+="px"),i.coordsize=u*1e3+n+u*1e3,i.coordorigin="0 0",i.span=a._g.doc.createElement("span"),i.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",j.appendChild(i.span),k.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d),c==1?(a._g.doc.body.appendChild(j),k.left=g+"px",k.top=h+"px",k.position="absolute"):c.firstChild?c.insertBefore(j,c.firstChild):c.appendChild(j),i.renderfix=function(){};return i},a.prototype.clear=function(){a.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=a._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},a.prototype.remove=function(){a.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}(window.Raphael) \ No newline at end of file diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/record_mic.swf Binary file metadataplayer/libs/record_mic.swf has changed diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/renkan-publish.js --- a/metadataplayer/libs/renkan-publish.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1079 +0,0 @@ -/* - * Copyright 2012 Institut de recherche et d'innovation - * contributor(s) : Yves-Marie Haussonne, Raphael Velt, Samuel Huron - * - * contact@iri.centrepompidou.fr - * http://www.iri.centrepompidou.fr - * - * This software is a computer program whose purpose is to show and add annotations on a video . - * This software is governed by the CeCILL-C license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL-C - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL-C license and that you accept its terms. -*/ - -if (typeof Rkns !== "object") { - Rkns = {} -} - -Rkns.$ = jQuery; - -Rkns._ = _; - -Rkns.i18n = { - en: { - zoom_in: "Zoom In", - zoom_out: "Zoom Out", - see_in_project: 'See also "{node}" in "{project}"' - } -} - -Rkns.Utils = { - inherit : function(_baseClass) { - var _class = function() { - _baseClass.apply(this, Array.prototype.slice.call(arguments, 0)); - if (typeof this._init == "function") { - this._init.apply(this, Array.prototype.slice.call(arguments, 0)); - } - } - _class.prototype = new _baseClass(); - return _class; - } -} - -Rkns.Models = {}; - -Rkns.Models.getUID = function(obj) { - var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { - var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); - return v.toString(16); - }); - return obj.type + "-" + guid; -}; - -Rkns.Models.RenkanModel = Backbone.RelationalModel.extend({ - idAttribute : "_id", - constructor: function(options) { - - if (typeof options !== "undefined") { - options._id = options._id || options.id || Rkns.Models.getUID(this); - options.title = options.title || "(untitled " + this.type + ")"; - options.description = options.description || ""; - options.uri = options.uri || ""; - - if(typeof this.prepare === "function") { - options = this.prepare(options); - } - } - Backbone.RelationalModel.prototype.constructor.call(this, options); - }, - validate: function() { - if(!this.type) { - return "object has no type"; - } - }, - addReference : function(_options, _propName, _list, _id, _default) { - var _element = _list.get(_id); - if (typeof _element === "undefined" && typeof _default !== "undefined") { - _options[_propName ] = _default; - } - else { - _options[_propName ] = _element; - } - } -}); - -// USER -Rkns.Models.User = Rkns.Models.RenkanModel.extend({ - type: "user", - prepare: function(options) { - options.color = options.color || "#666666"; - return options; - }, - toJSON: function() { - return { - id: this.get("_id"), - title: this.get("title"), - uri: this.get("uri"), - description: this.get("description"), - color: this.get("color"), - } - }, -}); - -// NODE -Rkns.Models.Node = Rkns.Models.RenkanModel.extend({ - type: "node", - relations: [{ - type: Backbone.HasOne, - key: "created_by", - relatedModel: Rkns.Models.User - }], - prepare: function(options) { - project = options.project; - this.addReference(options, "created_by", project.get("users"), options.created_by, project.current_user); - options.description = options.description || ""; - return options; - }, - toJSON: function() { - return { - id: this.get("_id"), - title: this.get("title"), - uri: this.get("uri"), - description: this.get("description"), - position: this.get("position"), - image: this.get("image"), - created_by: this.get("created_by").get("_id") - } - }, -}); - -// EDGE -Rkns.Models.Edge = Rkns.Models.RenkanModel.extend({ - type: "edge", - relations: [ - { - type: Backbone.HasOne, - key: "created_by", - relatedModel: Rkns.Models.User - }, - { - type: Backbone.HasOne, - key: "from", - relatedModel: Rkns.Models.Node - }, - { - type: Backbone.HasOne, - key: "to", - relatedModel: Rkns.Models.Node - }, - ], - prepare: function(options) { - project = options.project; - this.addReference(options, "created_by", project.get("users"), options.created_by, project.current_user); - this.addReference(options, "from", project.get("nodes"), options.from); - this.addReference(options, "to", project.get("nodes"), options.to); - return options; - }, - toJSON: function() { - return { - id: this.get("_id"), - title: this.get("title"), - uri: this.get("uri"), - description: this.get("description"), - from: this.get("from").get("_id"), - to: this.get("to").get("_id"), - created_by: this.get("created_by").get("_id"), - } - }, -}); - -// PROJECT -Rkns.Models.Project = Rkns.Models.RenkanModel.extend({ - type: "project", - relations: [ - { - type: Backbone.HasMany, - key: "users", - relatedModel: Rkns.Models.User, - reverseRelation: { - key: 'project', - includeInJSON: '_id' - }, - }, - { - type: Backbone.HasMany, - key: "nodes", - relatedModel: Rkns.Models.Node, - reverseRelation: { - key: 'project', - includeInJSON: '_id' - }, - }, - { - type: Backbone.HasMany, - key: "edges", - relatedModel: Rkns.Models.Edge, - reverseRelation: { - key: 'project', - includeInJSON: '_id' - }, - } - ], - addUser: function(_props) { - _props.project = this; - var _user = new Rkns.Models.User(_props); - this.get("users").push(_user); - return _user; - }, - addNode: function(_props) { - _props.project = this; - var _node = new Rkns.Models.Node(_props); - this.get("nodes").push(_node); - return _node; - }, - addEdge: function(_props) { - _props.project = this; - var _edge = new Rkns.Models.Edge(_props); - this.get("edges").push(_edge); - return _edge; - }, - removeNode: function(_model) { - this.get("nodes").remove(_model); - }, - removeEdge: function(_model) { - this.get("edges").remove(_model); - }, - validate: function(options) { - var _project = this; - Rkns._(options.users).each(function(_item) { - _item.project = _project; - }); - Rkns._(options.nodes).each(function(_item) { - _item.project = _project; - }); - Rkns._(options.edges).each(function(_item) { - _item.project = _project; - }); - }, - // Add event handler to remove edges when a node is removed - initialize: function() { - var _this = this; - this.on("remove:nodes", function(_node) { - _this.get("edges").remove( - _this.get("edges").filter(function(_edge) { - return _edge.get("from") == _node || _edge.get("to") == _node; - }) - ); - }); - } -}); - -/* Point of entry */ - -Rkns.Renkan = function(_opts) { - if (typeof _opts.language !== "string" || typeof Rkns.i18n[_opts.language] == "undefined") { - _opts.language = "en"; - } - if (typeof _opts.container !== "string") { - _opts.container = "renkan"; - } - if (typeof _opts.search !== "object" || !_opts.search) { - _opts.search = []; - } - this.projects = []; - this.l10n = Rkns.i18n[_opts.language]; - this.$ = Rkns.$("#" + _opts.container); - this.$.html(this.template()); - this.uris = {}; - this.active_project = null; - this.renderer = null; -} - -Rkns.Renkan.prototype.template = Rkns._.template( - '
    ' -); - -Rkns.Renkan.prototype.addProject = function(_opts) { - var _proj = new Rkns.Models.Project(), - _li = Rkns.$("
  • ").addClass("Rk-Project").text("Untitled #" + (1+this.projects.length)); - this.$.find(".Rk-Project-List").append(_li); - Rkns.loadJson(_proj, _opts); - var _this = this; - _li.click(function() { - _this.renderProject(_proj); - }); - _proj.on("change:title", function() { - _li.html(_proj.get("title")); - }); - _proj.on("select", function() { - _this.$.find(".Rk-Project").removeClass("active"); - _li.addClass("active"); - }); - _proj.on("add:nodes", function(_node) { - var _uri = _node.get("uri"); - if (_uri) { - if (typeof _this.uris[_uri] === "undefined") { - _this.uris[_uri] = []; - } - _this.uris[_uri].push(_node); - } - }); - this.projects.push(_proj); - return _proj; -} - -Rkns.Renkan.prototype.renderProject = function(_project) { - if (_project) { - if (this.renderer) { - this.renderer.destroy(); - } - this.active_project = _project; - this.renderer = new Rkns.Renderer.Scene(this, _project); - this.renderer.autoScale(); - _project.trigger("select"); - } -} - -Rkns.Renkan.prototype.renderProjectAt = function(_index) { - this.renderProject(this.projects[_index]); -} - -Rkns.loadJson = function(_proj, _opts) { - if (typeof _opts.http_method == "undefined") { - _opts.http_method = 'PUT'; - } - var _load = function() { - Rkns.$.getJSON(_opts.url, function(_data) { - _proj.set(_data); - if (typeof _opts.callback === "function") { - _opts.callback(_proj); - } - }); - } - _load(); -} - -Rkns.Renderer = { - _MARGIN_X: 80, - _MARGIN_Y: 50, - _MIN_DRAG_DISTANCE: 2, - _NODE_RADIUS: 20, - _NODE_FONT_SIZE: 10, - _EDGE_FONT_SIZE: 9, - _NODE_MAX_CHAR: 30, - _EDGE_MAX_CHAR: 20, - _ARROW_LENGTH: 16, - _ARROW_WIDTH: 8, - _TOOLTIP_ARROW_LENGTH : 15, - _TOOLTIP_ARROW_WIDTH : 26, - _TOOLTIP_MARGIN : 10, - _TOOLTIP_PADDING : 8, - _TOOLTIP_GRADIENT : new paper.Gradient(['#f0f0f0', '#d0d0d0']) -} - -Rkns.Renderer.Utils = { - shortenText : function(_text,_length) { - var _rgxp = new RegExp('^(.{' + _length + '}).+$'); - return _text.replace(/(\n|\r|\r\n)/mg,' ').replace(_rgxp,'$1…'); - }, - drawTooltip : function(_coords, _path, _width, _xmargin, _selector) { - _selector.css({ - width: (_width - 2* Rkns.Renderer._TOOLTIP_PADDING), - }); - var _height = _selector.outerHeight() + 2* Rkns.Renderer._TOOLTIP_PADDING, - _isLeft = (_coords.x < paper.view.center.x ? 1 : -1), - _left = _coords.x + _isLeft * ( _xmargin + Rkns.Renderer._TOOLTIP_ARROW_LENGTH ), - _right = _coords.x + _isLeft * ( _xmargin + Rkns.Renderer._TOOLTIP_ARROW_LENGTH + _width ), - _top = _coords.y - _height / 2; - if (_top < Rkns.Renderer._TOOLTIP_MARGIN) { - _top = Math.min( Rkns.Renderer._TOOLTIP_MARGIN, _coords.y - Rkns.Renderer._TOOLTIP_ARROW_WIDTH / 2 ); - } - var _bottom = _top + _height; - if (_bottom > (paper.view.size.height - Rkns.Renderer._TOOLTIP_MARGIN)) { - _bottom = Math.max( paper.view.size.height - Rkns.Renderer._TOOLTIP_MARGIN, _coords.y + Rkns.Renderer._TOOLTIP_ARROW_WIDTH / 2 ); - _top = _bottom - _height; - } - _path.segments[0].point - = _path.segments[7].point - = _coords.add([_isLeft * _xmargin, 0]); - _path.segments[1].point.x - = _path.segments[2].point.x - = _path.segments[5].point.x - = _path.segments[6].point.x - = _left; - _path.segments[3].point.x - = _path.segments[4].point.x - = _right; - _path.segments[2].point.y - = _path.segments[3].point.y - = _top; - _path.segments[4].point.y - = _path.segments[5].point.y - = _bottom; - _path.segments[1].point.y = _coords.y - Rkns.Renderer._TOOLTIP_ARROW_WIDTH / 2; - _path.segments[6].point.y = _coords.y + Rkns.Renderer._TOOLTIP_ARROW_WIDTH / 2; - _path.closed = true; - _path.fillColor = new paper.GradientColor(Rkns.Renderer._TOOLTIP_GRADIENT, [0,_top], [0, _bottom]); - _selector.css({ - left: (Rkns.Renderer._TOOLTIP_PADDING + Math.min(_left, _right)), - top: (Rkns.Renderer._TOOLTIP_PADDING + _top) - }); - } -} - -Rkns.Renderer._BaseRepresentation = function(_renderer, _model) { - if (typeof _renderer !== "undefined") { - this.renderer = _renderer; - this.project = _renderer.project; - this.model = _model; - if (this.model) { - var _this = this; - this._selectBinding = function() { - _this.select(); - }; - this._unselectBinding = function() { - _this.unselect(); - } - this._changeBinding = function() { - _this.redraw(); - } - this._removeBinding = function() { - _renderer.removeRepresentation(_this); - _renderer.redraw(); - } - this.model.on("change", this._changeBinding ); - this.model.on("remove", this._removeBinding ); - this.model.on("select", this._selectBinding ); - this.model.on("unselect", this._unselectBinding ); - } - } -} - -Rkns.Renderer._BaseRepresentation.prototype.super = function(_func) { - Rkns.Renderer._BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1)); -} - -Rkns.Renderer._BaseRepresentation.prototype.select = function() {} - -Rkns.Renderer._BaseRepresentation.prototype.unselect = function() {} - -Rkns.Renderer._BaseRepresentation.prototype.mouseup = function() {} - -Rkns.Renderer._BaseRepresentation.prototype.destroy = function() { - if (this.model) { - this.model.off("change", this._changeBinding ); - this.model.off("remove", this._removeBinding ); - this.model.off("select", this._selectBinding); - this.model.off("unselect", this._unselectBinding); - } -} - -Rkns.Renderer.Node = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation); - -Rkns.Renderer.Node.prototype._init = function() { - this.renderer.node_layer.activate(); - this.type = "Node"; - this.circle = new paper.Path.Circle([0, 0], Rkns.Renderer._NODE_RADIUS); - this.circle.fillColor = '#ffffff'; - this.circle.__representation = this; - this.title = new paper.PointText([0,0]); - this.title.characterStyle = { - fontSize: Rkns.Renderer._NODE_FONT_SIZE, - fillColor: 'black' - }; - this.title.paragraphStyle.justification = 'center'; - this.title.__representation = this; - this.model_coords = new paper.Point(this.model.get("position")); -} - -Rkns.Renderer.Node.prototype.redraw = function() { - this.paper_coords = this.renderer.toPaperCoords(this.model_coords); - this.circle.position = this.paper_coords; - this.title.content = Rkns.Renderer.Utils.shortenText(this.model.get("title"), Rkns.Renderer._NODE_MAX_CHAR); - this.title.position = this.paper_coords.add([0, 2 * Rkns.Renderer._NODE_RADIUS]); - this.circle.strokeColor = this.model.get("created_by").get("color"); - var _img = this.model.get("image"); - if (_img && _img !== this.img) { - var _image = new Image(), - _this = this; - _image.onload = function() { - if (_this.node_image) { - _this.node_image.remove(); - } - _this.renderer.node_layer.activate(); - var _ratio = Math.min(1, 2 * Rkns.Renderer._NODE_RADIUS / _image.width, 2 * Rkns.Renderer._NODE_RADIUS / _image.height ); - var _raster = new paper.Raster(_image); - var _clip = new paper.Path.Circle([0, 0], Rkns.Renderer._NODE_RADIUS); - _raster.scale(_ratio); - _this.node_image = new paper.Group(_clip, _raster); - _this.node_image.opacity = _this.selected ? .5 : .9; - /* This is a workaround to allow clipping at group level */ - _this.node_image.clipped = true; - _this.node_image.position = _this.paper_coords; - _this.node_image.__representation = _this; - paper.view.draw(); - } - _image.src = _img; - } - this.img = _img; - if (this.node_image) { - if (!this.img) { - this.node_image.remove(); - delete this.node_image; - } else { - this.node_image.position = this.paper_coords; - } - } -} - -Rkns.Renderer.Node.prototype.paperShift = function(_delta) { - this.paper_coords = this.paper_coords.add(_delta); - this.model_coords = this.renderer.toModelCoords(this.paper_coords); - this.renderer.redraw(); -} - -Rkns.Renderer.Node.prototype.openTooltip = function() { - this.renderer.removeRepresentationsOfType("tooltip"); - var _tooltip = this.renderer.addRepresentation("NodeTooltip",null); - _tooltip.node_representation = this; - _tooltip.draw(); -} - -Rkns.Renderer.Node.prototype.select = function() { - this.selected = true; - this.circle.strokeWidth = 3; - this.openTooltip(); - this.circle.fillColor = "#ffff80"; - if (this.node_image) { - this.node_image.opacity = .5; - } - paper.view.draw(); -} - -Rkns.Renderer.Node.prototype.unselect = function() { - this.selected = false; - this.circle.strokeWidth = 1; - this.circle.fillColor = "#ffffff"; - if (this.node_image) { - this.node_image.opacity = .9; - } - paper.view.draw(); -} - -Rkns.Renderer.Node.prototype.mouseup = function(_event) { -} - -Rkns.Renderer.Node.prototype.destroy = function(_event) { - this.super("destroy"); - this.circle.remove(); - this.title.remove(); - if (this.node_image) { - this.node_image.remove(); - } -} - -/* */ - -Rkns.Renderer.Edge = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation); - -Rkns.Renderer.Edge.prototype._init = function() { - this.renderer.edge_layer.activate(); - this.type = "Edge"; - this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from")); - this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to")); - this.bundle = this.renderer.addToBundles(this); - this.line = new paper.Path(); - this.line.add([0,0],[0,0],[0,0]); - this.line.__representation = this; - this.arrow = new paper.Path(); - this.arrow.add([0,0],[Rkns.Renderer._ARROW_LENGTH,Rkns.Renderer._ARROW_WIDTH / 2],[0,Rkns.Renderer._ARROW_WIDTH]); - this.arrow.__representation = this; - this.text = new paper.PointText(); - this.text.characterStyle = { - fontSize: Rkns.Renderer._EDGE_FONT_SIZE, - fillColor: 'black' - }; - this.text.paragraphStyle.justification = 'center'; - this.text.__representation = this; - this.text_angle = 0; - this.arrow_angle = 0; -} - -Rkns.Renderer.Edge.prototype.redraw = function() { - var _p0a = this.from_representation.paper_coords, - _p1a = this.to_representation.paper_coords, - _v = _p1a.subtract(_p0a), - _r = _v.length, - _u = _v.divide(_r), - _group_pos = this.bundle.getPosition(this), - _delta = new paper.Point([- _u.y, _u.x]).multiply( 12 * _group_pos ), - _p0b = _p0a.add(_delta), /* Adding a 4 px difference */ - _p1b = _p1a.add(_delta), /* to differentiate inbound and outbound links */ - _a = _v.angle, - _handle = _v.divide(3), - _color = this.model.get("created_by").get("color"); - this.paper_coords = _p0b.add(_p1b).divide(2); - this.line.strokeColor = _color; - this.line.segments[0].point = _p0a; - this.line.segments[1].point = this.paper_coords; - this.line.segments[1].handleIn = _handle.multiply(-1); - this.line.segments[1].handleOut = _handle; - this.line.segments[2].point = _p1a; - this.arrow.rotate(_a - this.arrow_angle); - this.arrow.fillColor = _color; - this.arrow.position = this.paper_coords.subtract(_u.multiply(4)); - this.arrow_angle = _a; - if (_a > 90) { - _a -= 180; - } - if (_a < -90) { - _a += 180; - } - this.text.rotate(_a - this.text_angle); - this.text.content = Rkns.Renderer.Utils.shortenText(this.model.get("title"), Rkns.Renderer._EDGE_MAX_CHAR); - this.text.position = this.paper_coords; - this.text_angle = _a; -} - -Rkns.Renderer.Edge.prototype.openTooltip = function() { - this.renderer.removeRepresentationsOfType("tooltip"); - var _tooltip = this.renderer.addRepresentation("EdgeTooltip",null); - _tooltip.edge_representation = this; - _tooltip.draw(); -} - -Rkns.Renderer.Edge.prototype.select = function() { - this.line.strokeWidth = 3; - this.openTooltip(); - paper.view.draw(); -} - -Rkns.Renderer.Edge.prototype.unselect = function() { - this.line.strokeWidth = 1; - paper.view.draw(); -} - -Rkns.Renderer.Edge.prototype.mouseup = function(_event) { -} - -Rkns.Renderer.Edge.prototype.paperShift = function(_delta) { - this.from_representation.paperShift(_delta); - this.to_representation.paperShift(_delta); - this.renderer.redraw(); -} - -Rkns.Renderer.Edge.prototype.destroy = function() { - this.super("destroy"); - this.line.remove(); - this.arrow.remove(); - this.text.remove(); - var _this = this; - this.bundle.edges = Rkns._(this.bundle.edges).reject(function(_edge) { - return _edge === _this; - }); -} - -/* */ - -Rkns.Renderer.NodeTooltip = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation); - -Rkns.Renderer.NodeTooltip.prototype._init = function() { - this.renderer.overlay_layer.activate(); - this.type = "tooltip"; - this.tooltip_block = new paper.Path(); - var _pts = Rkns._(Rkns._.range(8)).map(function() {return [0,0]}); - this.tooltip_block.add.apply(this.tooltip_block, _pts); - this.tooltip_block.strokeWidth = 2; - this.tooltip_block.strokeColor = "#999999"; - this.tooltip_block.fillColor = "#e0e0e0"; - this.tooltip_block.opacity = .8; - this.tooltip_$ = Rkns.$('
    ') - .appendTo(this.renderer.tooltip_$) - .css({ - position: "absolute", - opacity: .8 - }) - .hide(); -} - -Rkns.Renderer.NodeTooltip.prototype.template = Rkns._.template( - '

    ×<%=a%>

    ' - + '

    <%-description%>

    ' - + '' -); - -Rkns.Renderer.NodeTooltip.prototype.draw = function() { - var _model = this.node_representation.model, - _title = _model.get("title"), - _uri = _model.get("uri"); - this.tooltip_$ - .html(this.template({ - a: (_uri ? '' : '' ) + _title + (_uri ? '' : '' ), - description: _model.get("description").replace(/(\n|\r|\r\n)/mg,' ').substr(0,180).replace(/(^.{150,179})[\s].+$/m,'$1…') - })) - var _this = this, - _renkan = this.renderer.renkan, - _uris = _renkan.uris[_uri]; - Rkns._(_uris).each(function(_othernode) { - if (_othernode !== _model && _othernode.get("project") !== _this.project) { - var _otherproj = _othernode.get("project"), - _nodetitle = _othernode.get("title") || "Untitled node" - _projtitle = _otherproj.get("title") || "Untitled node", - _html = _renkan.l10n.see_in_project.replace('{node}',Rkns._.escape(_nodetitle)).replace('{project}',Rkns._.escape(_projtitle)), - _li = Rkns.$("
  • ").addClass("Rk-Related").html(_html); - _li.click(function() { - _renkan.renderProject(_otherproj); - Rkns._.defer(function() { - _othernode.trigger("select"); - }); - }); - _this.tooltip_$.append(_li); - } - }); - this.tooltip_$.find(".Rk-CloseX").click(function() { - _this.renderer.removeRepresentation(_this); - paper.view.draw(); - }); - this.redraw(); -} - -Rkns.Renderer.NodeTooltip.prototype.redraw = function() { - var _coords = this.node_representation.paper_coords; - Rkns.Renderer.Utils.drawTooltip(_coords, this.tooltip_block, 250, 15, this.tooltip_$); - this.tooltip_$.show(); -} - -Rkns.Renderer.NodeTooltip.prototype.destroy = function() { - this.tooltip_block.remove(); - this.tooltip_$.detach(); -} - -/* */ - -Rkns.Renderer.EdgeTooltip = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation); - -Rkns.Renderer.EdgeTooltip.prototype._init = function() { - this.renderer.overlay_layer.activate(); - this.type = "tooltip"; - this.tooltip_block = new paper.Path(); - var _pts = Rkns._(Rkns._.range(8)).map(function() {return [0,0]}); - this.tooltip_block.add.apply(this.tooltip_block, _pts); - this.tooltip_block.strokeWidth = 2; - this.tooltip_block.strokeColor = "#999999"; - this.tooltip_block.fillColor = "#e0e0e0"; - this.tooltip_block.opacity = .8; - this.tooltip_$ = Rkns.$('
    ') - .appendTo(this.renderer.tooltip_$) - .css({ - position: "absolute", - opacity: .8 - }) - .hide(); -} - -Rkns.Renderer.EdgeTooltip.prototype.template = Rkns._.template( - '

    ×<%=a%>

    ' - + '

    <%-description%>

    ' -); - -Rkns.Renderer.EdgeTooltip.prototype.draw = function() { - var _model = this.edge_representation.model, - _title = _model.get("title"), - _uri = _model.get("uri"); - this.tooltip_$ - .html(this.template({ - a: (_uri ? '' : '' ) + _title + (_uri ? '' : '' ), - description: _model.get("description").replace(/(\n|\r|\r\n)/mg,' ').substr(0,180).replace(/(^.{150,179})[\s].+$/m,'$1…') - })); - this.redraw(); - var _this = this; - this.tooltip_$.find(".Rk-CloseX").click(function() { - _this.renderer.removeRepresentation(_this); - paper.view.draw(); - }); -} - -Rkns.Renderer.EdgeTooltip.prototype.redraw = function() { - var _coords = this.edge_representation.paper_coords; - Rkns.Renderer.Utils.drawTooltip(_coords, this.tooltip_block, 250, 5, this.tooltip_$); - this.tooltip_$.show(); - paper.view.draw(); -} - -Rkns.Renderer.EdgeTooltip.prototype.destroy = function() { - this.tooltip_block.remove(); - this.tooltip_$.detach(); -} - -/* */ - -Rkns.Renderer.Scene = function(_renkan, _project) { - this.renkan = _renkan; - this.project = _project; - this.$ = Rkns.$(".Rk-Render"); - this.representations = []; - this.$.html(this.template({ - width: this.$.width(), - height: this.$.height(), - l10n: _renkan.l10n - })) - this.canvas_$ = this.$.find(".Rk-Canvas"); - this.tooltip_$ = this.$.find(".Rk-Editor"); - paper.setup(this.canvas_$[0]); - this.scale = 1; - this.offset = paper.view.center; - this.totalScroll = 0; - this.click_target = null; - this.selected_target = null; - this.edge_layer = new paper.Layer(); - this.node_layer = new paper.Layer(); - this.overlay_layer = new paper.Layer(); - this.bundles = []; - var _tool = new paper.Tool(), - _this = this; - _tool.minDistance = Rkns.Renderer._MIN_DRAG_DISTANCE; - _tool.onMouseMove = function(_event) { - _this.onMouseMove(_event); - } - _tool.onMouseDown = function(_event) { - _this.onMouseDown(_event); - } - _tool.onMouseDrag = function(_event) { - _this.onMouseDrag(_event); - } - this.canvas_$.mouseup(function(_event) { - _this.onMouseUp(_event); - }); - this.canvas_$.mousewheel(function(_event, _delta) { - _this.onScroll(_event, _delta); - }); - this.tooltip_$.find(".Rk-ZoomOut").click(function() { - _this.offset = new paper.Point([ - _this.canvas_$.width(), - _this.canvas_$.height() - ]).multiply( .5 * ( 1 - Math.SQRT1_2 ) ).add(_this.offset.multiply( Math.SQRT1_2 )); - _this.scale *= Math.SQRT1_2; - _this.redraw(); - }); - this.tooltip_$.find(".Rk-ZoomIn").click(function() { - _this.offset = new paper.Point([ - _this.canvas_$.width(), - _this.canvas_$.height() - ]).multiply( .5 * ( 1 - Math.SQRT2 ) ).add(_this.offset.multiply( Math.SQRT2 )); - _this.scale *= Math.SQRT2; - _this.redraw(); - }); - paper.view.onResize = function(_event) { - _this.offset = _this.offset.add(_event.delta.divide(2)); - _this.redraw(); - } - - var _thRedraw = Rkns._.throttle(function() { - _this.redraw(); - },50); - - this.addRepresentations("Node", this.project.get("nodes")); - this.addRepresentations("Edge", this.project.get("edges")); - - this._addNodesBinding = function(_node) { - _this.addRepresentation("Node", _node); - _thRedraw(); - } - this._addEdgesBinding = function(_edge) { - _this.addRepresentation("Edge", _edge); - _thRedraw(); - } - - this.project.on("add:nodes", this._addNodesBinding ); - this.project.on("add:edges", this._addEdgesBinding ); - this.redraw(); -} - -Rkns.Renderer.Scene.prototype.template = Rkns._.template( - '
    ' - + '
    ' - + '
    ' -); - -Rkns.Renderer.Scene.prototype.addToBundles = function(_edgeRepr) { - var _bundle = Rkns._(this.bundles).find(function(_bundle) { - return ( - ( _bundle.from === _edgeRepr.from_representation && _bundle.to === _edgeRepr.to_representation ) - || ( _bundle.from === _edgeRepr.to_representation && _bundle.to === _edgeRepr.from_representation ) - ); - }); - if (typeof _bundle !== "undefined") { - _bundle.edges.push(_edgeRepr) - } else { - _bundle = { - from: _edgeRepr.from_representation, - to: _edgeRepr.to_representation, - edges: [ _edgeRepr ], - getPosition: function(_er) { - var _dir = (_er.from_representation === this.from) ? 1 : -1; - return _dir * ( Rkns._(this.edges).indexOf(_er) - (this.edges.length - 1) / 2 ); - } - } - this.bundles.push(_bundle); - } - return _bundle; -} - -Rkns.Renderer.Scene.prototype.autoScale = function() { - if (this.project.get("nodes").length) { - var _xx = this.project.get("nodes").map(function(_node) { return _node.get("position").x }), - _yy = this.project.get("nodes").map(function(_node) { return _node.get("position").y }), - _minx = Math.min.apply(Math, _xx), - _miny = Math.min.apply(Math, _yy), - _maxx = Math.max.apply(Math, _xx), - _maxy = Math.max.apply(Math, _yy); - this.scale = Math.min((paper.view.size.width - 2 * Rkns.Renderer._MARGIN_X) / (_maxx - _minx), (paper.view.size.height - 2 * Rkns.Renderer._MARGIN_Y) / (_maxy - _miny)); - this.offset = paper.view.center.subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(this.scale)); - this.redraw(); - } -} - -Rkns.Renderer.Scene.prototype.toPaperCoords = function(_point) { - return _point.multiply(this.scale).add(this.offset); -} - - -Rkns.Renderer.Scene.prototype.toModelCoords = function(_point) { - return _point.subtract(this.offset).divide(this.scale); -} - -Rkns.Renderer.Scene.prototype.addRepresentation = function(_type, _model) { - var _repr = new Rkns.Renderer[_type](this, _model); - this.representations.push(_repr); - return _repr; -} - -Rkns.Renderer.Scene.prototype.addRepresentations = function(_type, _collection) { - var _this = this; - _collection.forEach(function(_model) { - _this.addRepresentation(_type, _model); - }); -} - -Rkns.Renderer.Scene.prototype.removeRepresentation = function(_representation) { - _representation.destroy(); - this.representations = Rkns._(this.representations).reject( - function(_repr) { - return _repr == _representation - } - ); -} - -Rkns.Renderer.Scene.prototype.getRepresentationByModel = function(_model) { - return Rkns._(this.representations).find(function(_repr) { - return _repr.model === _model; - }); -} - -Rkns.Renderer.Scene.prototype.removeRepresentationsOfType = function(_type) { - var _representations = Rkns._(this.representations).filter(function(_repr) { - return _repr.type == _type; - }), - _this = this; - Rkns._(_representations).each(function(_repr) { - _this.removeRepresentation(_repr); - }); -} - -Rkns.Renderer.Scene.prototype.unselectAll = function() { - Rkns._(this.representations).each(function(_repr) { - _repr.model.trigger("unselect"); - }); -} - -Rkns.Renderer.Scene.prototype.redraw = function() { - Rkns._(this.representations).each(function(_representation) { - _representation.redraw(); - }); - paper.view.draw(); -} - -Rkns.Renderer.Scene.prototype.addTempEdge = function(_from, _point) { - var _tmpEdge = this.addRepresentation("TempEdge",null); - _tmpEdge.end_pos = _point; - _tmpEdge.from_representation = _from; - _tmpEdge.redraw(); - this.click_target = _tmpEdge; -} - -Rkns.Renderer.Scene.prototype.findTarget = function(_hitResult) { - if (_hitResult && typeof _hitResult.item.__representation !== "undefined") { - var _newTarget = _hitResult.item.__representation; - if (this.selected_target !== _newTarget && _newTarget.model) { - if (this.selected_target) { - this.selected_target.model.trigger("unselect"); - } - _newTarget.model.trigger("select"); - this.selected_target = _newTarget; - } - } else { - if (!_hitResult) { - this.removeRepresentationsOfType("tooltip"); - } - if (this.selected_target) { - this.selected_target.model.trigger("unselect"); - } - this.selected_target = null; - } -} - -Rkns.Renderer.Scene.prototype.onMouseMove = function(_event) { - var _hitResult = paper.project.hitTest(_event.point); - if (this.is_dragging) { - if (this.click_target && typeof this.click_target.paperShift === "function") { - this.click_target.paperShift(_event.delta); - } else { - this.offset = this.offset.add(_event.delta); - this.redraw(); - } - } else { - this.findTarget(_hitResult); - } -} - -Rkns.Renderer.Scene.prototype.onMouseDown = function(_event) { - this.is_dragging = false; - var _hitResult = paper.project.hitTest(_event.point); - if (_hitResult && typeof _hitResult.item.__representation !== "undefined") { - this.click_target = _hitResult.item.__representation; - } else { - this.click_target = null; - } -} - -Rkns.Renderer.Scene.prototype.onMouseDrag = function(_event) { - this.is_dragging = true; - this.onMouseMove(_event); -} - -Rkns.Renderer.Scene.prototype.onMouseUp = function(_event) { - if (this.click_target) { - var _off = this.canvas_$.offset(); - if (this.click_target.model) { - this.click_target.model.trigger("click"); - } - } - this.is_dragging = false; - this.click_target = null; -} - -Rkns.Renderer.Scene.prototype.onScroll = function(_event, _scrolldelta) { - this.totalScroll += _scrolldelta; - if (Math.abs(this.totalScroll) >= 1) { - var _off = this.canvas_$.offset(), - _delta = new paper.Point([ - _event.pageX - _off.left, - _event.pageY - _off.top - ]).subtract(this.offset).multiply( Math.SQRT2 - 1 ); - if (this.totalScroll > 0) { - this.offset = this.offset.subtract(_delta); - this.scale *= Math.SQRT2; - } else { - this.offset = this.offset.add(_delta.divide( Math.SQRT2 )); - this.scale *= Math.SQRT1_2; - } - this.totalScroll = 0; - this.redraw(); - } -} - -Rkns.Renderer.Scene.prototype.destroy = function() { - this.project.off("add:nodes", this._addNodesBinding ); - this.project.off("add:edges", this._addEdgesBinding ); - Rkns._(this.representations).each(function(_repr) { - _repr.destroy(); - }); - this.$.html(""); - paper.remove(); -} - diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/swfobject.js --- a/metadataplayer/libs/swfobject.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -/* SWFObject v2.2 - is released under the MIT License -*/ -var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab. - * - */ -/* FIXME: properly use require.js feature. This will do for debugging in the meantime */ -window.tracemanager = (function($) { - // If there are more than MAX_FAILURE_COUNT synchronisation - // failures, then disable synchronisation - MAX_FAILURE_COUNT = 20; - - // If there are more than MAX_BUFFER_SIZE obsels in the buffer, - // then "compress" them as a single "ktbsFullBuffer" - MAX_BUFFER_SIZE = 500; - - var BufferedService_prototype = { - /* - * Buffered service for traces - */ - // url: "", - // buffer: [], - // isReady: false, - // timer: null, - // failureCount: 0, - - /* Flush buffer */ - flush: function() { - // FIXME: add mutex on this.buffer - if (! this.isReady) - { - if (window.console) window.console.log("Sync service not ready"); - } else if (this.failureCount > MAX_FAILURE_COUNT) - { - // Disable synchronisation - this.set_sync_mode('none'); - } else if (this.buffer.length) { - var temp = this.buffer; - this.buffer = []; - - if (this.mode == 'GET') - { - // GET mode: do some data mangline. We mark the - // "compressed" nature of the generated JSON by - // prefixing it with c - var data = 'c' + JSON.stringify(temp.map(function (o) { return o.toCompactJSON(); })); - // Swap " (very frequent, which will be - // serialized into %22) and ; (rather rare), this - // saves some bytes - data = data.replace(/[;"#]/g, function(s){ return s == ';' ? '"' : ( s == '"' ? ';' : '%23'); }); - // FIXME: check data length (< 2K is safe) - var request=$('').error( function() { this.failureCount += 1; }) - .load( function() { this.failureCount = 0; }) - .attr('src', this.url + 'trace/?data=' + data); - } - else - { - $.ajax({ url: this.url + 'trace/', - type: 'POST', - contentType: 'application/json', - data: JSON.stringify(temp.map(function (o) { return o.toJSON(); })), - processData: false, - // Type of the returned data. - dataType: "html", - error: function(jqXHR, textStatus, errorThrown) { - if (window.console) window.console.log("Error when sending buffer:", textStatus); - this.failureCount += 1; - }, - success: function(data, textStatus, jqXHR) { - // Reset failureCount to 0 as soon as there is 1 valid answer - this.failureCount = 0; - } - }); - } - } - }, - - /* Sync mode: delayed, sync (immediate sync), none (no - * synchronisation with server, the trace has to be explicitly saved - * if needed */ - set_sync_mode: function(mode, default_subject) { - this.sync_mode = mode; - if (! this.isReady && mode !== "none") - this.init(default_subject); - if (mode == 'delayed') { - this.start_timer(); - } else { - this.stop_timer(); - } - }, - - /* Enqueue an obsel */ - enqueue: function(obsel) { - if (this.buffer.length > MAX_BUFFER_SIZE) - { - obsel = new Obsel('ktbsFullBuffer', this.buffer[0].begin, - this.buffer[this.buffer.length - 1].end, this.buffer[0].subject); - obsel.trace = this.buffer[0].trace; - this.buffer = []; - } - this.buffer.push(obsel); - if (this.sync_mode === 'sync') { - // Immediate sync of the obsel. - this.flush(); - } - }, - - start_timer: function() { - var self = this; - if (this.timer === null) { - this.timer = window.setInterval(function() { - self.flush(); - }, this.timeOut); - } - }, - - stop_timer: function() { - if (this.timer !== null) { - window.clearInterval(this.timer); - this.timer = null; - } - }, - - /* - * Initialize the sync service - */ - init: function(default_subject) { - var self = this; - if (this.isReady) - /* Already initialized */ - return; - if (typeof default_subject === 'undefined') - default_subject = 'anonymous'; - if (this.mode == 'GET') - { - var request=$('').attr('src', this.url + 'login?userinfo={"default_subject": "' + default_subject + '"}'); - // Do not wait for the return, assume it is - // initialized. This assumption will not work anymore - // if login returns some necessary information - this.isReady = true; - } - else - { - $.ajax({ url: this.url + 'login', - type: 'POST', - data: 'userinfo={"default_subject":"' + default_subject + '"}', - success: function(data, textStatus, jqXHR) { - self.isReady = true; - if (self.buffer.length) { - self.flush(); - } - } - }); - } - } - }; - var BufferedService = function(url, mode) { - this.url = url; - this.buffer = []; - this.isReady = false; - this.timer = null; - this.failureCount = 0; - // sync_mode is either "none", "sync" or "buffered" - this.sync_mode = "none"; - /* mode can be either POST or GET */ - if (mode == 'POST' || mode == 'GET') - this.mode = mode; - else - this.mode = 'POST'; - /* Flush buffer every timeOut ms if the sync_mode is delayed */ - this.timeOut = 2000; - }; - BufferedService.prototype = BufferedService_prototype; - - var Trace_prototype = { - /* FIXME: We could/should use a sorted list such as - http://closure-library.googlecode.com/svn/docs/class_goog_structs_AvlTree.html - to speed up queries based on time */ - obsels: [], - /* Trace URI */ - uri: "", - default_subject: "", - /* baseuri is used as the base URI to resolve relative - * attribute-type names in obsels. Strictly speaking, this - * should rather be expressed as a reference to model, or - * more generically, as a qname/URI dict */ - baseuri: "", - /* Mapping of obsel type or property name to a compact - * representation (shorthands). - */ - shorthands: null, - syncservice: null, - - /* Define the trace URI */ - set_uri: function(uri) { - this.uri = uri; - }, - - /* Sync mode: delayed, sync (immediate sync), none (no - * synchronisation with server, the trace has to be explicitly saved - * if needed */ - set_sync_mode: function(mode) { - if (this.syncservice !== null) { - this.syncservice.set_sync_mode(mode, this.default_subject); - } - }, - - /* - * Return a list of the obsels of this trace matching the parameters - */ - list_obsels: function(_begin, _end, _reverse) { - var res; - if (typeof _begin !== 'undefined' || typeof _end !== 'undefined') { - /* - * Not optimized yet. - */ - res = []; - var l = this.obsels.length; - for (var i = 0; i < l; i++) { - var o = this.obsels[i]; - if ((typeof _begin !== 'undefined' && o.begin > _begin) && (typeof _end !== 'undefined' && o.end < _end)) { - res.push(o); - } - } - } - - if (typeof _reverse !== 'undefined') { - if (res !== undefined) { - /* Should reverse the whole list. Make a copy. */ - res = this.obsels.slice(0); - } - res.sort(function(a, b) { return b.begin - a.begin; }); - return res; - } - - if (res === undefined) { - res = this.obsels; - } - return res; - - }, - - /* - * Return the obsel of this trace identified by the URI, or undefined - */ - get_obsel: function(id) { - for (var i = 0; i < this.obsels.length; i++) { - /* FIXME: should check against variations of id/uri, take this.baseuri into account */ - if (this.obsels[i].uri === id) { - return this.obsels[i]; - } - } - return undefined; - }, - - set_default_subject: function(subject) { - // FIXME: if we call this method after the sync_service - // init method, then the default_subject will not be - // consistent anymore. Maybe we should then call init() again? - this.default_subject = subject; - }, - - get_default_subject: function() { - return this.default_subject; - }, - - /* (type:ObselType, begin:int, end:int?, subject:str?, attributes:[AttributeType=>any]?) */ - /* Create a new obsel and add it to the trace */ - create_obsel: function(type, begin, end, subject, _attributes) { - var o = new Obsel(type, begin, end, subject); - if (typeof _attributes !== 'undefined') { - o.attributes = _attributes; - } - o.trace = this; - this.obsels.push(o); - if (this.syncservice !== null) - this.syncservice.enqueue(o); - }, - - /* Helper methods */ - - /* Create a new obsel with the given attributes */ - trace: function(type, _attributes, _begin, _end, _subject) { - var t = (new Date()).getTime(); - if (typeof begin === 'undefined') { - _begin = t; - } - if (typeof end === 'undefined') { - _end = _begin; - } - if (typeof subject === 'undefined') { - _subject = this.default_subject; - } - if (typeof _attributes === 'undefined') { - _attributes = {}; - } - return this.create_obsel(type, _begin, _end, _subject, _attributes); - } - }; - - var Trace = function(uri, requestmode) { - /* FIXME: We could/should use a sorted list such as - http://closure-library.googlecode.com/svn/docs/class_goog_structs_AvlTree.html - to speed up queries based on time */ - this.obsels = []; - /* Trace URI */ - if (uri === undefined) - uri = ""; - this.uri = uri; - this.sync_mode = "none"; - this.default_subject = ""; - this.shorthands = {}; - /* baseuri is used a the base URI to resolve relative attribute names in obsels */ - this.baseuri = ""; - - this.syncservice = new BufferedService(uri, requestmode); - $(window).unload( function () { - if (this.syncservice && this.sync_mode !== 'none') { - this.syncservice.flush(); - this.syncservice.stop_timer(); - } - }); - }; - Trace.prototype = Trace_prototype; - - var Obsel_prototype = { - /* The following attributes are here for documentation - * purposes. They MUST be defined in the constructor - * function. */ - trace: undefined, - type: undefined, - begin: undefined, - end: undefined, - subject: undefined, - /* Dictionary indexed by ObselType URIs */ - attributes: {}, - - /* Method definitions */ - get_trace: function() { - return this.trace; - }, - - get_obsel_type: function() { - return this.type; - }, - get_begin: function() { - return this.begin; - }, - get_end: function() { - return this.end; - }, - get_subject: function() { - return this.subject; - }, - - list_attribute_types: function() { - var result = []; - for (var prop in this.attributes) { - if (this.attributes.hasOwnProperty(prop)) - result.push(prop); - } - /* FIXME: we return URIs here instead of AttributeType elements */ - return result; - }, - - list_relation_types: function() { - /* FIXME: not implemented yet */ - }, - - list_related_obsels: function (rt) { - /* FIXME: not implemented yet */ - }, - list_inverse_relation_types: function () { - /* FIXME: not implemented yet */ - }, - list_relating_obsels: function (rt) { - /* FIXME: not implemented yet */ - }, - /* - * Return the value of the given attribute type for this obsel - */ - get_attribute_value: function(at) { - if (typeof at === "string") - /* It is a URI */ - return this.attributes[at]; - else - /* FIXME: check that at is instance of AttributeType */ - return this.attributes[at.uri]; - }, - - - /* obsel modification (trace amendment) */ - - set_attribute_value: function(at, value) { - if (typeof at === "string") - /* It is a URI */ - this.attributes[at] = value; - /* FIXME: check that at is instance of AttributeType */ - else - this.attributes[at.uri] = value; - }, - - del_attribute_value: function(at) { - if (typeof at === "string") - /* It is a URI */ - delete this.attributes[at]; - /* FIXME: check that at is instance of AttributeType */ - else - delete this.attributes[at.uri]; - }, - - add_related_obsel: function(rt, value) { - /* FIXME: not implemented yet */ - }, - - del_related_obsel: function(rt, value) { - /* FIXME: not implemented yet */ - }, - - /* - * Return a JSON representation of the obsel - */ - toJSON: function() { - var r = { - "@id": this.id, - "@type": this.type, - "begin": this.begin, - "end": this.end, - "subject": this.subject - }; - for (var prop in this.attributes) { - if (this.attributes.hasOwnProperty(prop)) - r[prop] = this.attributes[prop]; - } - return r; - }, - - /* - * Return a compact JSON representation of the obsel. - * Use predefined + custom shorthands for types/properties - */ - toCompactJSON: function() { - var r = { - "@t": (this.trace.shorthands.hasOwnProperty(this.type) ? this.trace.shorthands[this.type] : this.type), - "@b": this.begin, - }; - // Transmit subject only if different from default_subject - if (this.subject !== this.trace.default_subject) - r["@s"] = this.subject; - - // Store duration (to save some bytes) and only if it is non-null - if (this.begin !== this.end) - r["@d"] = this.end - this.begin; - - // Store id only if != "" - if (this.id !== "") - r["@i"] = this.id; - - for (var prop in this.attributes) { - if (this.attributes.hasOwnProperty(prop)) - { - var v = this.attributes[prop]; - r[prop] = this.trace.shorthands.hasOwnProperty(v) ? this.trace.shorthands[v] : v; - } - } - return r; - }, - - toJSONstring: function() { - return JSON.stringify(this.toJSON()); - } - }; - - var Obsel = function(type, begin, end, subject, attributes) { - this.trace = undefined; - this.uri = ""; - this.id = ""; - this.type = type; - this.begin = begin; - this.end = end; - this.subject = subject; - /* Is the obsel synched with the server ? */ - this.sync_status = false; - /* Dictionary indexed by ObselType URIs */ - this.attributes = {}; - }; - Obsel.prototype = Obsel_prototype; - - var TraceManager_prototype = { - traces: [], - /* - * Return the trace with id name - * If it was not registered, return undefined. - */ - get_trace: function(name) { - return this.traces[name]; - }, - - /* - * Explicitly create and initialize a new trace with the given name. - * The optional uri parameter allows to initialize the trace URI. - * - * If another existed with the same name before, then it is replaced by a new one. - */ - init_trace: function(name, params) - { - if (window.console) window.console.log("init_trace", params); - url = params.url ? params.url : ""; - requestmode = params.requestmode ? params.requestmode : "POST"; - syncmode = params.syncmode ? params.syncmode : "none"; - default_subject = params.default_subject ? params.default_subject : "default"; - var t = new Trace(url, requestmode); - t.set_default_subject(default_subject); - t.set_sync_mode(syncmode); - this.traces[name] = t; - return t; - } - }; - - var TraceManager = function() { - this.traces = {}; - }; - TraceManager.prototype = TraceManager_prototype; - - var tracemanager = new TraceManager(); - return tracemanager; - })(jQuery); diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/libs/underscore-min.js --- a/metadataplayer/libs/underscore-min.js Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -// Underscore.js 1.3.3 -// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. -// Underscore is freely distributable under the MIT license. -// Portions of Underscore are inspired or borrowed from Prototype, -// Oliver Steele's Functional, and John Resig's Micro-Templating. -// For all details and documentation: -// http://documentcloud.github.com/underscore -(function(){function r(a,c,d){if(a===c)return 0!==a||1/a==1/c;if(null==a||null==c)return a===c;a._chain&&(a=a._wrapped);c._chain&&(c=c._wrapped);if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return!1;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== -c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return!1;for(var f=d.length;f--;)if(d[f]==a)return!0;d.push(a);var f=0,g=!0;if("[object Array]"==e){if(f=a.length,g=f==c.length)for(;f--&&(g=f in a==f in c&&r(a[f],c[f],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return!1;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,h)&&!f--)break; -g=!f}}d.pop();return g}var s=this,I=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,J=k.unshift,l=p.toString,K=p.hasOwnProperty,y=k.forEach,z=k.map,A=k.reduce,B=k.reduceRight,C=k.filter,D=k.every,E=k.some,q=k.indexOf,F=k.lastIndexOf,p=Array.isArray,L=Object.keys,t=Function.prototype.bind,b=function(a){return new m(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a, -c,d){if(a!=null)if(y&&a.forEach===y)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==null&&(a=[]);if(A&& -a.reduce===A){e&&(c=b.bind(c,e));return f?a.reduce(c,d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduceRight===B){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a, -c,b){var e;G(a,function(a,g,h){if(c.call(b,a,g,h)){e=a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(C&&a.filter===C)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(D&&a.every===D)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b, -a,g,h)))return o});return!!e};var G=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(E&&a.some===E)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=G(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= -function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]}; -j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1),true);return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a= -i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=L||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&& -c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={};j(b.flatten(i.call(arguments,1)),function(b){b in a&&(c[b]=a[b])});return c};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty= -function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFunction=function(a){return l.call(a)=="[object Function]"}; -b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a, -b){return K.call(a,b)};b.noConflict=function(){s._=I;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){M(c,b[c]=a[c])})};var N=0;b.uniqueId= -function(a){var b=N++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},v;for(v in n)n[n[v]]=v;var O=/\\|'|\r|\n|\t|\u2028|\u2029/g,P=/\\(\\|'|r|n|t|u2028|u2029)/g,w=function(a){return a.replace(P,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(O,function(a){return"\\"+n[a]}).replace(d.escape|| -u,function(a,b){return"'+\n_.escape("+w(b)+")+\n'"}).replace(d.interpolate||u,function(a,b){return"'+\n("+w(b)+")+\n'"}).replace(d.evaluate||u,function(a,b){return"';\n"+w(b)+"\n;__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c}; -b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var x=function(a,c){return c?b(a).chain():a},M=function(a,c){m.prototype[a]=function(){var a=i.call(arguments);J.call(a,this._wrapped);return x(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return x(d, -this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return x(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/mashup/bab_files/mashup-local-html.json --- a/metadataplayer/mashup/bab_files/mashup-local-html.json Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,506 +0,0 @@ -{ - "views": [ - { - "id": "v_33227665-49F3-7111-2BC6-3C4B6E90411C", - "contents": ["c1a84ff8-e2b0-11e0-8472-00145ea49a02", "c4ff2454-9842-11e1-9f9f-00145ea4a2be"], - "annotation_types": ["c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67", "c_3D9A9B5D-E144-4920-A9CA-3C4D26B48425"] - }, { - "meta": { - "stat": "1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" - }, - "id": "stat", - "contents": ["c4ff2454-9842-11e1-9f9f-00145ea4a2be"] - } - ], - "tags": [ - { - "meta": { - "dc:title": "jeux vidéo" - }, - "id": "jeux_video" - }, { - "meta": { - "dc:title": "intelligence collective" - }, - "id": "intelligence_collective" - }, { - "meta": { - "dc:title": "gamification" - }, - "id": "gamification" - }, { - "meta": { - "dc:title": "nouveaux médias" - }, - "id": "nouveaux_medias" - }, { - "meta": { - "dc:title": "world wide web" - }, - "id": "www" - }, { - "meta": { - "dc:title": "hypertexte" - }, - "id": "hypertexte" - }, { - "meta": { - "dc:title": "données liées" - }, - "id": "donnees_liees" - }, { - "meta": { - "dc:title": "données ouvertes" - }, - "id": "donnees_ouvertes" - } - ], - "lists": [ - { - "items": [ - { - "id-ref": "c_3D9A9B5D-E144-4920-A9CA-3C4D26B48425" - } - ], - "meta": { - "dc:contributor": "undefined", - "dc:created": "2012-05-11T15:08:00.342662", - "dc:creator": "undefined", - "id-ref": "c4ff2454-9842-11e1-9f9f-00145ea4a2be", - "dc:title": "Découpages personnels", - "editable": "false", - "dc:modified": "2012-05-11T15:08:00.342662", - "dc:description": "" - }, - "id": "g_5665330A-7789-1E08-13C2-3C4D26B44EAF" - }, { - "items": [ - { - "id-ref": "c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67" - } - ], - "meta": { - "dc:contributor": "undefined", - "dc:created": "2012-05-11T15:08:00.348445", - "dc:creator": "undefined", - "id-ref": "c1a84ff8-e2b0-11e0-8472-00145ea49a02", - "dc:title": "Découpages personnels", - "editable": "false", - "dc:modified": "2012-05-11T15:08:00.348445", - "dc:description": "" - }, - "id": "g_F84E6DE7-FB3E-4672-3E87-3C4B87BA959E" - }, { - - "items": ["s_48D417FA-D34B-C954-05F6-3C4B9392367E", "s_5D30DD53-BE06-49E0-EB72-3C4B99BA0AA4", "s_471A1070-AAD9-32F6-1E1B-3C4D52B5E4B9", "s_2B3C5B17-FB5E-8B99-AEDA-3C4BA2EB4234", "s_7EB7522B-82D7-4FD6-2C5F-3C4D6945539E", "s_2376F9F0-AC9A-229C-9A60-3C4BAEE2D03F", "s_E8C653B6-2B35-B2D6-1040-3C4D75BDF31B", "s_971168A0-A9B3-064D-46B4-3C4D7FA5DFD5", "s_0DB7AABB-3973-9352-95DF-3C4BC3DCFB2D"], - "meta": { - "dc:contributor": "IRI", - "dc:creator": "IRI", - "dc:title": "Bout à bout 2", - "dc:modified": "2012-06-22T17:21:32.514507", - "dc:created": "2012-06-22T17:21:32.514507", - "listtype": "mashup", - "dc:description": "" - }, - "id": "0" - } - ], - "medias": [ - { - "origin": "0", - "url": "bab_files/rsln_jane_mcgonigal.mp4", - "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms": "o=0", - "meta": { - "dc:contributor": "IRI", - "item": { - "name": "streamer", - "value": "rtmp://media.iri.centrepompidou.fr/ddc_player/" - }, - "dc:created": "2011-09-19T13:17:56.656743", - "dc:duration": 4127000, - "dc:creator": "IRI", - "dc:created.contents": "2012-02-13", - "dc:title": "RSLN - Jane McGonigal", - "dc:creator.contents": "IRI", - "dc:modified": "2012-02-13T11:55:33.052583", - "dc:description": "Regards sur le Numérique, 16 septembre 2011, Jane McGonigal. Comment le jeu vidéo va changer le monde ?" - }, - "id": "c1a84ff8-e2b0-11e0-8472-00145ea49a02", - "unit": "ms" - }, { - "origin": "0", - "url": "bab_files/www2012_timbernerslee.mp4", - "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms": "o=0", - "meta": { - "dc:contributor": "IRI", - "item": { - "name": "streamer", - "value": "rtmp://media.iri.centrepompidou.fr/ddc_player/" - }, - "dc:created": "2012-05-07T14:48:22.137437", - "dc:duration": 5245000, - "dc:creator": "IRI", - "dc:created.contents": "2012-05-07", - "dc:title": "WWW 2012 - Tim Berners-Lee", - "dc:creator.contents": "IRI", - "dc:modified": "2012-05-07T17:08:36.018270", - "dc:description": "World Wide Web Conference 2012, Wednesday 18/04, 11:00-12:30, Keynote by Tim Berners-Lee, graduate of Oxford University, inventor of the World Wide Web, an internet-based hypermedia initiative for global information sharing while at CERN, the European Particle Physics Laboratory, in 1989." - }, - "id": "c4ff2454-9842-11e1-9f9f-00145ea4a2be", - "unit": "ms" - } - ], - "meta": { - "dc:contributor": "admin", - "dc:created": "2012-05-11T16:26:53.787298", - "dc:creator": "admin", - "main_media": { - "id-ref": "mashup-001" - }, - "dc:description": "", - "dc:title": "test bout à bout", - "id": "5afd8bbe-9b75-11e1-9e5d-00145ea4a2be", - "dc:modified": "2012-05-11T16:37:30.246796" - }, - "annotations": [ - { - "content": { - "mimetype": "application/x-ldt-structured", - "description": "First Segment from Jane McGonigal", - "img": { - "src": "" - }, - "title": "McGonigal 1", - "color": "16763904", - "polemics": [], - "audio": { - "mimetype": "audio/mp3", - "src": "", - "href": null - } - }, - "begin": 420000, - "meta": { - "dc:contributor": "perso", - "id-ref": "c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67", - "dc:created": "2012-05-11T15:08:00.348480", - "dc:modified": "2012-05-11T15:08:00.348480", - "dc:creator": "perso" - }, - "end": 425000, - "tags": [ - { - "id-ref": "jeux_video" - }, { - "id-ref": "gamification" - } - ], - "color": "16763904", - "media": "c1a84ff8-e2b0-11e0-8472-00145ea49a02", - "id": "s_48D417FA-D34B-C954-05F6-3C4B9392367E" - }, { - "content": { - "mimetype": "application/x-ldt-structured", - "description": "Second segment from Jane McGonigal", - "img": { - "src": "" - }, - "title": "McGonigal 2", - "color": "16763904", - "polemics": [], - "audio": { - "mimetype": "audio/mp3", - "src": "", - "href": null - } - }, - "begin": 980096, - "meta": { - "dc:contributor": "perso", - "id-ref": "c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67", - "dc:created": "2012-05-11T15:08:00.348480", - "dc:modified": "2012-05-11T15:08:00.348480", - "dc:creator": "perso" - }, - "end": 995096, - "tags": [ - { - "id-ref": "nouveaux_medias" - }, { - "id-ref": "intelligence_collective" - } - ], - "color": "16763904", - "media": "c1a84ff8-e2b0-11e0-8472-00145ea49a02", - "id": "s_5D30DD53-BE06-49E0-EB72-3C4B99BA0AA4" - }, { - "content": { - "mimetype": "application/x-ldt-structured", - "description": "Third segment from Jane McGonigal", - "img": { - "src": "" - }, - "title": "McGonigal 3", - "color": "16763904", - "polemics": [], - "audio": { - "mimetype": "audio/mp3", - "src": "", - "href": null - } - }, - "begin": 1833044, - "meta": { - "dc:contributor": "perso", - "id-ref": "c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67", - "dc:created": "2012-05-11T15:08:00.348480", - "dc:modified": "2012-05-11T15:08:00.348480", - "dc:creator": "perso" - }, - "end": 1860044, - "tags": [ - { - "id-ref": "jeux_video" - } - ], - "color": "16763904", - "media": "c1a84ff8-e2b0-11e0-8472-00145ea49a02", - "id": "s_2B3C5B17-FB5E-8B99-AEDA-3C4BA2EB4234" - }, { - "content": { - "mimetype": "application/x-ldt-structured", - "description": "Fourth segment from Jane McGonigal", - "img": { - "src": "" - }, - "title": "McGonigal 4", - "color": "16763904", - "polemics": [], - "audio": { - "mimetype": "audio/mp3", - "src": "", - "href": null - } - }, - "begin": 2436996, - "meta": { - "dc:contributor": "perso", - "id-ref": "c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67", - "dc:created": "2012-05-11T15:08:00.348480", - "dc:modified": "2012-05-11T15:08:00.348480", - "dc:creator": "perso" - }, - "end": 2460096, - "tags": [ - { - "id-ref": "jeux_video" - }, { - "id-ref": "www" - } - ], - "color": "16763904", - "media": "c1a84ff8-e2b0-11e0-8472-00145ea49a02", - "id": "s_2376F9F0-AC9A-229C-9A60-3C4BAEE2D03F" - }, { - "content": { - "mimetype": "application/x-ldt-structured", - "description": "Fifth segment from Jane McGonigal", - "img": { - "src": "" - }, - "title": "McGonigal 5", - "color": "16763904", - "polemics": [], - "audio": { - "mimetype": "audio/mp3", - "src": "", - "href": null - } - }, - "begin": 3240000, - "meta": { - "dc:contributor": "perso", - "id-ref": "c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67", - "dc:created": "2012-05-11T15:08:00.348480", - "dc:modified": "2012-05-11T15:08:00.348480", - "dc:creator": "perso" - }, - "end": 3250000, - "tags": [ - { - "id-ref": "jeux_video" - }, { - "id-ref": "nouveaux_medias" - }, { - "id-ref": "gamification" - } - ], - "color": "16763904", - "media": "c1a84ff8-e2b0-11e0-8472-00145ea49a02", - "id": "s_0DB7AABB-3973-9352-95DF-3C4BC3DCFB2D" - }, { - "content": { - "mimetype": "application/x-ldt-structured", - "description": "First Segment from Tim Berners-Lee", - "img": { - "src": "" - }, - "title": "WWW 1", - "color": "10027008", - "polemics": [], - "audio": { - "mimetype": "audio/mp3", - "src": "", - "href": null - } - }, - "begin": 370000, - "meta": { - "dc:contributor": "perso", - "id-ref": "c_3D9A9B5D-E144-4920-A9CA-3C4D26B48425", - "dc:created": "2012-05-11T15:08:00.342701", - "dc:modified": "2012-05-11T15:08:00.342701", - "dc:creator": "perso" - }, - "end": 380000, - "tags": [ - { - "id-ref": "hypertexte" - }, { - "id-ref": "www" - }, { - "id-ref": "donnees_ouvertes" - }, { - "id-ref": "donnees_liees" - } - ], - "color": "10027008", - "media": "c4ff2454-9842-11e1-9f9f-00145ea4a2be", - "id": "s_471A1070-AAD9-32F6-1E1B-3C4D52B5E4B9" - }, { - "content": { - "mimetype": "application/x-ldt-structured", - "description": "Second Segment from Tim Berners-Lee", - "img": { - "src": "" - }, - "title": "WWW 2", - "color": "13369344", - "polemics": [], - "audio": { - "mimetype": "audio/mp3", - "src": "", - "href": null - } - }, - "begin": 1090000, - "meta": { - "dc:contributor": "perso", - "id-ref": "c_3D9A9B5D-E144-4920-A9CA-3C4D26B48425", - "dc:created": "2012-05-11T15:08:00.342701", - "dc:modified": "2012-05-11T15:08:00.342701", - "dc:creator": "perso" - }, - "end": 1105000, - "tags": null, - "color": "13369344", - "media": "c4ff2454-9842-11e1-9f9f-00145ea4a2be", - "id": "s_7EB7522B-82D7-4FD6-2C5F-3C4D6945539E" - }, { - "content": { - "mimetype": "application/x-ldt-structured", - "description": "Third segment from Tim Berners-Lee", - "img": { - "src": "" - }, - "title": "WWW 3", - "color": "10027008", - "polemics": [], - "audio": { - "mimetype": "audio/mp3", - "src": "", - "href": null - } - }, - "begin": 2030000, - "meta": { - "dc:contributor": "perso", - "id-ref": "c_3D9A9B5D-E144-4920-A9CA-3C4D26B48425", - "dc:created": "2012-05-11T15:08:00.342701", - "dc:modified": "2012-05-11T15:08:00.342701", - "dc:creator": "perso" - }, - "end": 2035000, - "tags": [ - { - "id-ref": "www" - } - ], - "color": "10027008", - "media": "c4ff2454-9842-11e1-9f9f-00145ea4a2be", - "id": "s_E8C653B6-2B35-B2D6-1040-3C4D75BDF31B" - }, { - "content": { - "mimetype": "application/x-ldt-structured", - "description": "Fourth Segment from Tim Berners-Lee", - "img": { - "src": "WWW 4" - }, - "title": "", - "color": "10027008", - "polemics": [], - "audio": { - "mimetype": "audio/mp3", - "src": "", - "href": null - } - }, - "begin": 2922000, - "meta": { - "dc:contributor": "perso", - "id-ref": "c_3D9A9B5D-E144-4920-A9CA-3C4D26B48425", - "dc:created": "2012-05-11T15:08:00.342701", - "dc:modified": "2012-05-11T15:08:00.342701", - "dc:creator": "perso" - }, - "end": 2940000, - "tags": [ - { - "id-ref": "hypertexte" - } - ], - "color": "10027008", - "media": "c4ff2454-9842-11e1-9f9f-00145ea4a2be", - "id": "s_971168A0-A9B3-064D-46B4-3C4D7FA5DFD5" - } - ], - "annotation-types": [ - { - "dc:contributor": "perso", - "dc:creator": "perso", - "dc:title": "Mon découpage", - "id": "c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67", - "dc:created": "2012-05-11T15:08:00.348480", - "dc:description": "", - "dc:modified": "2012-05-11T15:08:00.348480" - }, { - "dc:contributor": "perso", - "dc:creator": "perso", - "dc:title": "Mon découpage", - "id": "c_3D9A9B5D-E144-4920-A9CA-3C4D26B48425", - "dc:created": "2012-05-11T15:08:00.342701", - "dc:description": "", - "dc:modified": "2012-05-11T15:08:00.342701" - } - ], - "mashups": [ - { - "id": "mashup-001", - "meta": { - "dc:title": "Example mashup", - "dc:description": "This is an example mashup" - }, - "segments": ["s_48D417FA-D34B-C954-05F6-3C4B9392367E", "s_5D30DD53-BE06-49E0-EB72-3C4B99BA0AA4", "s_471A1070-AAD9-32F6-1E1B-3C4D52B5E4B9", "s_2B3C5B17-FB5E-8B99-AEDA-3C4BA2EB4234", "s_7EB7522B-82D7-4FD6-2C5F-3C4D6945539E", "s_2376F9F0-AC9A-229C-9A60-3C4BAEE2D03F", "s_E8C653B6-2B35-B2D6-1040-3C4D75BDF31B", "s_971168A0-A9B3-064D-46B4-3C4D7FA5DFD5", "s_0DB7AABB-3973-9352-95DF-3C4BC3DCFB2D"] - } - ] -} \ No newline at end of file diff -r 9409e6ebf891 -r 0cfd113f6a59 metadataplayer/mashup/bab_files/mashup-local.xml --- a/metadataplayer/mashup/bab_files/mashup-local.xml Fri Dec 14 17:15:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ - - - - - - - - - - - - Mon découpage - - - - - <abstract/> - <audio source=""/> - <tags/> - </element> - <element id="s_7EB7522B-82D7-4FD6-2C5F-3C4D6945539E" begin="1090000" dur="15000" author="admin" date="2012-05-11T16:30:39" color="13369344" src=""> - <title/> - <abstract/> - <audio source=""/> - <tags/> - </element> - <element id="s_E8C653B6-2B35-B2D6-1040-3C4D75BDF31B" begin="2030000" dur="5000" author="admin" date="2012-05-11T16:30:36" color="10027008" src=""> - <title/> - <abstract/> - <audio source=""/> - <tags/> - </element> - <element id="s_971168A0-A9B3-064D-46B4-3C4D7FA5DFD5" begin="2922000" dur="18000" author="admin" date="2012-05-11T16:30:33" color="10027008" src=""> - <title/> - <abstract/> - <audio source=""/> - <tags/> - </element> - </elements> - </decoupage> - </ensemble> - </content> - <content id="c1a84ff8-e2b0-11e0-8472-00145ea49a02"> - <ensemble id="g_F84E6DE7-FB3E-4672-3E87-3C4B87BA959E" idProject="5afd8bbe-9b75-11e1-9e5d-00145ea4a2be" title="Découpages personnels" author="undefined" abstract=""> - <decoupage id="c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67" author="perso"> - <title>Mon découpage - - - - - <abstract/> - <audio source=""/> - <tags/> - </element> - <element id="s_5D30DD53-BE06-49E0-EB72-3C4B99BA0AA4" begin="980096" dur="15000" author="admin" date="2012-05-11T16:32:08" color="16763904" src=""> - <title/> - <abstract/> - <audio source=""/> - <tags/> - </element> - <element id="s_2B3C5B17-FB5E-8B99-AEDA-3C4BA2EB4234" begin="1833044" dur="27000" author="admin" date="2012-05-11T16:28:12" color="16763904" src=""> - <title/> - <abstract/> - <audio source=""/> - <tags/> - </element> - <element id="s_2376F9F0-AC9A-229C-9A60-3C4BAEE2D03F" begin="2436996" dur="23100" author="admin" date="2012-05-11T16:28:18" color="16763904" src=""> - <title/> - <abstract/> - <audio source=""/> - <tags/> - </element> - <element id="s_0DB7AABB-3973-9352-95DF-3C4BC3DCFB2D" begin="3240000" dur="10000" author="admin" date="2012-05-11T16:28:26" color="16763904" src=""> - <title/> - <abstract/> - <audio source=""/> - <tags/> - </element> - </elements> - </decoupage> - </ensemble> - </content> - </annotations> - <displays> - <display id="v_33227665-49F3-7111-2BC6-3C4B6E90411C" title="Init view" idsel="c1a84ff8-e2b0-11e0-8472-00145ea49a02" tc="0" zoom="68" scroll="0" infoBAB=""> - <audio source=""/> - <content id="c1a84ff8-e2b0-11e0-8472-00145ea49a02"> - <decoupage idens="g_F84E6DE7-FB3E-4672-3E87-3C4B87BA959E" id="c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67" tagsSelect=""/> - </content> - <content id="c4ff2454-9842-11e1-9f9f-00145ea4a2be"> - <decoupage idens="g_5665330A-7789-1E08-13C2-3C4D26B44EAF" id="c_3D9A9B5D-E144-4920-A9CA-3C4D26B48425" tagsSelect=""/> - </content> - </display> - </displays> - <edits> - <editing id="0" tags=""> - <title>Bout à bout 1 - - - - - - - - - - - - - -
  • - - - -