# HG changeset patch
# User veltr
# Date 1359134189 -3600
# Node ID eefd336335f98ef0516cb0ec44931df02a778527
# Parent 7b65bf78873ad0be5fac0b7f28b94f8eb6ac2146
Some improvements: Hashtags can be used, links are now clickable, ....
diff -r 7b65bf78873a -r eefd336335f9 assets/psd/tooltip.psd
Binary file assets/psd/tooltip.psd has changed
diff -r 7b65bf78873a -r eefd336335f9 src/css/LdtPlayer-core.css
--- a/src/css/LdtPlayer-core.css Thu Jan 17 17:25:46 2013 +0100
+++ b/src/css/LdtPlayer-core.css Fri Jan 25 18:16:29 2013 +0100
@@ -12,4 +12,8 @@
/* font-family: Arial, Helvetica, sans-serif; */
color: black;
font-size: 12px;
-}
\ No newline at end of file
+}
+
+.Ldt-Highlight {
+ background: #ffa0fc;
+}
diff -r 7b65bf78873a -r eefd336335f9 src/js/model.js
--- a/src/js/model.js Thu Jan 17 17:25:46 2013 +0100
+++ b/src/js/model.js Fri Jan 25 18:16:29 2013 +0100
@@ -19,11 +19,12 @@
var uidbase = rand16(8) + "-" + rand16(4) + "-", uidincrement = Math.floor(Math.random()*0x10000);
var charsub = [
- [ 'a', 'á', 'à', 'â', 'ä' ],
- [ 'c', 'ç' ],
- [ 'e', 'é', 'è', 'ê', 'ë' ],
- [ 'i', 'í', 'ì', 'î', 'ï' ],
- [ 'o', 'ó', 'ò', 'ô', 'ö' ]
+ '[aáàâä]',
+ '[cç]',
+ '[eéèêë]',
+ '[iíìîï]',
+ '[oóòôö]',
+ '[uùûü]'
];
var removeChars = [
@@ -71,10 +72,7 @@
remrx = new RegExp(remsrc,"gm"),
txt = _text.toLowerCase().replace(remrx,"")
res = [],
- charsrc = ns._(charsub).map(function(c) {
- return "(" + c.join("|") + ")";
- }),
- charsrx = ns._(charsrc).map(function(c) {
+ charsrx = ns._(charsub).map(function(c) {
return new RegExp(c);
}),
src = "";
@@ -83,7 +81,7 @@
src += remsrc + "*";
}
var l = txt[j];
- ns._(charsrc).each(function(v, k) {
+ ns._(charsub).each(function(v, k) {
l = l.replace(charsrx[k], v);
});
src += l;
@@ -223,7 +221,7 @@
*/
Model.List.prototype.searchByTitle = function(_text, _iexact) {
var _iexact = _iexact || false,
- _rgxp = Model.regexpFromTextOrArray(_text, true);
+ _rgxp = Model.regexpFromTextOrArray(_text, true, _iexact);
return this.filter(function(_element) {
return _rgxp.test(_element.title);
});
@@ -231,7 +229,7 @@
Model.List.prototype.searchByDescription = function(_text, _iexact) {
var _iexact = _iexact || false,
- _rgxp = Model.regexpFromTextOrArray(_text, true);
+ _rgxp = Model.regexpFromTextOrArray(_text, true, _iexact);
return this.filter(function(_element) {
return _rgxp.test(_element.description);
});
@@ -239,7 +237,7 @@
Model.List.prototype.searchByTextFields = function(_text, _iexact) {
var _iexact = _iexact || false,
- _rgxp = Model.regexpFromTextOrArray(_text, true);
+ _rgxp = Model.regexpFromTextOrArray(_text, true, _iexact);
return this.filter(function(_element) {
var keywords = (_element.keywords || _element.getTagTexts() || []).join(", ");
return _rgxp.test(_element.description) || _rgxp.test(_element.title) || _rgxp.test(keywords);
@@ -819,17 +817,6 @@
Model.Mashup.prototype = new Model.Playable();
-Model.Mashup.prototype.checkLoaded = function() {
- var loaded = !!this.segments.length;
- this.getMedias().forEach(function(_m) {
- loaded = loaded && _m.loaded;
- });
- this.loaded = loaded;
- if (loaded) {
- this.trigger("loadedmetadata");
- }
-}
-
Model.Mashup.prototype.updateTimes = function() {
var _time = 0;
this.segments.forEach(function(_segment) {
@@ -1197,3 +1184,6 @@
return Model;
})(IriSP);
+
+/* END model.js */
+
diff -r 7b65bf78873a -r eefd336335f9 src/js/utils.js
--- a/src/js/utils.js Thu Jan 17 17:25:46 2013 +0100
+++ b/src/js/utils.js Fri Jan 25 18:16:29 2013 +0100
@@ -29,6 +29,79 @@
}
}
+IriSP.textFieldHtml = function(_text, _regexp, _extend) {
+ var list = [],
+ positions = [],
+ text = _text.replace(/(^\s+|\s+$)/g,'');
+
+ function addToList(_rx, _startHtml, _endHtml) {
+ while(true) {
+ var result = _rx.exec(text);
+ if (!result) {
+ break;
+ }
+ var end = _rx.lastIndex,
+ start = result.index;
+ list.push({
+ start: start,
+ end: end,
+ startHtml: (typeof _startHtml === "function" ? _startHtml(result) : _startHtml),
+ endHtml: (typeof _endHtml === "function" ? _endHtml(result) : _endHtml)
+ });
+ positions.push(start);
+ positions.push(end);
+ }
+ }
+
+ if (_regexp) {
+ addToList(_regexp, '', '');
+ }
+
+ addToList(/(https?:\/\/)?\w+\.\w+\S+/gm, function(matches) {
+ return ''
+ }, '');
+ addToList(/@([\d\w]{1,15})/gm, function(matches) {
+ return ''
+ }, '');
+ addToList(/\*[^*]+\*/gm, '', '');
+ addToList(/[\n\r]+/gm, '', '
');
+
+ IriSP._(_extend).each(function(x) {
+ addToList.apply(null, x);
+ });
+
+ positions = IriSP._(positions)
+ .chain()
+ .uniq()
+ .sortBy(function(p) { return parseInt(p) })
+ .value();
+
+ var res = "", lastIndex = 0;
+
+ for (var i = 0; i < positions.length; i++) {
+ var pos = positions[i];
+ res += text.substring(lastIndex, pos);
+ for (var j = list.length - 1; j >= 0; j--) {
+ var item = list[j];
+ if (item.start < pos && item.end >= pos) {
+ res += item.endHtml;
+ }
+ }
+ for (var j = 0; j < list.length; j++) {
+ var item = list[j];
+ if (item.start <= pos && item.end > pos) {
+ res += item.startHtml;
+ }
+ }
+ lastIndex = pos;
+ }
+
+ res += text.substring(lastIndex);
+
+ return res;
+
+}
+
IriSP.log = function() {
if (typeof console !== "undefined" && typeof IriSP.logging !== "undefined" && IriSP.logging) {
console.log.apply(console, arguments);
diff -r 7b65bf78873a -r eefd336335f9 src/js/widgets.js
--- a/src/js/widgets.js Thu Jan 17 17:25:46 2013 +0100
+++ b/src/js/widgets.js Fri Jan 25 18:16:29 2013 +0100
@@ -35,8 +35,10 @@
_this[_key] = _value;
});
+ this.$ = IriSP.jQuery('#' + this.container);
+
if (typeof this.width === "undefined") {
- this.width = player.config.width;
+ this.width = this.$.width();
}
/* Setting this.player at the end in case it's been overriden
@@ -45,7 +47,6 @@
this.player = player;
/* Adding classes and html attributes */
- this.$ = IriSP.jQuery('#' + this.container);
this.$.addClass("Ldt-TraceMe Ldt-Widget").attr("widget-type", _type);
this.l10n = (
diff -r 7b65bf78873a -r eefd336335f9 src/widgets/Annotation.css
--- a/src/widgets/Annotation.css Thu Jan 17 17:25:46 2013 +0100
+++ b/src/widgets/Annotation.css Fri Jan 25 18:16:29 2013 +0100
@@ -6,10 +6,6 @@
margin: 0;
}
-.Ldt-Annotation-Highlight {
- background: #ffa0fc;
-}
-
.Ldt-Annotation-Widget.Ldt-Annotation-ShowTop {
border-top-style: solid;
padding-top: 1px;
diff -r 7b65bf78873a -r eefd336335f9 src/widgets/Annotation.js
--- a/src/widgets/Annotation.js Thu Jan 17 17:25:46 2013 +0100
+++ b/src/widgets/Annotation.js Fri Jan 25 18:16:29 2013 +0100
@@ -76,17 +76,12 @@
return;
}
var title = currentAnnotation.title,
- description = currentAnnotation.description.replace(/(^\s+|\s+$)/g,'');
- if (currentAnnotation.found) {
- var rgxp = _this.source.getAnnotations().regexp || /^$/,
- repl = '$1';
- title = title.replace(rgxp,repl);
- description = description.replace(rgxp,repl).replace(/[\n\r]+/gm,'
');
- }
- _this.$.find(".Ldt-Annotation-Title").html(title || "(" + _this.l10n.untitled + ")");
+ description = currentAnnotation.description.replace(/(^\s+|\s+$)/g,''),
+ rx = (currentAnnotation.found ? (_this.source.getAnnotations().regexp || false) : false);
+ _this.$.find(".Ldt-Annotation-Title").html(IriSP.textFieldHtml(title,rx) || "(" + _this.l10n.untitled + ")");
if (description) {
_this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock");
- _this.$.find(".Ldt-Annotation-Description").html(description);
+ _this.$.find(".Ldt-Annotation-Description").html(IriSP.textFieldHtml(description,rx));
} else {
_this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock");
}
@@ -156,7 +151,7 @@
this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget");
}
- this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow" }, "arrow");
+ this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow", width: this.width }, "arrow");
this.onMediaEvent("timeupdate",timeupdate);
this.onMdpEvent("Annotation.hide","hide");
this.onMdpEvent("Annotation.show","show");
diff -r 7b65bf78873a -r eefd336335f9 src/widgets/AnnotationsList.css
--- a/src/widgets/AnnotationsList.css Thu Jan 17 17:25:46 2013 +0100
+++ b/src/widgets/AnnotationsList.css Fri Jan 25 18:16:29 2013 +0100
@@ -28,9 +28,6 @@
.Ldt-AnnotationsList-li.selected {
background-image: url(img/pinstripe-grey.png);
}
-.Ldt-AnnotationsList-highlight {
- background: #FFA0FC;
-}
.Ldt-AnnotationsList-ThumbContainer {
float: left;
width: 80px;
@@ -57,14 +54,25 @@
margin: 2px 2px 0 82px;
font-weight: bold;
}
-h3.Ldt-AnnotationsList-Title a {
+
+.Ldt-AnnotationsList-Title a {
color: #0068c4;
}
+
p.Ldt-AnnotationsList-Description {
margin: 2px 0 2px 82px;
font-size: 12px;
color: #333333;
}
+
+.Ldt-AnnotationsList-Description a {
+ color: #0068c4;
+}
+
+.Ldt-AnnotationsList-Description a:hover {
+ text-decoration: underline; color: #800000;
+}
+
ul.Ldt-AnnotationsList-Tags {
list-style: none;
padding: 0;
diff -r 7b65bf78873a -r eefd336335f9 src/widgets/AnnotationsList.js
--- a/src/widgets/AnnotationsList.js Thu Jan 17 17:25:46 2013 +0100
+++ b/src/widgets/AnnotationsList.js Fri Jan 25 18:16:29 2013 +0100
@@ -71,9 +71,9 @@
+ ''
+ '
{{description}}
' + + '{{{description}}}
' + '{{#tags.length}}' + '