mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-04 18:29:40 +02:00
Cosmetics: death to tabs
The refactoring I've been doing has reminded me of my strong preference for spaces, and I feel inclined to impose my will on the tree.
This commit is contained in:
parent
8a750c3e87
commit
ef4d366060
304 changed files with 30876 additions and 30875 deletions
|
@ -1,4 +1,4 @@
|
|||
// vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab:
|
||||
// vim:set softtabstop=4 shiftwidth=4 expandtab:
|
||||
//
|
||||
// Copyright 2001 - 2013 Ampache.org
|
||||
//
|
||||
|
@ -17,64 +17,64 @@
|
|||
|
||||
// Some cutesy flashing thing while we run
|
||||
Ajax.Responders.register({
|
||||
onCreate: function(){
|
||||
$('ajax-loading').style.display = 'block';
|
||||
},
|
||||
onComplete: function() {
|
||||
$('ajax-loading').style.display = 'none';
|
||||
}
|
||||
onCreate: function(){
|
||||
$('ajax-loading').style.display = 'block';
|
||||
},
|
||||
onComplete: function() {
|
||||
$('ajax-loading').style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// ajaxPost
|
||||
// Post the contents of a form.
|
||||
function ajaxPost(url, input, source) {
|
||||
if ($(source)) {
|
||||
Event.stopObserving(source, 'click', function() { ajaxPost(url, input, source); });
|
||||
}
|
||||
if ($(source)) {
|
||||
Event.stopObserving(source, 'click', function() { ajaxPost(url, input, source); });
|
||||
}
|
||||
|
||||
new Ajax.Request(url, {
|
||||
method: 'post',
|
||||
parameters: $(input).serialize(true),
|
||||
onSuccess: processContents
|
||||
});
|
||||
new Ajax.Request(url, {
|
||||
method: 'post',
|
||||
parameters: $(input).serialize(true),
|
||||
onSuccess: processContents
|
||||
});
|
||||
} // ajaxPost
|
||||
|
||||
// ajaxPut
|
||||
// Get response from the specified URL.
|
||||
function ajaxPut(url, source) {
|
||||
if ($(source)) {
|
||||
Event.stopObserving(source, 'click', function(){ ajaxPut(url, source); });
|
||||
}
|
||||
if ($(source)) {
|
||||
Event.stopObserving(source, 'click', function(){ ajaxPut(url, source); });
|
||||
}
|
||||
|
||||
new Ajax.Request(url, {
|
||||
method: 'put',
|
||||
onSuccess: processContents
|
||||
});
|
||||
new Ajax.Request(url, {
|
||||
method: 'put',
|
||||
onSuccess: processContents
|
||||
});
|
||||
} // ajaxPut
|
||||
|
||||
// ajaxState
|
||||
// Post the contents of a form without doing any observe() things.
|
||||
function ajaxState(url, input) {
|
||||
new Ajax.Request(url, {
|
||||
method: 'post',
|
||||
parameters: $(input).serialize(true),
|
||||
onSuccess: processContents
|
||||
});
|
||||
new Ajax.Request(url, {
|
||||
method: 'post',
|
||||
parameters: $(input).serialize(true),
|
||||
onSuccess: processContents
|
||||
});
|
||||
} // ajaxState
|
||||
|
||||
|
||||
// processContents
|
||||
// Iterate over a response and do any updates we received.
|
||||
function processContents(transport) {
|
||||
$A(transport.responseXML.getElementsByTagName('content')).each(updateElement);
|
||||
$A(transport.responseXML.getElementsByTagName('content')).each(updateElement);
|
||||
} // processContents
|
||||
|
||||
// updateElement
|
||||
// This isn't an anonymous function because I'm ornery. Does the actual
|
||||
// updates for processContents.
|
||||
function updateElement(contentXML) {
|
||||
var newID = contentXML.getAttribute('div');
|
||||
if($(newID)) {
|
||||
$(newID).update(contentXML.firstChild.nodeValue);
|
||||
}
|
||||
var newID = contentXML.getAttribute('div');
|
||||
if($(newID)) {
|
||||
$(newID).update(contentXML.firstChild.nodeValue);
|
||||
}
|
||||
} // updateElement
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab:
|
||||
// vim:set softtabstop=4 shiftwidth=4 expandtab:
|
||||
//
|
||||
// Copyright 2001 - 2013 Ampache.org
|
||||
// All rights reserved.
|
||||
|
@ -32,34 +32,34 @@ function flipField(field) {
|
|||
// updateText
|
||||
// Changes the specified elements innards. Used for the catalog mojo fluff.
|
||||
function updateText(field, value) {
|
||||
$(field).innerHTML = value;
|
||||
$(field).innerHTML = value;
|
||||
} // updateText
|
||||
|
||||
// toggleVisible
|
||||
// Toggles display type between block and none. Used for ajax loading div.
|
||||
function toggleVisible(element) {
|
||||
|
||||
if ($(element).style.display == 'block') {
|
||||
$(element).style.display = 'none';
|
||||
}
|
||||
else {
|
||||
$(element).style.display = 'block';
|
||||
}
|
||||
if ($(element).style.display == 'block') {
|
||||
$(element).style.display = 'none';
|
||||
}
|
||||
else {
|
||||
$(element).style.display = 'block';
|
||||
}
|
||||
} // toggleVisible
|
||||
|
||||
// delayRun
|
||||
// This function delays the run of another function by X milliseconds
|
||||
function delayRun(element, time, method, page, source) {
|
||||
|
||||
var function_string = method + '(\'' + page + '\',\'' + source + '\')';
|
||||
var function_string = method + '(\'' + page + '\',\'' + source + '\')';
|
||||
|
||||
var action = function () { eval(function_string); };
|
||||
var action = function () { eval(function_string); };
|
||||
|
||||
if (element.zid) {
|
||||
clearTimeout(element.zid);
|
||||
}
|
||||
if (element.zid) {
|
||||
clearTimeout(element.zid);
|
||||
}
|
||||
|
||||
element.zid = setTimeout(action, time);
|
||||
element.zid = setTimeout(action, time);
|
||||
|
||||
} // delayRun
|
||||
|
||||
|
@ -69,21 +69,21 @@ function delayRun(element, time, method, page, source) {
|
|||
// Localplay, which don't actually prompt for a new file
|
||||
function reloadUtil(target) {
|
||||
|
||||
if (navigator.appName == 'Opera') {
|
||||
$('util_iframe').contentWindow.location.reload(true);
|
||||
}
|
||||
else if (navigator.appName == 'Konqueror') {
|
||||
$('util_iframe').contentDocument.location.reload(true);
|
||||
}
|
||||
else {
|
||||
$('util_iframe').src = $('util_iframe').src;
|
||||
}
|
||||
if (navigator.appName == 'Opera') {
|
||||
$('util_iframe').contentWindow.location.reload(true);
|
||||
}
|
||||
else if (navigator.appName == 'Konqueror') {
|
||||
$('util_iframe').contentDocument.location.reload(true);
|
||||
}
|
||||
else {
|
||||
$('util_iframe').src = $('util_iframe').src;
|
||||
}
|
||||
} // reloadUtil
|
||||
|
||||
// reloadRedirect
|
||||
// Send them elsewhere
|
||||
function reloadRedirect(target) {
|
||||
window.location = target;
|
||||
window.location = target;
|
||||
} // reloadRedirect
|
||||
|
||||
// popupWindow
|
||||
|
@ -96,10 +96,10 @@ function popupWindow(url) {
|
|||
// This is kind of ugly. Let's not mess with it too much.
|
||||
function check_inline_song_edit(type, song) {
|
||||
var target = type + '_select_' + song;
|
||||
if ($(target).options[$(target).selectedIndex].value == -1) {
|
||||
$(target).innerHTML = '<input type="textbox" name="' + type + '_name" value="New ' + type + '" />';
|
||||
} else {
|
||||
$(target).innerHTML = '';
|
||||
}
|
||||
if ($(target).options[$(target).selectedIndex].value == -1) {
|
||||
$(target).innerHTML = '<input type="textbox" name="' + type + '_name" value="New ' + type + '" />';
|
||||
} else {
|
||||
$(target).innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
|
@ -23,21 +23,21 @@
|
|||
require_once '../init.php';
|
||||
|
||||
function arrayToJSON($array) {
|
||||
$json = '{ ';
|
||||
foreach ($array as $key => $value) {
|
||||
$json .= '"' . $key . '" : ';
|
||||
if (is_array($value)) {
|
||||
$json .= arrayToJSON($value);
|
||||
}
|
||||
else {
|
||||
// Make sure to strip backslashes and convert things to
|
||||
// entities in our output
|
||||
$json .= '"' . scrub_out(str_replace('\\', '', $value)) . '"';
|
||||
}
|
||||
$json .= ' , ';
|
||||
}
|
||||
$json = rtrim($json, ', ');
|
||||
return $json . ' }';
|
||||
$json = '{ ';
|
||||
foreach ($array as $key => $value) {
|
||||
$json .= '"' . $key . '" : ';
|
||||
if (is_array($value)) {
|
||||
$json .= arrayToJSON($value);
|
||||
}
|
||||
else {
|
||||
// Make sure to strip backslashes and convert things to
|
||||
// entities in our output
|
||||
$json .= '"' . scrub_out(str_replace('\\', '', $value)) . '"';
|
||||
}
|
||||
$json .= ' , ';
|
||||
}
|
||||
$json = rtrim($json, ', ');
|
||||
return $json . ' }';
|
||||
}
|
||||
|
||||
Header('content-type: application/x-javascript');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab:
|
||||
// vim:set softtabstop=4 shiftwidth=4 expandtab:
|
||||
//
|
||||
// Copyright 2010 - 2013 Ampache.org
|
||||
// All rights reserved.
|
||||
|
@ -21,148 +21,148 @@ var rowIter = 1;
|
|||
var rowCount = 0;
|
||||
|
||||
var SearchRow = {
|
||||
add: function(ruleType, operator, input) {
|
||||
if (typeof(ruleType) != 'string') {
|
||||
ruleType = 0;
|
||||
}
|
||||
else {
|
||||
types.each(function(i) {
|
||||
if (i.value.name == ruleType) {
|
||||
ruleType = i.key;
|
||||
throw $break;
|
||||
}
|
||||
});
|
||||
}
|
||||
add: function(ruleType, operator, input) {
|
||||
if (typeof(ruleType) != 'string') {
|
||||
ruleType = 0;
|
||||
}
|
||||
else {
|
||||
types.each(function(i) {
|
||||
if (i.value.name == ruleType) {
|
||||
ruleType = i.key;
|
||||
throw $break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof(operator) != 'string') {
|
||||
operator = 0;
|
||||
}
|
||||
else {
|
||||
$H(basetypes.get(types.get(ruleType).type)).each(function(i) {
|
||||
if (i.value.name == operator) {
|
||||
operator = i.key;
|
||||
throw $break;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (typeof(operator) != 'string') {
|
||||
operator = 0;
|
||||
}
|
||||
else {
|
||||
$H(basetypes.get(types.get(ruleType).type)).each(function(i) {
|
||||
if (i.value.name == operator) {
|
||||
operator = i.key;
|
||||
throw $break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var row = document.createElement('tr');
|
||||
var cells = new Array();
|
||||
for (var i = 0 ; i < 5 ; i++) {
|
||||
cells[i] = document.createElement('td');
|
||||
}
|
||||
|
||||
cells[0].appendChild(SearchRow.constructOptions(ruleType, rowIter));
|
||||
cells[1].appendChild(SearchRow.constructOperators(ruleType, rowIter, operator));
|
||||
cells[2].appendChild(SearchRow.constructInput(ruleType, rowIter, input));
|
||||
cells[3].innerHTML = removeIcon;
|
||||
var row = document.createElement('tr');
|
||||
var cells = new Array();
|
||||
for (var i = 0 ; i < 5 ; i++) {
|
||||
cells[i] = document.createElement('td');
|
||||
}
|
||||
|
||||
cells[0].appendChild(SearchRow.constructOptions(ruleType, rowIter));
|
||||
cells[1].appendChild(SearchRow.constructOperators(ruleType, rowIter, operator));
|
||||
cells[2].appendChild(SearchRow.constructInput(ruleType, rowIter, input));
|
||||
cells[3].innerHTML = removeIcon;
|
||||
|
||||
cells.each(function(i) {
|
||||
row.appendChild(i);
|
||||
});
|
||||
cells.each(function(i) {
|
||||
row.appendChild(i);
|
||||
});
|
||||
|
||||
$('searchtable').appendChild(row);
|
||||
rowCount++;
|
||||
$('searchtable').appendChild(row);
|
||||
rowCount++;
|
||||
|
||||
Event.observe(cells[3], 'click', function(e){if(rowCount > 1) { Element.remove(this.parentNode); rowCount--; }});
|
||||
Event.observe(cells[3], 'click', function(e){if(rowCount > 1) { Element.remove(this.parentNode); rowCount--; }});
|
||||
|
||||
rowIter++;
|
||||
},
|
||||
constructInput: function(ruleType, ruleNumber, input) {
|
||||
if (input === null || input === undefined) {
|
||||
input = '';
|
||||
}
|
||||
rowIter++;
|
||||
},
|
||||
constructInput: function(ruleType, ruleNumber, input) {
|
||||
if (input === null || input === undefined) {
|
||||
input = '';
|
||||
}
|
||||
|
||||
widget = $H(types.get(ruleType).widget);
|
||||
widget = $H(types.get(ruleType).widget);
|
||||
|
||||
var inputNode = document.createElement(widget.get('0'));
|
||||
inputNode.id = 'rule_' + ruleNumber + '_input';
|
||||
inputNode.name = 'rule_' + ruleNumber + '_input';
|
||||
var inputNode = document.createElement(widget.get('0'));
|
||||
inputNode.id = 'rule_' + ruleNumber + '_input';
|
||||
inputNode.name = 'rule_' + ruleNumber + '_input';
|
||||
|
||||
switch(widget.get('0')) {
|
||||
case 'input':
|
||||
inputNode.setAttribute('type', widget.get('1'));
|
||||
inputNode.setAttribute('value', input);
|
||||
break;
|
||||
case 'select':
|
||||
$H(widget.get('1')).each(function(i) {
|
||||
var option = document.createElement('option');
|
||||
if ( isNaN(parseInt(i.value)) ) {
|
||||
realvalue = i.key;
|
||||
}
|
||||
else {
|
||||
realvalue = parseInt(i.value);
|
||||
}
|
||||
if ( input == realvalue ) {
|
||||
option.selected = true;
|
||||
}
|
||||
option.value = realvalue;
|
||||
option.innerHTML = i.value;
|
||||
inputNode.appendChild(option);
|
||||
});
|
||||
break;
|
||||
}
|
||||
switch(widget.get('0')) {
|
||||
case 'input':
|
||||
inputNode.setAttribute('type', widget.get('1'));
|
||||
inputNode.setAttribute('value', input);
|
||||
break;
|
||||
case 'select':
|
||||
$H(widget.get('1')).each(function(i) {
|
||||
var option = document.createElement('option');
|
||||
if ( isNaN(parseInt(i.value)) ) {
|
||||
realvalue = i.key;
|
||||
}
|
||||
else {
|
||||
realvalue = parseInt(i.value);
|
||||
}
|
||||
if ( input == realvalue ) {
|
||||
option.selected = true;
|
||||
}
|
||||
option.value = realvalue;
|
||||
option.innerHTML = i.value;
|
||||
inputNode.appendChild(option);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
return inputNode;
|
||||
},
|
||||
constructOptions: function(ruleType, ruleNumber) {
|
||||
var optionsNode = document.createElement('select');
|
||||
optionsNode.id = 'rule_' + ruleNumber;
|
||||
optionsNode.name = 'rule_' + ruleNumber;
|
||||
return inputNode;
|
||||
},
|
||||
constructOptions: function(ruleType, ruleNumber) {
|
||||
var optionsNode = document.createElement('select');
|
||||
optionsNode.id = 'rule_' + ruleNumber;
|
||||
optionsNode.name = 'rule_' + ruleNumber;
|
||||
|
||||
types.each(function(i) {
|
||||
var option = document.createElement('option');
|
||||
option.innerHTML = i.value.label;
|
||||
option.value = i.value.name;
|
||||
if ( i.key == ruleType ) {
|
||||
option.selected = true;
|
||||
}
|
||||
optionsNode.appendChild(option);
|
||||
});
|
||||
types.each(function(i) {
|
||||
var option = document.createElement('option');
|
||||
option.innerHTML = i.value.label;
|
||||
option.value = i.value.name;
|
||||
if ( i.key == ruleType ) {
|
||||
option.selected = true;
|
||||
}
|
||||
optionsNode.appendChild(option);
|
||||
});
|
||||
|
||||
Event.observe(optionsNode, 'change', SearchRow.update);
|
||||
Event.observe(optionsNode, 'change', SearchRow.update);
|
||||
|
||||
return optionsNode;
|
||||
},
|
||||
constructOperators: function(ruleType, ruleNumber, operator) {
|
||||
var operatorNode = document.createElement('select');
|
||||
operatorNode.id = 'rule_' + ruleNumber + '_operator';
|
||||
operatorNode.name = 'rule_' + ruleNumber + '_operator';
|
||||
return optionsNode;
|
||||
},
|
||||
constructOperators: function(ruleType, ruleNumber, operator) {
|
||||
var operatorNode = document.createElement('select');
|
||||
operatorNode.id = 'rule_' + ruleNumber + '_operator';
|
||||
operatorNode.name = 'rule_' + ruleNumber + '_operator';
|
||||
|
||||
basetype = types.get(ruleType).type;
|
||||
operatorNode.className = 'operator' + basetype;
|
||||
basetype = types.get(ruleType).type;
|
||||
operatorNode.className = 'operator' + basetype;
|
||||
|
||||
$H(basetypes.get(basetype)).each(function(i) {
|
||||
var option = document.createElement('option');
|
||||
option.innerHTML = i.value.description;
|
||||
option.value = i.key;
|
||||
if (i.key == operator) {
|
||||
option.selected = true;
|
||||
}
|
||||
operatorNode.appendChild(option);
|
||||
});
|
||||
$H(basetypes.get(basetype)).each(function(i) {
|
||||
var option = document.createElement('option');
|
||||
option.innerHTML = i.value.description;
|
||||
option.value = i.key;
|
||||
if (i.key == operator) {
|
||||
option.selected = true;
|
||||
}
|
||||
operatorNode.appendChild(option);
|
||||
});
|
||||
|
||||
return operatorNode;
|
||||
},
|
||||
update: function() {
|
||||
var r_findID = /rule_(\d+)/;
|
||||
var targetID = r_findID.exec(this.id)[1];
|
||||
return operatorNode;
|
||||
},
|
||||
update: function() {
|
||||
var r_findID = /rule_(\d+)/;
|
||||
var targetID = r_findID.exec(this.id)[1];
|
||||
|
||||
var operator = $('rule_' + targetID + '_operator');
|
||||
if (operator.className != 'operator' + types.get(this.selectedIndex).type) {
|
||||
var operator_cell = operator.parentNode;
|
||||
Element.remove(operator);
|
||||
operator_cell.appendChild(SearchRow.constructOperators(this.selectedIndex, targetID));
|
||||
}
|
||||
var operator = $('rule_' + targetID + '_operator');
|
||||
if (operator.className != 'operator' + types.get(this.selectedIndex).type) {
|
||||
var operator_cell = operator.parentNode;
|
||||
Element.remove(operator);
|
||||
operator_cell.appendChild(SearchRow.constructOperators(this.selectedIndex, targetID));
|
||||
}
|
||||
|
||||
var input = $('rule_' + targetID + '_input');
|
||||
var input = $('rule_' + targetID + '_input');
|
||||
|
||||
if (input.type == 'text') {
|
||||
var oldinput = input.value;
|
||||
}
|
||||
if (input.type == 'text') {
|
||||
var oldinput = input.value;
|
||||
}
|
||||
|
||||
var input_cell = input.parentNode;
|
||||
Element.remove(input);
|
||||
input_cell.appendChild(SearchRow.constructInput(this.selectedIndex, targetID, oldinput));
|
||||
}
|
||||
var input_cell = input.parentNode;
|
||||
Element.remove(input);
|
||||
input_cell.appendChild(SearchRow.constructInput(this.selectedIndex, targetID, oldinput));
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue