mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-11-29 11:24:11 +01:00
First work on new Contacts js and group based UI.
This commit is contained in:
parent
11d9539a29
commit
6b77479899
@ -10,6 +10,20 @@
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('contacts');
|
||||
|
||||
$categories = OC_Contacts_App::getCategories();
|
||||
$catmgr = OC_Contacts_App::getVCategories();
|
||||
$categories = $catmgr->categories(OC_VCategories::FORMAT_MAP);
|
||||
foreach($categories as &$category) {
|
||||
$ids = array();
|
||||
$contacts = $catmgr->itemsForCategory(
|
||||
$category['name'],
|
||||
array(
|
||||
'tablename' => '*PREFIX*contacts_cards',
|
||||
'fields' => array('id',),
|
||||
));
|
||||
foreach($contacts as $contact) {
|
||||
$ids[] = $contact['id'];
|
||||
}
|
||||
$category['contacts'] = $ids;
|
||||
}
|
||||
|
||||
OCP\JSON::success(array('data' => array('categories'=>$categories)));
|
||||
|
@ -8,18 +8,19 @@
|
||||
|
||||
function cmp($a, $b)
|
||||
{
|
||||
if ($a['displayname'] == $b['displayname']) {
|
||||
if ($a['fullname'] == $b['fullname']) {
|
||||
return 0;
|
||||
}
|
||||
return ($a['displayname'] < $b['displayname']) ? -1 : 1;
|
||||
return ($a['fullname'] < $b['fullname']) ? -1 : 1;
|
||||
}
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('contacts');
|
||||
|
||||
$start = isset($_GET['startat'])?$_GET['startat']:0;
|
||||
$offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
|
||||
$aid = isset($_GET['aid'])?$_GET['aid']:null;
|
||||
|
||||
$active_addressbooks = array();
|
||||
if(is_null($aid)) {
|
||||
// Called initially to get the active addressbooks.
|
||||
$active_addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
|
||||
@ -36,7 +37,7 @@ $contacts_addressbook = array();
|
||||
$ids = array();
|
||||
foreach($active_addressbooks as $addressbook) {
|
||||
$ids[] = $addressbook['id'];
|
||||
if(!isset($contacts_addressbook[$addressbook['id']])) {
|
||||
/*if(!isset($contacts_addressbook[$addressbook['id']])) {
|
||||
$contacts_addressbook[$addressbook['id']]
|
||||
= array('contacts' => array('type' => 'book',));
|
||||
$contacts_addressbook[$addressbook['id']]['displayname']
|
||||
@ -47,25 +48,45 @@ foreach($active_addressbooks as $addressbook) {
|
||||
= $addressbook['permissions'];
|
||||
$contacts_addressbook[$addressbook['id']]['owner']
|
||||
= $addressbook['userid'];
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
$contacts_alphabet = array();
|
||||
|
||||
// get next 50 for each addressbook.
|
||||
foreach($ids as $id) {
|
||||
$contacts_alphabet = array_merge(
|
||||
$contacts_alphabet,
|
||||
OC_Contacts_VCard::all($ids)
|
||||
);
|
||||
/*foreach($ids as $id) {
|
||||
if($id) {
|
||||
$contacts_alphabet = array_merge(
|
||||
$contacts_alphabet,
|
||||
OC_Contacts_VCard::all($id, $start, 50)
|
||||
OC_Contacts_VCard::all($id, $offset, 50)
|
||||
);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
uasort($contacts_alphabet, 'cmp');
|
||||
|
||||
$contacts = array();
|
||||
|
||||
|
||||
// Our new array for the contacts sorted by addressbook
|
||||
if($contacts_alphabet) {
|
||||
foreach($contacts_alphabet as $contact) {
|
||||
$vcard = OC_VObject::parse($contact['carddata']);
|
||||
if(is_null($vcard)) {
|
||||
continue;
|
||||
}
|
||||
$details = OC_Contacts_VCard::structureContact($vcard);
|
||||
$contacts[] = array(
|
||||
'id' => $contact['id'],
|
||||
'aid' => $contact['addressbookid'],
|
||||
'data' => $details,
|
||||
);
|
||||
// This should never execute.
|
||||
if(!isset($contacts_addressbook[$contact['addressbookid']])) {
|
||||
/*if(!isset($contacts_addressbook[$contact['addressbookid']])) {
|
||||
$contacts_addressbook[$contact['addressbookid']] = array(
|
||||
'contacts' => array('type' => 'book',)
|
||||
);
|
||||
@ -89,10 +110,10 @@ if($contacts_alphabet) {
|
||||
isset($contacts_addressbook[$contact['addressbookid']]['permissions'])
|
||||
? $contacts_addressbook[$contact['addressbookid']]['permissions']
|
||||
: '0',
|
||||
);
|
||||
);*/
|
||||
}
|
||||
}
|
||||
unset($contacts_alphabet);
|
||||
uasort($contacts_addressbook, 'cmp');
|
||||
//unset($contacts_alphabet);
|
||||
uasort($contacts_alphabet, 'cmp');
|
||||
|
||||
OCP\JSON::success(array('data' => array('entries' => $contacts_addressbook)));
|
||||
OCP\JSON::success(array('data' => array('contacts' => $contacts, 'addressbooks' => $active_addressbooks)));
|
||||
|
@ -25,7 +25,7 @@ function cmpcontacts($a, $b)
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('contacts');
|
||||
|
||||
$offset = isset($_GET['startat']) ? $_GET['startat'] : null;
|
||||
$offset = isset($_GET['offset']) ? $_GET['offset'] : null;
|
||||
$category = isset($_GET['category']) ? $_GET['category'] : null;
|
||||
|
||||
$list = array();
|
||||
@ -36,19 +36,17 @@ if(is_null($category)) {
|
||||
$categories = $catmgr->categories(OC_VCategories::FORMAT_MAP);
|
||||
uasort($categories, 'cmpcategories');
|
||||
foreach($categories as $category) {
|
||||
$list[$category['id']] = array(
|
||||
$list[] = array(
|
||||
'name' => $category['name'],
|
||||
'contacts' => $catmgr->itemsForCategory(
|
||||
$category['name'],
|
||||
array(
|
||||
'tablename' => '*PREFIX*contacts_cards',
|
||||
'fields' => array('id', 'addressbookid', 'fullname'),
|
||||
),
|
||||
50,
|
||||
$offset)
|
||||
'fields' => array('id',),
|
||||
))
|
||||
);
|
||||
uasort($list[$category['id']]['contacts'], 'cmpcontacts');
|
||||
}
|
||||
uasort($list['contacts'], 'cmpcontacts');
|
||||
} else {
|
||||
$list[$category] = $catmgr->itemsForCategory(
|
||||
$category,
|
||||
|
@ -34,7 +34,7 @@ function debug($msg, $tracelevel=0, $debuglevel=OCP\Util::DEBUG)
|
||||
} else {
|
||||
$call = debug_backtrace(false);
|
||||
}
|
||||
error_log('trace: '.print_r($call, true));
|
||||
//error_log('trace: '.print_r($call, true));
|
||||
$call = $call[$tracelevel];
|
||||
if($debuglevel !== false) {
|
||||
OCP\Util::writeLog('contacts',
|
||||
|
151
css/contacts.css
151
css/contacts.css
@ -1,15 +1,25 @@
|
||||
/*dl > dt {
|
||||
font-weight: bold;
|
||||
}*/
|
||||
input[type=checkbox] { height: 14px; width: 14px; border: 1px solid #fff; -moz-appearance:none; -webkit-appearance: none; -moz-box-sizing:none; box-sizing:none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; }
|
||||
input[type=checkbox]:hover { border: 1px solid #D4D4D4 !important; }
|
||||
input[type=checkbox]:checked::after {
|
||||
content: url('%appswebroot%/contacts/img/checkmark.png');
|
||||
display: block;
|
||||
position: relative;
|
||||
top: -8px;
|
||||
left: -6px;
|
||||
}
|
||||
select { border: 1px solid silver; }
|
||||
option { border-left: 1px solid silver; border-right: 1px solid silver; }
|
||||
option:first-child { border-top: 1px solid silver; }
|
||||
option:last-child { border-bottom: 1px solid silver; }
|
||||
#leftcontent { top: 3.5em !important; padding: 0; margin: 0; }
|
||||
#leftcontent a { padding: 0 0 0 25px; }
|
||||
#rightcontent { top: 3.5em !important; padding-top: 5px; }
|
||||
#leftcontent h3 { cursor: pointer; -moz-transition: background 300ms ease 0s; background: none no-repeat scroll 1em center #eee; border-bottom: 1px solid #ddd; border-top: 1px solid #fff; display: block; max-width: 100%; padding: 0.5em 0.8em; color: #666; text-shadow: 0 1px 0 #f8f8f8; font-size: 1.2em; }
|
||||
#leftcontent h3:hover,#leftcontent h3:active,#leftcontent h3.active { background-color: #DBDBDB; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #D4D4D4; color: #333333; font-weight: bold; }
|
||||
#leftcontent h3 img.shared { float: right; opacity: 0.4; }
|
||||
#leftcontent h3 img.shared:hover { opacity: 1; }
|
||||
#contacts { position: fixed; background: #fff; max-width: 100%; width: 20em; left: 12.5em; top: 3.7em; bottom: 3em; overflow: auto; padding: 0; margin: 0; }
|
||||
.contacts a { height: 23px; display: block; left: 12.5em; margin: 0 0 0 0; padding: 0 0 0 25px; }
|
||||
.contacts li.ui-draggable { height: 23px; }
|
||||
.ui-draggable-dragging { width: 17em; cursor: move; }
|
||||
.ui-state-hover { border: 1px solid dashed; }
|
||||
@ -17,34 +27,23 @@
|
||||
#bottomcontrols img { margin-top: 0.35em; }
|
||||
#uploadprogressbar { display: none; padding: 0; bottom: 3em; height:2em; width: 20em; margin:0; background:#eee; border:1px solid #ccc; position:fixed; }
|
||||
button.control { float: left; margin: 0.2em 0 0 1em; height: 2.4em; width: 2.4em; /* border: 0 none; border-radius: 0; -moz-box-shadow: none; box-shadow: none; outline: 0 none;*/ }
|
||||
.settings { background:url('%webroot%/core/img/actions/settings.svg') no-repeat center; float: right !important; margin: 0.2em 1em 0 0 !important; }
|
||||
.import { background:url('%webroot%/core/img/actions/upload.svg') no-repeat center; }
|
||||
.newcontact { background:url('%appswebroot%/contacts/img/contact-new.svg') no-repeat center; }
|
||||
#actionbar { clear: both; height: 30px;}
|
||||
#contacts_deletecard {position:relative; float:left; background:url('%webroot%/core/img/actions/delete.svg') no-repeat center; }
|
||||
#contacts_downloadcard {position:relative; float:left; background:url('%webroot%/core/img/actions/download.svg') no-repeat center; }
|
||||
#contacts_propertymenu { clear: left; float:left; max-width: 15em; margin: 2em; }
|
||||
#contacts_propertymenu_button { position:relative;top:0;left:0; margin: 0; }
|
||||
#contacts_propertymenu_dropdown { background-color: #fff; position:relative; right:0; overflow:hidden; text-overflow:ellipsis; border: thin solid #1d2d44; box-shadow: 0 3px 5px #bbb; /* -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; box-shadow:0 0 10px #000; -moz-border-radius:0.5em; -webkit-border-radius:0.5em; border-radius:0.5em; -moz-border-radius:0.5em; -webkit-border-radius:0.5em;*/ border-radius: 3px; }
|
||||
#contacts_propertymenu li { display: block; font-weight: bold; height: 20px; }
|
||||
#contacts_propertymenu li a { padding: 3px; display: block }
|
||||
#contacts_propertymenu li:hover { background-color: #1d2d44; }
|
||||
#contacts_propertymenu li a:hover { color: #fff }
|
||||
#card { width: auto; font-size: 10px; /*max-width: 70em; border: thin solid lightgray; display: block;*/ }
|
||||
#contact { width: auto; font-size: 10px; /*max-width: 70em; border: thin solid lightgray; display: block;*/ }
|
||||
#firstrun { position: relative; top: 25%; left: 20%; right: 20%; width: 50%; font-weight:bold; text-align: center; color: #777; }
|
||||
#firstrun h3 { font-size:1.5em; text-align: center; margin-bottom: 1em; }
|
||||
#firstrun p { font-size:1.2em; text-align: }
|
||||
#firstrun #selections { font-size:0.8em; margin: 2em auto auto auto; clear: both; }
|
||||
|
||||
#card input[type="text"].contacts_property,input[type="email"].contacts_property,input[type="url"].contacts_property { width: 14em; float: left; font-weight: bold; }
|
||||
.categories { float: left; width: 16em; }
|
||||
#card input[type="checkbox"].contacts_property, #card input[type="text"], #card input[type="email"], #card input[type="url"], #card input[type="tel"], #card input[type="date"], #card select, #card textarea { background-color: #fefefe; border: 0 !important; -moz-appearance:none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; }
|
||||
#card input[type="text"]:hover, #card input[type="text"]:focus, #card input[type="text"]:active, input[type="email"]:hover, #card input[type="url"]:hover, #card input[type="tel"]:hover, #card input[type="date"]:hover, #card input[type="date"], #card input[type="date"]:hover, #card input[type="date"]:active, #card input[type="date"]:active, #card input[type="date"]:active, #card input[type="email"]:active, #card input[type="url"]:active, #card input[type="tel"]:active, #card textarea:focus, #card textarea:hover { border: 0 !important; -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #ddd, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #ddd, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #ddd, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; float: left; }
|
||||
#card textarea { width: 80%; min-height: 5em; min-width: 30em; margin: 0 !important; padding: 0 !important; outline: 0 !important;}
|
||||
dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; cursor: normal; }
|
||||
#contact input:not([type="checkbox"]), #contact select, #contact textarea { background-color: #fefefe; border: 1px solid #fff !important; -moz-appearance:none !important; -webkit-appearance: none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; }
|
||||
#contact input:hover:not([type="checkbox"]), #contact input:active:not([type="checkbox"]), #contact textarea:focus, #contact textarea:hover { border: 1px solid silver !important; -moz-border-radius:.3em; -webkit-border-radius:.3em; border-radius:.3em; outline:none; float: left; }
|
||||
|
||||
#contact textarea { width: 80%; min-height: 5em; min-width: 30em; margin: 0 !important; padding: 0 !important; outline: 0 !important;}
|
||||
|
||||
#contact input[type="checkbox"] { margin-top: 10px; vertical-align: bottom; float: left; }
|
||||
dl.form { width: auto; margin: 0; padding: 0; cursor: normal; }
|
||||
.form dt { display: table-cell; clear: left; float: left; width: 7em; margin: 0; padding: 0.8em 0.5em 0 0; text-align:right; text-overflow:ellipsis; o-text-overflow: ellipsis; vertical-align: text-bottom; color: #bbb;/* white-space: pre-wrap; white-space: -moz-pre-wrap !important; white-space: -pre-wrap; white-space: -o-pre-wrap;*/ }
|
||||
.form dd { display: table-cell; clear: right; float: left; margin: 0; padding: 0px; white-space: nowrap; vertical-align: text-bottom; }
|
||||
label:hover, dt:hover { color: #333; }
|
||||
.form dd { display: table-cell; clear: right; float: left; margin: 0; padding: 0; white-space: nowrap; vertical-align: text-bottom; }
|
||||
/*::-webkit-input-placeholder { color: #bbb; }
|
||||
:-moz-placeholder { color: #bbb; }
|
||||
:-ms-input-placeholder { color: #bbb; }*/
|
||||
@ -66,7 +65,6 @@ label:hover, dt:hover { color: #333; }
|
||||
.upload { background:url('%webroot%/core/img/actions/upload.svg') no-repeat center; }
|
||||
.download { background:url('%webroot%/core/img/actions/download.svg') no-repeat center; }
|
||||
.cloud { background:url('%webroot%/core/img/places/picture.svg') no-repeat center; }
|
||||
/*.globe { background:url('../img/globe.svg') no-repeat center; }*/
|
||||
.globe { background:url('%webroot%/core/img/actions/public.svg') no-repeat center; }
|
||||
.transparent{ opacity: 0.6; }
|
||||
#edit_name_dialog { padding:0; }
|
||||
@ -74,19 +72,13 @@ label:hover, dt:hover { color: #333; }
|
||||
#edit_address_dialog { /*width: 30em;*/ }
|
||||
#edit_address_dialog > input { width: 15em; }
|
||||
#edit_photo_dialog_img { display: block; min-width: 150; min-height: 200; }
|
||||
#fn { float: left !important; width: 18em !important; }
|
||||
#name { /*position: absolute; top: 0px; left: 0px;*/ min-width: 25em; height: 2em; clear: right; display: block; }
|
||||
#identityprops { /*position: absolute; top: 2.5em; left: 0px;*/ }
|
||||
#contact_photo { float: left; margin: 1em; }
|
||||
#contact_identity { min-width: 30em; padding: 0.5em;}
|
||||
.contactsection { position: relative; float: left; width: 35em; padding: 0.5em; height: auto; }
|
||||
|
||||
#cropbox { margin: auto; }
|
||||
#contacts_details_photo_wrapper { width: 150px; }
|
||||
#contacts_details_photo_wrapper.wait { opacity: 0.6; filter:alpha(opacity=0.6); z-index:1000; background: url('%webroot%/core/img/loading.gif') no-repeat center center; cursor: wait; }
|
||||
.contacts_details_photo { border-radius: 0.5em; border: thin solid #bbb; margin: 0.3em; background: url('%webroot%/core/img/loading.gif') no-repeat center center; -moz-box-shadow: 0 1px 3px #777; -webkit-box-shadow: 0 1px 3px #777; box-shadow: 0 1px 3px #777; opacity: 1; }
|
||||
.contacts_details_photo { border-radius: 0.3em; border: thin solid #bbb; margin: 0.3em; background: url('%webroot%/core/img/loading.gif') no-repeat center center; -moz-box-shadow: 0 1px 3px #777; -webkit-box-shadow: 0 1px 3px #777; box-shadow: 0 1px 3px #777; opacity: 1; }
|
||||
.contacts_details_photo:hover { background: #fff; cursor: default; }
|
||||
#phototools { position:absolute; margin: 5px 0 0 10px; width:auto; height:22px; padding:0px; background-color:#fff; list-style-type:none; border-radius: 0.5em; -moz-box-shadow: 0 1px 3px #777; -webkit-box-shadow: 0 1px 3px #777; box-shadow: 0 1px 3px #777; }
|
||||
#phototools { position:absolute; margin: 5px 0 0 10px; width:auto; height:22px; padding:0px; background-color:#fff; list-style-type:none; border-radius: 0.3em; -moz-box-shadow: 0 1px 3px #777; -webkit-box-shadow: 0 1px 3px #777; box-shadow: 0 1px 3px #777; }
|
||||
#phototools li { display: inline; }
|
||||
#phototools li a { float:left; cursor:pointer; width:22px; height:22px; opacity: 0.6; }
|
||||
#phototools li a:hover { opacity: 0.8; }
|
||||
@ -118,24 +110,26 @@ dl.addresscard .action { float: right; }
|
||||
#file_upload_form { width: 0; height: 0; }
|
||||
#file_upload_target, #import_upload_target, #crop_target { display:none; }
|
||||
#file_upload_start, #import_upload_start { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; z-index:1001; width:0; height:0;}
|
||||
input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; }
|
||||
.big { font-weight:bold; font-size:1.2em; }
|
||||
.huge { font-weight:bold; font-size:1.5em; }
|
||||
.propertycontainer dd { float: left; width: 25em; }
|
||||
/*.propertylist { clear: none; max-width: 33em; }*/
|
||||
.propertylist li.propertycontainer { white-space: nowrap; min-width: 35em; display: block; clear: both; }
|
||||
.propertycontainer[data-element="EMAIL"] > input[type="email"],.propertycontainer[data-element="TEL"] > input[type="text"] { min-width: 12em !important; float: left; }
|
||||
.propertylist li > input[type="checkbox"],input[type="radio"] { float: left; clear: left; width: 16px; height: 16px; vertical-align: middle; padding: 0; }
|
||||
|
||||
.propertylist li.propertycontainer { white-space: nowrap; min-width: 38em; display: block; clear: both; }
|
||||
.propertylist { float: left; }
|
||||
.propertylist li > input[type="checkbox"],input[type="radio"] { float: left; }
|
||||
.propertylist li > input.value:not([type="checkbox"]) { min-width: 16em; }
|
||||
.propertylist li > select { float: left; max-width: 8em; }
|
||||
.propertylist li > .select_wrapper { float: left; overflow: hidden; color: #bbb; font-size: 0.8em; }
|
||||
.propertylist li > .select_wrapper select { float: left; overflow: hidden; color: #bbb; }
|
||||
.propertylist li > .select_wrapper select { float: left; overflow: hidden; text-overflow: ellipsis; color: #bbb; width: 8em; }
|
||||
.propertylist li > .select_wrapper select:hover { overflow: inherit; text-overflow: inherit; }
|
||||
.propertylist li > .select_wrapper select option { color: #777; }
|
||||
.propertylist li > .select_wrapper select:hover,.propertylist li > select:focus,.propertylist li > select:active { color: #777; }
|
||||
.propertylist li > .select_wrapper select.impp { margin-left: -23px; direction: rtl; }
|
||||
.propertylist li > .select_wrapper select.rtl { margin-left: -24px; direction: rtl; }
|
||||
.propertylist li > .select_wrapper select.types { margin-right: -23px; }
|
||||
.propertylist li > input[type="checkbox"].impp { clear: none; }
|
||||
.propertylist li > label.xab { display: block; color: #bbb; float:left; clear: both; padding: 0.5em 0 0 2.5em; }
|
||||
.propertylist li > label.xab:hover { color: #777; }
|
||||
label, dt, .label { float: left; font-size: 0.7em; color: #bbb !important; max-width: 7em !important; border: 0; }
|
||||
label:hover, .form dt:hover, input.label:hover { color: #777 !important; }
|
||||
.typelist[type="button"] { float: left; max-width: 8em; border: 0; background-color: #fff; color: #bbb; box-shadow: none; } /* for multiselect */
|
||||
.typelist[type="button"]:hover { color: #777; } /* for multiselect */
|
||||
.addresslist { clear: both; font-weight: bold; }
|
||||
@ -157,3 +151,80 @@ input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; }
|
||||
.addressbooks-settings a.action { opacity: 0.2; }
|
||||
.addressbooks-settings a.action:hover { opacity: 1; }
|
||||
.addressbooks-settings td.active, .addressbooks-settings td.action { width: 20px; }
|
||||
|
||||
#toggle_all { position: absolute; bottom: .5em; left: .8em; }
|
||||
.numcontacts { float: right; }
|
||||
input.propertytype { float: left; font-size: .8em; width: 8em !important; direction: rtl;}
|
||||
#rightcontent, .rightcontent { position:fixed; top: 7.5em; left: 32.5em; overflow-x:hidden; overflow-y: auto; }
|
||||
#rightcontent table { position: relative; top: 0; left: 0; right: 0; }
|
||||
#contactsheader { position: fixed; padding: 0; margin:0; top:3.5em; left: 32.5em; right: 0; height: 4em; border-bottom: 1px solid #DDDDDD; z-index: 50; }
|
||||
#contactsheader div { padding: 0 0.5em; height: 100%; width: 90%; margin:0; }
|
||||
|
||||
#contactsheader button { width: 26px; height: 26px; margin-right: .5em; top: .7em; opacity: 0.5; }
|
||||
#contactsheader button:hover { opacity: 1; }
|
||||
#contactsheader .settings { background:url('%webroot%/core/img/actions/settings.svg') no-repeat center; position: absolute; right: 1em; margin: 0; }
|
||||
#contactsheader .import { background:url('%webroot%/core/img/actions/upload.svg') no-repeat center; }
|
||||
#contactsheader .newcontact { background:url('%appswebroot%/contacts/img/contact-new.svg') no-repeat center; }
|
||||
#contactsheader .delete { background:url('%webroot%/core/img/actions/delete.svg') no-repeat center; }
|
||||
#contactsheader .add { background:url('%webroot%/core/img/actions/add.svg') no-repeat center; margin-left: 5em; }
|
||||
|
||||
#contactlist tr { height: 3em; }
|
||||
#contactlist tr td { text-overflow: ellipsis; border-bottom: 1px solid #DDDDDD; font-weight: normal; text-align: left; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
|
||||
#contactlist tr td:hover { overflow: inherit; text-overflow: inherit; background-color: #fff; z-index: 200; }
|
||||
#contactlist tr td:not(.adr) { width: 15%; }
|
||||
#contactlist tr td.name>input[type=checkbox]:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; float:left; margin:.5em 0 0 1.2em; -webkit-transition:opacity 200ms; -moz-transition:opacity 200ms; -o-transition:opacity 200ms; transition:opacity 200ms; }
|
||||
#contactlist tr td.name>input[type="checkbox"]:hover:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; }
|
||||
#contactlist tr td.name>input[type="checkbox"]:checked:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; }
|
||||
#contactlist tr td.name { font-weight: bold; text-indent: 1.6em; -webkit-transition:background-image 500ms; -moz-transition:background-image 500ms; -o-transition:background-image 500ms; transition:background-image 500ms; position:relative; background-position:1em .5em !important; background-repeat:no-repeat !important; }
|
||||
#contactlist tr td.email span { float: left; clear: none; }
|
||||
#contactlist tr td a.mailto { float: right; cursor:pointer; width:22px; height:22px; z-index: 200; opacity: 0.6; background:url('%webroot%/core/img/actions/mail.svg') no-repeat center; }
|
||||
#contactlist tr td a.mailto:hover { opacity: 0.8; }
|
||||
|
||||
section#contact { position: relative; top: 0; left: 0; right: 0; }
|
||||
|
||||
#contact figure { float: left; clear: none; }
|
||||
#contact figure img { -moz-border-radius:.3em; -webkit-border-radius:.3em; border-radius:.3em; border: thin solid #bbb; margin: 0.3em; background: url('%webroot%/core/img/loading.gif') no-repeat center center; -moz-box-shadow: 0 1px 3px #777; -webkit-box-shadow: 0 1px 3px #777; box-shadow: 0 1px 3px #777; opacity: 1; }
|
||||
#contact section { float: left; margin: 1em; }
|
||||
#contact footer { clear: both; margin: 1em; }
|
||||
#contact li { display: block; clear: both; white-space: nowrap; }
|
||||
#contact span.adr { float: left; max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
#contact span.adr:hover { overflow: inherit; }
|
||||
#contact .value {float: left; }
|
||||
|
||||
|
||||
@media screen and (max-width: 1500px) {
|
||||
#contactlist tr td.categories { display: none; }
|
||||
}
|
||||
@media screen and (max-width: 1400px) {
|
||||
#contactlist tr td.adr { display: none; }
|
||||
}
|
||||
@media screen and (min-width: 1400px) {
|
||||
ul.propertylist {
|
||||
-moz-column-count: 3;
|
||||
/*-webkit-columns: 3;*/
|
||||
-o-columns: 3;
|
||||
columns: 3;
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: 1100) and (max-width: 1200px) {
|
||||
#contactlist tr td.tel { display: none; }
|
||||
}
|
||||
@media screen and (min-width: 800px) and (max-width: 1400) {
|
||||
ul.propertylist {
|
||||
-moz-column-count: 2;
|
||||
-webkit-columns: 2;
|
||||
-o-columns: 2;
|
||||
columns: 2;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 900px) {
|
||||
#contactlist tr td.email { display: none; }
|
||||
}
|
||||
@media screen and (max-width: 400px) {
|
||||
ul.propertylist {
|
||||
-moz-column-count: 1;
|
||||
-webkit-columns: 1;
|
||||
-o-columns: 1;
|
||||
columns: 1;
|
||||
}
|
||||
}
|
||||
|
BIN
img/checkmark.png
Normal file
BIN
img/checkmark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 280 B |
@ -29,6 +29,7 @@ OCP\App::setActiveNavigationEntry('contacts_index');
|
||||
// Load a specific user?
|
||||
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
|
||||
$impp_types = OC_Contacts_App::getTypesOfProperty('IMPP');
|
||||
$adr_types = OC_Contacts_App::getTypesOfProperty('ADR');
|
||||
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
|
||||
$email_types = OC_Contacts_App::getTypesOfProperty('EMAIL');
|
||||
$ims = OC_Contacts_App::getIMOptions();
|
||||
@ -48,7 +49,8 @@ $maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
|
||||
|
||||
OCP\Util::addscript('', 'jquery.multiselect');
|
||||
OCP\Util::addscript('', 'oc-vcategories');
|
||||
OCP\Util::addscript('contacts', 'contacts');
|
||||
OCP\Util::addscript('contacts', 'app');
|
||||
OCP\Util::addscript('contacts', 'modernizr');
|
||||
OCP\Util::addscript('contacts', 'expanding');
|
||||
OCP\Util::addscript('contacts', 'jquery.combobox');
|
||||
OCP\Util::addscript('files', 'jquery.fileupload');
|
||||
@ -60,12 +62,13 @@ OCP\Util::addStyle('contacts', 'jquery.combobox');
|
||||
OCP\Util::addStyle('contacts', 'jquery.Jcrop');
|
||||
OCP\Util::addStyle('contacts', 'contacts');
|
||||
|
||||
$tmpl = new OCP\Template( "contacts", "index", "user" );
|
||||
$tmpl = new OCP\Template( "contacts", "contacts", "user" );
|
||||
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize, false);
|
||||
$tmpl->assign('uploadMaxHumanFilesize',
|
||||
OCP\Util::humanFileSize($maxUploadFilesize), false);
|
||||
$tmpl->assign('phone_types', $phone_types, false);
|
||||
$tmpl->assign('email_types', $email_types, false);
|
||||
$tmpl->assign('adr_types', $adr_types, false);
|
||||
$tmpl->assign('impp_types', $impp_types, false);
|
||||
$tmpl->assign('categories', $categories, false);
|
||||
$tmpl->assign('im_protocols', $im_protocols, false);
|
||||
|
871
js/app.js
Normal file
871
js/app.js
Normal file
@ -0,0 +1,871 @@
|
||||
if (typeof Object.create !== 'function') {
|
||||
Object.create = function (o) {
|
||||
function F() {}
|
||||
F.prototype = o;
|
||||
return new F();
|
||||
};
|
||||
}
|
||||
|
||||
Array.prototype.clean = function(deleteValue) {
|
||||
for (var i = 0; i < this.length; i++) {
|
||||
if (this[i] == deleteValue) {
|
||||
this.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
OC.Contacts = OC.Contacts || {
|
||||
init:function() {
|
||||
this.ENTER_KEY = 13;
|
||||
this.scrollTimeoutMiliSecs = 100;
|
||||
this.isScrolling = false;
|
||||
this.cacheElements();
|
||||
this.Contacts = new OC.Contacts.ContactList(
|
||||
this.$contactList,
|
||||
this.$contactListItemTemplate,
|
||||
this.$contactFullTemplate,
|
||||
this.detailTemplates
|
||||
);
|
||||
this.bindEvents();
|
||||
},
|
||||
/**
|
||||
* Arguments:
|
||||
* message: The text message to show.
|
||||
* timeout: The timeout in seconds before the notification disappears. Default 10.
|
||||
* timeouthandler: A function to run on timeout.
|
||||
* clickhandler: A function to run on click. If a timeouthandler is given it will be cancelled.
|
||||
* data: An object that will be passed as argument to the timeouthandler and clickhandler functions.
|
||||
* cancel: If set cancel all ongoing timer events and hide the notification.
|
||||
*/
|
||||
notify:function(params) {
|
||||
var self = this;
|
||||
if(!self.notifier) {
|
||||
self.notifier = $('#notification');
|
||||
}
|
||||
if(params.cancel) {
|
||||
self.notifier.off('click');
|
||||
for(var id in self.notifier.data()) {
|
||||
if($.isNumeric(id)) {
|
||||
clearTimeout(parseInt(id));
|
||||
}
|
||||
}
|
||||
self.notifier.text('').fadeOut().removeData();
|
||||
return;
|
||||
}
|
||||
self.notifier.text(params.message);
|
||||
self.notifier.fadeIn();
|
||||
self.notifier.on('click', function() { $(this).fadeOut();});
|
||||
var timer = setTimeout(function() {
|
||||
if(!self || !self.notifier) {
|
||||
var self = OC.Contacts;
|
||||
self.notifier = $('#notification');
|
||||
}
|
||||
self.notifier.fadeOut();
|
||||
if(params.timeouthandler && $.isFunction(params.timeouthandler)) {
|
||||
params.timeouthandler(self.notifier.data(dataid));
|
||||
self.notifier.off('click');
|
||||
self.notifier.removeData(dataid);
|
||||
}
|
||||
}, params.timeout && $.isNumeric(params.timeout) ? parseInt(params.timeout)*1000 : 10000);
|
||||
var dataid = timer.toString();
|
||||
if(params.data) {
|
||||
self.notifier.data(dataid, params.data);
|
||||
}
|
||||
if(params.clickhandler && $.isFunction(params.clickhandler)) {
|
||||
self.notifier.on('click', function() {
|
||||
if(!self || !self.notifier) {
|
||||
var self = OC.Contacts;
|
||||
self.notifier = $(this);
|
||||
}
|
||||
clearTimeout(timer);
|
||||
self.notifier.off('click');
|
||||
params.clickhandler(self.notifier.data(dataid));
|
||||
self.notifier.removeData(dataid);
|
||||
});
|
||||
}
|
||||
},
|
||||
loading:function(obj, state) {
|
||||
if(state) {
|
||||
$(obj).addClass('loading');
|
||||
} else {
|
||||
$(obj).removeClass('loading');
|
||||
}
|
||||
},
|
||||
cacheElements: function() {
|
||||
var self = this;
|
||||
this.detailTemplates = {};
|
||||
// Load templates for contact details.
|
||||
// The weird double loading is because jquery apparently doesn't
|
||||
// create a searchable object from a script element.
|
||||
$.each($($('#contactDetailsTemplate').html()), function(idx, node) {
|
||||
if(node.nodeType === Node.ELEMENT_NODE && node.nodeName === 'DIV') {
|
||||
var $tmpl = $(node.innerHTML);
|
||||
self.detailTemplates[$tmpl.data('element')] = $(node.outerHTML);
|
||||
}
|
||||
});
|
||||
this.$groupListItemTemplate = $('#groupListItemTemplate');
|
||||
this.$contactListItemTemplate = $('#contactListItemTemplate');
|
||||
this.$contactFullTemplate = $('#contactFullTemplate');
|
||||
this.$contactDetailsTemplate = $('#contactDetailsTemplate');
|
||||
this.$rightContent = $('#rightcontent');
|
||||
this.$header = $('#contactsheader');
|
||||
this.$groupList = $('#grouplist');
|
||||
this.$contactList = $('#contactlist');
|
||||
this.$contactListHeader = $('#contactlistheader');
|
||||
this.$toggleAll = $('#toggle_all');
|
||||
},
|
||||
bindEvents: function() {
|
||||
var self = this;
|
||||
this.$toggleAll.on('change', function() {
|
||||
self.Contacts.toggleAll(this, self.$contactList.find('input:checkbox'));
|
||||
});
|
||||
this.$contactList.on('change', 'input:checkbox', function(event) {
|
||||
var id = parseInt($(this).parents('tr').first().data('id'));
|
||||
self.Contacts.selectedContacts.push(id);
|
||||
console.log('selected', id);
|
||||
});
|
||||
$(document).bind('status.contact.deleted', function(e, data) {
|
||||
var id = parseInt(data.id);
|
||||
console.log('contact', data.id, 'deleted');
|
||||
// update counts on group list
|
||||
self.$groupList.find('h3').each(function(i, group) {
|
||||
if($(this).data('type') === 'all') {
|
||||
$(this).find('.numcontacts').text(parseInt($(this).find('.numcontacts').text()-1));
|
||||
} else if($(this).data('type') === 'category') {
|
||||
var contacts = $(this).data('contacts');
|
||||
console.log('contacts', contacts, contacts.indexOf(id), contacts.indexOf(String(id)));
|
||||
if(contacts.indexOf(String(id)) !== -1) {
|
||||
contacts.splice(contacts.indexOf(String(id)), 1);
|
||||
console.log('contacts', contacts, contacts.indexOf(id), contacts.indexOf(String(id)));
|
||||
$(this).data('contacts', contacts);
|
||||
$(this).find('.numcontacts').text(contacts.length);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).bind('status.contact.enabled', function(e, enabled) {
|
||||
if(enabled) {
|
||||
self.$header.find('.delete').show();
|
||||
} else {
|
||||
self.$header.find('.delete').hide();
|
||||
}
|
||||
});
|
||||
$(document).bind('status.contactsLoaded', function(e, result) {
|
||||
console.log('contactsLoaded', result);
|
||||
if(result.status !== true) {
|
||||
alert('Error loading contacts!');
|
||||
}
|
||||
self.numcontacts = result.numcontacts;
|
||||
self.loadGroups();
|
||||
self.$rightContent.removeClass('loading');
|
||||
});
|
||||
// mark items whose title was hid under the top edge as read
|
||||
/*this.$rightContent.scroll(function() {
|
||||
// prevent too many scroll requests;
|
||||
if(!self.isScrolling) {
|
||||
self.isScrolling = true;
|
||||
var num = self.$contactList.find('tr').length;
|
||||
//console.log('num', num);
|
||||
var offset = self.$contactList.find('tr:eq(' + (num-20) + ')').offset().top;
|
||||
if(offset < self.$rightContent.height()) {
|
||||
console.log('load more');
|
||||
self.Contacts.loadContacts(num, function() {
|
||||
self.isScrolling = false;
|
||||
});
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
self.isScrolling = false;
|
||||
}, self.scrollTimeoutMiliSecs);
|
||||
}
|
||||
//console.log('scroll, unseen:', offset, self.$rightContent.height());
|
||||
}
|
||||
});*/
|
||||
this.$groupList.on('click', 'h3', function() {
|
||||
console.log('Group click', $(this).data('id'), $(this).data('type'));
|
||||
delete self.currentid;
|
||||
self.$groupList.find('h3').removeClass('active');
|
||||
self.$contactList.show();
|
||||
self.$header.find('.list').show();
|
||||
self.$header.find('.single').hide();
|
||||
$('#contact').remove();
|
||||
$(this).addClass('active');
|
||||
if($(this).data('type') === 'category') {
|
||||
self.Contacts.showContacts($(this).data('contacts'));
|
||||
} else {
|
||||
self.Contacts.showContacts($(this).data('id'));
|
||||
}
|
||||
});
|
||||
this.$contactList.on('click', 'tr', function(event) {
|
||||
if($(event.target).is('input')) {
|
||||
return;
|
||||
}
|
||||
if($(event.target).is('a.mailto')) {
|
||||
console.log('mailto', $(this).find('.email').text().trim());
|
||||
window.location.href='mailto:' + $(this).find('.email').text().trim();
|
||||
return;
|
||||
}
|
||||
self.currentid = $(this).data('id');
|
||||
console.log('Contact click', self.currentid);
|
||||
self.$contactList.hide();
|
||||
self.$header.find('.list').hide();
|
||||
self.$header.find('.single').show();
|
||||
self.$rightContent.prepend(self.Contacts.showContact(self.currentid));
|
||||
});
|
||||
this.$header.find('.delete').on('click keydown', function() {
|
||||
console.log('delete');
|
||||
if(self.currentid) {
|
||||
self.Contacts.delayedDeleteContact(self.currentid);
|
||||
} else {
|
||||
console.log('currentid is not set');
|
||||
}
|
||||
});
|
||||
this.$header.find('.settings').on('click keydown', function() {
|
||||
try {
|
||||
//ninjahelp.hide();
|
||||
OC.appSettings({appid:'contacts', loadJS:true, cache:false});
|
||||
} catch(e) {
|
||||
console.log('error:', e.message);
|
||||
}
|
||||
});
|
||||
this.$contactList.on('mouseenter', 'td.email', function(event) {
|
||||
if($(this).text().trim().length > 3) {
|
||||
$(this).find('.mailto').fadeIn(100);
|
||||
}
|
||||
});
|
||||
this.$contactList.on('mouseleave', 'td.email', function(event) {
|
||||
$(this).find('.mailto').fadeOut(100);
|
||||
});
|
||||
$('[title]').tipsy(); // find all with a title attribute and tipsy them
|
||||
},
|
||||
update: function() {
|
||||
console.log('update');
|
||||
},
|
||||
loadGroups: function() {
|
||||
var self = this;
|
||||
var groupList = this.$groupList;
|
||||
var tmpl = this.$groupListItemTemplate;
|
||||
|
||||
tmpl.octemplate({id: 'all', type: 'all', num: this.numcontacts, name: t('contacts', 'All')}).appendTo(groupList);
|
||||
tmpl.octemplate({id: 'fav', type: 'fav', num: '', name: t('contacts', 'Favorites')}).appendTo(groupList);
|
||||
$.getJSON(OC.filePath('contacts', 'ajax', 'categories/list.php'), {}, function(jsondata) {
|
||||
if (jsondata && jsondata.status == 'success') {
|
||||
self.categories = [];
|
||||
$.each(jsondata.data.categories, function(c, category) {
|
||||
var $elem = (tmpl).octemplate({
|
||||
id: category.id,
|
||||
type: 'category',
|
||||
num: category.contacts.length,
|
||||
name: category.name,
|
||||
})
|
||||
self.categories.push({id: category.id, name: category.name});
|
||||
$elem.data('contacts', category.contacts)
|
||||
$elem.appendTo(groupList);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
/**
|
||||
* An item which binds the appropriate html and event handlers
|
||||
* @param parent the parent Contacts list
|
||||
* @param data the data used to populate the contact
|
||||
* @param template the jquery object used to render the contact
|
||||
*/
|
||||
var Contact = function(parent, id, access, data, listtemplate, fulltemplate, detailtemplates) {
|
||||
//console.log('contact:', id, access); //parent, id, data, listtemplate, fulltemplate);
|
||||
this.parent = parent,
|
||||
this.id = id,
|
||||
this.access = access,
|
||||
this.data = data,
|
||||
this.$listTemplate = listtemplate,
|
||||
this.$fullTemplate = fulltemplate;
|
||||
this.detailTemplates = detailtemplates;
|
||||
var self = this;
|
||||
this.multi_properties = ['EMAIL', 'TEL', 'IMPP', 'ADR', 'URL'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Act on change
|
||||
* @param event
|
||||
*/
|
||||
Contact.prototype.save = function(self, obj) {
|
||||
OC.Contacts.loading(obj, true);
|
||||
var container = $(obj).hasClass('propertycontainer')
|
||||
? obj : self.propertyContainerFor(obj);
|
||||
var element = container.data('element').toUpperCase();
|
||||
console.log('change', obj, element, container, container
|
||||
.find('input.value,select.value,textarea.value'));//.serializeArray());
|
||||
var q = container.find('input.value,select.value,textarea.value').serialize();
|
||||
if(q == '' || q == undefined) {
|
||||
$(document).trigger('status.contact', {
|
||||
status: 'error',
|
||||
message: t('contacts', 'Couldn\'t serialize elements.'),
|
||||
});
|
||||
OC.Contacts.loading(obj, false);
|
||||
return false;
|
||||
}
|
||||
q = q + '&id=' + self.id + '&name=' + element;
|
||||
if(self.multi_properties.indexOf(element) !== -1) {
|
||||
q = q + '&checksum=' + container.data('checksum');
|
||||
}
|
||||
console.log(q);
|
||||
OC.Contacts.loading(obj, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove any open contact from the DOM and detach it's list
|
||||
* element from the DOM.
|
||||
*/
|
||||
Contact.prototype.detach = function() {
|
||||
if(this.$fullelem) {
|
||||
this.$fullelem.remove();
|
||||
}
|
||||
if(this.$listelem) {
|
||||
return this.$listelem.detach();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a contact to en/disabled depending on its permissions.
|
||||
* @param boolean enabled
|
||||
*/
|
||||
Contact.prototype.setEnabled = function(enabled) {
|
||||
console.log('setEnabled', enabled);
|
||||
if(enabled) {
|
||||
this.$fullelem.find('#addproperty').show();
|
||||
} else {
|
||||
this.$fullelem.find('#addproperty').hide();
|
||||
}
|
||||
this.enabled = enabled;
|
||||
this.$fullelem.find('.value,.action').each(function () {
|
||||
console.log($(this));
|
||||
$(this).prop('disabled', !enabled);
|
||||
});
|
||||
$(document).trigger('status.contact.enabled', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete contact from data store and remove it from the DOM
|
||||
*/
|
||||
Contact.prototype.destroy = function(cb) {
|
||||
var self = this;
|
||||
$.post(OC.filePath('contacts', 'ajax', 'contact/delete.php'),
|
||||
{id: this.id}, function(jsondata) {
|
||||
if(jsondata && jsondata.status === 'success') {
|
||||
if(self.$listelem) {
|
||||
self.$listelem.remove();
|
||||
}
|
||||
if(self.$fullelem) {
|
||||
self.$fullelem.remove();
|
||||
}
|
||||
}
|
||||
if(typeof cb == 'function') {
|
||||
cb({
|
||||
status: jsondata ? jsondata.status : 'error',
|
||||
message: (jsondata && jsondata.data) ? jsondata.data.message : '',
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Contact.prototype.propertyContainerFor = function(obj) {
|
||||
return $(obj).parents('.propertycontainer').first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the list item
|
||||
* @return A jquery object to be inserted in the DOM
|
||||
*/
|
||||
Contact.prototype.renderListItem = function() {
|
||||
this.$listelem = this.$listTemplate.octemplate({
|
||||
id: this.id,
|
||||
name: this.getPreferredValue('FN', ''),
|
||||
email: this.getPreferredValue('EMAIL', ''),
|
||||
tel: this.getPreferredValue('TEL', ''),
|
||||
adr: this.getPreferredValue('ADR', []).clean('').join(', '),
|
||||
categories: this.getPreferredValue('CATEGORIES', [])
|
||||
.clean('').join(' / '),
|
||||
});
|
||||
return this.$listelem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the full contact
|
||||
* @return A jquery object to be inserted in the DOM
|
||||
*/
|
||||
Contact.prototype.renderContact = function() {
|
||||
var self = this;
|
||||
console.log('renderContact', this.data);
|
||||
var values = this.data
|
||||
? {
|
||||
id: this.id,
|
||||
name: this.getPreferredValue('FN', ''),
|
||||
nickname: this.getPreferredValue('NICKNAME', ''),
|
||||
title: this.getPreferredValue('TITLE', ''),
|
||||
org: this.getPreferredValue('ORG', []).clean('').join(', '), // TODO Add parts if more than one.
|
||||
bday: this.getPreferredValue('BDAY', '').length >= 10
|
||||
? $.datepicker.formatDate('dd-mm-yy',
|
||||
$.datepicker.parseDate('yy-mm-dd',
|
||||
this.getPreferredValue('BDAY', '').substring(0, 10)))
|
||||
: '',
|
||||
}
|
||||
: {id: '', name: '', nickname: '', title: '', org: '', bday: ''};
|
||||
this.$fullelem = this.$fullTemplate.octemplate(values).data('contactobject', this);
|
||||
this.$fullelem.on('change', '#addproperty', function(event) {
|
||||
console.log('add', $(this).val());
|
||||
$(this).val('')
|
||||
});
|
||||
this.$fullelem.on('change', '.value', function(event) {
|
||||
console.log('change', event);
|
||||
self.save(self, event.target);
|
||||
});
|
||||
this.$fullelem.find('form').on('submit', function(event) {
|
||||
console.log('submit', event);
|
||||
return false;
|
||||
});
|
||||
this.$fullelem.find('[data-element="bday"]')
|
||||
.find('input').datepicker({
|
||||
dateFormat : 'dd-mm-yy'
|
||||
});
|
||||
if(!this.data) {
|
||||
// A new contact
|
||||
this.setEnabled(true);
|
||||
return this.$fullelem;
|
||||
}
|
||||
for(var value in values) {
|
||||
console.log(value);
|
||||
if(!values[value].length) {
|
||||
this.$fullelem.find('[data-element="' + value + '"]').hide();
|
||||
}
|
||||
}
|
||||
$.each(this.multi_properties, function(idx, name) {
|
||||
if(self.data[name]) {
|
||||
var $list = self.$fullelem.find('ul.' + name.toLowerCase());
|
||||
$list.show();
|
||||
for(var p in self.data[name]) {
|
||||
if(typeof self.data[name][p] === 'object') {
|
||||
var property = self.data[name][p];
|
||||
console.log(name, p, property);
|
||||
$property = null;
|
||||
switch(name) {
|
||||
case 'TEL':
|
||||
case 'URL':
|
||||
case 'EMAIL':
|
||||
$property = self.renderStandardProperty(name.toLowerCase(), property);
|
||||
break;
|
||||
case 'ADR':
|
||||
$property = self.renderAddressProperty(property);
|
||||
break;
|
||||
case 'IMPP':
|
||||
$property = self.renderIMProperty(property);
|
||||
break;
|
||||
}
|
||||
if(!$property) {
|
||||
continue;
|
||||
}
|
||||
//console.log('$property', $property);
|
||||
if(property.label) {
|
||||
if(!property.parameters['TYPE']) {
|
||||
property.parameters['TYPE'] = [];
|
||||
}
|
||||
property.parameters['TYPE'].push(property.label);
|
||||
}
|
||||
for(var param in property.parameters) {
|
||||
//console.log('param', param);
|
||||
if(param.toUpperCase() == 'PREF') {
|
||||
$property.find('input[type="checkbox"]').attr('checked', 'checked')
|
||||
}
|
||||
else if(param.toUpperCase() == 'TYPE') {
|
||||
for(etype in property.parameters[param]) {
|
||||
var found = false;
|
||||
var et = property.parameters[param][etype];
|
||||
if(typeof et !== 'string') {
|
||||
continue;
|
||||
}
|
||||
//console.log('et', et);
|
||||
if(et.toUpperCase() === 'INTERNET') {
|
||||
continue;
|
||||
}
|
||||
$property.find('select.type option').each(function() {
|
||||
if($(this).val().toUpperCase() === et.toUpperCase()) {
|
||||
$(this).attr('selected', 'selected');
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
if(!found) {
|
||||
$property.find('select.type option:last-child').after('<option value="'+et+'" selected="selected">'+et+'</option>');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(param.toUpperCase() == 'X-SERVICE-TYPE') {
|
||||
//console.log('setting', $property.find('select.impp'), 'to', property.parameters[param].toLowerCase());
|
||||
$property.find('select.impp').val(property.parameters[param].toLowerCase());
|
||||
}
|
||||
}
|
||||
$property.find('select.type[name="parameters[TYPE][]"]')
|
||||
.combobox({
|
||||
singleclick: true,
|
||||
classes: ['propertytype', 'float', 'label'],
|
||||
});
|
||||
$list.append($property);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if(this.access.owner !== OC.currentUser
|
||||
&& !(this.access.permissions & OC.PERMISSION_UPDATE
|
||||
|| this.access.permissions & OC.PERMISSION_DELETE)) {
|
||||
this.setEnabled(false);
|
||||
}
|
||||
return this.$fullelem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a simple property. Used for EMAIL and TEL.
|
||||
* @return A jquery object to be injected in the DOM
|
||||
*/
|
||||
Contact.prototype.renderStandardProperty = function(name, property) {
|
||||
if(!this.detailTemplates[name]) {
|
||||
console.log('No template for', name);
|
||||
return;
|
||||
}
|
||||
var values = { value: property.value, checksum: property.checksum };
|
||||
$elem = this.detailTemplates[name].octemplate(values);
|
||||
return $elem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an ADR (address) property.
|
||||
* @return A jquery object to be injected in the DOM
|
||||
*/
|
||||
Contact.prototype.renderAddressProperty = function(property) {
|
||||
if(!this.detailTemplates['adr']) {
|
||||
console.log('No template for adr', this.detailTemplates);
|
||||
return;
|
||||
}
|
||||
var values = {
|
||||
value: property.value.clean('').join(', '),
|
||||
checksum: property.checksum,
|
||||
adr0: property.value[0] || '',
|
||||
adr1: property.value[1] || '',
|
||||
adr2: property.value[2] || '',
|
||||
adr3: property.value[3] || '',
|
||||
adr4: property.value[4] || '',
|
||||
adr5: property.value[5] || '',
|
||||
};
|
||||
$elem = this.detailTemplates['adr'].octemplate(values);
|
||||
return $elem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an IMPP (Instant Messaging) property.
|
||||
* @return A jquery object to be injected in the DOM
|
||||
*/
|
||||
Contact.prototype.renderIMProperty = function(property) {
|
||||
if(!this.detailTemplates['impp']) {
|
||||
console.log('No template for impp', this.detailTemplates);
|
||||
return;
|
||||
}
|
||||
var values = {
|
||||
value: property.value,
|
||||
checksum: property.checksum,
|
||||
};
|
||||
$elem = this.detailTemplates['impp'].octemplate(values);
|
||||
return $elem;
|
||||
}
|
||||
/**
|
||||
* Get the jquery element associated with this object
|
||||
*/
|
||||
Contact.prototype.getListItemElement = function() {
|
||||
if(!this.$listelem) {
|
||||
this.renderListItem();
|
||||
}
|
||||
return this.$listelem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the preferred value for a property.
|
||||
* If a preferred value is not found the first one will be returned.
|
||||
* @param string name The name of the property like EMAIL, TEL or ADR.
|
||||
* @param def A default value to return if nothing is found.
|
||||
*/
|
||||
Contact.prototype.getPreferredValue = function(name, def) {
|
||||
var pref = def, found = false;
|
||||
if(this.data[name]) {
|
||||
var props = this.data[name];
|
||||
//console.log('props', props);
|
||||
$.each(props, function( i, prop ) {
|
||||
//console.log('prop:', i, prop);
|
||||
if(i === 0) { // Choose first to start with
|
||||
pref = prop.value;
|
||||
}
|
||||
for(var param in prop.parameters) {
|
||||
if(param.toUpperCase() == 'PREF') {
|
||||
found = true; //
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found) {
|
||||
return false; // break out of loop
|
||||
}
|
||||
});
|
||||
}
|
||||
return pref;
|
||||
}
|
||||
|
||||
var ContactList = function(contactlist, contactlistitemtemplate, contactfulltemplate, contactdetailtemplates) {
|
||||
//console.log('ContactList', contactlist, contactlistitemtemplate, contactfulltemplate, contactdetailtemplates);
|
||||
var self = this;
|
||||
this.contacts = {};
|
||||
this.deletionQueue = [];
|
||||
this.selectedContacts = [];
|
||||
this.$contactList = contactlist;
|
||||
this.$contactListItemTemplate = contactlistitemtemplate;
|
||||
this.$contactFullTemplate = contactfulltemplate;
|
||||
this.contactDetailTemplates = contactdetailtemplates;
|
||||
this.$contactList.scrollTop(0);
|
||||
this.loadContacts(0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show contacts in list
|
||||
* @param Array contacts. A list of contact ids.
|
||||
*/
|
||||
ContactList.prototype.showContacts = function(contacts) {
|
||||
for(var contact in this.contacts) {
|
||||
if(contacts === 'all') {
|
||||
this.contacts[contact].getListItemElement().show();
|
||||
} else {
|
||||
contact = parseInt(contact);
|
||||
if(contacts.indexOf(String(contact)) === -1) {
|
||||
this.contacts[contact].getListItemElement().hide();
|
||||
} else {
|
||||
this.contacts[contact].getListItemElement().show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Jumps to an element in the contact list
|
||||
* FIXME: Use cached contact element.
|
||||
* @param number the number of the item starting with 0
|
||||
*/
|
||||
ContactList.prototype.jumpToElemenId = function(id) {
|
||||
$elem = $('tr.contact_item[data-id="' + id + '"]');
|
||||
this.$contactList.scrollTop(
|
||||
$elem.offset().top - this.$contactList.offset().top
|
||||
+ this.$contactList.scrollTop());
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Contact object by searching for its id
|
||||
* @param id the id of the node
|
||||
* @return the Contact object or undefined if not found.
|
||||
* FIXME: If continious loading is reintroduced this will have
|
||||
* to load the requested contact.
|
||||
*/
|
||||
ContactList.prototype.findById = function(id) {
|
||||
return this.contacts[parseInt(id)];
|
||||
};
|
||||
|
||||
ContactList.prototype.warnNotDeleted = function(e) {
|
||||
e = e || window.event;
|
||||
var warn = t('contacts', 'Some contacts are marked for deletion, but not deleted yet. Please wait for them to be deleted.');
|
||||
if (e) {
|
||||
e.returnValue = String(warn);
|
||||
}
|
||||
if(OC.Contacts.Contacts.deletionQueue.length > 0) {
|
||||
setTimeout(OC.Contacts.Contacts.deleteFilesInQueue, 1);
|
||||
}
|
||||
return warn;
|
||||
}
|
||||
|
||||
ContactList.prototype.delayedDeleteContact = function(id) {
|
||||
var self = this;
|
||||
var listelem = this.contacts[parseInt(id)].detach();
|
||||
self.$contactList.show();
|
||||
this.deletionQueue.push(parseInt(id));
|
||||
console.log('deletionQueue', this.deletionQueue, listelem);
|
||||
if(!window.onbeforeunload) {
|
||||
window.onbeforeunload = this.warnNotDeleted;
|
||||
}
|
||||
// TODO: Check if there are anymore contacts, otherwise show intro.
|
||||
OC.Contacts.notify({
|
||||
data:listelem,
|
||||
message:t('contacts','Click to undo deletion of "') + listelem.find('td.name').text() + '"',
|
||||
//timeout:5,
|
||||
timeouthandler:function(listelem) {
|
||||
console.log('timeout', listelem);
|
||||
self.deleteContact(listelem.data('id'), true);
|
||||
},
|
||||
clickhandler:function(listelem) {
|
||||
self.insertContact({contact:listelem});
|
||||
OC.Contacts.notify({message:t('contacts', 'Cancelled deletion of: "') + listelem.find('a').text() + '"'});
|
||||
window.onbeforeunload = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a contact with this id
|
||||
* @param id the id of the contact
|
||||
*/
|
||||
ContactList.prototype.deleteContact = function(id, removeFromQueue) {
|
||||
var self = this;
|
||||
var id = parseInt(id);
|
||||
console.log('deletionQueue', this.deletionQueue);
|
||||
var updateQueue = function(id, remove) {
|
||||
if(removeFromQueue) {
|
||||
OC.Contacts.Contacts.deletionQueue.splice(OC.Contacts.Contacts.deletionQueue.indexOf(parseInt(id)), 1);
|
||||
}
|
||||
if(OC.Contacts.Contacts.deletionQueue.length == 0) {
|
||||
window.onbeforeunload = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(OC.Contacts.Contacts.deletionQueue.indexOf(parseInt(id)) == -1 && removeFromQueue) {
|
||||
console.log('returning');
|
||||
updateQueue(id, removeFromQueue);
|
||||
if(typeof cb == 'function') {
|
||||
window.onbeforeunload = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.contacts[id].destroy(function(response) {
|
||||
console.log('deleteContact', response);
|
||||
if(response.status === 'success') {
|
||||
delete self.contacts[parseInt(id)];
|
||||
updateQueue(id, removeFromQueue);
|
||||
self.$contactList.show();
|
||||
window.onbeforeunload = null;
|
||||
$(document).trigger('status.contact.deleted', {
|
||||
id: id,
|
||||
});
|
||||
} else {
|
||||
OC.Contacts.notify({message:response.message});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the contact with this id in edit mode
|
||||
* @param id the id of the contact
|
||||
*/
|
||||
ContactList.prototype.showContact = function(id) {
|
||||
console.log('Contacts.showContact', id, this.contacts[parseInt(id)], this.contacts)
|
||||
return this.contacts[parseInt(id)].renderContact();
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggle all checkboxes
|
||||
*/
|
||||
ContactList.prototype.toggleAll = function(toggler, togglees) {
|
||||
var isChecked = $(toggler).is(':checked');
|
||||
console.log('toggleAll', isChecked, self);
|
||||
$.each(togglees, function( i, item ) {
|
||||
item.checked = isChecked;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Insert a contact in the list
|
||||
* @param jQuery object
|
||||
*/
|
||||
ContactList.prototype.insertContact = function(contact) {
|
||||
console.log('insertContact', contact);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load contacts
|
||||
* @param int offset
|
||||
*/
|
||||
ContactList.prototype.loadContacts = function(offset, cb) {
|
||||
var self = this;
|
||||
// Should the actual ajax call be in the controller?
|
||||
$.getJSON(OC.filePath('contacts', 'ajax', 'contact/list.php'), {offset: offset}, function(jsondata) {
|
||||
if (jsondata && jsondata.status == 'success') {
|
||||
console.log('addressbooks', jsondata.data.addressbooks);
|
||||
self.addressbooks = {};
|
||||
$.each(jsondata.data.addressbooks, function(i, book) {
|
||||
self.addressbooks[parseInt(book.id)] = {owner: book.userid, permissions: parseInt(book.permissions)};
|
||||
});
|
||||
$.each(jsondata.data.contacts, function(c, contact) {
|
||||
self.contacts[parseInt(contact.id)]
|
||||
= new Contact(
|
||||
self,
|
||||
contact.id,
|
||||
self.addressbooks[parseInt(contact.aid)],
|
||||
contact.data,
|
||||
self.$contactListItemTemplate,
|
||||
self.$contactFullTemplate,
|
||||
self.contactDetailTemplates
|
||||
);
|
||||
var item = self.contacts[parseInt(contact.id)].renderListItem()
|
||||
self.$contactList.append(item);
|
||||
});
|
||||
$(document).trigger('status.contactsLoaded', {
|
||||
status: true,
|
||||
numcontacts: jsondata.data.contacts.length
|
||||
});
|
||||
}
|
||||
if(typeof cb === 'function') {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
}
|
||||
OC.Contacts.ContactList = ContactList;
|
||||
|
||||
|
||||
/**
|
||||
* Object Template
|
||||
* Inspired by micro templating done by e.g. underscore.js
|
||||
*/
|
||||
var Template = {
|
||||
init: function(options, elem) {
|
||||
// Mix in the passed in options with the default options
|
||||
this.options = $.extend({},this.options,options);
|
||||
|
||||
// Save the element reference, both as a jQuery
|
||||
// reference and a normal reference
|
||||
this.elem = elem;
|
||||
this.$elem = $(elem);
|
||||
|
||||
var _html = this._build(this.options);
|
||||
//console.log('html', this.$elem.html());
|
||||
return $(_html);
|
||||
},
|
||||
// From stackoverflow.com/questions/1408289/best-way-to-do-variable-interpolation-in-javascript
|
||||
_build: function(o){
|
||||
return this.$elem.html().replace(/{([^{}]*)}/g,
|
||||
function (a, b) {
|
||||
var r = o[b];
|
||||
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
||||
}
|
||||
);
|
||||
},
|
||||
options: {
|
||||
},
|
||||
};
|
||||
|
||||
$.fn.octemplate = function(options) {
|
||||
if ( this.length ) {
|
||||
var _template = Object.create(Template);
|
||||
return _template.init(options, this);
|
||||
}
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
OC.Contacts.init();
|
||||
|
||||
});
|
@ -6,18 +6,21 @@
|
||||
$.widget('ui.combobox', {
|
||||
options: {
|
||||
id: null,
|
||||
name: null,
|
||||
showButton: false,
|
||||
editable: true
|
||||
editable: true,
|
||||
singleclick: false,
|
||||
},
|
||||
_create: function() {
|
||||
var self = this,
|
||||
select = this.element.hide(),
|
||||
selected = select.children(':selected'),
|
||||
value = selected.val() ? selected.text() : '';
|
||||
var input = this.input = $('<input type="text">')
|
||||
var name = this.element.attr('name');
|
||||
//this.element.attr('name', 'old_' + name)
|
||||
var input = this.input = $('<input type="text" />')
|
||||
.insertAfter( select )
|
||||
.val( value )
|
||||
//.attr('name', name)
|
||||
.autocomplete({
|
||||
delay: 0,
|
||||
minLength: 0,
|
||||
@ -80,10 +83,20 @@
|
||||
self._setOption(key, value);
|
||||
});
|
||||
|
||||
input.dblclick(function() {
|
||||
// pass empty string as value to search for, displaying all results
|
||||
input.autocomplete('search', '');
|
||||
});
|
||||
var clickHandler = function(e) {
|
||||
var w = self.input.autocomplete('widget');
|
||||
if(w.is(':visible')) {
|
||||
self.input.autocomplete('close');
|
||||
} else {
|
||||
input.autocomplete('search', '');
|
||||
}
|
||||
}
|
||||
|
||||
if(this.options['singleclick'] === true) {
|
||||
input.click(clickHandler);
|
||||
} else {
|
||||
input.dblclick(clickHandler);
|
||||
}
|
||||
|
||||
if(this.options['showButton']) {
|
||||
this.button = $('<button type="button"> </button>')
|
||||
@ -128,10 +141,6 @@
|
||||
this.options['id'] = value;
|
||||
this.input.attr('id', value);
|
||||
break;
|
||||
case 'name':
|
||||
this.options['name'] = value;
|
||||
this.input.attr('name', value);
|
||||
break;
|
||||
case 'attributes':
|
||||
var input = this.input;
|
||||
$.each(this.options['attributes'], function(key, value) {
|
||||
|
1394
js/modernizr.js
Normal file
1394
js/modernizr.js
Normal file
@ -0,0 +1,1394 @@
|
||||
/*!
|
||||
* Modernizr v2.6.3pre
|
||||
* www.modernizr.com
|
||||
*
|
||||
* Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
|
||||
* Available under the BSD and MIT licenses: www.modernizr.com/license/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modernizr tests which native CSS3 and HTML5 features are available in
|
||||
* the current UA and makes the results available to you in two ways:
|
||||
* as properties on a global Modernizr object, and as classes on the
|
||||
* <html> element. This information allows you to progressively enhance
|
||||
* your pages with a granular level of control over the experience.
|
||||
*
|
||||
* Modernizr has an optional (not included) conditional resource loader
|
||||
* called Modernizr.load(), based on Yepnope.js (yepnopejs.com).
|
||||
* To get a build that includes Modernizr.load(), as well as choosing
|
||||
* which tests to include, go to www.modernizr.com/download/
|
||||
*
|
||||
* Authors Faruk Ates, Paul Irish, Alex Sexton
|
||||
* Contributors Ryan Seddon, Ben Alman
|
||||
*/
|
||||
|
||||
window.Modernizr = (function( window, document, undefined ) {
|
||||
|
||||
var version = '2.6.3pre',
|
||||
|
||||
Modernizr = {},
|
||||
|
||||
/*>>cssclasses*/
|
||||
// option for enabling the HTML classes to be added
|
||||
enableClasses = true,
|
||||
/*>>cssclasses*/
|
||||
|
||||
docElement = document.documentElement,
|
||||
|
||||
/**
|
||||
* Create our "modernizr" element that we do most feature tests on.
|
||||
*/
|
||||
mod = 'modernizr',
|
||||
modElem = document.createElement(mod),
|
||||
mStyle = modElem.style,
|
||||
|
||||
/**
|
||||
* Create the input element for various Web Forms feature tests.
|
||||
*/
|
||||
inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ ,
|
||||
|
||||
/*>>smile*/
|
||||
smile = ':)',
|
||||
/*>>smile*/
|
||||
|
||||
toString = {}.toString,
|
||||
|
||||
// TODO :: make the prefixes more granular
|
||||
/*>>prefixes*/
|
||||
// List of property values to set for css tests. See ticket #21
|
||||
prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
|
||||
/*>>prefixes*/
|
||||
|
||||
/*>>domprefixes*/
|
||||
// Following spec is to expose vendor-specific style properties as:
|
||||
// elem.style.WebkitBorderRadius
|
||||
// and the following would be incorrect:
|
||||
// elem.style.webkitBorderRadius
|
||||
|
||||
// Webkit ghosts their properties in lowercase but Opera & Moz do not.
|
||||
// Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+
|
||||
// erik.eae.net/archives/2008/03/10/21.48.10/
|
||||
|
||||
// More here: github.com/Modernizr/Modernizr/issues/issue/21
|
||||
omPrefixes = 'Webkit Moz O ms',
|
||||
|
||||
cssomPrefixes = omPrefixes.split(' '),
|
||||
|
||||
domPrefixes = omPrefixes.toLowerCase().split(' '),
|
||||
/*>>domprefixes*/
|
||||
|
||||
/*>>ns*/
|
||||
ns = {'svg': 'http://www.w3.org/2000/svg'},
|
||||
/*>>ns*/
|
||||
|
||||
tests = {},
|
||||
inputs = {},
|
||||
attrs = {},
|
||||
|
||||
classes = [],
|
||||
|
||||
slice = classes.slice,
|
||||
|
||||
featureName, // used in testing loop
|
||||
|
||||
|
||||
/*>>teststyles*/
|
||||
// Inject element with style element and some CSS rules
|
||||
injectElementWithStyles = function( rule, callback, nodes, testnames ) {
|
||||
|
||||
var style, ret, node, docOverflow,
|
||||
div = document.createElement('div'),
|
||||
// After page load injecting a fake body doesn't work so check if body exists
|
||||
body = document.body,
|
||||
// IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it.
|
||||
fakeBody = body || document.createElement('body');
|
||||
|
||||
if ( parseInt(nodes, 10) ) {
|
||||
// In order not to give false positives we create a node for each test
|
||||
// This also allows the method to scale for unspecified uses
|
||||
while ( nodes-- ) {
|
||||
node = document.createElement('div');
|
||||
node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
|
||||
div.appendChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
// <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed
|
||||
// when injected with innerHTML. To get around this you need to prepend the 'NoScope' element
|
||||
// with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements.
|
||||
// msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx
|
||||
// Documents served as xml will throw if using ­ so use xml friendly encoded version. See issue #277
|
||||
style = ['­','<style id="s', mod, '">', rule, '</style>'].join('');
|
||||
div.id = mod;
|
||||
// IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody.
|
||||
// Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270
|
||||
(body ? div : fakeBody).innerHTML += style;
|
||||
fakeBody.appendChild(div);
|
||||
if ( !body ) {
|
||||
//avoid crashing IE8, if background image is used
|
||||
fakeBody.style.background = '';
|
||||
//Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible
|
||||
fakeBody.style.overflow = 'hidden';
|
||||
docOverflow = docElement.style.overflow;
|
||||
docElement.style.overflow = 'hidden';
|
||||
docElement.appendChild(fakeBody);
|
||||
}
|
||||
|
||||
ret = callback(div, rule);
|
||||
// If this is done after page load we don't want to remove the body so check if body exists
|
||||
if ( !body ) {
|
||||
fakeBody.parentNode.removeChild(fakeBody);
|
||||
docElement.style.overflow = docOverflow;
|
||||
} else {
|
||||
div.parentNode.removeChild(div);
|
||||
}
|
||||
|
||||
return !!ret;
|
||||
|
||||
},
|
||||
/*>>teststyles*/
|
||||
|
||||
/*>>mq*/
|
||||
// adapted from matchMedia polyfill
|
||||
// by Scott Jehl and Paul Irish
|
||||
// gist.github.com/786768
|
||||
testMediaQuery = function( mq ) {
|
||||
|
||||
var matchMedia = window.matchMedia || window.msMatchMedia;
|
||||
if ( matchMedia ) {
|
||||
return matchMedia(mq).matches;
|
||||
}
|
||||
|
||||
var bool;
|
||||
|
||||
injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) {
|
||||
bool = (window.getComputedStyle ?
|
||||
getComputedStyle(node, null) :
|
||||
node.currentStyle)['position'] == 'absolute';
|
||||
});
|
||||
|
||||
return bool;
|
||||
|
||||
},
|
||||
/*>>mq*/
|
||||
|
||||
|
||||
/*>>hasevent*/
|
||||
//
|
||||
// isEventSupported determines if a given element supports the given event
|
||||
// kangax.github.com/iseventsupported/
|
||||
//
|
||||
// The following results are known incorrects:
|
||||
// Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative
|
||||
// Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333
|
||||
// ...
|
||||
isEventSupported = (function() {
|
||||
|
||||
var TAGNAMES = {
|
||||
'select': 'input', 'change': 'input',
|
||||
'submit': 'form', 'reset': 'form',
|
||||
'error': 'img', 'load': 'img', 'abort': 'img'
|
||||
};
|
||||
|
||||
function isEventSupported( eventName, element ) {
|
||||
|
||||
element = element || document.createElement(TAGNAMES[eventName] || 'div');
|
||||
eventName = 'on' + eventName;
|
||||
|
||||
// When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those
|
||||
var isSupported = eventName in element;
|
||||
|
||||
if ( !isSupported ) {
|
||||
// If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element
|
||||
if ( !element.setAttribute ) {
|
||||
element = document.createElement('div');
|
||||
}
|
||||
if ( element.setAttribute && element.removeAttribute ) {
|
||||
element.setAttribute(eventName, '');
|
||||
isSupported = is(element[eventName], 'function');
|
||||
|
||||
// If property was created, "remove it" (by setting value to `undefined`)
|
||||
if ( !is(element[eventName], 'undefined') ) {
|
||||
element[eventName] = undefined;
|
||||
}
|
||||
element.removeAttribute(eventName);
|
||||
}
|
||||
}
|
||||
|
||||
element = null;
|
||||
return isSupported;
|
||||
}
|
||||
return isEventSupported;
|
||||
})(),
|
||||
/*>>hasevent*/
|
||||
|
||||
// TODO :: Add flag for hasownprop ? didn't last time
|
||||
|
||||
// hasOwnProperty shim by kangax needed for Safari 2.0 support
|
||||
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
|
||||
|
||||
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
|
||||
hasOwnProp = function (object, property) {
|
||||
return _hasOwnProperty.call(object, property);
|
||||
};
|
||||
}
|
||||
else {
|
||||
hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */
|
||||
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
|
||||
};
|
||||
}
|
||||
|
||||
// Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js
|
||||
// es5.github.com/#x15.3.4.5
|
||||
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function bind(that) {
|
||||
|
||||
var target = this;
|
||||
|
||||
if (typeof target != "function") {
|
||||
throw new TypeError();
|
||||
}
|
||||
|
||||
var args = slice.call(arguments, 1),
|
||||
bound = function () {
|
||||
|
||||
if (this instanceof bound) {
|
||||
|
||||
var F = function(){};
|
||||
F.prototype = target.prototype;
|
||||
var self = new F();
|
||||
|
||||
var result = target.apply(
|
||||
self,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
if (Object(result) === result) {
|
||||
return result;
|
||||
}
|
||||
return self;
|
||||
|
||||
} else {
|
||||
|
||||
return target.apply(
|
||||
that,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return bound;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* setCss applies given styles to the Modernizr DOM node.
|
||||
*/
|
||||
function setCss( str ) {
|
||||
mStyle.cssText = str;
|
||||
}
|
||||
|
||||
/**
|
||||
* setCssAll extrapolates all vendor-specific css strings.
|
||||
*/
|
||||
function setCssAll( str1, str2 ) {
|
||||
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
|
||||
}
|
||||
|
||||
/**
|
||||
* is returns a boolean for if typeof obj is exactly type.
|
||||
*/
|
||||
function is( obj, type ) {
|
||||
return typeof obj === type;
|
||||
}
|
||||
|
||||
/**
|
||||
* contains returns a boolean for if substr is found within str.
|
||||
*/
|
||||
function contains( str, substr ) {
|
||||
return !!~('' + str).indexOf(substr);
|
||||
}
|
||||
|
||||
/*>>testprop*/
|
||||
|
||||
// testProps is a generic CSS / DOM property test.
|
||||
|
||||
// In testing support for a given CSS property, it's legit to test:
|
||||
// `elem.style[styleName] !== undefined`
|
||||
// If the property is supported it will return an empty string,
|
||||
// if unsupported it will return undefined.
|
||||
|
||||
// We'll take advantage of this quick test and skip setting a style
|
||||
// on our modernizr element, but instead just testing undefined vs
|
||||
// empty string.
|
||||
|
||||
// Because the testing of the CSS property names (with "-", as
|
||||
// opposed to the camelCase DOM properties) is non-portable and
|
||||
// non-standard but works in WebKit and IE (but not Gecko or Opera),
|
||||
// we explicitly reject properties with dashes so that authors
|
||||
// developing in WebKit or IE first don't end up with
|
||||
// browser-specific content by accident.
|
||||
|
||||
function testProps( props, prefixed ) {
|
||||
for ( var i in props ) {
|
||||
var prop = props[i];
|
||||
if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
|
||||
return prefixed == 'pfx' ? prop : true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*>>testprop*/
|
||||
|
||||
// TODO :: add testDOMProps
|
||||
/**
|
||||
* testDOMProps is a generic DOM property test; if a browser supports
|
||||
* a certain property, it won't return undefined for it.
|
||||
*/
|
||||
function testDOMProps( props, obj, elem ) {
|
||||
for ( var i in props ) {
|
||||
var item = obj[props[i]];
|
||||
if ( item !== undefined) {
|
||||
|
||||
// return the property name as a string
|
||||
if (elem === false) return props[i];
|
||||
|
||||
// let's bind a function (and it has a bind method -- certain native objects that report that they are a
|
||||
// function don't [such as webkitAudioContext])
|
||||
if (is(item, 'function') && 'bind' in item){
|
||||
// default to autobind unless override
|
||||
return item.bind(elem || obj);
|
||||
}
|
||||
|
||||
// return the unbound function or obj or value
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*>>testallprops*/
|
||||
/**
|
||||
* testPropsAll tests a list of DOM properties we want to check against.
|
||||
* We specify literally ALL possible (known and/or likely) properties on
|
||||
* the element including the non-vendor prefixed one, for forward-
|
||||
* compatibility.
|
||||
*/
|
||||
function testPropsAll( prop, prefixed, elem ) {
|
||||
|
||||
var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
|
||||
props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
|
||||
|
||||
// did they call .prefixed('boxSizing') or are we just testing a prop?
|
||||
if(is(prefixed, "string") || is(prefixed, "undefined")) {
|
||||
return testProps(props, prefixed);
|
||||
|
||||
// otherwise, they called .prefixed('requestAnimationFrame', window[, elem])
|
||||
} else {
|
||||
props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
|
||||
return testDOMProps(props, prefixed, elem);
|
||||
}
|
||||
}
|
||||
/*>>testallprops*/
|
||||
|
||||
|
||||
/**
|
||||
* Tests
|
||||
* -----
|
||||
*/
|
||||
|
||||
// The *new* flexbox
|
||||
// dev.w3.org/csswg/css3-flexbox
|
||||
|
||||
tests['flexbox'] = function() {
|
||||
return testPropsAll('flexWrap');
|
||||
};
|
||||
|
||||
// The *old* flexbox
|
||||
// www.w3.org/TR/2009/WD-css3-flexbox-20090723/
|
||||
|
||||
tests['flexboxlegacy'] = function() {
|
||||
return testPropsAll('boxDirection');
|
||||
};
|
||||
|
||||
// On the S60 and BB Storm, getContext exists, but always returns undefined
|
||||
// so we actually have to call getContext() to verify
|
||||
// github.com/Modernizr/Modernizr/issues/issue/97/
|
||||
|
||||
tests['canvas'] = function() {
|
||||
var elem = document.createElement('canvas');
|
||||
return !!(elem.getContext && elem.getContext('2d'));
|
||||
};
|
||||
|
||||
tests['canvastext'] = function() {
|
||||
return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
|
||||
};
|
||||
|
||||
// webk.it/70117 is tracking a legit WebGL feature detect proposal
|
||||
|
||||
// We do a soft detect which may false positive in order to avoid
|
||||
// an expensive context creation: bugzil.la/732441
|
||||
|
||||
tests['webgl'] = function() {
|
||||
return !!window.WebGLRenderingContext;
|
||||
};
|
||||
|
||||
/*
|
||||
* The Modernizr.touch test only indicates if the browser supports
|
||||
* touch events, which does not necessarily reflect a touchscreen
|
||||
* device, as evidenced by tablets running Windows 7 or, alas,
|
||||
* the Palm Pre / WebOS (touch) phones.
|
||||
*
|
||||
* Additionally, Chrome (desktop) used to lie about its support on this,
|
||||
* but that has since been rectified: crbug.com/36415
|
||||
*
|
||||
* We also test for Firefox 4 Multitouch Support.
|
||||
*
|
||||
* For more info, see: modernizr.github.com/Modernizr/touch.html
|
||||
*/
|
||||
|
||||
tests['touch'] = function() {
|
||||
var bool;
|
||||
|
||||
if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
|
||||
bool = true;
|
||||
} else {
|
||||
injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
|
||||
bool = node.offsetTop === 9;
|
||||
});
|
||||
}
|
||||
|
||||
return bool;
|
||||
};
|
||||
|
||||
|
||||
// geolocation is often considered a trivial feature detect...
|
||||
// Turns out, it's quite tricky to get right:
|
||||
//
|
||||
// Using !!navigator.geolocation does two things we don't want. It:
|
||||
// 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513
|
||||
// 2. Disables page caching in WebKit: webk.it/43956
|
||||
//
|
||||
// Meanwhile, in Firefox < 8, an about:config setting could expose
|
||||
// a false positive that would throw an exception: bugzil.la/688158
|
||||
|
||||
tests['geolocation'] = function() {
|
||||
return 'geolocation' in navigator;
|
||||
};
|
||||
|
||||
|
||||
tests['postmessage'] = function() {
|
||||
return !!window.postMessage;
|
||||
};
|
||||
|
||||
|
||||
// Chrome incognito mode used to throw an exception when using openDatabase
|
||||
// It doesn't anymore.
|
||||
tests['websqldatabase'] = function() {
|
||||
return !!window.openDatabase;
|
||||
};
|
||||
|
||||
// Vendors had inconsistent prefixing with the experimental Indexed DB:
|
||||
// - Webkit's implementation is accessible through webkitIndexedDB
|
||||
// - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB
|
||||
// For speed, we don't test the legacy (and beta-only) indexedDB
|
||||
tests['indexedDB'] = function() {
|
||||
return !!testPropsAll("indexedDB", window);
|
||||
};
|
||||
|
||||
// documentMode logic from YUI to filter out IE8 Compat Mode
|
||||
// which false positives.
|
||||
tests['hashchange'] = function() {
|
||||
return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
|
||||
};
|
||||
|
||||
// Per 1.6:
|
||||
// This used to be Modernizr.historymanagement but the longer
|
||||
// name has been deprecated in favor of a shorter and property-matching one.
|
||||
// The old API is still available in 1.6, but as of 2.0 will throw a warning,
|
||||
// and in the first release thereafter disappear entirely.
|
||||
tests['history'] = function() {
|
||||
return !!(window.history && history.pushState);
|
||||
};
|
||||
|
||||
tests['draganddrop'] = function() {
|
||||
var div = document.createElement('div');
|
||||
return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
|
||||
};
|
||||
|
||||
// FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10
|
||||
// will be supported until FF19 (2/12/13), at which time, ESR becomes FF17.
|
||||
// FF10 still uses prefixes, so check for it until then.
|
||||
// for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/
|
||||
tests['websockets'] = function() {
|
||||
return 'WebSocket' in window || 'MozWebSocket' in window;
|
||||
};
|
||||
|
||||
|
||||
// css-tricks.com/rgba-browser-support/
|
||||
tests['rgba'] = function() {
|
||||
// Set an rgba() color and check the returned value
|
||||
|
||||
setCss('background-color:rgba(150,255,150,.5)');
|
||||
|
||||
return contains(mStyle.backgroundColor, 'rgba');
|
||||
};
|
||||
|
||||
tests['hsla'] = function() {
|
||||
// Same as rgba(), in fact, browsers re-map hsla() to rgba() internally,
|
||||
// except IE9 who retains it as hsla
|
||||
|
||||
setCss('background-color:hsla(120,40%,100%,.5)');
|
||||
|
||||
return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
|
||||
};
|
||||
|
||||
tests['multiplebgs'] = function() {
|
||||
// Setting multiple images AND a color on the background shorthand property
|
||||
// and then querying the style.background property value for the number of
|
||||
// occurrences of "url(" is a reliable method for detecting ACTUAL support for this!
|
||||
|
||||
setCss('background:url(https://),url(https://),red url(https://)');
|
||||
|
||||
// If the UA supports multiple backgrounds, there should be three occurrences
|
||||
// of the string "url(" in the return value for elemStyle.background
|
||||
|
||||
return (/(url\s*\(.*?){3}/).test(mStyle.background);
|
||||
};
|
||||
|
||||
|
||||
|
||||
// this will false positive in Opera Mini
|
||||
// github.com/Modernizr/Modernizr/issues/396
|
||||
|
||||
tests['backgroundsize'] = function() {
|
||||
return testPropsAll('backgroundSize');
|
||||
};
|
||||
|
||||
tests['borderimage'] = function() {
|
||||
return testPropsAll('borderImage');
|
||||
};
|
||||
|
||||
|
||||
// Super comprehensive table about all the unique implementations of
|
||||
// border-radius: muddledramblings.com/table-of-css3-border-radius-compliance
|
||||
|
||||
tests['borderradius'] = function() {
|
||||
return testPropsAll('borderRadius');
|
||||
};
|
||||
|
||||
// WebOS unfortunately false positives on this test.
|
||||
tests['boxshadow'] = function() {
|
||||
return testPropsAll('boxShadow');
|
||||
};
|
||||
|
||||
// FF3.0 will false positive on this test
|
||||
tests['textshadow'] = function() {
|
||||
return document.createElement('div').style.textShadow === '';
|
||||
};
|
||||
|
||||
|
||||
tests['opacity'] = function() {
|
||||
// Browsers that actually have CSS Opacity implemented have done so
|
||||
// according to spec, which means their return values are within the
|
||||
// range of [0.0,1.0] - including the leading zero.
|
||||
|
||||
setCssAll('opacity:.55');
|
||||
|
||||
// The non-literal . in this regex is intentional:
|
||||
// German Chrome returns this value as 0,55
|
||||
// github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632
|
||||
return (/^0.55$/).test(mStyle.opacity);
|
||||
};
|
||||
|
||||
|
||||
// Note, Android < 4 will pass this test, but can only animate
|
||||
// a single property at a time
|
||||
// daneden.me/2011/12/putting-up-with-androids-bullshit/
|
||||
tests['cssanimations'] = function() {
|
||||
return testPropsAll('animationName');
|
||||
};
|
||||
|
||||
|
||||
tests['csscolumns'] = function() {
|
||||
return testPropsAll('columnCount');
|
||||
};
|
||||
|
||||
|
||||
tests['cssgradients'] = function() {
|
||||
/**
|
||||
* For CSS Gradients syntax, please see:
|
||||
* webkit.org/blog/175/introducing-css-gradients/
|
||||
* developer.mozilla.org/en/CSS/-moz-linear-gradient
|
||||
* developer.mozilla.org/en/CSS/-moz-radial-gradient
|
||||
* dev.w3.org/csswg/css3-images/#gradients-
|
||||
*/
|
||||
|
||||
var str1 = 'background-image:',
|
||||
str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
|
||||
str3 = 'linear-gradient(left top,#9f9, white);';
|
||||
|
||||
setCss(
|
||||
// legacy webkit syntax (FIXME: remove when syntax not in use anymore)
|
||||
(str1 + '-webkit- '.split(' ').join(str2 + str1) +
|
||||
// standard syntax // trailing 'background-image:'
|
||||
prefixes.join(str3 + str1)).slice(0, -str1.length)
|
||||
);
|
||||
|
||||
return contains(mStyle.backgroundImage, 'gradient');
|
||||
};
|
||||
|
||||
|
||||
tests['cssreflections'] = function() {
|
||||
return testPropsAll('boxReflect');
|
||||
};
|
||||
|
||||
|
||||
tests['csstransforms'] = function() {
|
||||
return !!testPropsAll('transform');
|
||||
};
|
||||
|
||||
|
||||
tests['csstransforms3d'] = function() {
|
||||
|
||||
var ret = !!testPropsAll('perspective');
|
||||
|
||||
// Webkit's 3D transforms are passed off to the browser's own graphics renderer.
|
||||
// It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
|
||||
// some conditions. As a result, Webkit typically recognizes the syntax but
|
||||
// will sometimes throw a false positive, thus we must do a more thorough check:
|
||||
if ( ret && 'webkitPerspective' in docElement.style ) {
|
||||
|
||||
// Webkit allows this media query to succeed only if the feature is enabled.
|
||||
// `@media (transform-3d),(-webkit-transform-3d){ ... }`
|
||||
injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
|
||||
ret = node.offsetLeft === 9 && node.offsetHeight === 3;
|
||||
});
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
tests['csstransitions'] = function() {
|
||||
return testPropsAll('transition');
|
||||
};
|
||||
|
||||
|
||||
/*>>fontface*/
|
||||
// @font-face detection routine by Diego Perini
|
||||
// javascript.nwbox.com/CSSSupport/
|
||||
|
||||
// false positives:
|
||||
// WebOS github.com/Modernizr/Modernizr/issues/342
|
||||
// WP7 github.com/Modernizr/Modernizr/issues/538
|
||||
tests['fontface'] = function() {
|
||||
var bool;
|
||||
|
||||
injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
|
||||
var style = document.getElementById('smodernizr'),
|
||||
sheet = style.sheet || style.styleSheet,
|
||||
cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
|
||||
|
||||
bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
|
||||
});
|
||||
|
||||
return bool;
|
||||
};
|
||||
/*>>fontface*/
|
||||
|
||||
// CSS generated content detection
|
||||
tests['generatedcontent'] = function() {
|
||||
var bool;
|
||||
|
||||
injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {
|
||||
bool = node.offsetHeight >= 3;
|
||||
});
|
||||
|
||||
return bool;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// These tests evaluate support of the video/audio elements, as well as
|
||||
// testing what types of content they support.
|
||||
//
|
||||
// We're using the Boolean constructor here, so that we can extend the value
|
||||
// e.g. Modernizr.video // true
|
||||
// Modernizr.video.ogg // 'probably'
|
||||
//
|
||||
// Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845
|
||||
// thx to NielsLeenheer and zcorpan
|
||||
|
||||
// Note: in some older browsers, "no" was a return value instead of empty string.
|
||||
// It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2
|
||||
// It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5
|
||||
|
||||
tests['video'] = function() {
|
||||
var elem = document.createElement('video'),
|
||||
bool = false;
|
||||
|
||||
// IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224
|
||||
try {
|
||||
if ( bool = !!elem.canPlayType ) {
|
||||
bool = new Boolean(bool);
|
||||
bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
|
||||
|
||||
// Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546
|
||||
bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
|
||||
|
||||
bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
|
||||
}
|
||||
|
||||
} catch(e) { }
|
||||
|
||||
return bool;
|
||||
};
|
||||
|
||||
tests['audio'] = function() {
|
||||
var elem = document.createElement('audio'),
|
||||
bool = false;
|
||||
|
||||
try {
|
||||
if ( bool = !!elem.canPlayType ) {
|
||||
bool = new Boolean(bool);
|
||||
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
|
||||
bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
|
||||
|
||||
// Mimetypes accepted:
|
||||
// developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements
|
||||
// bit.ly/iphoneoscodecs
|
||||
bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
|
||||
bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
|
||||
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
|
||||
}
|
||||
} catch(e) { }
|
||||
|
||||
return bool;
|
||||
};
|
||||
|
||||
|
||||
// In FF4, if disabled, window.localStorage should === null.
|
||||
|
||||
// Normally, we could not test that directly and need to do a
|
||||
// `('localStorage' in window) && ` test first because otherwise Firefox will
|
||||
// throw bugzil.la/365772 if cookies are disabled
|
||||
|
||||
// Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem
|
||||
// will throw the exception:
|
||||
// QUOTA_EXCEEDED_ERRROR DOM Exception 22.
|
||||
// Peculiarly, getItem and removeItem calls do not throw.
|
||||
|
||||
// Because we are forced to try/catch this, we'll go aggressive.
|
||||
|
||||
// Just FWIW: IE8 Compat mode supports these features completely:
|
||||
// www.quirksmode.org/dom/html5.html
|
||||
// But IE8 doesn't support either with local files
|
||||
|
||||
tests['localstorage'] = function() {
|
||||
try {
|
||||
localStorage.setItem(mod, mod);
|
||||
localStorage.removeItem(mod);
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
tests['sessionstorage'] = function() {
|
||||
try {
|
||||
sessionStorage.setItem(mod, mod);
|
||||
sessionStorage.removeItem(mod);
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
tests['webworkers'] = function() {
|
||||
return !!window.Worker;
|
||||
};
|
||||
|
||||
|
||||
tests['applicationcache'] = function() {
|
||||
return !!window.applicationCache;
|
||||
};
|
||||
|
||||
|
||||
// Thanks to Erik Dahlstrom
|
||||
tests['svg'] = function() {
|
||||
return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
|
||||
};
|
||||
|
||||
// specifically for SVG inline in HTML, not within XHTML
|
||||
// test page: paulirish.com/demo/inline-svg
|
||||
tests['inlinesvg'] = function() {
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = '<svg/>';
|
||||
return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
|
||||
};
|
||||
|
||||
// SVG SMIL animation
|
||||
tests['smil'] = function() {
|
||||
return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
|
||||
};
|
||||
|
||||
// This test is only for clip paths in SVG proper, not clip paths on HTML content
|
||||
// demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg
|
||||
|
||||
// However read the comments to dig into applying SVG clippaths to HTML content here:
|
||||
// github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491
|
||||
tests['svgclippaths'] = function() {
|
||||
return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
|
||||
};
|
||||
|
||||
/*>>webforms*/
|
||||
// input features and input types go directly onto the ret object, bypassing the tests loop.
|
||||
// Hold this guy to execute in a moment.
|
||||
function webforms() {
|
||||
/*>>input*/
|
||||
// Run through HTML5's new input attributes to see if the UA understands any.
|
||||
// We're using f which is the <input> element created early on
|
||||
// Mike Taylr has created a comprehensive resource for testing these attributes
|
||||
// when applied to all input types:
|
||||
// miketaylr.com/code/input-type-attr.html
|
||||
// spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
|
||||
|
||||
// Only input placeholder is tested while textarea's placeholder is not.
|
||||
// Currently Safari 4 and Opera 11 have support only for the input placeholder
|
||||
// Both tests are available in feature-detects/forms-placeholder.js
|
||||
Modernizr['input'] = (function( props ) {
|
||||
for ( var i = 0, len = props.length; i < len; i++ ) {
|
||||
attrs[ props[i] ] = !!(props[i] in inputElem);
|
||||
}
|
||||
if (attrs.list){
|
||||
// safari false positive's on datalist: webk.it/74252
|
||||
// see also github.com/Modernizr/Modernizr/issues/146
|
||||
attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
|
||||
}
|
||||
return attrs;
|
||||
})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
|
||||
/*>>input*/
|
||||
|
||||
/*>>inputtypes*/
|
||||
// Run through HTML5's new input types to see if the UA understands any.
|
||||
// This is put behind the tests runloop because it doesn't return a
|
||||
// true/false like all the other tests; instead, it returns an object
|
||||
// containing each input type with its corresponding true/false value
|
||||
|
||||
// Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/
|
||||
Modernizr['inputtypes'] = (function(props) {
|
||||
|
||||
for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
|
||||
|
||||
inputElem.setAttribute('type', inputElemType = props[i]);
|
||||
bool = inputElem.type !== 'text';
|
||||
|
||||
// We first check to see if the type we give it sticks..
|
||||
// If the type does, we feed it a textual value, which shouldn't be valid.
|
||||
// If the value doesn't stick, we know there's input sanitization which infers a custom UI
|
||||
if ( bool ) {
|
||||
|
||||
inputElem.value = smile;
|
||||
inputElem.style.cssText = 'position:absolute;visibility:hidden;';
|
||||
|
||||
if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
|
||||
|
||||
docElement.appendChild(inputElem);
|
||||
defaultView = document.defaultView;
|
||||
|
||||
// Safari 2-4 allows the smiley as a value, despite making a slider
|
||||
bool = defaultView.getComputedStyle &&
|
||||
defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
|
||||
// Mobile android web browser has false positive, so must
|
||||
// check the height to see if the widget is actually there.
|
||||
(inputElem.offsetHeight !== 0);
|
||||
|
||||
docElement.removeChild(inputElem);
|
||||
|
||||
} else if ( /^(search|tel)$/.test(inputElemType) ){
|
||||
// Spec doesn't define any special parsing or detectable UI
|
||||
// behaviors so we pass these through as true
|
||||
|
||||
// Interestingly, opera fails the earlier test, so it doesn't
|
||||
// even make it here.
|
||||
|
||||
} else if ( /^(url|email)$/.test(inputElemType) ) {
|
||||
// Real url and email support comes with prebaked validation.
|
||||
bool = inputElem.checkValidity && inputElem.checkValidity() === false;
|
||||
|
||||
} else {
|
||||
// If the upgraded input compontent rejects the :) text, we got a winner
|
||||
bool = inputElem.value != smile;
|
||||
}
|
||||
}
|
||||
|
||||
inputs[ props[i] ] = !!bool;
|
||||
}
|
||||
return inputs;
|
||||
})('search tel url email datetime date month week time datetime-local number range color'.split(' '));
|
||||
/*>>inputtypes*/
|
||||
}
|
||||
/*>>webforms*/
|
||||
|
||||
|
||||
// End of test definitions
|
||||
// -----------------------
|
||||
|
||||
|
||||
|
||||
// Run through all tests and detect their support in the current UA.
|
||||
// todo: hypothetically we could be doing an array of tests and use a basic loop here.
|
||||
for ( var feature in tests ) {
|
||||
if ( hasOwnProp(tests, feature) ) {
|
||||
// run the test, throw the return value into the Modernizr,
|
||||
// then based on that boolean, define an appropriate className
|
||||
// and push it into an array of classes we'll join later.
|
||||
featureName = feature.toLowerCase();
|
||||
Modernizr[featureName] = tests[feature]();
|
||||
|
||||
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
|
||||
}
|
||||
}
|
||||
|
||||
/*>>webforms*/
|
||||
// input tests need to run.
|
||||
Modernizr.input || webforms();
|
||||
/*>>webforms*/
|
||||
|
||||
|
||||
/**
|
||||
* addTest allows the user to define their own feature tests
|
||||
* the result will be added onto the Modernizr object,
|
||||
* as well as an appropriate className set on the html element
|
||||
*
|
||||
* @param feature - String naming the feature
|
||||
* @param test - Function returning true if feature is supported, false if not
|
||||
*/
|
||||
Modernizr.addTest = function ( feature, test ) {
|
||||
if ( typeof feature == 'object' ) {
|
||||
for ( var key in feature ) {
|
||||
if ( hasOwnProp( feature, key ) ) {
|
||||
Modernizr.addTest( key, feature[ key ] );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
feature = feature.toLowerCase();
|
||||
|
||||
if ( Modernizr[feature] !== undefined ) {
|
||||
// we're going to quit if you're trying to overwrite an existing test
|
||||
// if we were to allow it, we'd do this:
|
||||
// var re = new RegExp("\\b(no-)?" + feature + "\\b");
|
||||
// docElement.className = docElement.className.replace( re, '' );
|
||||
// but, no rly, stuff 'em.
|
||||
return Modernizr;
|
||||
}
|
||||
|
||||
test = typeof test == 'function' ? test() : test;
|
||||
|
||||
if (typeof enableClasses !== "undefined" && enableClasses) {
|
||||
docElement.className += ' ' + (test ? '' : 'no-') + feature;
|
||||
}
|
||||
Modernizr[feature] = test;
|
||||
|
||||
}
|
||||
|
||||
return Modernizr; // allow chaining.
|
||||
};
|
||||
|
||||
|
||||
// Reset modElem.cssText to nothing to reduce memory footprint.
|
||||
setCss('');
|
||||
modElem = inputElem = null;
|
||||
|
||||
/*>>shiv*/
|
||||
/*! HTML5 Shiv v3.6.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */
|
||||
;(function(window, document) {
|
||||
/*jshint evil:true */
|
||||
/** Preset options */
|
||||
var options = window.html5 || {};
|
||||
|
||||
/** Used to skip problem elements */
|
||||
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
||||
|
||||
/** Not all elements can be cloned in IE **/
|
||||
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
|
||||
|
||||
/** Detect whether the browser supports default html5 styles */
|
||||
var supportsHtml5Styles;
|
||||
|
||||
/** Name of the expando, to work with multiple documents or to re-shiv one document */
|
||||
var expando = '_html5shiv';
|
||||
|
||||
/** The id for the the documents expando */
|
||||
var expanID = 0;
|
||||
|
||||
/** Cached data for each document */
|
||||
var expandoData = {};
|
||||
|
||||
/** Detect whether the browser supports unknown elements */
|
||||
var supportsUnknownElements;
|
||||
|
||||
(function() {
|
||||
try {
|
||||
var a = document.createElement('a');
|
||||
a.innerHTML = '<xyz></xyz>';
|
||||
//if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
|
||||
supportsHtml5Styles = ('hidden' in a);
|
||||
|
||||
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
||||
// assign a false positive if unable to shiv
|
||||
(document.createElement)('a');
|
||||
var frag = document.createDocumentFragment();
|
||||
return (
|
||||
typeof frag.cloneNode == 'undefined' ||
|
||||
typeof frag.createDocumentFragment == 'undefined' ||
|
||||
typeof frag.createElement == 'undefined'
|
||||
);
|
||||
}());
|
||||
} catch(e) {
|
||||
supportsHtml5Styles = true;
|
||||
supportsUnknownElements = true;
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a style sheet with the given CSS text and adds it to the document.
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @param {String} cssText The CSS text.
|
||||
* @returns {StyleSheet} The style element.
|
||||
*/
|
||||
function addStyleSheet(ownerDocument, cssText) {
|
||||
var p = ownerDocument.createElement('p'),
|
||||
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
||||
|
||||
p.innerHTML = 'x<style>' + cssText + '</style>';
|
||||
return parent.insertBefore(p.lastChild, parent.firstChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of `html5.elements` as an array.
|
||||
* @private
|
||||
* @returns {Array} An array of shived element node names.
|
||||
*/
|
||||
function getElements() {
|
||||
var elements = html5.elements;
|
||||
return typeof elements == 'string' ? elements.split(' ') : elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data associated to the given document
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @returns {Object} An object of data.
|
||||
*/
|
||||
function getExpandoData(ownerDocument) {
|
||||
var data = expandoData[ownerDocument[expando]];
|
||||
if (!data) {
|
||||
data = {};
|
||||
expanID++;
|
||||
ownerDocument[expando] = expanID;
|
||||
expandoData[expanID] = data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived element for the given nodeName and document
|
||||
* @memberOf html5
|
||||
* @param {String} nodeName name of the element
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived element.
|
||||
*/
|
||||
function createElement(nodeName, ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createElement(nodeName);
|
||||
}
|
||||
if (!data) {
|
||||
data = getExpandoData(ownerDocument);
|
||||
}
|
||||
var node;
|
||||
|
||||
if (data.cache[nodeName]) {
|
||||
node = data.cache[nodeName].cloneNode();
|
||||
} else if (saveClones.test(nodeName)) {
|
||||
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
||||
} else {
|
||||
node = data.createElem(nodeName);
|
||||
}
|
||||
|
||||
// Avoid adding some elements to fragments in IE < 9 because
|
||||
// * Attributes like `name` or `type` cannot be set/changed once an element
|
||||
// is inserted into a document/fragment
|
||||
// * Link elements with `src` attributes that are inaccessible, as with
|
||||
// a 403 response, will cause the tab/window to crash
|
||||
// * Script elements appended to fragments will execute when their `src`
|
||||
// or `text` property is set
|
||||
return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived DocumentFragment for the given document
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived DocumentFragment.
|
||||
*/
|
||||
function createDocumentFragment(ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createDocumentFragment();
|
||||
}
|
||||
data = data || getExpandoData(ownerDocument);
|
||||
var clone = data.frag.cloneNode(),
|
||||
i = 0,
|
||||
elems = getElements(),
|
||||
l = elems.length;
|
||||
for(;i<l;i++){
|
||||
clone.createElement(elems[i]);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shivs the `createElement` and `createDocumentFragment` methods of the document.
|
||||
* @private
|
||||
* @param {Document|DocumentFragment} ownerDocument The document.
|
||||
* @param {Object} data of the document.
|
||||
*/
|
||||
function shivMethods(ownerDocument, data) {
|
||||
if (!data.cache) {
|
||||
data.cache = {};
|
||||
data.createElem = ownerDocument.createElement;
|
||||
data.createFrag = ownerDocument.createDocumentFragment;
|
||||
data.frag = data.createFrag();
|
||||
}
|
||||
|
||||
|
||||
ownerDocument.createElement = function(nodeName) {
|
||||
//abort shiv
|
||||
if (!html5.shivMethods) {
|
||||
return data.createElem(nodeName);
|
||||
}
|
||||
return createElement(nodeName, ownerDocument, data);
|
||||
};
|
||||
|
||||
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
||||
'var n=f.cloneNode(),c=n.createElement;' +
|
||||
'h.shivMethods&&(' +
|
||||
// unroll the `createElement` calls
|
||||
getElements().join().replace(/\w+/g, function(nodeName) {
|
||||
data.createElem(nodeName);
|
||||
data.frag.createElement(nodeName);
|
||||
return 'c("' + nodeName + '")';
|
||||
}) +
|
||||
');return n}'
|
||||
)(html5, data.frag);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Shivs the given document.
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The document to shiv.
|
||||
* @returns {Document} The shived document.
|
||||
*/
|
||||
function shivDocument(ownerDocument) {
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
var data = getExpandoData(ownerDocument);
|
||||
|
||||
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
||||
data.hasCSS = !!addStyleSheet(ownerDocument,
|
||||
// corrects block display not defined in IE6/7/8/9
|
||||
'article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}' +
|
||||
// adds styling not present in IE6/7/8/9
|
||||
'mark{background:#FF0;color:#000}'
|
||||
);
|
||||
}
|
||||
if (!supportsUnknownElements) {
|
||||
shivMethods(ownerDocument, data);
|
||||
}
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The `html5` object is exposed so that more elements can be shived and
|
||||
* existing shiving can be detected on iframes.
|
||||
* @type Object
|
||||
* @example
|
||||
*
|
||||
* // options can be changed before the script is included
|
||||
* html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
|
||||
*/
|
||||
var html5 = {
|
||||
|
||||
/**
|
||||
* An array or space separated string of node names of the elements to shiv.
|
||||
* @memberOf html5
|
||||
* @type Array|String
|
||||
*/
|
||||
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video',
|
||||
|
||||
/**
|
||||
* A flag to indicate that the HTML5 style sheet should be inserted.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivCSS': (options.shivCSS !== false),
|
||||
|
||||
/**
|
||||
* Is equal to true if a browser supports creating unknown/HTML5 elements
|
||||
* @memberOf html5
|
||||
* @type boolean
|
||||
*/
|
||||
'supportsUnknownElements': supportsUnknownElements,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the document's `createElement` and `createDocumentFragment`
|
||||
* methods should be overwritten.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivMethods': (options.shivMethods !== false),
|
||||
|
||||
/**
|
||||
* A string to describe the type of `html5` object ("default" or "default print").
|
||||
* @memberOf html5
|
||||
* @type String
|
||||
*/
|
||||
'type': 'default',
|
||||
|
||||
// shivs the document according to the specified `html5` object options
|
||||
'shivDocument': shivDocument,
|
||||
|
||||
//creates a shived element
|
||||
createElement: createElement,
|
||||
|
||||
//creates a shived documentFragment
|
||||
createDocumentFragment: createDocumentFragment
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose html5
|
||||
window.html5 = html5;
|
||||
|
||||
// shiv the document
|
||||
shivDocument(document);
|
||||
|
||||
}(this, document));
|
||||
/*>>shiv*/
|
||||
|
||||
// Assign private properties to the return object with prefix
|
||||
Modernizr._version = version;
|
||||
|
||||
// expose these for the plugin API. Look in the source for how to join() them against your input
|
||||
/*>>prefixes*/
|
||||
Modernizr._prefixes = prefixes;
|
||||
/*>>prefixes*/
|
||||
/*>>domprefixes*/
|
||||
Modernizr._domPrefixes = domPrefixes;
|
||||
Modernizr._cssomPrefixes = cssomPrefixes;
|
||||
/*>>domprefixes*/
|
||||
|
||||
/*>>mq*/
|
||||
// Modernizr.mq tests a given media query, live against the current state of the window
|
||||
// A few important notes:
|
||||
// * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false
|
||||
// * A max-width or orientation query will be evaluated against the current state, which may change later.
|
||||
// * You must specify values. Eg. If you are testing support for the min-width media query use:
|
||||
// Modernizr.mq('(min-width:0)')
|
||||
// usage:
|
||||
// Modernizr.mq('only screen and (max-width:768)')
|
||||
Modernizr.mq = testMediaQuery;
|
||||
/*>>mq*/
|
||||
|
||||
/*>>hasevent*/
|
||||
// Modernizr.hasEvent() detects support for a given event, with an optional element to test on
|
||||
// Modernizr.hasEvent('gesturestart', elem)
|
||||
Modernizr.hasEvent = isEventSupported;
|
||||
/*>>hasevent*/
|
||||
|
||||
/*>>testprop*/
|
||||
// Modernizr.testProp() investigates whether a given style property is recognized
|
||||
// Note that the property names must be provided in the camelCase variant.
|
||||
// Modernizr.testProp('pointerEvents')
|
||||
Modernizr.testProp = function(prop){
|
||||
return testProps([prop]);
|
||||
};
|
||||
/*>>testprop*/
|
||||
|
||||
/*>>testallprops*/
|
||||
// Modernizr.testAllProps() investigates whether a given style property,
|
||||
// or any of its vendor-prefixed variants, is recognized
|
||||
// Note that the property names must be provided in the camelCase variant.
|
||||
// Modernizr.testAllProps('boxSizing')
|
||||
Modernizr.testAllProps = testPropsAll;
|
||||
/*>>testallprops*/
|
||||
|
||||
|
||||
/*>>teststyles*/
|
||||
// Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards
|
||||
// Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... })
|
||||
Modernizr.testStyles = injectElementWithStyles;
|
||||
/*>>teststyles*/
|
||||
|
||||
|
||||
/*>>prefixed*/
|
||||
// Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input
|
||||
// Modernizr.prefixed('boxSizing') // 'MozBoxSizing'
|
||||
|
||||
// Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style.
|
||||
// Return values will also be the camelCase variant, if you need to translate that to hypenated style use:
|
||||
//
|
||||
// str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-');
|
||||
|
||||
// If you're trying to ascertain which transition end event to bind to, you might do something like...
|
||||
//
|
||||
// var transEndEventNames = {
|
||||
// 'WebkitTransition' : 'webkitTransitionEnd',
|
||||
// 'MozTransition' : 'transitionend',
|
||||
// 'OTransition' : 'oTransitionEnd',
|
||||
// 'msTransition' : 'MSTransitionEnd',
|
||||
// 'transition' : 'transitionend'
|
||||
// },
|
||||
// transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
|
||||
|
||||
Modernizr.prefixed = function(prop, obj, elem){
|
||||
if(!obj) {
|
||||
return testPropsAll(prop, 'pfx');
|
||||
} else {
|
||||
// Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame'
|
||||
return testPropsAll(prop, obj, elem);
|
||||
}
|
||||
};
|
||||
/*>>prefixed*/
|
||||
|
||||
|
||||
/*>>cssclasses*/
|
||||
// Remove "no-js" class from <html> element, if it exists:
|
||||
docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
|
||||
|
||||
// Add the new classes to the <html> element.
|
||||
(enableClasses ? ' js ' + classes.join(' ') : '');
|
||||
/*>>cssclasses*/
|
||||
|
||||
return Modernizr;
|
||||
|
||||
})(this, this.document);
|
@ -19,7 +19,7 @@ OC.Contacts.Settings = OC.Contacts.Settings || {
|
||||
if(!active) {
|
||||
$('#contacts h3[data-id="'+id+'"],#contacts ul[data-id="'+id+'"]').remove();
|
||||
} else {
|
||||
OC.Contacts.Contacts.update();
|
||||
OC.Contacts.update();
|
||||
}
|
||||
} else {
|
||||
console.log('Error:', jsondata.data.message);
|
||||
@ -41,7 +41,7 @@ OC.Contacts.Settings = OC.Contacts.Settings || {
|
||||
$('#contacts h3[data-id="'+id+'"],#contacts ul[data-id="'+id+'"]').remove();
|
||||
row.remove()
|
||||
OC.Contacts.Settings.Addressbook.showActions(['new',]);
|
||||
OC.Contacts.Contacts.update();
|
||||
OC.Contacts.update();
|
||||
} else {
|
||||
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
|
||||
}
|
||||
@ -108,7 +108,7 @@ OC.Contacts.Settings = OC.Contacts.Settings || {
|
||||
row.find('td.name').text(jsondata.data.addressbook.displayname);
|
||||
row.find('td.description').text(jsondata.data.addressbook.description);
|
||||
}
|
||||
OC.Contacts.Contacts.update();
|
||||
OC.Contacts.update();
|
||||
} else {
|
||||
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
|
||||
}
|
||||
|
@ -237,8 +237,8 @@ class OC_Contacts_App {
|
||||
* @brief returns the categories for the user
|
||||
* @return (Array) $categories
|
||||
*/
|
||||
public static function getCategories() {
|
||||
$categories = self::getVCategories()->categories();
|
||||
public static function getCategories($format = null) {
|
||||
$categories = self::getVCategories()->categories($format);
|
||||
return ($categories ? $categories : self::getDefaultCategories());
|
||||
}
|
||||
|
||||
@ -280,7 +280,7 @@ class OC_Contacts_App {
|
||||
}
|
||||
$start = 0;
|
||||
$batchsize = 10;
|
||||
$categories = new OC_VCategories('contacts');
|
||||
$categories = new OC_VCategories('contact');
|
||||
while($vccontacts =
|
||||
OC_Contacts_VCard::all($vcaddressbookids, $start, $batchsize)) {
|
||||
$cards = array();
|
||||
|
@ -645,6 +645,9 @@ class OC_Contacts_VCard {
|
||||
if($temp['label'] == '_$!<Other>!$_') {
|
||||
$temp['label'] = OC_Contacts_App::$l10n->t('Other');
|
||||
}
|
||||
if($temp['label'] == '_$!<HomePage>!$_') {
|
||||
$temp['label'] = OC_Contacts_App::$l10n->t('HomePage');
|
||||
}
|
||||
}
|
||||
if(array_key_exists($pname, $details)) {
|
||||
$details[$pname][] = $temp;
|
||||
@ -673,9 +676,12 @@ class OC_Contacts_VCard {
|
||||
public static function structureProperty($property) {
|
||||
$value = $property->value;
|
||||
//$value = htmlspecialchars($value);
|
||||
if($property->name == 'ADR' || $property->name == 'N') {
|
||||
if($property->name == 'ADR' || $property->name == 'N' || $property->name == 'ORG') {
|
||||
$value = self::unescapeDelimiters($value);
|
||||
} elseif($property->name == 'BDAY') {
|
||||
} elseif($property->name == 'CATEGORIES') {
|
||||
$value = self::unescapeDelimiters($value, ',');
|
||||
}
|
||||
elseif($property->name == 'BDAY') {
|
||||
if(strpos($value, '-') === false) {
|
||||
if(strlen($value) >= 8) {
|
||||
$value = substr($value, 0, 4).'-'.substr($value, 4, 2).'-'.substr($value, 6, 2);
|
||||
@ -684,6 +690,19 @@ class OC_Contacts_VCard {
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($property->name == 'IMPP') {
|
||||
if(strpos($value, ':') !== false) {
|
||||
$value = explode(':', $value);
|
||||
$protocol = array_shift($value);
|
||||
if(!isset($property->parameters['X-SERVICE-TYPE'])) {
|
||||
$property->add(new Sabre_VObject_Parameter(
|
||||
'X-SERVICE-TYPE',
|
||||
strtoupper(strip_tags($protocol)))
|
||||
);
|
||||
}
|
||||
$value = implode('', $value);
|
||||
}
|
||||
}
|
||||
if(is_string($value)) {
|
||||
$value = strtr($value, array('\,' => ',', '\;' => ';'));
|
||||
}
|
||||
@ -702,12 +721,18 @@ class OC_Contacts_VCard {
|
||||
}
|
||||
// NOTE: Apparently Sabre_VObject_Reader can't always deal with value list parameters
|
||||
// like TYPE=HOME,CELL,VOICE. Tanghus.
|
||||
if (in_array($property->name, array('TEL', 'EMAIL')) && $parameter->name == 'TYPE') {
|
||||
// TODO: Check if parameter is has commas and split + merge if so.
|
||||
if ($parameter->name == 'TYPE') {
|
||||
$pvalue = $parameter->value;
|
||||
if(is_string($pvalue) && strpos($pvalue, ',') !== false) {
|
||||
$pvalue = array_map('trim', explode(',', $pvalue));
|
||||
}
|
||||
$pvalue = is_array($pvalue) ? $pvalue : array($pvalue);
|
||||
if (isset($temp['parameters'][$parameter->name])) {
|
||||
$temp['parameters'][$parameter->name][] = $parameter->value;
|
||||
$temp['parameters'][$parameter->name][] = $pvalue;
|
||||
}
|
||||
else {
|
||||
$temp['parameters'][$parameter->name] = array($parameter->value);
|
||||
$temp['parameters'][$parameter->name] = $pvalue;
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
203
templates/contacts.php
Normal file
203
templates/contacts.php
Normal file
@ -0,0 +1,203 @@
|
||||
<div id='notification'></div>
|
||||
<div id="appsettings" class="popup topright hidden"></div>
|
||||
<script type='text/javascript'>
|
||||
var totalurl = '<?php echo OCP\Util::linkToRemote('carddav'); ?>addressbooks';
|
||||
var categories = <?php echo json_encode($_['categories']); ?>;
|
||||
var id = '<?php echo $_['id']; ?>';
|
||||
var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>';
|
||||
</script>
|
||||
<div id="leftcontent">
|
||||
<div class="hidden" id="statusbar"></div>
|
||||
<nav id="grouplist">
|
||||
</nav>
|
||||
<div id="uploadprogressbar"></div>
|
||||
<div id="bottomcontrols">
|
||||
<button class="control newcontact" id="contacts_newcontact" title="<?php echo $l->t('Add Contact'); ?>"></button>
|
||||
<button class="control import" title="<?php echo $l->t('Import'); ?>"></button>
|
||||
<button class="control settings" title="<?php echo $l->t('Settings'); ?>"></button>
|
||||
<form id="import_upload_form" action="<?php echo OCP\Util::linkTo('contacts', 'ajax/uploadimport.php'); ?>" method="post" enctype="multipart/form-data" target="import_upload_target">
|
||||
<input class="float" id="import_upload_start" type="file" accept="text/directory,text/vcard,text/x-vcard" name="importfile" />
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
|
||||
</form>
|
||||
<iframe name="import_upload_target" id='import_upload_target' src=""></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div id="contactsheader">
|
||||
<div class="list">
|
||||
<input type="checkbox" id="toggle_all" title="<?php echo $l->t('(De-)select all'); ?>" />
|
||||
<button class="add"></button>
|
||||
</div>
|
||||
<div class="single hidden">
|
||||
<button class="add" title="<?php echo $l->t('Add Contact'); ?>"></button>
|
||||
<button class="delete" title="<?php echo $l->t('Delete Contact'); ?>"></button>
|
||||
</div>
|
||||
<button class="settings"></button>
|
||||
</div>
|
||||
<div id="rightcontent" class="loading">
|
||||
<table>
|
||||
<tbody id="contactlist">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script id="contactListItemTemplate" type="text/template">
|
||||
<tr class="contact" data-id="{id}">
|
||||
<td class="name"
|
||||
style="background: url('<?php echo OCP\Util::linkTo('contacts', 'thumbnail.php'); ?>?id={id}')">
|
||||
<input type="checkbox" name="id" value="{id}" />{name}
|
||||
</td>
|
||||
<td class="email">
|
||||
<span>{email}</span>
|
||||
<a class="mailto hidden" title="<?php echo $l->t('Compose mail'); ?>"></a>
|
||||
</td>
|
||||
<td class="tel">{tel}</td>
|
||||
<td class="adr">{adr}</td>
|
||||
<td class="categories">{categories}</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script id="groupListItemTemplate" type="text/template">
|
||||
<h3 class="group" data-type="{type}" data-id="{id}">{name} <span class="numcontacts">{num}<span></h3>
|
||||
</script>
|
||||
|
||||
<script id="contactFullTemplate" type="text/template">
|
||||
<section id="contact" data-id="{id}">
|
||||
<form>
|
||||
<section class="singlevalues">
|
||||
<figure id="profilepicture" tabindex="1">
|
||||
<img src="<?php echo OCP\Util::linkTo('contacts', 'photo.php'); ?>?id={id}" />
|
||||
</figure>
|
||||
<div style="float: left;" data-element="fn" class="propertycontainer">
|
||||
<input class="huge value" type="text" name="value" value="{name}" />
|
||||
<dl class="form">
|
||||
<dt data-element="nickname" class="hidden">
|
||||
<?php echo $l->t('Nickname'); ?>
|
||||
</dt>
|
||||
<dd data-element="nickname" class="propertycontainer hidden">
|
||||
<input class="value" type="text" name="value" value="{nickname}" />
|
||||
</dd>
|
||||
<dt data-element="title" class="hidden">
|
||||
<?php echo $l->t('Title'); ?>
|
||||
</dt>
|
||||
<dd data-element="title" class="propertycontainer hidden">
|
||||
<input class="value" type="text" name="value" value="{title}" />
|
||||
</dd>
|
||||
<dt data-element="org" class="hidden">
|
||||
<?php echo $l->t('Organization'); ?>
|
||||
</dt>
|
||||
<dd data-element="org" class="propertycontainer hidden">
|
||||
<input class="value" type="text" name="value" value="{org}" />
|
||||
</dd>
|
||||
<dt data-element="bday" class="hidden">
|
||||
<?php echo $l->t('Birthday'); ?>
|
||||
</dt>
|
||||
<dd data-element="bday" class="propertycontainer hidden">
|
||||
<input class="value" type="text" name="value" value="{bday}" />
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<section class="note" data-element="note">
|
||||
<textarea class="value">Some text here</textarea>
|
||||
</section>
|
||||
</section>
|
||||
<section class="multivalues">
|
||||
<ul class="email propertylist hidden">
|
||||
</ul>
|
||||
<ul class="tel propertylist hidden">
|
||||
</ul>
|
||||
<ul class="adr propertylist hidden">
|
||||
</ul>
|
||||
<ul class="url propertylist hidden">
|
||||
</ul>
|
||||
<ul class="impp propertylist hidden">
|
||||
</ul>
|
||||
</section>
|
||||
</form>
|
||||
<footer>
|
||||
<select id="addproperty">
|
||||
<option value=""><?php echo $l->t('Add'); ?></option>
|
||||
<option value="ORG"><?php echo $l->t('Organization'); ?></option>
|
||||
<option value="NICKNAME"><?php echo $l->t('Nickname'); ?></option>
|
||||
<option value="BDAY"><?php echo $l->t('Birthday'); ?></option>
|
||||
<option value="TEL"><?php echo $l->t('Phone'); ?></option>
|
||||
<option value="EMAIL"><?php echo $l->t('Email'); ?></option>
|
||||
<option value="IMPP"><?php echo $l->t('Instant Messaging'); ?></option>
|
||||
<option value="ADR"><?php echo $l->t('Address'); ?></option>
|
||||
<option value="NOTE"><?php echo $l->t('Note'); ?></option>
|
||||
<option value="URL"><?php echo $l->t('Web site'); ?></option>
|
||||
<option value="CATEGORIES"><?php echo $l->t('Groups'); ?></option>
|
||||
</select>
|
||||
Add button here</footer>
|
||||
</section>
|
||||
</script>
|
||||
|
||||
<script id="contactDetailsTemplate" class="hidden" type="text/template">
|
||||
<div class="email">
|
||||
<li data-element="email" data-checksum="{checksum}" class="propertycontainer">
|
||||
<select class="rtl type value" name="parameters[TYPE][]">
|
||||
<?php echo OCP\html_select_options($_['email_types'], array()) ?>
|
||||
</select>
|
||||
<input type="checkbox" class="value tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
|
||||
<input type="email" required="required" class="nonempty value" name="value" value="{value}" x-moz-errormessage="<?php echo $l->t('Please specify a valid email address.'); ?>" placeholder="<?php echo $l->t('someone@example.com'); ?>" />
|
||||
<span class="listactions"><a class="action mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
|
||||
<a role="button" class="action delete" title="<?php echo $l->t('Delete email address'); ?>"></a></span>
|
||||
</li>
|
||||
</div>
|
||||
<div class="tel">
|
||||
<li data-element="tel" data-checksum="{checksum}" class="propertycontainer">
|
||||
<select class="rtl type value" name="parameters[TYPE][]">
|
||||
<?php echo OCP\html_select_options($_['phone_types'], array()) ?>
|
||||
</select>
|
||||
<input type="checkbox" class="value tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
|
||||
<input type="tel" required="required" class="nonempty value" name="value" value="{value}" placeholder="<?php echo $l->t('Enter phone number'); ?>" />
|
||||
<span class="listactions">
|
||||
<a role="button" class="action delete" title="<?php echo $l->t('Delete phone number'); ?>"></a></span>
|
||||
</li>
|
||||
</div>
|
||||
<div class="url">
|
||||
<li data-element="url" data-checksum="{checksum}" class="propertycontainer">
|
||||
<select class="rtl type value" name="parameters[TYPE][]">
|
||||
<?php echo OCP\html_select_options($_['email_types'], array()) ?>
|
||||
</select>
|
||||
<input type="checkbox" class="value tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
|
||||
<input type="url" required="required" class="nonempty value" name="value" value="{value}" placeholder="http://www.example.com/" />
|
||||
<span class="listactions">
|
||||
<a role="button" class="action globe" title="<?php echo $l->t('Go to web site'); ?>">
|
||||
<a role="button" class="action delete" title="<?php echo $l->t('Delete URL'); ?>"></a></span>
|
||||
</li>
|
||||
</div>
|
||||
<div class="adr">
|
||||
<li data-element="adr" data-checksum="{checksum}" class="propertycontainer">
|
||||
<select class="rtl type value" name="parameters[TYPE][]">
|
||||
<?php echo OCP\html_select_options($_['adr_types'], array()) ?>
|
||||
</select>
|
||||
<input type="checkbox" class="value tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
|
||||
<span class="float adr">{value}</span>
|
||||
<span class="listactions">
|
||||
<a class="action globe" title="<?php echo $l->t('View on map'); ?>"></a>
|
||||
<a class="action edit" title="<?php echo $l->t('Edit address details'); ?>"></a>
|
||||
<a class="action delete" title="<?php echo $l->t('Delete address'); ?>"></a></span>
|
||||
<input type="hidden" id="adr_0" name="value[ADR][0]" value="{adr0}" />
|
||||
<input type="hidden" id="adr_1" name="value[ADR][1]" value="{adr1}" />
|
||||
<input type="hidden" id="adr_2" name="value[ADR][2]" value="{adr2}" />
|
||||
<input type="hidden" id="adr_3" name="value[ADR][3]" value="{adr3}" />
|
||||
<input type="hidden" id="adr_4" name="value[ADR][4]" value="{adr4}" />
|
||||
<input type="hidden" id="adr_5" name="value[ADR][5]" value="{adr5}" />
|
||||
</li>
|
||||
</div>
|
||||
<div class="impp">
|
||||
<li data-element="impp" data-checksum="{checksum}" class="propertycontainer">
|
||||
<select class="type value" name="parameters[TYPE][]">
|
||||
<?php echo OCP\html_select_options($_['impp_types'], array()) ?>
|
||||
</select>
|
||||
<input type="checkbox" class="contacts_property impp tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
|
||||
<div class="select_wrapper">
|
||||
<select class="rtl value label impp" name="parameters[X-SERVICE-TYPE]">
|
||||
<?php echo OCP\html_select_options($_['im_protocols'], array()) ?>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" required="required" class="nonempty contacts_property" name="value" value="{value}"
|
||||
placeholder="<?php echo $l->t('Instant Messenger'); ?>" />
|
||||
<a role="button" class="action delete" title="<?php echo $l->t('Delete IM'); ?>"></a>
|
||||
</li>
|
||||
</div>
|
||||
</script>
|
@ -53,7 +53,7 @@ if(is_null($contact)) {
|
||||
OCP\Response::enableCaching($caching);
|
||||
OC_Contacts_App::setLastModifiedHeader($contact);
|
||||
|
||||
$thumbnail_size = 23;
|
||||
$thumbnail_size = 28;
|
||||
|
||||
// Find the photo from VCard.
|
||||
$image = new OC_Image();
|
||||
|
Loading…
Reference in New Issue
Block a user