Compare commits
No commits in common. "master" and "stable" have entirely different histories.
10 changed files with 54 additions and 115 deletions
|
|
@ -25,7 +25,6 @@ Ox.Request = (function() {
|
||||||
$element;
|
$element;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
async: true,
|
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
bindEvent <f> Bind event
|
bindEvent <f> Bind event
|
||||||
|
|
@ -140,7 +139,6 @@ Ox.Request = (function() {
|
||||||
} else {
|
} else {
|
||||||
pending[req] = true;
|
pending[req] = true;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: Ox.Request.async,
|
|
||||||
beforeSend: function(request) {
|
beforeSend: function(request) {
|
||||||
var csrftoken = Ox.Cookies('csrftoken');
|
var csrftoken = Ox.Cookies('csrftoken');
|
||||||
if (csrftoken) {
|
if (csrftoken) {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
width: function() {
|
width: function() {
|
||||||
var width = self.options.width;
|
var width = self.options.width;
|
||||||
that.css({width: width - 8 + 'px'}); // 2 x 4 px padding
|
that.css({width: width - 8 + 'px'}); // 2 x 4 px padding
|
||||||
self.options.type != 'input' && self.$items.forEach(function($item) {
|
self.options.type == 'textarea' && self.$items.forEach(function($item) {
|
||||||
$item.options({width: width})
|
$item.options({width: width})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ Ox.Editable = function(options, self) {
|
||||||
|
|
||||||
self = self || {};
|
self = self || {};
|
||||||
var that = Ox.Element({
|
var that = Ox.Element({
|
||||||
element: options.type == 'input' ? '<span>' : '<div>',
|
element: options.type == 'textarea' ? '<div>' : '<span>',
|
||||||
tooltip: options.tooltip
|
tooltip: options.tooltip
|
||||||
}, self)
|
}, self)
|
||||||
.defaults({
|
.defaults({
|
||||||
|
|
@ -94,9 +94,7 @@ Ox.Editable = function(options, self) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (self.options.type != 'data') {
|
self.options.value = self.options.value.toString();
|
||||||
self.options.value = self.options.value.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
self.css = {};
|
self.css = {};
|
||||||
self.$value = Ox.Element(self.options.type == 'input' ? '<span>' : '<div>')
|
self.$value = Ox.Element(self.options.type == 'input' ? '<span>' : '<div>')
|
||||||
|
|
@ -161,7 +159,7 @@ Ox.Editable = function(options, self) {
|
||||||
changeOnKeypress: true,
|
changeOnKeypress: true,
|
||||||
element: self.options.type == 'input' ? '<span>' : '<div>',
|
element: self.options.type == 'input' ? '<span>' : '<div>',
|
||||||
style: 'square',
|
style: 'square',
|
||||||
type: getInputType(),
|
type: self.options.type,
|
||||||
value: formatInputValue()
|
value: formatInputValue()
|
||||||
})
|
})
|
||||||
.css(self.css)
|
.css(self.css)
|
||||||
|
|
@ -205,15 +203,14 @@ Ox.Editable = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatInputValue() {
|
function formatInputValue() {
|
||||||
return self.options.unformat
|
return self.options.type == 'input'
|
||||||
? self.options.unformat(self.options.value)
|
? (self.options.unformat || Ox.decodeHTMLEntities)(self.options.value)
|
||||||
: self.options.type == 'input' ? Ox.decodeHTMLEntities(self.options.value)
|
|
||||||
: self.options.value.replace(/<br\/?><br\/?>/g, '\n\n');
|
: self.options.value.replace(/<br\/?><br\/?>/g, '\n\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTestValue() {
|
function formatTestValue() {
|
||||||
var value = Ox.encodeHTMLEntities(
|
var value = Ox.encodeHTMLEntities(
|
||||||
(self.options.type != 'data' && self.options.unformat || Ox.identity)(self.$input.options('value'))
|
(self.options.unformat || Ox.identity)(self.$input.options('value'))
|
||||||
);
|
);
|
||||||
return !value ? ' '
|
return !value ? ' '
|
||||||
: self.options.type == 'input'
|
: self.options.type == 'input'
|
||||||
|
|
@ -250,9 +247,7 @@ Ox.Editable = function(options, self) {
|
||||||
self.$input.value().replace(/\n\n+/g, '\0')
|
self.$input.value().replace(/\n\n+/g, '\0')
|
||||||
).replace(/\0/g, '\n\n').trim();
|
).replace(/\0/g, '\n\n').trim();
|
||||||
return (
|
return (
|
||||||
self.options.type == 'data'
|
self.options.type == 'input'
|
||||||
? JSON.parse(value)
|
|
||||||
: self.options.type == 'input'
|
|
||||||
? Ox.encodeHTMLEntities(value)
|
? Ox.encodeHTMLEntities(value)
|
||||||
: Ox.sanitizeHTML(value, self.options.tags, self.options.globalAttributes)
|
: Ox.sanitizeHTML(value, self.options.tags, self.options.globalAttributes)
|
||||||
);
|
);
|
||||||
|
|
@ -270,7 +265,7 @@ Ox.Editable = function(options, self) {
|
||||||
height = self.options.height || Ox.limit(self.$test.height(), self.minHeight, self.maxHeight);
|
height = self.options.height || Ox.limit(self.$test.height(), self.minHeight, self.maxHeight);
|
||||||
width = self.$test.width();
|
width = self.$test.width();
|
||||||
// +Ox.UI.SCROLLBAR_SIZE to prevent scrollbar from showing up
|
// +Ox.UI.SCROLLBAR_SIZE to prevent scrollbar from showing up
|
||||||
if (self.options.type != 'input') {
|
if (self.options.type == 'textarea') {
|
||||||
width += Ox.UI.SCROLLBAR_SIZE;
|
width += Ox.UI.SCROLLBAR_SIZE;
|
||||||
}
|
}
|
||||||
width = self.options.width || Ox.limit(width, self.minWidth, self.maxWidth);
|
width = self.options.width || Ox.limit(width, self.minWidth, self.maxWidth);
|
||||||
|
|
@ -285,16 +280,12 @@ Ox.Editable = function(options, self) {
|
||||||
width: width,
|
width: width,
|
||||||
height: height
|
height: height
|
||||||
});
|
});
|
||||||
self.$input.find(getInputType()).css({
|
self.$input.find(self.options.type).css({
|
||||||
width: width + 'px',
|
width: width + 'px',
|
||||||
height: height + 'px'
|
height: height + 'px'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInputType() {
|
|
||||||
return self.options.type == 'data' ? 'textarea' : self.options.type
|
|
||||||
}
|
|
||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
self.options.editing = false;
|
self.options.editing = false;
|
||||||
that.removeClass('OxEditing');
|
that.removeClass('OxEditing');
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
self.$widget.options({width: self.options.width});
|
self.$widget.options({width: self.options.width});
|
||||||
}
|
}
|
||||||
self.$annotations.options({
|
self.$annotations.options({
|
||||||
width: isTextType(self.options.type)
|
width: self.options.type == 'text'
|
||||||
? self.options.width + 8
|
? self.options.width + 8
|
||||||
: self.options.width
|
: self.options.width
|
||||||
});
|
});
|
||||||
|
|
@ -284,7 +284,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
clickLink: self.options.clickLink,
|
clickLink: self.options.clickLink,
|
||||||
confirmDeleteDialog: self.options.confirmDeleteDialog,
|
confirmDeleteDialog: self.options.confirmDeleteDialog,
|
||||||
editable: self.options.editable,
|
editable: self.options.editable,
|
||||||
getSortValue: isTextType(self.options.type)
|
getSortValue: self.options.type == 'text'
|
||||||
? function(value) {
|
? function(value) {
|
||||||
return Ox.stripTags(value);
|
return Ox.stripTags(value);
|
||||||
}
|
}
|
||||||
|
|
@ -301,24 +301,8 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
+ Ox.formatDate(item.modified.slice(0, 10), '%B %e, %Y');
|
+ Ox.formatDate(item.modified.slice(0, 10), '%B %e, %Y');
|
||||||
} : '',
|
} : '',
|
||||||
width: self.options.width,
|
width: self.options.width,
|
||||||
maxHeight: isTextType(self.options.type) ? Infinity : void 0,
|
maxHeight: self.options.type == 'text' ? Infinity : void 0,
|
||||||
type: self.options.type == 'data' ? 'data' : self.options.type == 'text' ? 'textarea' : 'input',
|
type: self.options.type == 'text' ? 'textarea' : 'input'
|
||||||
format: self.options.type == 'data' ? function(value) {
|
|
||||||
return Ox.TreeList({
|
|
||||||
data: value,
|
|
||||||
width: self.options.width
|
|
||||||
}).css({
|
|
||||||
minHeight: '256px',
|
|
||||||
});
|
|
||||||
} : self.options.translate ? function(value) {
|
|
||||||
return Ox._(value);
|
|
||||||
} : null,
|
|
||||||
unformat: function(value) {
|
|
||||||
if (self.options.type == 'data') {
|
|
||||||
return JSON.stringify(value, null, " ");
|
|
||||||
}
|
|
||||||
return Ox.decodeHTMLEntities(Ox.stripTags(value));
|
|
||||||
}
|
|
||||||
}, self.options.autocomplete ? {
|
}, self.options.autocomplete ? {
|
||||||
autocomplete: function(value, callback) {
|
autocomplete: function(value, callback) {
|
||||||
self.options.autocomplete(self.options.id, value, callback);
|
self.options.autocomplete(self.options.id, value, callback);
|
||||||
|
|
@ -329,9 +313,14 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
autocompleteSelectHighlight: true,
|
autocompleteSelectHighlight: true,
|
||||||
autocompleteSelectMaxWidth: 256,
|
autocompleteSelectMaxWidth: 256,
|
||||||
autocompleteSelectOffset: {left: 0, top: 0},
|
autocompleteSelectOffset: {left: 0, top: 0},
|
||||||
autocompleteSelectUpdate: true
|
autocompleteSelectUpdate: true,
|
||||||
} : {
|
format: self.options.translate ? function(value) {
|
||||||
}))
|
return Ox._(value);
|
||||||
|
} : null,
|
||||||
|
unformat: function(value) {
|
||||||
|
return Ox.decodeHTMLEntities(Ox.stripTags(value));
|
||||||
|
}
|
||||||
|
} : {}))
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
add: function(data) {
|
add: function(data) {
|
||||||
if (self.editing) {
|
if (self.editing) {
|
||||||
|
|
@ -559,8 +548,8 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
|
|
||||||
function getSort() {
|
function getSort() {
|
||||||
return ({
|
return ({
|
||||||
duration: ['-duration', '+in', isTextType(self.options.type) ? '+created' : '+value'],
|
duration: ['-duration', '+in', self.options.type == 'text' ? '+created' : '+value'],
|
||||||
position: ['+in', '+duration', isTextType(self.options.type) ? '+created' : '+value'],
|
position: ['+in', '+duration', self.options.type == 'text' ? '+created' : '+value'],
|
||||||
text: ['+value', '+in', '+duration'],
|
text: ['+value', '+in', '+duration'],
|
||||||
created: ['+created', '+in', '+duration', '+value']
|
created: ['+created', '+in', '+duration', '+value']
|
||||||
})[self.options.sort];
|
})[self.options.sort];
|
||||||
|
|
@ -571,10 +560,6 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
&& !!item[self.options.type].type;
|
&& !!item[self.options.type].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isTextType(type) {
|
|
||||||
return ['text', 'data'].includes(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeAnnotation(data) {
|
function removeAnnotation(data) {
|
||||||
var item;
|
var item;
|
||||||
self.editing = false;
|
self.editing = false;
|
||||||
|
|
|
||||||
|
|
@ -247,13 +247,13 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
if (annotation && folder) {
|
if (annotation && folder) {
|
||||||
key = folder.options('id');
|
key = folder.options('id');
|
||||||
type = folder.options('type');
|
type = folder.options('type');
|
||||||
value = type == 'data' ? '' : annotation.entity ? annotation.entity.name : annotation.value;
|
value = annotation.entity ? annotation.entity.name : annotation.value;
|
||||||
isEditable = annotation.editable;
|
isEditable = annotation.editable;
|
||||||
isEntity = !!annotation.entity;
|
isEntity = !!annotation.entity;
|
||||||
isEvent = type == 'event';
|
isEvent = type == 'event';
|
||||||
isPlace = type == 'place';
|
isPlace = type == 'place';
|
||||||
isEventOrPlace = isEvent || isPlace;
|
isEventOrPlace = isEvent || isPlace;
|
||||||
isString = type != 'text' && type != 'data';
|
isString = type != 'text';
|
||||||
// fixme: absence of annotation[type] may be an error
|
// fixme: absence of annotation[type] may be an error
|
||||||
isDefined = isEventOrPlace && !!annotation[type] && !!annotation[type].type;
|
isDefined = isEventOrPlace && !!annotation[type] && !!annotation[type].type;
|
||||||
annotationTitle = folder.options('item') + ': "' + Ox.stripTags(value) + '"';
|
annotationTitle = folder.options('item') + ': "' + Ox.stripTags(value) + '"';
|
||||||
|
|
|
||||||
|
|
@ -1069,16 +1069,10 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
if (query.length) {
|
if (query.length) {
|
||||||
query = query.toLowerCase();
|
query = query.toLowerCase();
|
||||||
results = self.annotations.filter(function(annotation) {
|
results = self.annotations.filter(function(annotation) {
|
||||||
let value = annotation.value
|
return Ox.contains(['*', annotation.layer], self.options.findLayer)
|
||||||
if (!value.toLowerCase && value.toString) {
|
&& Ox.decodeHTMLEntities(Ox.stripTags(
|
||||||
value = value.toString()
|
annotation.value.toLowerCase()
|
||||||
}
|
)).indexOf(query) > -1;
|
||||||
if (value.toLowerCase) {
|
|
||||||
return Ox.contains(['*', annotation.layer], self.options.findLayer)
|
|
||||||
&& Ox.decodeHTMLEntities(Ox.stripTags(
|
|
||||||
value.toLowerCase()
|
|
||||||
)).indexOf(query) > -1;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
|
@ -1125,9 +1119,6 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
Ox.forEach(layer.items, function(item) {
|
Ox.forEach(layer.items, function(item) {
|
||||||
if (item.id == annotationId) {
|
if (item.id == annotationId) {
|
||||||
value = item.value;
|
value = item.value;
|
||||||
if (!value.toLowerCase && value.toString) {
|
|
||||||
value = value.toString()
|
|
||||||
}
|
|
||||||
found = true;
|
found = true;
|
||||||
return false; // break
|
return false; // break
|
||||||
}
|
}
|
||||||
|
|
@ -1285,15 +1276,9 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
var words = [];
|
var words = [];
|
||||||
Ox.forEach(Ox.count(Ox.words(
|
Ox.forEach(Ox.count(Ox.words(
|
||||||
self.annotations.map(function(annotation) {
|
self.annotations.map(function(annotation) {
|
||||||
let value = annotation.value
|
return Ox.decodeHTMLEntities(
|
||||||
if (!value.toLowerCase && value.toString) {
|
Ox.stripTags(annotation.value.toLowerCase())
|
||||||
value = value.toString()
|
);
|
||||||
}
|
|
||||||
if (value.toLowerCase) {
|
|
||||||
return Ox.decodeHTMLEntities(
|
|
||||||
Ox.stripTags(value.toLowerCase())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}).join(' ')
|
}).join(' ')
|
||||||
)), function(count, value) {
|
)), function(count, value) {
|
||||||
words.push({count: count, value: value});
|
words.push({count: count, value: value});
|
||||||
|
|
@ -1446,12 +1431,11 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
position: self.options.position
|
position: self.options.position
|
||||||
});
|
});
|
||||||
if (self.editing && self.options.selected.length && self.options.selected[0] != '_') {
|
if (self.editing && self.options.selected.length && self.options.selected[0] != '_') {
|
||||||
let value = $('.OxEditableElement input:visible').val()
|
|
||||||
that.triggerEvent('editannotation', {
|
that.triggerEvent('editannotation', {
|
||||||
id: self.options.selected,
|
id: self.options.selected,
|
||||||
'in': self.options['in'],
|
'in': self.options['in'],
|
||||||
out: self.options.out,
|
out: self.options.out,
|
||||||
value: value
|
value: $('.OxEditableElement input:visible').val()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1584,9 +1568,6 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
}
|
}
|
||||||
data['in'] = self.options['in'];
|
data['in'] = self.options['in'];
|
||||||
data.out = self.options.out;
|
data.out = self.options.out;
|
||||||
if (data.layer == 'data' && Ox.isString(data.value)) {
|
|
||||||
data.value = JSON.parse(data.value)
|
|
||||||
}
|
|
||||||
that.triggerEvent('editannotation', data);
|
that.triggerEvent('editannotation', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -399,7 +399,6 @@ Ox.VideoElement = function(options, self) {
|
||||||
}
|
}
|
||||||
if (video.currentTime == in_) {
|
if (video.currentTime == in_) {
|
||||||
Ox.Log('Video', 'sCV', 'already at position');
|
Ox.Log('Video', 'sCV', 'already at position');
|
||||||
that.triggerEvent('seeked');
|
|
||||||
ready();
|
ready();
|
||||||
} else {
|
} else {
|
||||||
self.$video.one('seeked', function() {
|
self.$video.one('seeked', function() {
|
||||||
|
|
|
||||||
|
|
@ -519,13 +519,9 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
.css(getVideoCSS(
|
.css(getVideoCSS(
|
||||||
self.$poster[0].width,
|
self.$poster[0].width,
|
||||||
self.$poster[0].height
|
self.$poster[0].height
|
||||||
));
|
))
|
||||||
if (Ox.isUndefined(self.posterIsVisible) && self.options.paused) {
|
.show();
|
||||||
self.$poster.show()
|
self.posterIsVisible = true;
|
||||||
self.posterIsVisible = true;
|
|
||||||
} else {
|
|
||||||
hidePoster()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.appendTo(self.$videoContainer);
|
.appendTo(self.$videoContainer);
|
||||||
|
|
@ -2776,7 +2772,6 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
if (!self.options.paused) {
|
if (!self.options.paused) {
|
||||||
self.playOnLoad = true;
|
self.playOnLoad = true;
|
||||||
togglePaused('button');
|
togglePaused('button');
|
||||||
hidePoster();
|
|
||||||
}
|
}
|
||||||
self.loadedMetadata = false;
|
self.loadedMetadata = false;
|
||||||
showLoadingIcon();
|
showLoadingIcon();
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ Ox.Dialog = function(options, self) {
|
||||||
var that = Ox.Element({}, self)
|
var that = Ox.Element({}, self)
|
||||||
.defaults({
|
.defaults({
|
||||||
buttons: [],
|
buttons: [],
|
||||||
borderless: false,
|
|
||||||
controlsBottom: [],
|
controlsBottom: [],
|
||||||
controlsTop: [],
|
controlsTop: [],
|
||||||
closeButton: false,
|
closeButton: false,
|
||||||
|
|
@ -74,7 +73,7 @@ Ox.Dialog = function(options, self) {
|
||||||
.appendTo(Ox.Fullscreen.element ? Ox.Fullscreen.element : Ox.$body);
|
.appendTo(Ox.Fullscreen.element ? Ox.Fullscreen.element : Ox.$body);
|
||||||
|
|
||||||
self.hasButtons = !!self.options.buttons.length;
|
self.hasButtons = !!self.options.buttons.length;
|
||||||
self.barsHeight = !self.options.borderless*24 + 24 * self.hasButtons;
|
self.barsHeight = 24 + 24 * self.hasButtons;
|
||||||
self.initialMaxHeight = self.options.maxHeight;
|
self.initialMaxHeight = self.options.maxHeight;
|
||||||
self.initialMaxWidth = self.options.maxWidth;
|
self.initialMaxWidth = self.options.maxWidth;
|
||||||
self.titleMargin = 8 + (self.options.closeButton ? 20 : 0)
|
self.titleMargin = 8 + (self.options.closeButton ? 20 : 0)
|
||||||
|
|
@ -95,9 +94,7 @@ Ox.Dialog = function(options, self) {
|
||||||
size: 24
|
size: 24
|
||||||
})
|
})
|
||||||
.addClass('OxTitlebar')
|
.addClass('OxTitlebar')
|
||||||
if (!self.options.borderless) {
|
.appendTo(that);
|
||||||
self.$titlebar.appendTo(that);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.options.closeButton) {
|
if (self.options.closeButton) {
|
||||||
self.$closeButton = Ox.Button({
|
self.$closeButton = Ox.Button({
|
||||||
|
|
@ -608,13 +605,6 @@ Ox.Dialog = function(options, self) {
|
||||||
borderBottomRightRadius: '8px'
|
borderBottomRightRadius: '8px'
|
||||||
})
|
})
|
||||||
.appendTo(that);
|
.appendTo(that);
|
||||||
if (self.options.borderless) {
|
|
||||||
self.$content.css({
|
|
||||||
top: 0,
|
|
||||||
borderTopLeftRadius: '8px',
|
|
||||||
borderTopRightRadius: '8px'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
!isImage && self.$content.append(
|
!isImage && self.$content.append(
|
||||||
self.options.content.css(self.hasButtons ? {} : {
|
self.options.content.css(self.hasButtons ? {} : {
|
||||||
borderBottomLeftRadius: '8px',
|
borderBottomLeftRadius: '8px',
|
||||||
|
|
|
||||||
|
|
@ -80,13 +80,13 @@ def build_oxjs(downloads=False, geo=False):
|
||||||
path = source_path + 'UI/svg/'
|
path = source_path + 'UI/svg/'
|
||||||
for filename in [filename for filename in os.listdir(path) if not filename[0] in '._']:
|
for filename in [filename for filename in os.listdir(path) if not filename[0] in '._']:
|
||||||
svg = read_text(path + filename)
|
svg = read_text(path + filename)
|
||||||
svg = re.sub(r'\n\s*', '', svg)
|
svg = re.sub('\n\s*', '', svg)
|
||||||
svg = re.sub(r'<!--.+?-->', '', svg)
|
svg = re.sub('<!--.+?-->', '', svg)
|
||||||
# end fix
|
# end fix
|
||||||
ui_images[filename[:-4]] = svg
|
ui_images[filename[:-4]] = svg
|
||||||
if filename.startswith('symbolLoading'):
|
if filename.startswith('symbolLoading'):
|
||||||
for theme in themes:
|
for theme in themes:
|
||||||
theme_svg = re.sub(r'#808080', format_hex(theme_data[theme]['symbolDefaultColor']), svg)
|
theme_svg = re.sub('#808080', format_hex(theme_data[theme]['symbolDefaultColor']), svg)
|
||||||
write_file('%sUI/themes/%s/svg/%s' % (dev_path, theme, filename), theme_svg)
|
write_file('%sUI/themes/%s/svg/%s' % (dev_path, theme, filename), theme_svg)
|
||||||
write_file('%sUI/themes/%s/svg/%s' % (min_path, theme, filename), theme_svg)
|
write_file('%sUI/themes/%s/svg/%s' % (min_path, theme, filename), theme_svg)
|
||||||
|
|
||||||
|
|
@ -101,10 +101,10 @@ def build_oxjs(downloads=False, geo=False):
|
||||||
and (geo or '/Geo/' not in path):
|
and (geo or '/Geo/' not in path):
|
||||||
# write copies in min path
|
# write copies in min path
|
||||||
source = os.path.join(path, filename)
|
source = os.path.join(path, filename)
|
||||||
is_jquery = re.search(r'^jquery-[\d\.]+\.js$', filename)
|
is_jquery = re.search('^jquery-[\d\.]+\.js$', filename)
|
||||||
is_jquery_min = re.search(r'^jquery-[\d\.]+\.min\.js$', filename)
|
is_jquery_min = re.search('^jquery-[\d\.]+\.min\.js$', filename)
|
||||||
is_jquery_plugin = re.search(r'^jquery\..*?\.js$', filename)
|
is_jquery_plugin = re.search('^jquery\..*?\.js$', filename)
|
||||||
is_jsonc = re.search(r'\.jsonc$', filename)
|
is_jsonc = re.search('\.jsonc$', filename)
|
||||||
if is_jquery or is_jquery_min:
|
if is_jquery or is_jquery_min:
|
||||||
target = os.path.join(path.replace(source_path, min_path), 'jquery.js')
|
target = os.path.join(path.replace(source_path, min_path), 'jquery.js')
|
||||||
else:
|
else:
|
||||||
|
|
@ -113,7 +113,7 @@ def build_oxjs(downloads=False, geo=False):
|
||||||
ui_files['dev'].append(target.replace(min_path, ''))
|
ui_files['dev'].append(target.replace(min_path, ''))
|
||||||
ui_files['min'].append(target.replace(min_path, ''))
|
ui_files['min'].append(target.replace(min_path, ''))
|
||||||
if '/Ox/js/' not in source and '/UI/js/' not in source and not is_jquery:
|
if '/Ox/js/' not in source and '/UI/js/' not in source and not is_jquery:
|
||||||
if re.match(r'^Ox\..+\.js$', filename) or is_jsonc:
|
if re.match('^Ox\..+\.js$', filename) or is_jsonc:
|
||||||
js = read_text(source)
|
js = read_text(source)
|
||||||
print('minifiy and write', filename, target)
|
print('minifiy and write', filename, target)
|
||||||
write_file(target, ox.js.minify(js, '' if is_jsonc else comment))
|
write_file(target, ox.js.minify(js, '' if is_jsonc else comment))
|
||||||
|
|
@ -129,7 +129,7 @@ def build_oxjs(downloads=False, geo=False):
|
||||||
if not is_jquery_min:
|
if not is_jquery_min:
|
||||||
write_link(link_source, link_target)
|
write_link(link_source, link_target)
|
||||||
# locales
|
# locales
|
||||||
match = re.search(r'/(\w+)/json/locale.(\w+).json', source)
|
match = re.search('/(\w+)/json/locale.(\w+).json', source)
|
||||||
if match:
|
if match:
|
||||||
module = match.group(1)
|
module = match.group(1)
|
||||||
locale = match.group(2)
|
locale = match.group(2)
|
||||||
|
|
@ -182,12 +182,12 @@ def build_oxjs(downloads=False, geo=False):
|
||||||
if not js_dir + filename in sum(ox_files, []):
|
if not js_dir + filename in sum(ox_files, []):
|
||||||
ox_files[-1].append(js_dir + filename)
|
ox_files[-1].append(js_dir + filename)
|
||||||
js = re.sub(
|
js = re.sub(
|
||||||
r'Ox.LOCALES = \{\}',
|
'Ox.LOCALES = \{\}',
|
||||||
'Ox.LOCALES = ' + json.dumps(locales, indent=4, sort_keys=True),
|
'Ox.LOCALES = ' + json.dumps(locales, indent=4, sort_keys=True),
|
||||||
js
|
js
|
||||||
)
|
)
|
||||||
js = re.sub(
|
js = re.sub(
|
||||||
r"Ox.VERSION = '([\d\.]+)'",
|
"Ox.VERSION = '([\d\.]+)'",
|
||||||
"Ox.VERSION = '%s'" % version,
|
"Ox.VERSION = '%s'" % version,
|
||||||
js
|
js
|
||||||
)
|
)
|
||||||
|
|
@ -238,7 +238,7 @@ def build_oxjs(downloads=False, geo=False):
|
||||||
data = {
|
data = {
|
||||||
# sum(list, []) is flatten
|
# sum(list, []) is flatten
|
||||||
'documentation': sorted(sum(ox_files, [])) + sorted(list(filter(
|
'documentation': sorted(sum(ox_files, [])) + sorted(list(filter(
|
||||||
lambda x: re.search(r'\.js$', x),
|
lambda x: re.search('\.js$', x),
|
||||||
ui_files['dev']
|
ui_files['dev']
|
||||||
)) + ['%s/%s.js' % (x, x) for x in ['Geo', 'Image', 'Unicode']]),
|
)) + ['%s/%s.js' % (x, x) for x in ['Geo', 'Image', 'Unicode']]),
|
||||||
'examples': sorted(sum(map(
|
'examples': sorted(sum(map(
|
||||||
|
|
@ -250,7 +250,7 @@ def build_oxjs(downloads=False, geo=False):
|
||||||
)
|
)
|
||||||
)),
|
)),
|
||||||
list(filter(
|
list(filter(
|
||||||
lambda x: not re.search(r'^[._]', x),
|
lambda x: not re.search('^[._]', x),
|
||||||
os.listdir(root_path + 'examples/')
|
os.listdir(root_path + 'examples/')
|
||||||
))
|
))
|
||||||
), [])) if os.path.exists(root_path + 'examples/') else (),
|
), [])) if os.path.exists(root_path + 'examples/') else (),
|
||||||
|
|
@ -264,7 +264,7 @@ def build_oxjs(downloads=False, geo=False):
|
||||||
'title': get_title(root_path + 'readme/' + x)
|
'title': get_title(root_path + 'readme/' + x)
|
||||||
},
|
},
|
||||||
filter(
|
filter(
|
||||||
lambda x: not re.search(r'^[._]', x) and re.search(r'\.html$', x),
|
lambda x: not re.search('^[._]', x) and re.search('\.html$', x),
|
||||||
os.listdir(root_path + 'readme/')
|
os.listdir(root_path + 'readme/')
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
|
@ -355,7 +355,7 @@ def parse_css(css, values):
|
||||||
) for vals in value]
|
) for vals in value]
|
||||||
)
|
)
|
||||||
return string
|
return string
|
||||||
return re.sub(r'\$(\w+)(\[\d+\])?', sub, css)
|
return re.sub('\$(\w+)(\[\d+\])?', sub, css)
|
||||||
|
|
||||||
def read_file(file):
|
def read_file(file):
|
||||||
print('reading', file)
|
print('reading', file)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue