1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

Add responsive elements for tables and fix code style

This commit is contained in:
Afterster 2014-03-15 10:19:59 +01:00
parent b7e0966007
commit ea815a1ff1
26 changed files with 258 additions and 124 deletions

View file

@ -88,9 +88,11 @@ Ampache includes some external modules that carry their own licensing.
* [Ratchet] (http://socketo.me): MIT * [Ratchet] (http://socketo.me): MIT
* [ReactPHP] (https://github.com/reactphp/react): MIT * [ReactPHP] (https://github.com/reactphp/react): MIT
* [Guzzle] (https://github.com/guzzle/guzzle): MIT * [Guzzle] (https://github.com/guzzle/guzzle): MIT
* [Symfony Components] (https://github.com/symfony/): MIT * [Symfony Components] (https://github.com/symfony): MIT
* [Evenement] (https://github.com/igorw/evenement): MIT * [Evenement] (https://github.com/igorw/evenement): MIT
* [RhinoSlider] (http://rhinoslider.com/): MIT * [RhinoSlider] (http://rhinoslider.com): MIT
* [MediaTable] (https://github.com/edenspiekermann/MediaTable): MIT
* [Responsive Elements] (https://github.com/kumailht/responsive-elements): MIT
Translations Translations

View file

@ -290,7 +290,7 @@ class Artist extends database_object
$this->tags = Tag::get_top_tags('artist', $this->id); $this->tags = Tag::get_top_tags('artist', $this->id);
$this->f_tags = Tag::get_display($this->tags, $this->id, 'artist'); $this->f_tags = Tag::get_display($this->tags, $this->id, 'artist');
$this->object_cnt = $extra_info['object_cnt']; $this->object_cnt = $extra_info['object_cnt'];
return true; return true;

View file

@ -204,7 +204,7 @@ abstract class Catalog extends database_object
{ {
$pattern = "/\.(" . AmpConfig::get('catalog_file_pattern') . ")$/i"; $pattern = "/\.(" . AmpConfig::get('catalog_file_pattern') . ")$/i";
$match = preg_match($pattern, $file); $match = preg_match($pattern, $file);
return $match; return $match;
} }
@ -213,7 +213,7 @@ abstract class Catalog extends database_object
$video_pattern = "/\.(" . AmpConfig::get('catalog_video_pattern') . ")$/i"; $video_pattern = "/\.(" . AmpConfig::get('catalog_video_pattern') . ")$/i";
return preg_match($video_pattern, $file); return preg_match($video_pattern, $file);
} }
public static function is_playlist_file($file) public static function is_playlist_file($file)
{ {
$playlist_pattern = "/\.(" . AmpConfig::get('catalog_playlist_pattern') . ")$/i"; $playlist_pattern = "/\.(" . AmpConfig::get('catalog_playlist_pattern') . ")$/i";
@ -1050,7 +1050,7 @@ abstract class Catalog extends database_object
return $title; return $title;
} // check_title } // check_title
/** /**
* playlist_import * playlist_import
* Attempts to create a Public Playlist based on the playlist file * Attempts to create a Public Playlist based on the playlist file
@ -1067,7 +1067,7 @@ abstract class Catalog extends database_object
} elseif (substr($playlist, -4,4) == 'xspf') { } elseif (substr($playlist, -4,4) == 'xspf') {
$files = self::parse_xspf($data); $files = self::parse_xspf($data);
} }
$songs = array(); $songs = array();
$pinfo = pathinfo($playlist); $pinfo = pathinfo($playlist);
if ($files) { if ($files) {
@ -1097,7 +1097,7 @@ abstract class Catalog extends database_object
} }
} }
debug_event('catalog', 'Add file ' . $file . ' to playlist.', '5'); debug_event('catalog', 'Add file ' . $file . ' to playlist.', '5');
// First, try to found the file as absolute path // First, try to found the file as absolute path
$sql = "SELECT `id` FROM `song` WHERE `file` = ?"; $sql = "SELECT `id` FROM `song` WHERE `file` = ?";
$db_results = Dba::read($sql, array($file)); $db_results = Dba::read($sql, array($file));
@ -1124,9 +1124,9 @@ abstract class Catalog extends database_object
} // if it's a file } // if it's a file
} }
} }
debug_event('import_playlist', "Parsed " . $filename . ", found " . count($songs) . " songs", 5); debug_event('import_playlist', "Parsed " . $filename . ", found " . count($songs) . " songs", 5);
if (count($songs)) { if (count($songs)) {
$name = $pinfo['extension'] . " - " . $pinfo['filename']; $name = $pinfo['extension'] . " - " . $pinfo['filename'];
$playlist_id = Playlist::create($name, 'public'); $playlist_id = Playlist::create($name, 'public');
@ -1163,7 +1163,7 @@ abstract class Catalog extends database_object
{ {
$files = array(); $files = array();
$results = explode("\n", $data); $results = explode("\n", $data);
foreach ($results as $value) { foreach ($results as $value) {
$value = trim($value); $value = trim($value);
if (!empty($value) && substr($value, 0, 1) != '#') { if (!empty($value) && substr($value, 0, 1) != '#') {
@ -1173,7 +1173,7 @@ abstract class Catalog extends database_object
return $files; return $files;
} // parse_m3u } // parse_m3u
/** /**
* parse_pls * parse_pls
* this takes pls filename and then attempts to found song filenames listed in the pls * this takes pls filename and then attempts to found song filenames listed in the pls
@ -1182,7 +1182,7 @@ abstract class Catalog extends database_object
{ {
$files = array(); $files = array();
$results = explode("\n", $data); $results = explode("\n", $data);
foreach ($results as $value) { foreach ($results as $value) {
$value = trim($value); $value = trim($value);
if (preg_match("/file[0-9]+[\s]*\=(.*)/i", $value, $matches)) { if (preg_match("/file[0-9]+[\s]*\=(.*)/i", $value, $matches)) {
@ -1195,7 +1195,7 @@ abstract class Catalog extends database_object
return $files; return $files;
} // parse_pls } // parse_pls
/** /**
* parse_asx * parse_asx
* this takes asx filename and then attempts to found song filenames listed in the asx * this takes asx filename and then attempts to found song filenames listed in the asx
@ -1204,7 +1204,7 @@ abstract class Catalog extends database_object
{ {
$files = array(); $files = array();
$xml = simplexml_load_string($data); $xml = simplexml_load_string($data);
if ($xml) { if ($xml) {
foreach ($xml->entry as $entry) { foreach ($xml->entry as $entry) {
$file = trim($entry->ref['href']); $file = trim($entry->ref['href']);
@ -1216,7 +1216,7 @@ abstract class Catalog extends database_object
return $files; return $files;
} // parse_asx } // parse_asx
/** /**
* parse_xspf * parse_xspf
* this takes xspf filename and then attempts to found song filenames listed in the xspf * this takes xspf filename and then attempts to found song filenames listed in the xspf

View file

@ -390,7 +390,7 @@ class Plex_Api
} }
return strlen($header); return strlen($header);
} }
public static function replay_body($ch, $data) public static function replay_body($ch, $data)
{ {
echo $data; echo $data;
@ -499,11 +499,11 @@ class Plex_Api
$width = $_REQUEST['width']; $width = $_REQUEST['width'];
$height = $_REQUEST['height']; $height = $_REQUEST['height'];
$url = $_REQUEST['url']; $url = $_REQUEST['url'];
// Replace 32400 request port with the real listening port // Replace 32400 request port with the real listening port
// *** To `Plex Inc`: *** // *** To `Plex Inc`: ***
// Please allow listening port server configuration for your Plex server // Please allow listening port server configuration for your Plex server
// and fix your clients to not request resources so hard-coded on 127.0.0.1:32400. // and fix your clients to not request resources so hard-coded on 127.0.0.1:32400.
// May be ok on Apple & UPnP world but that's really ugly for a server... // May be ok on Apple & UPnP world but that's really ugly for a server...
// Yes, it's a little hack but it works. // Yes, it's a little hack but it works.
$localrs = "http://127.0.0.1:32400/"; $localrs = "http://127.0.0.1:32400/";
@ -547,13 +547,13 @@ class Plex_Api
$song_id = Plex_XML_Data::getAmpacheId($matches[1]); $song_id = Plex_XML_Data::getAmpacheId($matches[1]);
} }
} }
if (!empty($format) && !empty($song_id)) { if (!empty($format) && !empty($song_id)) {
$urlparams = '&transcode_to=' . $format; $urlparams = '&transcode_to=' . $format;
if (!empty($br)) { if (!empty($br)) {
$urlparams .= '&bitrate=' . $br; $urlparams .= '&bitrate=' . $br;
} }
$url = Song::play_url($song_id, $urlparams); $url = Song::play_url($song_id, $urlparams);
self::stream_url($url); self::stream_url($url);
} }
@ -678,11 +678,12 @@ class Plex_Api
Plex_XML_Data::setContainerSize($r); Plex_XML_Data::setContainerSize($r);
self::apiOutput($r->asXML()); self::apiOutput($r->asXML());
} }
protected static function stream_url($url) { protected static function stream_url($url)
{
// header("Location: " . $url); // header("Location: " . $url);
set_time_limit(0); set_time_limit(0);
$ch = curl_init($url); $ch = curl_init($url);
curl_setopt_array($ch, array( curl_setopt_array($ch, array(
CURLOPT_HTTPHEADER => array("User-Agent: Plex"), CURLOPT_HTTPHEADER => array("User-Agent: Plex"),
@ -953,13 +954,13 @@ class Plex_Api
} }
} }
} }
protected static function get_users_account($authtoken='') protected static function get_users_account($authtoken='')
{ {
if (empty($authtoken)) { if (empty($authtoken)) {
$authtoken = Plex_XML_Data::getMyPlexAuthToken(); $authtoken = Plex_XML_Data::getMyPlexAuthToken();
} }
$action = 'users/account?auth_token=' . $authtoken; $action = 'users/account?auth_token=' . $authtoken;
$res = self::myPlexRequest($action); $res = self::myPlexRequest($action);
return $res['xml']; return $res['xml'];

View file

@ -71,7 +71,7 @@ class Recommendation
protected static function get_recommendation_cache($type, $id, $get_items = false) protected static function get_recommendation_cache($type, $id, $get_items = false)
{ {
self::gc(); self::gc();
$sql = "SELECT `id`, `last_update` FROM `recommendation` WHERE `object_type` = ? AND `object_id` = ?"; $sql = "SELECT `id`, `last_update` FROM `recommendation` WHERE `object_type` = ? AND `object_id` = ?";
$db_results = Dba::read($sql, array($type, $id)); $db_results = Dba::read($sql, array($type, $id));

View file

@ -353,7 +353,7 @@ class Search extends playlist_object
'type' => 'boolean_numeric', 'type' => 'boolean_numeric',
'widget' => array('select', $playlists) 'widget' => array('select', $playlists)
); );
$this->types[] = array( $this->types[] = array(
'name' => 'playlist_name', 'name' => 'playlist_name',
'label' => T_('Playlist Name'), 'label' => T_('Playlist Name'),
@ -1031,7 +1031,7 @@ class Search extends playlist_object
case 'rating': case 'rating':
$where[] = "COALESCE(`rating`.`rating`,0) $sql_match_operator '$input'"; $where[] = "COALESCE(`rating`.`rating`,0) $sql_match_operator '$input'";
$join['rating'] = true; $join['rating'] = true;
break; break;
case 'played_times': case 'played_times':
$where[] = "`song`.`id` IN (SELECT `object_count`.`object_id` FROM `object_count` " . $where[] = "`song`.`id` IN (SELECT `object_count`.`object_id` FROM `object_count` " .
"WHERE `object_count`.`object_type` = 'song'" . "WHERE `object_count`.`object_type` = 'song'" .
@ -1206,7 +1206,7 @@ class Search extends playlist_object
$sql_match_operator = $operator['sql']; $sql_match_operator = $operator['sql'];
$where[] = "`playlist`.`type` = 'public'"; $where[] = "`playlist`.`type` = 'public'";
switch ($rule[0]) { switch ($rule[0]) {
case 'name': case 'name':
$where[] = "`playlist`.`name` $sql_match_operator '$input'"; $where[] = "`playlist`.`name` $sql_match_operator '$input'";
@ -1222,7 +1222,7 @@ class Search extends playlist_object
$join['catalog'] = true; $join['catalog'] = true;
$where_sql = implode(" $sql_logic_operator ", $where); $where_sql = implode(" $sql_logic_operator ", $where);
if ($join['playlist_data']) { if ($join['playlist_data']) {
$table['playlist_data'] = "LEFT JOIN `playlist_data` ON `playlist_data`.`playlist` = `playlist`.`id`"; $table['playlist_data'] = "LEFT JOIN `playlist_data` ON `playlist_data`.`playlist` = `playlist`.`id`";
} }

View file

@ -50,7 +50,7 @@ class Slideshow
debug_event('echonest', 'EchoNest artist images error: ' . $e->getMessage(), '1'); debug_event('echonest', 'EchoNest artist images error: ' . $e->getMessage(), '1');
} }
} }
foreach (Plugin::get_plugins('get_photos') as $plugin_name) { foreach (Plugin::get_plugins('get_photos') as $plugin_name) {
$plugin = new Plugin($plugin_name); $plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) { if ($plugin->load($GLOBALS['user'])) {

View file

@ -96,7 +96,7 @@ class Tag extends database_object
$sql = "SELECT `tag_map`.`id`,`tag_map`.`tag_id`, `tag`.`name`,`tag_map`.`object_id`,`tag_map`.`user` FROM `tag` " . $sql = "SELECT `tag_map`.`id`,`tag_map`.`tag_id`, `tag`.`name`,`tag_map`.`object_id`,`tag_map`.`user` FROM `tag` " .
"LEFT JOIN `tag_map` ON `tag_map`.`tag_id`=`tag`.`id` " . "LEFT JOIN `tag_map` ON `tag_map`.`tag_id`=`tag`.`id` " .
"WHERE `tag_map`.`object_type`='$type' AND `tag_map`.`object_id` IN $idlist"; "WHERE `tag_map`.`object_type`='$type' AND `tag_map`.`object_id` IN $idlist";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
$tags = array(); $tags = array();
@ -177,7 +177,7 @@ class Tag extends database_object
return $insert_id; return $insert_id;
} // add_tag } // add_tag
/** /**
* update * update
* Update the name of the tag * Update the name of the tag
@ -188,7 +188,7 @@ class Tag extends database_object
if (!strlen($name)) { return false; } if (!strlen($name)) { return false; }
$name = Dba::escape($name); $name = Dba::escape($name);
$sql = 'UPDATE `tag` SET `name` = ? WHERE `id` = ?'; $sql = 'UPDATE `tag` SET `name` = ? WHERE `id` = ?';
Dba::write($sql, array($name, $this->id)); Dba::write($sql, array($name, $this->id));
@ -247,7 +247,7 @@ class Tag extends database_object
"WHERE `tag_map`.`id` IS NULL"; "WHERE `tag_map`.`id` IS NULL";
$db_results = Dba::write($sql); $db_results = Dba::write($sql);
} }
/** /**
* delete * delete
* *
@ -257,13 +257,13 @@ class Tag extends database_object
{ {
$sql = "DELETE FROM `tag_map` WHERE `tag_map`.`tag_id`='".$this->id."'"; $sql = "DELETE FROM `tag_map` WHERE `tag_map`.`tag_id`='".$this->id."'";
$db_results = Dba::write($sql); $db_results = Dba::write($sql);
$sql = "DELETE FROM `tag` WHERE `tag`.`id`='".$this->id."'"; $sql = "DELETE FROM `tag` WHERE `tag`.`id`='".$this->id."'";
$db_results = Dba::write($sql); $db_results = Dba::write($sql);
// Call the garbage collector to clean everything // Call the garbage collector to clean everything
Tag::gc(); Tag::gc();
parent::clear_cache(); parent::clear_cache();
} }
@ -362,7 +362,7 @@ class Tag extends database_object
while ($row = Dba::fetch_assoc($db_results)) { while ($row = Dba::fetch_assoc($db_results)) {
$results[] = $row; $results[] = $row;
} }
return $results; return $results;
} // get_object_tags } // get_object_tags
@ -408,16 +408,16 @@ class Tag extends database_object
} }
$results = array(); $results = array();
$sql = "SELECT `tag_map`.`tag_id`, `tag`.`name`, COUNT(`tag_map`.`object_id`) AS `count` " . $sql = "SELECT `tag_map`.`tag_id`, `tag`.`name`, COUNT(`tag_map`.`object_id`) AS `count` " .
"FROM `tag_map` " . "FROM `tag_map` " .
"LEFT JOIN `tag` ON `tag`.`id`=`tag_map`.`tag_id` " . "LEFT JOIN `tag` ON `tag`.`id`=`tag_map`.`tag_id` " .
"GROUP BY `tag`.`name` ORDER BY `count` DESC "; "GROUP BY `tag`.`name` ORDER BY `count` DESC ";
if ($limit > 0) { if ($limit > 0) {
$sql .= " LIMIT $limit"; $sql .= " LIMIT $limit";
} }
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) { while ($row = Dba::fetch_assoc($db_results)) {
@ -558,5 +558,5 @@ class Tag extends database_object
return false; return false;
} // validate_type } // validate_type
} // end of Tag class } // end of Tag class

View file

@ -378,10 +378,10 @@ class Update
$update_string = '- Add artist description/recommendation external service data cache.<br />'; $update_string = '- Add artist description/recommendation external service data cache.<br />';
$version[] = array('version' => '360044','description' => $update_string); $version[] = array('version' => '360044','description' => $update_string);
$update_string = '- Set user field on playlists as optional.<br />'; $update_string = '- Set user field on playlists as optional.<br />';
$version[] = array('version' => '360045','description' => $update_string); $version[] = array('version' => '360045','description' => $update_string);
$update_string = '- Add broadcast web player by default preference.<br />'; $update_string = '- Add broadcast web player by default preference.<br />';
$version[] = array('version' => '360046','description' => $update_string); $version[] = array('version' => '360046','description' => $update_string);
@ -2287,7 +2287,7 @@ class Update
return true; return true;
} }
/** /**
* update_360045 * update_360045
* *
@ -2300,7 +2300,7 @@ class Update
return true; return true;
} }
/** /**
* update_360046 * update_360046
* *

View file

@ -33,12 +33,12 @@ function log_event($username, $event_name, $event_description, $log_name)
/* must have some name */ /* must have some name */
$log_name = $log_name ? $log_name : 'ampache'; $log_name = $log_name ? $log_name : 'ampache';
$username = $username ? $username : 'ampache'; $username = $username ? $username : 'ampache';
$log_filename = AmpConfig::get('log_filename'); $log_filename = AmpConfig::get('log_filename');
if (empty($log_filename)) { if (empty($log_filename)) {
$log_filename = "%name.%Y%m%d.log"; $log_filename = "%name.%Y%m%d.log";
} }
$log_filename = str_replace("%name", $log_name, $log_filename); $log_filename = str_replace("%name", $log_name, $log_filename);
$log_filename = str_replace("%Y", date('Y'), $log_filename); $log_filename = str_replace("%Y", date('Y'), $log_filename);
$log_filename = str_replace("%m", date('m'), $log_filename); $log_filename = str_replace("%m", date('m'), $log_filename);

View file

@ -303,7 +303,7 @@ class Catalog_local extends Catalog
if (AmpConfig::get('catalog_video_pattern')) { if (AmpConfig::get('catalog_video_pattern')) {
$is_video_file = Catalog::is_video_file($file); $is_video_file = Catalog::is_video_file($file);
} }
if ($options['parse_playlist'] && AmpConfig::get('catalog_playlist_pattern')) { if ($options['parse_playlist'] && AmpConfig::get('catalog_playlist_pattern')) {
$is_playlist = Catalog::is_playlist_file($file); $is_playlist = Catalog::is_playlist_file($file);
} }

View file

@ -86,37 +86,13 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
/* -----[[ B R E A C K P O I N T S ]]------------ */ /* -----[[ B R E A C K P O I N T S ]]------------ */
@media screen and (min-width: 768px) { .mediaTableWrapper.gt500 th.optional, .mediaTableWrapper.gt500 td.optional {
display: table-cell;
.activeMediaTable th.optional, .activeMediaTable td.optional {
display: table-cell;
_display:block; /* IE6 Hack */
}
/* IE7 Hack */
*+html .activeMediaTable th.optional, *+html .activeMediaTable td.optional { display:block }
} }
.mediaTableWrapper.gt700 th, .mediaTableWrapper.gt700 td {
@media screen and (min-width: 1024px) { display: table-cell;
.activeMediaTable th, .activeMediaTable td {
display: table-cell;
_display:block; /* IE6 Hack */
}
/* IE7 Hack */
*+html .activeMediaTable th, *+html .activeMediaTable td { display:block }
} }
/* -----[[ T H E M I N G ]]------------ */ /* -----[[ T H E M I N G ]]------------ */
/** /**

View file

@ -71,6 +71,7 @@ http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/
// Create the wrapper. // Create the wrapper.
wdg.$wrap.addClass('mediaTableWrapper'); wdg.$wrap.addClass('mediaTableWrapper');
wdg.$wrap.attr('data-respond', '');
// Place the wrapper near the table and fill with MediaTable. // Place the wrapper near the table and fill with MediaTable.
wdg.$table.before(wdg.$wrap).appendTo(wdg.$wrap); wdg.$table.before(wdg.$wrap).appendTo(wdg.$wrap);

View file

@ -0,0 +1,153 @@
//
// Responsive Elements
// Copyright (c) 2013 Kumail Hunaid
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
var ResponsiveElements = {
elementsAttributeName: 'data-respond',
maxRefreshRate: 5,
defaults: {
// How soon should you start adding breakpoints
start: 100,
// When to stop adding breakpoints
end: 900,
// At what interval should breakpoints be added?
interval: 50
},
init: function() {
var self = this;
$(function() {
self.el = {
window: $(window),
responsive_elements: $('[' + self.elementsAttributeName + ']')
};
self.events();
});
},
parseOptions: function(options_string) {
// data-respond="start: 100px; end: 900px; interval: 50px; watch: true;"
if (!options_string) return false;
this._options_cache = this._options_cache || {};
if (this._options_cache[options_string]) return this._options_cache[options_string];
var options_array = options_string.replace(/\s+/g, '').split(';'),
options_object = {};
for (var i = 0; i < options_array.length; i++) {
if (!options_array[i]) continue;
var property_array = (options_array[i]).split(':');
var key = property_array[0];
var value = property_array[1];
if (value.slice(-2) === 'px') {
value = value.replace('px', '');
}
if (!isNaN(value)) {
value = parseInt(value, 10);
}
options_object[key] = value;
}
this._options_cache[options_string] = options_object;
return options_object;
},
generateBreakpointsOnAllElements: function() {
var self = ResponsiveElements;
self.el.responsive_elements.each(function(i, _el) {
self.generateBreakpointsOnElement($(_el));
});
},
generateBreakpointsOnElement: function(_el) {
var options_string = _el.attr(this.elementsAttributeName),
options = this.parseOptions(options_string) || this.defaults,
breakpoints = this.generateBreakpoints(_el.width(), options);
this.cleanUpBreakpoints(_el);
_el.addClass(breakpoints.join(' '));
},
generateBreakpoints: function(width, options) {
var start = options.start,
end = options.end,
interval = options.interval,
i = interval > start ? interval : ~~(start / interval) * interval,
classes = [];
while (i <= end) {
if (i < width) classes.push('gt' + i);
if (i > width) classes.push('lt' + i);
if (i == width) classes.push('lt' + i);
i += interval;
}
return classes;
},
parseBreakpointClasses: function(breakpoints_string) {
var classes = breakpoints_string.split(/\s+/),
breakpointClasses = [];
$(classes).each(function(i, className) {
if (className.match(/^gt\d+|lt\d+$/)) breakpointClasses.push(className);
});
return breakpointClasses;
},
cleanUpBreakpoints: function(_el) {
var classesToCleanup = this.parseBreakpointClasses(_el.attr('class') || '');
_el.removeClass(classesToCleanup.join(' '));
},
events: function() {
this.generateBreakpointsOnAllElements();
this.el.window.bind('resize', this.utils.debounce(
this.generateBreakpointsOnAllElements, this.maxRefreshRate));
},
utils: {
// Debounce is part of Underscore.js 1.5.2 http://underscorejs.org
// (c) 2009-2013 Jeremy Ashkenas. Distributed under the MIT license.
debounce: function(func, wait, immediate) {
// Returns a function, that, as long as it continues to be invoked,
// will not be triggered. The function will be called after it stops
// being called for N milliseconds. If `immediate` is passed,
// trigger the function on the leading edge, instead of the trailing.
var result;
var timeout = null;
return function() {
var context = this,
args = arguments;
var later = function() {
timeout = null;
if (!immediate) result = func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) result = func.apply(context, args);
return result;
};
}
}
};
ResponsiveElements.init();

View file

@ -98,7 +98,7 @@ switch ($_REQUEST['action']) {
/* Controls the editing of objects */ /* Controls the editing of objects */
case 'edit_object': case 'edit_object':
debug_event('ajax_server', "Editing object...", '5'); debug_event('ajax_server', "Editing object...", '5');
// Scrub the data // Scrub the data
foreach ($_POST as $key => $data) { foreach ($_POST as $key => $data) {
$_POST[$key] = unhtmlentities(scrub_in($data)); $_POST[$key] = unhtmlentities(scrub_in($data));
@ -315,21 +315,21 @@ switch ($_REQUEST['action']) {
$results[$key] = ob_get_contents(); $results[$key] = ob_get_contents();
ob_end_clean(); ob_end_clean();
break; break;
case 'action_buttons': case 'action_buttons':
ob_start(); ob_start();
if (AmpConfig::get('ratings')) { if (AmpConfig::get('ratings')) {
echo " <div id='rating_" . $_GET['object_id'] . "_" . $_GET['object_type'] . "'>"; echo " <div id='rating_" . $_GET['object_id'] . "_" . $_GET['object_type'] . "'>";
Rating::show($_GET['object_id'], $_GET['object_type']); Rating::show($_GET['object_id'], $_GET['object_type']);
echo "</div>"; echo "</div>";
} }
if (AmpConfig::get('userflags')) { if (AmpConfig::get('userflags')) {
echo " <div id='userflag_" . $_GET['object_id'] . "_" . $_GET['object_type'] . "'>"; echo " <div id='userflag_" . $_GET['object_id'] . "_" . $_GET['object_type'] . "'>";
Userflag::show($_GET['object_id'], $_GET['object_type']); Userflag::show($_GET['object_id'], $_GET['object_type']);
echo "</div>"; echo "</div>";
} }
$results['action_buttons'] = ob_get_contents(); $results['action_buttons'] = ob_get_contents();
ob_end_clean(); ob_end_clean();
break; break;
default: default:
$results['rfc3514'] = '0x1'; $results['rfc3514'] = '0x1';
break; break;

View file

@ -116,7 +116,7 @@ switch ($_REQUEST['action']) {
); );
} }
} }
if ($target == 'anywhere' || $target == 'playlist') { if ($target == 'anywhere' || $target == 'playlist') {
$searchreq = array( $searchreq = array(
'limit' => $limit, 'limit' => $limit,

View file

@ -48,7 +48,7 @@ switch ($_REQUEST['action']) {
ob_start(); ob_start();
$type = $_REQUEST['object_type']; $type = $_REQUEST['object_type'];
$id = $_REQUEST['object_id']; $id = $_REQUEST['object_id'];
if ($type == "song") { if ($type == "song") {
$media = new Song($id); $media = new Song($id);
$shouts = Shoutbox::get_shouts($type, $id); $shouts = Shoutbox::get_shouts($type, $id);

View file

@ -53,6 +53,7 @@ if (AmpConfig::get('use_rss')) { ?>
<script src="<?php echo $web_path; ?>/modules/jscroll/jquery.jscroll.min.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/jscroll/jquery.jscroll.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/jquery/jquery.qrcode.min.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/jquery/jquery.qrcode.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/rhinoslider/js/rhinoslider-1.05.min.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/rhinoslider/js/rhinoslider-1.05.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/responsive-elements/responsive-elements.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/modules/jquery-mediaTable/jquery.mediaTable.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/jquery-mediaTable/jquery.mediaTable.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/lib/javascript/base.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/lib/javascript/base.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script>
@ -158,11 +159,11 @@ function init_slideshow_check()
} }
function swap_slideshow() function swap_slideshow()
{ {
if (iSlideshow == null) { if (iSlideshow == null) {
init_slideshow_refresh(); init_slideshow_refresh();
} else { } else {
stop_slideshow(); stop_slideshow();
} }
} }
function init_slideshow_refresh() function init_slideshow_refresh()
{ {
@ -189,7 +190,7 @@ function refresh_slideshow()
} }
function stop_slideshow() function stop_slideshow()
{ {
if (iSlideshow != null) { if (iSlideshow != null) {
iSlideshow = null; iSlideshow = null;
$("#aslideshow").css({'display': 'none'}); $("#aslideshow").css({'display': 'none'});
} }

View file

@ -23,7 +23,7 @@
$web_path = AmpConfig::get('web_path'); $web_path = AmpConfig::get('web_path');
$thcount = 8; $thcount = 8;
?> ?>
<script type="text/javascript"> <script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>'); setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script> </script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>

View file

@ -25,27 +25,27 @@ session_start();
$web_path = AmpConfig::get('web_path'); $web_path = AmpConfig::get('web_path');
$thcount = 8; $thcount = 8;
?> ?>
<script type="text/javascript"> <script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>'); setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script> </script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0">
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play"></th> <th class="cel_play essential"></th>
<th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=artist&sort=name', T_('Artist'),'artist_sort_name'); ?></th> <th class="cel_artist essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=artist&sort=name', T_('Artist'),'artist_sort_name'); ?></th>
<th class="cel_add"></th> <th class="cel_add essential"></th>
<th class="cel_songs"><?php echo T_('Songs'); ?></th> <th class="cel_songs optional"><?php echo T_('Songs'); ?></th>
<th class="cel_albums"><?php echo T_('Albums'); ?></th> <th class="cel_albums optional"><?php echo T_('Albums'); ?></th>
<th class="cel_time"><?php echo T_('Time'); ?></th> <th class="cel_time optional"><?php echo T_('Time'); ?></th>
<th class="cel_tags"><?php echo T_('Tags'); ?></th> <th class="cel_tags optional"><?php echo T_('Tags'); ?></th>
<?php if (AmpConfig::get('ratings')) { ++$thcount; ?> <?php if (AmpConfig::get('ratings')) { ++$thcount; ?>
<th class="cel_rating"><?php echo T_('Rating'); ?></th> <th class="cel_rating optional"><?php echo T_('Rating'); ?></th>
<?php } ?> <?php } ?>
<?php if (AmpConfig::get('userflags')) { ++$thcount; ?> <?php if (AmpConfig::get('userflags')) { ++$thcount; ?>
<th class="cel_userflag"><?php echo T_('Flag'); ?></th> <th class="cel_userflag optional"><?php echo T_('Flag'); ?></th>
<?php } ?> <?php } ?>
<th class="cel_action"><?php echo T_('Action'); ?></th> <th class="cel_action essential"><?php echo T_('Action'); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View file

@ -21,7 +21,7 @@
*/ */
?> ?>
<script type="text/javascript"> <script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>'); setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script> </script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>

View file

@ -21,7 +21,7 @@
*/ */
?> ?>
<script type="text/javascript"> <script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>'); setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script> </script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>

View file

@ -26,7 +26,7 @@ require_once AmpConfig::get('prefix') . '/templates/stylesheets.inc.php';
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
var jsAjaxServer = "<?php echo AmpConfig::get('ajax_server') ?>"; var jsAjaxServer = "<?php echo AmpConfig::get('ajax_server') ?>";
var jsAjaxUrl = "<?php echo AmpConfig::get('ajax_url') ?>"; var jsAjaxUrl = "<?php echo AmpConfig::get('ajax_url') ?>";
function update_action() { } function update_action() { }
</script> </script>
<?php <?php
@ -154,9 +154,9 @@ if ($isVideo) {
} }
currentjpitem = currenti; currentjpitem = currenti;
<?php if ($iframed) { ?> <?php if ($iframed) { ?>
if (previousartist != currentjpitem.attr("data-artist_id")) { if (previousartist != currentjpitem.attr("data-artist_id")) {
NotifyOfNewSong(); NotifyOfNewSong();
} }
<?php } ?> <?php } ?>
} }
if (brkey != '') { if (brkey != '') {
@ -176,7 +176,7 @@ if (!$isVideo && !$isRadio && !$is_share) {
if (AmpConfig::get('sociable')) { if (AmpConfig::get('sociable')) {
echo "actionsobj += ' <a href=\"javascript:NavigateTo(\'" . AmpConfig::get('web_path') . "/shout.php?action=show_add_shout&type=song&id=' + currenti.attr('data-song_id') + '\');\">" . UI::get_icon('comment', T_('Post Shout')) . "</a>';"; echo "actionsobj += ' <a href=\"javascript:NavigateTo(\'" . AmpConfig::get('web_path') . "/shout.php?action=show_add_shout&type=song&id=' + currenti.attr('data-song_id') + '\');\">" . UI::get_icon('comment', T_('Post Shout')) . "</a>';";
} }
echo "actionsobj += '<div id=\'action_buttons\'></div>';"; echo "actionsobj += '<div id=\'action_buttons\'></div>';";
if (AmpConfig::get('waveform')) { if (AmpConfig::get('waveform')) {
echo "var waveformobj = '';"; echo "var waveformobj = '';";
if (AmpConfig::get('waveform')) { if (AmpConfig::get('waveform')) {
@ -271,7 +271,7 @@ if ($isVideo) {
$("#jquery_jplayer_1").bind($.jPlayer.event.volumechange, function(event) { $("#jquery_jplayer_1").bind($.jPlayer.event.volumechange, function(event) {
$.cookie('jp_volume', event.jPlayer.options.volume, { expires: 7, path: '/'}); $.cookie('jp_volume', event.jPlayer.options.volume, { expires: 7, path: '/'});
}); });
$('#jp_container_1' + ' ul:last').sortable({ $('#jp_container_1' + ' ul:last').sortable({
update: function () { update: function () {
jplaylist.scan(); jplaylist.scan();
@ -585,7 +585,7 @@ if ($isVideo) {
} else { } else {
$broadcast_id = $broadcasts[0]; $broadcast_id = $broadcasts[0];
} }
$broadcast = new Broadcast($broadcast_id); $broadcast = new Broadcast($broadcast_id);
$key = Broadcast::generate_key(); $key = Broadcast::generate_key();
$broadcast->update_state(true, $key); $broadcast->update_state(true, $key);

View file

@ -21,7 +21,7 @@
*/ */
?> ?>
<script type="text/javascript"> <script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>'); setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script> </script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php' ?>

View file

@ -23,7 +23,7 @@
$web_path = AmpConfig::get('web_path'); $web_path = AmpConfig::get('web_path');
$thcount = 8; $thcount = 8;
?> ?>
<script type="text/javascript"> <script type="text/javascript">
setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>'); setTagsChoices('<?php echo Tag::get_display(Tag::get_tags()); ?>');
</script> </script>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?> <?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>

View file

@ -39,7 +39,7 @@
<a class="tag_delete" href="<?php echo AmpConfig::get('ajax_url') ?>?page=tag&action=delete&tag_id=<?php echo $data['id']; ?>" onclick="return confirm('<?php echo T_('Do you really want to delete the tag?'); ?>');"><?php echo UI::get_icon('delete', T_('Delete')); ?></a> <a class="tag_delete" href="<?php echo AmpConfig::get('ajax_url') ?>?page=tag&action=delete&tag_id=<?php echo $data['id']; ?>" onclick="return confirm('<?php echo T_('Do you really want to delete the tag?'); ?>');"><?php echo UI::get_icon('delete', T_('Delete')); ?></a>
</li> </li>
</ul> </ul>
</div> </div>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
<?php if (!count($object_ids)) { ?> <?php if (!count($object_ids)) { ?>