aboutsummaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-09-02 07:58:06 +0200
committerkondou <kondou@ts.unde.re>2013-09-02 07:58:06 +0200
commite5fc7b9dbeb01ac116bb132903c562c8f7d3c5b3 (patch)
treeb7d8d913cdf7f4d1ce42f3027918ad0f5fbe5c3b /core/js
parent8dd93c8c0288a11f04816bea2a58aee661ef9e97 (diff)
parentf038cb9aea7c9a1513ab14d0df002773b17d5333 (diff)
downloadnextcloud-server-e5fc7b9dbeb01ac116bb132903c562c8f7d3c5b3.tar.gz
nextcloud-server-e5fc7b9dbeb01ac116bb132903c562c8f7d3c5b3.zip
Merge branch 'master' into clean_up_util
Conflicts: lib/base.php
Diffstat (limited to 'core/js')
-rw-r--r--core/js/compatibility.js2
-rw-r--r--core/js/config.js4
-rw-r--r--core/js/jquery.ocdialog.js10
-rw-r--r--core/js/js.js2
-rw-r--r--core/js/listview.js4
-rw-r--r--core/js/multiselect.js4
-rw-r--r--core/js/oc-dialogs.js40
-rw-r--r--core/js/oc-vcategories.js2
-rw-r--r--core/js/octemplate.js9
-rw-r--r--core/js/placeholder.js65
-rw-r--r--core/js/router.js2
-rw-r--r--core/js/share.js22
12 files changed, 123 insertions, 43 deletions
diff --git a/core/js/compatibility.js b/core/js/compatibility.js
index b690803ca77..6548f95d42b 100644
--- a/core/js/compatibility.js
+++ b/core/js/compatibility.js
@@ -24,7 +24,7 @@ if (typeof Object.keys !== 'function') {
}
}
return k;
- }
+ };
}
/**
diff --git a/core/js/config.js b/core/js/config.js
index 563df4e6632..52d1c3aee25 100644
--- a/core/js/config.js
+++ b/core/js/config.js
@@ -9,7 +9,7 @@ OC.AppConfig={
getCall:function(action,data,callback){
data.action=action;
$.getJSON(OC.AppConfig.url,data,function(result){
- if(result.status='success'){
+ if(result.status==='success'){
if(callback){
callback(result.data);
}
@@ -19,7 +19,7 @@ OC.AppConfig={
postCall:function(action,data,callback){
data.action=action;
$.post(OC.AppConfig.url,data,function(result){
- if(result.status='success'){
+ if(result.status==='success'){
if(callback){
callback(result.data);
}
diff --git a/core/js/jquery.ocdialog.js b/core/js/jquery.ocdialog.js
index 7413927e3b2..bafbd0e0e9f 100644
--- a/core/js/jquery.ocdialog.js
+++ b/core/js/jquery.ocdialog.js
@@ -13,7 +13,7 @@
this.originalCss = {
display: this.element[0].style.display,
width: this.element[0].style.width,
- height: this.element[0].style.height,
+ height: this.element[0].style.height
};
this.originalTitle = this.element.attr('title');
@@ -152,7 +152,7 @@
content_height -= this.$buttonrow.outerHeight(true);
}
this.parent = this.$dialog.parent().length > 0 ? this.$dialog.parent() : $('body');
- content_height = Math.min(content_height, this.parent.height()-20)
+ content_height = Math.min(content_height, this.parent.height()-20);
this.element.css({
height: content_height + 'px',
width: this.$dialog.innerWidth()-20 + 'px'
@@ -187,7 +187,7 @@
}
},
widget: function() {
- return this.$dialog
+ return this.$dialog;
},
close: function() {
this._destroyOverlay();
@@ -200,10 +200,10 @@
},
destroy: function() {
if(this.$title) {
- this.$title.remove()
+ this.$title.remove();
}
if(this.$buttonrow) {
- this.$buttonrow.remove()
+ this.$buttonrow.remove();
}
if(this.originalTitle) {
diff --git a/core/js/js.js b/core/js/js.js
index d580b6113e6..af4a6d6b336 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -709,7 +709,6 @@ $(document).ready(function(){
});
label.hide();
};
- setShowPassword($('#password'), $('label[for=show]'));
setShowPassword($('#adminpass'), $('label[for=show]'));
setShowPassword($('#pass2'), $('label[for=personal-show]'));
setShowPassword($('#dbpass'), $('label[for=dbpassword]'));
@@ -762,6 +761,7 @@ $(document).ready(function(){
$('.password .action').tipsy({gravity:'se', fade:true, live:true});
$('#upload').tipsy({gravity:'w', fade:true});
$('.selectedActions a').tipsy({gravity:'s', fade:true, live:true});
+ $('a.action.delete').tipsy({gravity:'e', fade:true, live:true});
$('a.action').tipsy({gravity:'s', fade:true, live:true});
$('td .modified').tipsy({gravity:'s', fade:true, live:true});
diff --git a/core/js/listview.js b/core/js/listview.js
index 3a713a6222c..18d0bdeaf7c 100644
--- a/core/js/listview.js
+++ b/core/js/listview.js
@@ -11,11 +11,11 @@ ListView.generateTable=function(collumns){
html+='<thead>';
html+='</head>';
html+='<tbody>';
- html+'<tr class="template">';
+ html+='<tr class="template">';
$.each(collumns,function(index,collumn){
html+='<th class="'+collumn.toLower()+'"</th>';
});
- html+'</tr>';
+ html+='</tr>';
html+='</tbody>';
html='</table>';
return $(html);
diff --git a/core/js/multiselect.js b/core/js/multiselect.js
index 48d521e1856..373fd2d41a2 100644
--- a/core/js/multiselect.js
+++ b/core/js/multiselect.js
@@ -25,7 +25,7 @@
'labels':[],
'oncheck':false,
'onuncheck':false,
- 'minWidth': 'default;',
+ 'minWidth': 'default;'
};
$(this).attr('data-msid', multiSelectId);
$.extend(settings,options);
@@ -200,7 +200,7 @@
return false;
}
var li=$(this).parent();
- var val = $(this).val()
+ var val = $(this).val();
var select=button.parent().next();
if(typeof settings.createCallback === 'function') {
var response = settings.createCallback(select, val);
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 5cbc8359d52..4092b8d0746 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -79,9 +79,15 @@ var OCdialogs = {
title: title
}).data('path', '');
- if (modal === undefined) { modal = false };
- if (multiselect === undefined) { multiselect = false };
- if (mimetype_filter === undefined) { mimetype_filter = '' };
+ if (modal === undefined) {
+ modal = false;
+ }
+ if (multiselect === undefined) {
+ multiselect = false;
+ }
+ if (mimetype_filter === undefined) {
+ mimetype_filter = '';
+ }
$('body').append(self.$filePicker);
@@ -106,7 +112,7 @@ var OCdialogs = {
datapath.push(self.$filePicker.data('path') + '/' + $(element).text());
});
} else {
- var datapath = self.$filePicker.data('path');
+ datapath = self.$filePicker.data('path');
datapath += '/' + self.$filelist.find('.filepicker_element_selected .filename').text();
}
callback(datapath);
@@ -151,7 +157,9 @@ var OCdialogs = {
message: content,
type: dialog_type
});
- if (modal === undefined) { modal = false };
+ if (modal === undefined) {
+ modal = false;
+ }
$('body').append($dlg);
var buttonlist = [];
switch (buttons) {
@@ -159,7 +167,9 @@ var OCdialogs = {
buttonlist = [{
text: t('core', 'Yes'),
click: function(){
- if (callback !== undefined) { callback(true) };
+ if (callback !== undefined) {
+ callback(true);
+ }
$(dialog_id).ocdialog('close');
},
defaultButton: true
@@ -167,7 +177,9 @@ var OCdialogs = {
{
text: t('core', 'No'),
click: function(){
- if (callback !== undefined) { callback(false) };
+ if (callback !== undefined) {
+ callback(false);
+ }
$(dialog_id).ocdialog('close');
}
}];
@@ -175,7 +187,9 @@ var OCdialogs = {
case OCdialogs.OK_BUTTON:
var functionToCall = function() {
$(dialog_id).ocdialog('close');
- if(callback !== undefined) { callback() };
+ if(callback !== undefined) {
+ callback();
+ }
};
buttonlist[0] = {
text: t('core', 'Ok'),
@@ -183,7 +197,7 @@ var OCdialogs = {
defaultButton: true
};
break;
- };
+ }
$(dialog_id).ocdialog({
closeOnEscape: true,
@@ -265,7 +279,7 @@ var OCdialogs = {
var sorted = dirs.concat(others);
$.each(sorted, function(idx, entry) {
- $li = self.$listTmpl.octemplate({
+ var $li = self.$listTmpl.octemplate({
type: entry.type,
dir: dir,
filename: entry.name,
@@ -283,13 +297,13 @@ var OCdialogs = {
*/
_fillSlug: function() {
this.$dirTree.empty();
- var self = this
+ var self = this;
var path = this.$filePicker.data('path');
var $template = $('<span data-dir="{dir}">{name}</span>');
if(path) {
var paths = path.split('/');
$.each(paths, function(index, dir) {
- var dir = paths.pop();
+ dir = paths.pop();
if(dir === '') {
return false;
}
@@ -323,7 +337,7 @@ var OCdialogs = {
$element.toggleClass('filepicker_element_selected');
return;
} else if ( $element.data('type') === 'dir' ) {
- this._fillFilePicker(this.$filePicker.data('path') + '/' + $element.data('entryname'))
+ this._fillFilePicker(this.$filePicker.data('path') + '/' + $element.data('entryname'));
}
}
};
diff --git a/core/js/oc-vcategories.js b/core/js/oc-vcategories.js
index c745dbc5fbd..c297a24680d 100644
--- a/core/js/oc-vcategories.js
+++ b/core/js/oc-vcategories.js
@@ -23,7 +23,7 @@ var OCCategories= {
d.css('cursor', 'wait').find('input,button:not(#category_addbutton)')
.prop('disabled', true).css('cursor', 'wait');
}
- }
+ };
var dlg = $('#edit_categories_dialog').dialog({
modal: true,
height: 350, minHeight:200, width: 250, minWidth: 200,
diff --git a/core/js/octemplate.js b/core/js/octemplate.js
index e69c6cc56e0..46ffa976574 100644
--- a/core/js/octemplate.js
+++ b/core/js/octemplate.js
@@ -60,9 +60,10 @@
var self = this;
if(typeof this.options.escapeFunction === 'function') {
- for (var key = 0; key < this.vars.length; key++) {
- if(typeof this.vars[key] === 'string') {
- this.vars[key] = self.options.escapeFunction(this.vars[key]);
+ var keys = Object.keys(this.vars);
+ for (var key = 0; key < keys.length; key++) {
+ if(typeof this.vars[keys[key]] === 'string') {
+ this.vars[keys[key]] = self.options.escapeFunction(this.vars[keys[key]]);
}
}
}
@@ -85,7 +86,7 @@
}
},
options: {
- escapeFunction: function(str) {return $('<i></i>').text(str).html();}
+ escapeFunction: escapeHTML
}
};
diff --git a/core/js/placeholder.js b/core/js/placeholder.js
new file mode 100644
index 00000000000..16543541cb4
--- /dev/null
+++ b/core/js/placeholder.js
@@ -0,0 +1,65 @@
+/**
+ * ownCloud
+ *
+ * @author Morris Jobke
+ * @copyright 2013 Morris Jobke <morris.jobke@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Adds a background color to the element called on and adds the first character
+ * of the passed in string. This string is also the seed for the generation of
+ * the background color.
+ *
+ * You have following HTML:
+ *
+ * <div id="albumart"></div>
+ *
+ * And call this from Javascript:
+ *
+ * $('#albumart').placeholder('The Album Title');
+ *
+ * Which will result in:
+ *
+ * <div id="albumart" style="background-color: rgb(123, 123, 123); ... ">T</div>
+ *
+ */
+
+(function ($) {
+ $.fn.placeholder = function(seed) {
+ var hash = md5(seed),
+ maxRange = parseInt('ffffffffff', 16),
+ red = parseInt(hash.substr(0,10), 16) / maxRange * 256,
+ green = parseInt(hash.substr(10,10), 16) / maxRange * 256,
+ blue = parseInt(hash.substr(20,10), 16) / maxRange * 256,
+ rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)],
+ height = this.height();
+ this.css('background-color', 'rgb(' + rgb.join(',') + ')');
+
+ // CSS rules
+ this.css('color', 'rgb(255, 255, 255)');
+ this.css('font-weight', 'bold');
+ this.css('text-align', 'center');
+
+ // calculate the height
+ this.css('line-height', height + 'px');
+ this.css('font-size', (height * 0.55) + 'px');
+
+ if(seed !== null && seed.length) {
+ this.html(seed[0].toUpperCase());
+ }
+ };
+}(jQuery));
diff --git a/core/js/router.js b/core/js/router.js
index b94721673a7..44e7c30602e 100644
--- a/core/js/router.js
+++ b/core/js/router.js
@@ -1,4 +1,4 @@
-OC.router_base_url = OC.webroot + '/index.php',
+OC.router_base_url = OC.webroot + '/index.php';
OC.Router = {
// register your ajax requests to load after the loading of the routes
// has finished. otherwise you face problems with race conditions
diff --git a/core/js/share.js b/core/js/share.js
index e7fb26d0ed8..27c16f38b92 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -103,9 +103,9 @@ OC.Share={
var checkReshare = true;
if (typeof OC.Share.statuses[itemSource] === 'undefined') {
// NOTE: Check does not always work and misses some shares, fix later
- checkShares = true;
+ var checkShares = true;
} else {
- checkShares = true;
+ var checkShares = true;
}
$.ajax({type: 'GET', url: OC.filePath('core', 'ajax', 'share.php'), data: { fetch: 'getItem', itemType: itemType, itemSource: itemSource, checkReshare: checkReshare, checkShares: checkShares }, async: false, success: function(result) {
if (result && result.status === 'success') {
@@ -228,23 +228,23 @@ OC.Share={
});
}
$('#shareWith').autocomplete({minLength: 1, source: function(search, response) {
- // if (cache[search.term]) {
- // response(cache[search.term]);
- // } else {
+ // if (cache[search.term]) {
+ // response(cache[search.term]);
+ // } else {
$.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getShareWith', search: search.term, itemShares: OC.Share.itemShares }, function(result) {
if (result.status == 'success' && result.data.length > 0) {
response(result.data);
} else {
// Suggest sharing via email if valid email address
-// var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i);
-// if (pattern.test(search.term)) {
-// response([{label: t('core', 'Share via email:')+' '+search.term, value: {shareType: OC.Share.SHARE_TYPE_EMAIL, shareWith: search.term}}]);
-// } else {
+// var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i);
+// if (pattern.test(search.term)) {
+// response([{label: t('core', 'Share via email:')+' '+search.term, value: {shareType: OC.Share.SHARE_TYPE_EMAIL, shareWith: search.term}}]);
+// } else {
response([t('core', 'No people found')]);
-// }
+// }
}
});
- // }
+ // }
},
focus: function(event, focused) {
event.preventDefault();