mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-30 19:52:17 +01:00
Contacts: Added missing files.
This commit is contained in:
parent
f933648023
commit
ced3309fd3
78
css/multiselect.css
Normal file
78
css/multiselect.css
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
|
||||||
|
This file is licensed under the Affero General Public License version 3 or later.
|
||||||
|
See the COPYING-README file. */
|
||||||
|
|
||||||
|
ul.multiselectoptions {
|
||||||
|
background-color:#fff;
|
||||||
|
border:1px solid #ddd;
|
||||||
|
border-top:none;
|
||||||
|
box-shadow:0 1px 1px #ddd;
|
||||||
|
padding-top:.5em;
|
||||||
|
position:absolute;
|
||||||
|
max-height: 20em;
|
||||||
|
overflow-y: auto;
|
||||||
|
z-index:49;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.multiselectoptions.down {
|
||||||
|
border-bottom-left-radius:.5em;
|
||||||
|
border-bottom-right-radius:.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.multiselectoptions.up {
|
||||||
|
border-top-left-radius:.5em;
|
||||||
|
border-top-right-radius:.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.multiselectoptions>li {
|
||||||
|
overflow:hidden;
|
||||||
|
white-space:nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.multiselect {
|
||||||
|
display:inline-block;
|
||||||
|
max-width:400px;
|
||||||
|
min-width:100px;
|
||||||
|
padding-right:.6em;
|
||||||
|
position:relative;
|
||||||
|
vertical-align:bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.multiselect.active {
|
||||||
|
background-color:#fff;
|
||||||
|
position:relative;
|
||||||
|
z-index:50;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.multiselect.up {
|
||||||
|
border-top:0 none;
|
||||||
|
border-top-left-radius:0;
|
||||||
|
border-top-right-radius:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.multiselect.down {
|
||||||
|
border-bottom:none;
|
||||||
|
border-bottom-left-radius:0;
|
||||||
|
border-bottom-right-radius:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.multiselect>span:first-child {
|
||||||
|
float:left;
|
||||||
|
margin-right:2em;
|
||||||
|
overflow:hidden;
|
||||||
|
text-overflow:ellipsis;
|
||||||
|
width:90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.multiselect>span:last-child {
|
||||||
|
position:absolute;
|
||||||
|
right:.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.multiselectoptions input.new {
|
||||||
|
border-top-left-radius:0;
|
||||||
|
border-top-right-radius:0;
|
||||||
|
padding-bottom:.2em;
|
||||||
|
padding-top:.2em;
|
||||||
|
margin:0;
|
||||||
|
}
|
BIN
img/checkmark-gray.png
Normal file
BIN
img/checkmark-gray.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 742 B |
110
img/checkmark-gray.svg
Normal file
110
img/checkmark-gray.svg
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="300"
|
||||||
|
height="300"
|
||||||
|
id="svg2"
|
||||||
|
sodipodi:version="0.32"
|
||||||
|
inkscape:version="0.48.3.1 r9886"
|
||||||
|
inkscape:export-filename="/home/tol/owncloud/apps/contacts/img/checkmark-green.png"
|
||||||
|
inkscape:export-xdpi="6"
|
||||||
|
inkscape:export-ydpi="6"
|
||||||
|
sodipodi:docname="checkmark.svg"
|
||||||
|
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||||
|
version="1.0"
|
||||||
|
sodipodi:modified="true">
|
||||||
|
<defs
|
||||||
|
id="defs4">
|
||||||
|
<inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 180.81233 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="417.20389 : 180.81233 : 1"
|
||||||
|
inkscape:persp3d-origin="208.60194 : 120.54155 : 1"
|
||||||
|
id="perspective2441" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
gridtolerance="10000"
|
||||||
|
guidetolerance="10"
|
||||||
|
objecttolerance="10"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="0.7"
|
||||||
|
inkscape:cx="406.63391"
|
||||||
|
inkscape:cy="114.40134"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
inkscape:window-width="1024"
|
||||||
|
inkscape:window-height="712"
|
||||||
|
inkscape:window-x="100"
|
||||||
|
inkscape:window-y="100"
|
||||||
|
showgrid="false"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:guide-bbox="true"
|
||||||
|
inkscape:window-maximized="0">
|
||||||
|
<sodipodi:guide
|
||||||
|
orientation="0,1"
|
||||||
|
position="348.57143,57.142857"
|
||||||
|
id="guide3213" />
|
||||||
|
<sodipodi:guide
|
||||||
|
orientation="1,0"
|
||||||
|
position="302.85714,57.142857"
|
||||||
|
id="guide3215" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<cc:license
|
||||||
|
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
<cc:License
|
||||||
|
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||||
|
</cc:License>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-101.54091,-225.22029)">
|
||||||
|
<path
|
||||||
|
style="fill:#6c5353;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="M 404.39805,284.11817 C 368.06032,253.38444 350.86772,226.50504 350.86772,226.50504 283.76197,275.28106 212.49623,448.47251 212.49623,448.47251 179.09795,390.4747 145.5172,374.29794 145.5172,374.29794 c -15.09673,24.88467 -41.11915,58.04874 -41.11915,58.04874 60.69423,20.16404 111.63866,94.15836 111.63866,94.15836 C 326.16622,313.22083 404.39805,284.11817 404.39805,284.11817 z"
|
||||||
|
id="path5075"
|
||||||
|
sodipodi:nodetypes="ccccccc"
|
||||||
|
inkscape:export-filename="C:\Documents and Settings\Staff\Desktop\photos\SVG\path2161.png"
|
||||||
|
inkscape:export-xdpi="72.839996"
|
||||||
|
inkscape:export-ydpi="72.839996"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.9 KiB |
BIN
img/checkmark-green.png
Normal file
BIN
img/checkmark-green.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 618 B |
109
img/checkmark-green.svg
Normal file
109
img/checkmark-green.svg
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="300"
|
||||||
|
height="300"
|
||||||
|
id="svg2"
|
||||||
|
sodipodi:version="0.32"
|
||||||
|
inkscape:version="0.48.3.1 r9886"
|
||||||
|
inkscape:export-filename="C:\Documents and Settings\Staff\Desktop\checkmark.png"
|
||||||
|
inkscape:export-xdpi="72.839996"
|
||||||
|
inkscape:export-ydpi="72.839996"
|
||||||
|
sodipodi:docname="checkmark.svg"
|
||||||
|
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||||
|
version="1.0"
|
||||||
|
sodipodi:modified="true">
|
||||||
|
<defs
|
||||||
|
id="defs4">
|
||||||
|
<inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 180.81233 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="417.20389 : 180.81233 : 1"
|
||||||
|
inkscape:persp3d-origin="208.60194 : 120.54155 : 1"
|
||||||
|
id="perspective2441" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
gridtolerance="10000"
|
||||||
|
guidetolerance="10"
|
||||||
|
objecttolerance="10"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="0.7"
|
||||||
|
inkscape:cx="165.91962"
|
||||||
|
inkscape:cy="114.40134"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
inkscape:window-width="1024"
|
||||||
|
inkscape:window-height="712"
|
||||||
|
inkscape:window-x="100"
|
||||||
|
inkscape:window-y="100"
|
||||||
|
showgrid="false"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:guide-bbox="true"
|
||||||
|
inkscape:window-maximized="0">
|
||||||
|
<sodipodi:guide
|
||||||
|
orientation="0,1"
|
||||||
|
position="348.57143,57.142857"
|
||||||
|
id="guide3213" />
|
||||||
|
<sodipodi:guide
|
||||||
|
orientation="1,0"
|
||||||
|
position="302.85714,57.142857"
|
||||||
|
id="guide3215" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<cc:license
|
||||||
|
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
|
||||||
|
</cc:Work>
|
||||||
|
<cc:License
|
||||||
|
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||||
|
</cc:License>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-101.54091,-225.22029)">
|
||||||
|
<path
|
||||||
|
style="fill:#1e6f1e;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
d="M 404.39805,284.11817 C 368.06032,253.38444 350.86772,226.50504 350.86772,226.50504 283.76197,275.28106 212.49623,448.47251 212.49623,448.47251 179.09795,390.4747 145.5172,374.29794 145.5172,374.29794 c -15.09673,24.88467 -41.11915,58.04874 -41.11915,58.04874 60.69423,20.16404 111.63866,94.15836 111.63866,94.15836 C 326.16622,313.22083 404.39805,284.11817 404.39805,284.11817 z"
|
||||||
|
id="path5075"
|
||||||
|
sodipodi:nodetypes="ccccccc"
|
||||||
|
inkscape:export-filename="C:\Documents and Settings\Staff\Desktop\photos\SVG\path2161.png"
|
||||||
|
inkscape:export-xdpi="72.839996"
|
||||||
|
inkscape:export-ydpi="72.839996"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.9 KiB |
78
img/starred.svg
Normal file
78
img/starred.svg
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="300"
|
||||||
|
height="300"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.3.1 r9886"
|
||||||
|
sodipodi:docname="starred.svg">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="2.8"
|
||||||
|
inkscape:cx="53.205915"
|
||||||
|
inkscape:cy="122.67739"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
fit-margin-top="0"
|
||||||
|
fit-margin-left="0"
|
||||||
|
fit-margin-right="0"
|
||||||
|
fit-margin-bottom="0"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1021"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="27"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-148.03866,-752.3843)">
|
||||||
|
<path
|
||||||
|
sodipodi:type="star"
|
||||||
|
style="fill:#ffcc00;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:0.56578944;stroke-dasharray:none"
|
||||||
|
id="path2987"
|
||||||
|
sodipodi:sides="5"
|
||||||
|
sodipodi:cx="330"
|
||||||
|
sodipodi:cy="1027.7194"
|
||||||
|
sodipodi:r1="169.28609"
|
||||||
|
sodipodi:r2="75.090073"
|
||||||
|
sodipodi:arg1="-1.5686866"
|
||||||
|
sodipodi:arg2="-0.95344865"
|
||||||
|
inkscape:flatsided="false"
|
||||||
|
inkscape:rounded="0"
|
||||||
|
inkscape:randomized="0"
|
||||||
|
d="m 330.35715,858.43365 43.11057,108.05601 117.64292,9.25721 -89.44547,74.39173 27.54954,114.7457 -98.39092,-62.0794 -100.61637,61.6596 28.63654,-112.759 -89.73387,-76.63797 116.08927,-7.60945 z"
|
||||||
|
inkscape:transform-center-y="-15.471227"
|
||||||
|
transform="matrix(0.91668358,0,0,0.96331605,-4.7129291,-71.75982)"
|
||||||
|
inkscape:transform-center-x="-0.1011681" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -47,7 +47,7 @@ $freeSpace=OC_Filesystem::free_space('/');
|
|||||||
$freeSpace=max($freeSpace, 0);
|
$freeSpace=max($freeSpace, 0);
|
||||||
$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
|
$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
|
||||||
|
|
||||||
OCP\Util::addscript('', 'multiselect');
|
OCP\Util::addscript('contacts', 'multiselect');
|
||||||
OCP\Util::addscript('', 'oc-vcategories');
|
OCP\Util::addscript('', 'oc-vcategories');
|
||||||
OCP\Util::addscript('contacts', 'app');
|
OCP\Util::addscript('contacts', 'app');
|
||||||
OCP\Util::addscript('contacts', 'contacts');
|
OCP\Util::addscript('contacts', 'contacts');
|
||||||
@ -56,10 +56,10 @@ OCP\Util::addscript('contacts', 'placeholder.polyfill.jquery');
|
|||||||
OCP\Util::addscript('contacts', 'expanding');
|
OCP\Util::addscript('contacts', 'expanding');
|
||||||
OCP\Util::addscript('contacts', 'jquery.combobox');
|
OCP\Util::addscript('contacts', 'jquery.combobox');
|
||||||
OCP\Util::addscript('files', 'jquery.fileupload');
|
OCP\Util::addscript('files', 'jquery.fileupload');
|
||||||
OCP\Util::addscript('core', 'jquery.inview');
|
//OCP\Util::addscript('core', 'jquery.inview');
|
||||||
OCP\Util::addscript('contacts', 'jquery.Jcrop');
|
OCP\Util::addscript('contacts', 'jquery.Jcrop');
|
||||||
OCP\Util::addscript('contacts', 'jquery.multi-autocomplete');
|
OCP\Util::addscript('contacts', 'jquery.multi-autocomplete');
|
||||||
OCP\Util::addStyle('', 'jquery.multiselect');
|
OCP\Util::addStyle('contacts', 'multiselect');
|
||||||
OCP\Util::addStyle('contacts', 'jquery.combobox');
|
OCP\Util::addStyle('contacts', 'jquery.combobox');
|
||||||
OCP\Util::addStyle('contacts', 'jquery.Jcrop');
|
OCP\Util::addStyle('contacts', 'jquery.Jcrop');
|
||||||
OCP\Util::addStyle('contacts', 'contacts');
|
OCP\Util::addStyle('contacts', 'contacts');
|
||||||
|
282
js/multiselect.js
Normal file
282
js/multiselect.js
Normal file
@ -0,0 +1,282 @@
|
|||||||
|
/**
|
||||||
|
* @param 'createCallback' A function to be called when a new entry is created. Two arguments are supplied to this function:
|
||||||
|
* The select element used and the value of the option. If the function returns false addition will be cancelled. If it returns
|
||||||
|
* anything else it will be used as the value of the newly added option.
|
||||||
|
* @param 'createText' The placeholder text for the create action.
|
||||||
|
* @param 'title' The title to show if no options are selected.
|
||||||
|
* @param 'checked' An array containing values for options that should be checked. Any options which are already selected will be added to this array.
|
||||||
|
* @param 'labels' The corresponding labels to show for the checked items.
|
||||||
|
* @param 'oncheck' Callback function which will be called when a checkbox/radiobutton is selected. If the function returns false the input will be unchecked.
|
||||||
|
* @param 'onuncheck' @see 'oncheck'.
|
||||||
|
* @param 'singleSelect' If true radiobuttons will be used instead of checkboxes.
|
||||||
|
*/
|
||||||
|
(function( $ ){
|
||||||
|
var multiSelectId=-1;
|
||||||
|
$.fn.multiSelect=function(options) {
|
||||||
|
multiSelectId++;
|
||||||
|
var settings = {
|
||||||
|
'createCallback':false,
|
||||||
|
'createText':false,
|
||||||
|
'singleSelect':false,
|
||||||
|
'title':this.attr('title'),
|
||||||
|
'checked':[],
|
||||||
|
'labels':[],
|
||||||
|
'oncheck':false,
|
||||||
|
'onuncheck':false,
|
||||||
|
'minWidth': 'default;',
|
||||||
|
};
|
||||||
|
$(this).attr('data-msid', multiSelectId);
|
||||||
|
$.extend(settings,options);
|
||||||
|
$.each(this.children(),function(i,option) {
|
||||||
|
// If the option is selected, but not in the checked array, add it.
|
||||||
|
if($(option).attr('selected') && settings.checked.indexOf($(option).val()) === -1) {
|
||||||
|
settings.checked.push($(option).val());
|
||||||
|
settings.labels.push($(option).text().trim());
|
||||||
|
}
|
||||||
|
// If the option is in the checked array but not selected, select it.
|
||||||
|
else if(settings.checked.indexOf($(option).val()) !== -1 && !$(option).attr('selected')) {
|
||||||
|
$(option).attr('selected', 'selected');
|
||||||
|
settings.labels.push($(option).text().trim());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var button=$('<div class="multiselect button"><span>'+settings.title+'</span><span>▾</span></div>');
|
||||||
|
var span=$('<span/>');
|
||||||
|
span.append(button);
|
||||||
|
button.data('id',multiSelectId);
|
||||||
|
button.selectedItems=[];
|
||||||
|
this.hide();
|
||||||
|
this.before(span);
|
||||||
|
if(settings.minWidth=='default') {
|
||||||
|
settings.minWidth=button.width();
|
||||||
|
}
|
||||||
|
button.css('min-width',settings.minWidth);
|
||||||
|
settings.minOuterWidth=button.outerWidth()-2;
|
||||||
|
button.data('settings',settings);
|
||||||
|
|
||||||
|
if(!settings.singleSelect && settings.checked.length>0) {
|
||||||
|
button.children('span').first().text(settings.labels.join(', '));
|
||||||
|
} else if(settings.singleSelect) {
|
||||||
|
button.children('span').first().text(this.find(':selected').text());
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
self.menuDirection = 'down';
|
||||||
|
button.click(function(event){
|
||||||
|
|
||||||
|
var button=$(this);
|
||||||
|
if(button.parent().children('ul').length>0) {
|
||||||
|
if(self.menuDirection === 'down') {
|
||||||
|
button.parent().children('ul').slideUp(400,function() {
|
||||||
|
button.parent().children('ul').remove();
|
||||||
|
button.removeClass('active');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
button.parent().children('ul').fadeOut(400,function() {
|
||||||
|
button.parent().children('ul').remove();
|
||||||
|
button.removeClass('active').removeClass('up');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var lists=$('ul.multiselectoptions');
|
||||||
|
lists.slideUp(400,function(){
|
||||||
|
lists.remove();
|
||||||
|
$('div.multiselect').removeClass('active');
|
||||||
|
button.addClass('active');
|
||||||
|
});
|
||||||
|
button.addClass('active');
|
||||||
|
event.stopPropagation();
|
||||||
|
var options=$(this).parent().next().children();
|
||||||
|
var list=$('<ul class="multiselectoptions"/>').hide().appendTo($(this).parent());
|
||||||
|
var inputType = settings.singleSelect ? 'radio' : 'checkbox';
|
||||||
|
function createItem(element, checked){
|
||||||
|
element=$(element);
|
||||||
|
var item=element.val();
|
||||||
|
var id='ms'+multiSelectId+'-option-'+item;
|
||||||
|
var input=$('<input type="' + inputType + '"/>');
|
||||||
|
input.attr('id',id);
|
||||||
|
if(settings.singleSelect) {
|
||||||
|
input.attr('name', 'ms'+multiSelectId+'-option');
|
||||||
|
}
|
||||||
|
var label=$('<label/>');
|
||||||
|
label.attr('for',id);
|
||||||
|
label.text(element.text() || item);
|
||||||
|
if(settings.checked.indexOf(item)!=-1 || checked) {
|
||||||
|
input.attr('checked', true);
|
||||||
|
}
|
||||||
|
if(checked){
|
||||||
|
if(settings.singleSelect) {
|
||||||
|
settings.checked = [item];
|
||||||
|
settings.labels = [item];
|
||||||
|
} else {
|
||||||
|
settings.checked.push(item);
|
||||||
|
settings.labels.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
input.change(function(){
|
||||||
|
var value = $(this).attr('id').substring(String('ms'+multiSelectId+'-option').length+1);
|
||||||
|
var label = $(this).next().text().trim();
|
||||||
|
if($(this).is(':checked')) {
|
||||||
|
if(settings.singleSelect) {
|
||||||
|
settings.checked = [];
|
||||||
|
settings.labels = [];
|
||||||
|
$.each(self.find('option'), function() {
|
||||||
|
$(this).removeAttr('selected');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
element.attr('selected','selected');
|
||||||
|
if(typeof settings.oncheck === 'function') {
|
||||||
|
if(settings.oncheck(value)===false) {
|
||||||
|
$(this).attr('checked', false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
settings.checked.push(value);
|
||||||
|
settings.labels.push(label);
|
||||||
|
} else {
|
||||||
|
var index=settings.checked.indexOf(value);
|
||||||
|
element.attr('selected',null);
|
||||||
|
if(typeof settings.onuncheck === 'function') {
|
||||||
|
if(settings.onuncheck(value)===false) {
|
||||||
|
$(this).attr('checked',true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
settings.checked.splice(index,1);
|
||||||
|
settings.labels.splice(index,1);
|
||||||
|
}
|
||||||
|
var oldWidth=button.width();
|
||||||
|
button.children('span').first().text(settings.labels.length > 0
|
||||||
|
? settings.labels.join(', ')
|
||||||
|
: settings.title);
|
||||||
|
var newOuterWidth=Math.max((button.outerWidth()-2),settings.minOuterWidth)+'px';
|
||||||
|
var newWidth=Math.max(button.width(),settings.minWidth);
|
||||||
|
var pos=button.position();
|
||||||
|
button.css('height',button.height());
|
||||||
|
button.css('white-space','nowrap');
|
||||||
|
button.css('width',oldWidth);
|
||||||
|
button.animate({'width':newWidth},undefined,undefined,function(){
|
||||||
|
button.css('width','');
|
||||||
|
});
|
||||||
|
list.animate({'width':newOuterWidth,'left':pos.left+3});
|
||||||
|
});
|
||||||
|
var li=$('<li></li>');
|
||||||
|
li.append(input).append(label);
|
||||||
|
return li;
|
||||||
|
}
|
||||||
|
$.each(options,function(index,item){
|
||||||
|
list.append(createItem(item));
|
||||||
|
});
|
||||||
|
button.parent().data('preventHide',false);
|
||||||
|
if(settings.createText){
|
||||||
|
var li=$('<li>+ <em>'+settings.createText+'<em></li>');
|
||||||
|
li.click(function(event){
|
||||||
|
li.empty();
|
||||||
|
var input=$('<input class="new">');
|
||||||
|
li.append(input);
|
||||||
|
input.focus();
|
||||||
|
input.css('width',button.innerWidth());
|
||||||
|
button.parent().data('preventHide',true);
|
||||||
|
input.keypress(function(event) {
|
||||||
|
if(event.keyCode == 13) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
var value = $(this).val();
|
||||||
|
var exists = false;
|
||||||
|
$.each(options,function(index, item) {
|
||||||
|
if ($(item).val() == value || $(item).text() == value) {
|
||||||
|
exists = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (exists) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var li=$(this).parent();
|
||||||
|
var val = $(this).val()
|
||||||
|
var select=button.parent().next();
|
||||||
|
if(typeof settings.createCallback === 'function') {
|
||||||
|
var response = settings.createCallback(select, val);
|
||||||
|
console.log('response', response);
|
||||||
|
if(response === false) {
|
||||||
|
return false;
|
||||||
|
} else if(typeof response !== 'undefined') {
|
||||||
|
val = response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(settings.singleSelect) {
|
||||||
|
$.each(select.find('option:selected'), function() {
|
||||||
|
$(this).removeAttr('selected');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(this).remove();
|
||||||
|
li.text('+ '+settings.createText);
|
||||||
|
li.before(createItem(this));
|
||||||
|
var option=$('<option selected="selected"/>');
|
||||||
|
option.text($(this).val()).val(val).attr('selected', 'selected');
|
||||||
|
select.append(option);
|
||||||
|
li.prev().children('input').prop('checked', true).trigger('change');
|
||||||
|
button.parent().data('preventHide',false);
|
||||||
|
button.children('span').first().text(settings.labels.length > 0
|
||||||
|
? settings.labels.join(', ')
|
||||||
|
: settings.title);
|
||||||
|
if(self.menuDirection === 'up') {
|
||||||
|
var list = li.parent();
|
||||||
|
list.css('top', list.position().top-li.outerHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
input.blur(function() {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
$(this).remove();
|
||||||
|
li.text('+ '+settings.createText);
|
||||||
|
setTimeout(function(){
|
||||||
|
button.parent().data('preventHide',false);
|
||||||
|
},100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
list.append(li);
|
||||||
|
}
|
||||||
|
var pos=button.position();
|
||||||
|
if($(document).height() > button.offset().top+button.outerHeight() + list.children().length * button.height()) {
|
||||||
|
list.css('top',pos.top+button.outerHeight()-5);
|
||||||
|
list.css('left',pos.left+3);
|
||||||
|
list.css('width',(button.outerWidth()-2)+'px');
|
||||||
|
list.addClass('down');
|
||||||
|
button.addClass('down');
|
||||||
|
list.slideDown();
|
||||||
|
} else {
|
||||||
|
list.css('top', pos.top - list.height());
|
||||||
|
list.css('left', pos.left+3);
|
||||||
|
list.css('width',(button.outerWidth()-2)+'px');
|
||||||
|
list.detach().insertBefore($(this));
|
||||||
|
list.addClass('up');
|
||||||
|
button.addClass('up');
|
||||||
|
list.fadeIn();
|
||||||
|
self.menuDirection = 'up';
|
||||||
|
}
|
||||||
|
list.click(function(event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$(window).click(function() {
|
||||||
|
if(!button.parent().data('preventHide')) {
|
||||||
|
// How can I save the effect in a var?
|
||||||
|
if(self.menuDirection === 'down') {
|
||||||
|
button.parent().children('ul').slideUp(400,function() {
|
||||||
|
button.parent().children('ul').remove();
|
||||||
|
button.removeClass('active').removeClass('down');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
button.parent().children('ul').fadeOut(400,function() {
|
||||||
|
button.parent().children('ul').remove();
|
||||||
|
button.removeClass('active').removeClass('up');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return span;
|
||||||
|
};
|
||||||
|
})( jQuery );
|
Loading…
x
Reference in New Issue
Block a user