Page 1 of 5

Music folder accordion

PostPosted: Fri Oct 01, 2010 12:43 pm
by re-entity
For a neater presentation of your music folders, I've reformatted the a-z html and added a javascript accordion.

Image

Replace the following files with the content below...

/var/subsonic/jetty/1806/webapp/WEB-INF/jsp/left.jsp
Code: Select all
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="iso-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
    <%@ include file="head.jsp" %>
    <script type="text/javascript" src="<c:url value="/script/scripts.js"/>"></script>
    <script type="text/javascript" src="<c:url value="/script/smooth-scroll.js"/>"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript">
      $(document).ready(function(){
   $('.accordion-content').hide();
   //toggle the componenet with class accordion
   $('.accordion-toggle').click(function(){
      //$(this).toggleClass('toggle-accordion-active');
      $(this).next('.accordion-content').slideToggle(300);
   });
   $('#accordion-expand-all').click(function(){
      $('.accordion-content').slideToggle(300);
   });
      });
    </script>
</head>

<body class="bgcolor2 leftframe">
<a name="top"></a>
<div class="alpha-jump">
    <c:forEach items="${model.indexes}" var="index">
        <a href="#${index.index}" accesskey="${index.index}">${index.index}</a>
    </c:forEach>
</div>

<c:if test="${model.statistics.songCount gt 0}">
    <div class="detail">
        <fmt:message key="left.statistics">
            <p><fmt:param value="${model.statistics.artistCount}"/></p>
            <p><fmt:param value="${model.statistics.albumCount}"/></p>
            <p><fmt:param value="${model.statistics.songCount}"/></p>
            <p><fmt:param value="${model.bytes}"/></p>
            <p><fmt:param value="${model.hours}"/></p>
        </fmt:message>
    </div>
</c:if>

<c:if test="${fn:length(model.musicFolders) > 1}">
    <div id="music-folders">
        <select name="musicFolderId" onchange="location='left.view?musicFolderId=' + options[selectedIndex].value;" >
            <option value="-1"><fmt:message key="left.allfolders"/></option>
            <c:forEach items="${model.musicFolders}" var="musicFolder">
                <option ${model.selectedMusicFolder.id == musicFolder.id ? "selected" : ""} value="${musicFolder.id}">${musicFolder.name}</option>
            </c:forEach>
        </select>
    </div>
</c:if>

<c:if test="${not empty model.shortcuts}">
    <h2><fmt:message key="left.shortcut"/></h2>
    <c:forEach items="${model.shortcuts}" var="shortcut">
        <p class="dense">
            <sub:url value="main.view" var="mainUrl">
                <sub:param name="path" value="${shortcut.path}"/>
            </sub:url>
            <a target="main" href="${mainUrl}">${shortcut.name}</a>
        </p>
    </c:forEach>
</c:if>

<c:if test="${not empty model.radios}">
    <h2 class="bgcolor1"><fmt:message key="left.radio"/></h2>
    <c:forEach items="${model.radios}" var="radio">
        <p class="dense">
            <a target="hidden" href="${radio.streamUrl}">
                <img src="<spring:theme code="playImage"/>" alt="<fmt:message key="common.play"/>" title="<fmt:message key="common.play"/>"></a>
            <c:choose>
                <c:when test="${empty radio.homepageUrl}">
                    ${radio.name}
                </c:when>
                <c:otherwise>
                    <a target="main" href="${radio.homepageUrl}">${radio.name}</a>
                </c:otherwise>
            </c:choose>
        </p>
    </c:forEach>
</c:if>

<c:forEach items="${model.indexedArtists}" var="entry">
    <h2 class="alpha-sort accordion-toggle"><a name="${entry.key.index}"></a>${entry.key.index}</h2>
    <div class="alpha-node accordion-content">
    <c:forEach items="${entry.value}" var="artist">
        <p class="dense">
            <span title="${artist.name}">
                <sub:url value="main.view" var="mainUrl">
                    <c:forEach items="${artist.musicFiles}" var="musicFile">
                        <sub:param name="path" value="${musicFile.path}"/>
                    </c:forEach>
                </sub:url>
                <a target="main" href="${mainUrl}"><str:truncateNicely upper="${model.captionCutoff}">${artist.name}</str:truncateNicely></a>
            </span>
        </p>
    </c:forEach>
    </div>
</c:forEach>
    <p><a id="accordion-expand-all" href="#">Toggle all</a></p>
<c:forEach items="${model.singleSongs}" var="song">
    <p class="dense">
        <span title="${song.title}">
            <c:import url="playAddDownload.jsp">
                <c:param name="path" value="${song.path}"/>
                <c:param name="playEnabled" value="${model.user.streamRole and not model.partyMode}"/>
                <c:param name="addEnabled" value="${model.user.streamRole}"/>
                <c:param name="downloadEnabled" value="${model.user.downloadRole and not model.partyMode}"/>
            </c:import>
            <str:truncateNicely upper="${model.captionCutoff}">${song.title}</str:truncateNicely>
        </span>
    </p>
</c:forEach>

<div class="alpha-jump">
    <c:forEach items="${model.indexes}" var="index">
        <a href="#${index.index}">${index.index}</a>
    </c:forEach>
</div>


</body></html>


/var/subsonic/jetty/1806/webapp/style/default.css
Code: Select all
/*
* CSS styleshet for default theme.
*
* Note that attributes that are typically changed by theme authors are
* placed at the top.
  *
* Author: Sindre Mehus
*/

/* The primary background color (light blue). */
.bgcolor1 {
    background-color: #EFEFEF;
}

/* The secondary background color (darker blue). */
.bgcolor2, .ruleTableHeader, .log {
    background-color: #DEE3E7
}

/* Put stuff here if you need to customize any of the frames. */
.mainframe {
}
.topframe {
}
.leftframe {
}
.rightframe {
}
.playlistframe {
}

/* Background color for selected header. */
.headerSelected {
    background-color: lightyellow;
}

/* Background color for form controls (use default). */
input, select {
}

/* Hover color for form controls (use default). */
input:hover, select:hover {
}

/* The primary foreground color (black). */
body {
    color: black;
}

/* The secondary foreground color used for h1, details etc (gray). */
h1, .detail, .albumComment {
    color: #696969;
}

/* Foreground color used for h2, bold and tr. */
h2, b, tr {
    color: #333333;
}

/* Link color */
a:link, a:active, a:visited, a:link *, a:active *, a:visited * {
    color: #006699
}

/* Link hover color */
a:hover, a:hover * {
    text-decoration: underline;
    color: #DD6900
}

/* Color for warning messages. */
.warning {
    color: red;
}

/* Simple dark border. */
.border1, .ruleTableHeader, .ruleTableCell, .headerSelected, .log {
    border: 1px solid black;
}

/* Scrollbar colors (supported on IE and Opera) */
body {
    scrollbar-face-color: #DEE3E7;
    scrollbar-highlight-color: #FFFFFF;
    scrollbar-shadow-color: #DEE3E7;
    scrollbar-3dlight-color: #D1D7DC;
    scrollbar-arrow-color: #006699;
    scrollbar-track-color: #EFEFEF;
    scrollbar-darkshadow-color: #98AAB1;
}

/* Font 1 */
body, h2, form, label, table, a {
    font-family: verdana, arial, sans-serif;
}

/* Font 2 */
h1, h1 a, .logo {
    font-family: arial, sans-serif;
}

/***************************************************************************************
* The rest of the CSS is typically not changed in other themes (but not necessarily so).
***************************************************************************************/

body {
    padding:0;
    border:0;
    margin:0.75em;
    font-size: 9pt;
    line-height: 1.5em;
}

p {
    padding:0;
    border:0;
    margin:0 0 1em 0;
}
.alpha-sort {
    border-bottom:1px solid #fff;
    margin:0;
    padding:0 5px;
}

.alpha-jump {
    display:none;
}

.dense {
    margin: 0;
}

h1 {
    white-space: nowrap;
    font-size: 140%;
    padding: 0 0 0.2em 0;
    border: 0;
    margin: 0;
}

h2 {
    white-space: nowrap;
    font-size: 100%;
    margin: 1em 0 0.2em 0;
}

form {
    font-size: 100%;
    line-height: 140%;
    padding: 0;
    border: 0;
    margin: 0;
}

input, select, textarea {
    font-size: 9pt;
}

label {
    font-size: 100%;
    line-height: 140%;
}

table {
    font-size: 100%;
    line-height: 140%;
    padding: 0;
    border: 0;
    margin: 0 0 0.4em 0;
}

/* Table with some white space above it.*/
table.indent {
    margin: 1em 0 0.4em 0;
}

a {
    font-size: 100%;
    text-decoration: none
}

img {
    border-style: none;
    border: 0;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.headerSelected {
    padding: 0.25em;
}

.detail {
    margin-bottom:1em;
    white-space: nowrap;
    font-size: 8pt;
    line-height: 1.25em;
}

.warning {
    white-space: nowrap;
}

.logo {
    white-space: nowrap;
    font-size: 16pt;
}

.back, .forward {
    background-position:center left;
    background-repeat:no-repeat;
    padding-left: 16px;
    line-height: 16px;
}

.back {
    background-image:url("../icons/back.gif");
}

.forward {
    background-image:url("../icons/forward.gif");
}

.albumComment {
    width: 50em;
    font-size: 8pt;
    line-height: 1.4em;
    padding-top: 0.25em;
}

.log {
    white-space: nowrap;
    font-size: 8pt;
    line-height: 1em;
}

.checkbox {
}

/* Table with simple lines between the cells. */
.ruleTable {
    border-collapse: collapse;
}

.ruleTableHeader, .ruleTableCell {
    margin: 5px;
    padding: 5px;
}

.ruleTableHeader {
    font-weight: bold;
}

PostPosted: Sat Oct 02, 2010 11:50 am
by Toytronic
Nice mod, i'm using it right now!
Thanks Re-Entity :)

PostPosted: Mon Oct 04, 2010 3:27 am
by rodan1967
How do I get rid of it once I edited the 2 files? I make back up of my original files and then edited them with your changes. Played around with it then decided I preferred the original no accordion format. So I restored my original files but when I login into my subsonic it still have accordion view.. What changed other than the 2 files you modded? I even tried reinstalling Subsonic and it did not get rid of the mod.

PostPosted: Mon Oct 04, 2010 3:39 am
by rodan1967
Ok figured out what the problem was. I needed to clear Firefox's browser cache or it will continue to display the accordion view even after removing modded files.

PostPosted: Wed Nov 03, 2010 10:27 am
by kroken
Nice mod but is it possible to change the text when i click the "Toggle All" To "Hide all" ?

PostPosted: Sat Nov 06, 2010 6:19 pm
by kroken
nevermind, fixed it bymyself here it is if anyone else need.

Code: Select all
    <script type="text/javascript">
      $(document).ready(function(){
   $('.accordion-content').hide();
   //toggle the componenet with class accordion
   $('.accordion-toggle').click(function(){
      //$(this).toggleClass('toggle-accordion-active');
      $(this).next('.accordion-content').slideToggle(300);
   });
   $('#accordion-expand-all').click(function(){
      $('.accordion-content').slideToggle(300);
   this.innerHTML = ( this.innerHTML == "Show All" ) ? "Hide All" : "Show All";
   });
      });

    </script>



Code: Select all
<p><a id="accordion-expand-all" href="#">Show All</a></p>

PostPosted: Sat Dec 25, 2010 5:52 am
by thezoggy
I followed your mod idea but implemented the jquery accordion w/themeroller differently. Your mod was more of a collapse/expand div rather than a true accordion as with an accordion you can only have 1 expanded section.

Image

the theme used for the accordion was ui-darkness.

if anyone wants the code let me know and i'll post the details

PostPosted: Sat Dec 25, 2010 8:22 am
by daveydz3
thezoggy wrote:I followed your mod idea but implemented the jquery accordion w/themeroller differently. Your mod was more of a collapse/expand div rather than a true accordion as with an accordion you can only have 1 expanded section.

Image

the theme used for the accordion was ui-darkness.

if anyone wants the code let me know and i'll post the details


i'd like to try it out, thanks.

PostPosted: Sat Dec 25, 2010 8:48 am
by thezoggy
http://www.speedyshare.com/files/258844 ... ordion.zip

Here are all the files, just extract to the folder just before webapp.
So for example for me it was: C:\subsonic\jetty\1946\

Let me know if you have any problems.

--z

PostPosted: Tue Feb 08, 2011 10:19 pm
by 3R3
thx re-entity for the thread and idea, and thezoggy for improving it. Running the jquery accordion right now, and apart from it not showing up right away, even after clearing browser cache, cookies, restart server, restart browser and clearing the jetty cache in various sequences, it works great!
So my 2 cents are, dont be too impatient with this, the behemoth that is SS just needs a little time to stomach it ;) give it 2 hours, after you cleared caches and restarted things, before you start worrying.

regards,
3R3

EDIT: Yes it works, just dont delete anything.

How to install thezoggys mod for Dummies
In the "subsonic-accordion.zip" file are 3 folders under "webapp". To install you just go to your own "webapp" folder and put the content from the archives "script", "style" and "WEB-INF" folders into the corresponding folders in your own "webapp" folders.

PostPosted: Sun Feb 13, 2011 2:56 am
by TENtimesFAST
thezoggy wrote:http://www.speedyshare.com/files/25884442/subsonic-accordion.zip

Here are all the files, just extract to the folder just before webapp.
So for example for me it was: C:\subsonic\jetty\1946\

Let me know if you have any problems.

--z


Just wanted to see if this worked for anyone of if I'm screwing something up.

I deleted the "webapp" folder then extracted the current one that you provided but now I just get a 404.

Any pointers would be appreciated!

PostPosted: Fri Feb 18, 2011 10:35 am
by thezoggy
well you shouldn't be deleting anything. all this does is replace/update a few template files. deleting the webapp folder for subsonic (which runs as a webapp) is not a good move.

PostPosted: Wed Feb 23, 2011 6:48 pm
by 3R3
TENtimesFAST wrote:
thezoggy wrote:http://www.speedyshare.com/files/25884442/subsonic-accordion.zip

Here are all the files, just extract to the folder just before webapp.
So for example for me it was: C:\subsonic\jetty\1946\

Let me know if you have any problems.

--z


Just wanted to see if this worked for anyone of if I'm screwing something up.

I deleted the "webapp" folder then extracted the current one that you provided but now I just get a 404.

Any pointers would be appreciated!


You essentially deleted all the web content of SS, but unfortunately no data or statistics or users. just download your version again and extract the "webapp" folder from the archive into the place you deleted it from and you should be set. stop the server before you do that though.

PostPosted: Sat Feb 26, 2011 10:25 pm
by disgustipated
i cant get this to work either and i am copying the folders properly by unzipping and putting them in the jetty folders

PostPosted: Sat Feb 26, 2011 10:26 pm
by disgustipated
funny, i just got it to work by choosing the 2 minutes to midnight theme