├── fieldparams.gif ├── iconlink ├── language │ └── en-GB │ │ ├── en-GB.plg_fields_iconlink.sys.ini │ │ └── en-GB.plg_fields_iconlink.ini ├── media │ ├── css │ │ ├── bootstrap-iconpicker.min.css │ │ ├── bootstrap-iconpicker.css │ │ ├── fontawesome-iconpicker.min.css │ │ └── fontawesome-iconpicker.css │ ├── LICENCE │ └── js │ │ ├── bootstrap-iconpicker.min.js │ │ ├── bootstrap-iconpicker.js │ │ ├── fontawesome-iconpicker.min.js │ │ └── fontawesome-iconpicker.js ├── tmpl │ └── iconlink.php ├── iconlink.php ├── params │ ├── iconlink.xml │ └── fields │ │ └── iconclass.php └── iconlink.xml └── README.md /fieldparams.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolcat-creations/plg_fields_iconlink/master/fieldparams.gif -------------------------------------------------------------------------------- /iconlink/language/en-GB/en-GB.plg_fields_iconlink.sys.ini: -------------------------------------------------------------------------------- 1 | PLG_FIELDS_ICONLINK="Font Awesome Iconlink" 2 | PLG_FIELDS_ICONLINK_XML_DESCRIPTION="This plugin lets you create new fields of type 'URL'
You can select the Font-Awesome Icon class in the field parameters." 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # plg_fields_iconlink 2 | Joomla! Custom Fields Plugin to display an url with a Font Awesome icon. (For Joomla 3) 3 | 4 | ## Custom Fields Plugin 5 | works for templates that use font awesome 4 fonts 6 | displays the url with an icon 7 | 8 | In the additional field parameters you can choose the target, the icon-class with an icon search, the icon-size and if to show the url or not. 9 | 10 | Apply your own css by adding a render class in the options tab of the field settings. 11 | 12 | ## Field params: 13 | ![Fieldparams](/fieldparams.gif) 14 | -------------------------------------------------------------------------------- /iconlink/language/en-GB/en-GB.plg_fields_iconlink.ini: -------------------------------------------------------------------------------- 1 | PLG_FIELDS_ICONLINK="Font Awesome Iconlink" 2 | PLG_FIELDS_ICONLINK_XML_DESCRIPTION="This plugin lets you create new fields of type 'URL'
You can select the Font-Awesome Icon class in the field parameters." 3 | PLG_FIELDS_ICONLINK_TARGET_LABEL="Target" 4 | PLG_FIELDS_ICONLINK_LABEL="Iconlink (%s)" 5 | PLG_FIELDS_ICONLINK_PARAMS_RELATIVE_DESC="Are relative URLs allowed." 6 | PLG_FIELDS_ICONLINK_PARAMS_RELATIVE_LABEL="Relative" 7 | PLG_FIELDS_ICONLINK_PARAMS_SCHEMES_DESC="The allowed schemes." 8 | PLG_FIELDS_ICONLINK_PARAMS_SCHEMES_LABEL="Schemes" 9 | PLG_ICONLINK_ICON="Icon" 10 | PLG_FIELDS_ICONLINK_SEARCHTEXT="Search" 11 | PLG_ICONLINK_ICON_LEFT="Icon left" 12 | PLG_ICONLINK_ICON_RIGHT="Icon right" 13 | PLG_FIELDS_ICONLINK_PAGESINDEX="%s of %s pages" 14 | PLG_FIELDS_ICONLINK_ICONSINDEX="%s - %s of %s icons" 15 | PLG_FIELDS_ICONLINK_ICONSIZE="Icon size" 16 | PLG_FIELDS_ICONLINK_SHOWURL="Show url" 17 | PLG_FIELDS_ICONLINK_ICONSIZE_REGULAR="regular" 18 | PLG_FIELDS_ICONLINK_ICONSIZE_LARGE="large" -------------------------------------------------------------------------------- /iconlink/media/css/bootstrap-iconpicker.min.css: -------------------------------------------------------------------------------- 1 | /*!======================================================================== 2 | * File: bootstrap-iconpicker.min.css v1.9.0 by @victor-valencia 3 | * https://victor-valencia.github.com/bootstrap-iconpicker 4 | * ======================================================================== 5 | * Copyright 2013-2017 Victor Valencia Rico. 6 | * Licensed under MIT license. 7 | * https://github.com/victor-valencia/bootstrap-iconpicker/blob/master/LICENSE 8 | * ======================================================================== 9 | */ 10 | 11 | .iconpicker .caret{margin-left:10px!important}.iconpicker{min-width:60px}.iconpicker input.search-control{margin-bottom:6px;margin-top:6px}div.iconpicker.left .table-icons{margin-right:auto}div.iconpicker.center .table-icons{margin-left:auto;margin-right:auto}div.iconpicker.right .table-icons{margin-left:auto}.table-icons .btn{min-height:30px;min-width:35px;text-align:center;padding:0;margin:2px}.table-icons td{min-width:39px}.popover{max-width:inherit!important}.iconpicker-popover{z-index:1050!important}.iconpicker-popover .search-control{margin-bottom:6px;margin-top:6px} -------------------------------------------------------------------------------- /iconlink/tmpl/iconlink.php: -------------------------------------------------------------------------------- 1 | value; 12 | 13 | if ($value == '') 14 | { 15 | return; 16 | } 17 | 18 | $attributes = ''; 19 | 20 | if (!JUri::isInternal($value)) 21 | { 22 | $attributes = ' rel="nofollow noopener noreferrer" target="_blank"'; 23 | } 24 | 25 | $doc = JFactory::getDocument(); 26 | $doc->addStyleDeclaration('dd.field-entry.socialmedia { float: left;}'); 27 | 28 | $iconclass = $field->fieldparams['iconclass']; 29 | $iconsize = $field->fieldparams['iconsize']; 30 | $target = $field->fieldparams['target']; 31 | $showurl = $field->fieldparams['showurl']; 32 | $linktext = ''; 33 | 34 | if ($showurl) 35 | { 36 | $linktext = $value; 37 | } 38 | 39 | echo sprintf(' ' . $linktext . '', 40 | htmlspecialchars($value), 41 | $attributes, 42 | htmlspecialchars($value) 43 | ); 44 | -------------------------------------------------------------------------------- /iconlink/media/LICENCE: -------------------------------------------------------------------------------- 1 | Media Files: 2 | http://victor-valencia.github.io/bootstrap-iconpicker/ 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (c) 2013-2017 victor-valencia 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | this software and associated documentation files (the "Software"), to deal in 10 | the Software without restriction, including without limitation the rights to 11 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | the Software, and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.s -------------------------------------------------------------------------------- /iconlink/iconlink.php: -------------------------------------------------------------------------------- 1 | setAttribute('validate', 'url'); 46 | 47 | if (!$fieldNode->getAttribute('relative')) 48 | { 49 | $fieldNode->removeAttribute('relative'); 50 | } 51 | 52 | return $fieldNode; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /iconlink/media/css/bootstrap-iconpicker.css: -------------------------------------------------------------------------------- 1 | /*!======================================================================== 2 | * File: bootstrap-iconpicker.css v1.9.0 by @victor-valencia 3 | * https://victor-valencia.github.com/bootstrap-iconpicker 4 | * ======================================================================== 5 | * Copyright 2013-2017 Victor Valencia Rico. 6 | * Licensed under MIT license. 7 | * https://github.com/victor-valencia/bootstrap-iconpicker/blob/master/LICENSE 8 | * ======================================================================== 9 | */ 10 | 11 | .iconpicker .caret { 12 | margin-left: 10px !important; 13 | } 14 | 15 | .iconpicker { 16 | min-width: 60px; 17 | } 18 | 19 | .iconpicker input.search-control { 20 | margin-bottom: 6px; 21 | margin-top: 6px; 22 | } 23 | 24 | div.iconpicker.left .table-icons { 25 | margin-right: auto; 26 | } 27 | 28 | div.iconpicker.center .table-icons { 29 | margin-left: auto; 30 | margin-right: auto; 31 | } 32 | 33 | div.iconpicker.right .table-icons { 34 | margin-left: auto; 35 | } 36 | 37 | .table-icons .btn { 38 | min-height: 30px; 39 | min-width: 35px; 40 | text-align: center; 41 | padding: 0; 42 | margin: 2px; 43 | } 44 | 45 | .table-icons td { 46 | min-width: 39px; 47 | } 48 | 49 | .popover { 50 | max-width: inherit !important; 51 | } 52 | 53 | .iconpicker-popover { 54 | z-index: 1050 !important; 55 | } 56 | 57 | .iconpicker-popover .search-control { 58 | margin-bottom: 6px; 59 | margin-top: 6px; 60 | } 61 | -------------------------------------------------------------------------------- /iconlink/params/iconlink.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
6 | 7 | 8 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 |
82 |
83 |
84 | -------------------------------------------------------------------------------- /iconlink/params/fields/iconclass.php: -------------------------------------------------------------------------------- 1 | params); 32 | $iconleft = $pluginParams->get('iconleft'); 33 | $iconright = $pluginParams->get('iconright'); 34 | } 35 | 36 | $return = '
'; 37 | 38 | $return .= ""; 68 | 69 | return $return; 70 | } 71 | 72 | } 73 | 74 | ?> 75 | 76 | 77 | -------------------------------------------------------------------------------- /iconlink/iconlink.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | plg_fields_iconlink 4 | Elisa Foltyn, coolcat-creations.com 5 | September 2017 6 | Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved. 7 | GNU General Public License version 2 or later; see LICENSE.txt 8 | admin@joomla.org 9 | www.joomla.org 10 | 3.7.0 11 | PLG_FIELDS_ICONLINK_XML_DESCRIPTION 12 | 13 | iconlink.php 14 | language 15 | params 16 | tmpl 17 | 18 | 19 | en-GB/en-GB.plg_fields_iconlink.ini 20 | en-GB/en-GB.plg_fields_iconlink.ini 21 | 22 | 23 | 24 | css 25 | js 26 | 27 | 28 | 29 |
31 | 32 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 56 | 57 | 58 | 59 | 60 | 66 | 67 | 68 | 74 | 75 | 76 |
77 |
78 |
79 |
80 | -------------------------------------------------------------------------------- /iconlink/media/css/fontawesome-iconpicker.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome Icon Picker 3 | * https://itsjavi.com/fontawesome-iconpicker/ 4 | * 5 | * Originally written by (c) 2016 Javi Aguilar 6 | * Licensed under the MIT License 7 | * https://github.com/itsjavi/fontawesome-iconpicker/blob/master/LICENSE 8 | * 9 | */.iconpicker-popover.popover{position:absolute;top:0;left:0;display:none;max-width:none;padding:1px;text-align:left;width:216px;background:#f7f7f7}.iconpicker-popover.popover.top,.iconpicker-popover.popover.topLeftCorner,.iconpicker-popover.popover.topLeft,.iconpicker-popover.popover.topRight,.iconpicker-popover.popover.topRightCorner{margin-top:-10px}.iconpicker-popover.popover.right,.iconpicker-popover.popover.rightTop,.iconpicker-popover.popover.rightBottom{margin-left:10px}.iconpicker-popover.popover.bottom,.iconpicker-popover.popover.bottomRightCorner,.iconpicker-popover.popover.bottomRight,.iconpicker-popover.popover.bottomLeft,.iconpicker-popover.popover.bottomLeftCorner{margin-top:10px}.iconpicker-popover.popover.left,.iconpicker-popover.popover.leftBottom,.iconpicker-popover.popover.leftTop{margin-left:-10px}.iconpicker-popover.popover.inline{margin:0 0 12px 0;position:relative;display:inline-block;opacity:1;top:auto;left:auto;bottom:auto;right:auto;max-width:100%;box-shadow:none;z-index:auto;vertical-align:top}.iconpicker-popover.popover.inline>.arrow{display:none}.dropdown-menu .iconpicker-popover.inline{margin:0;border:none}.dropdown-menu.iconpicker-container{padding:0}.iconpicker-popover.popover .popover-title{padding:12px;font-size:13px;line-height:15px;border-bottom:1px solid #ebebeb;background-color:#f7f7f7}.iconpicker-popover.popover .popover-title input[type=search].iconpicker-search{margin:0 0 2px 0}.iconpicker-popover.popover .popover-title-text~input[type=search].iconpicker-search{margin-top:12px}.iconpicker-popover.popover .popover-content{padding:0px;text-align:center}.iconpicker-popover .popover-footer{float:none;clear:both;padding:12px;text-align:right;margin:0;border-top:1px solid #ebebeb;background-color:#f7f7f7}.iconpicker-popover .popover-footer:before,.iconpicker-popover .popover-footer:after{content:" ";display:table}.iconpicker-popover .popover-footer:after{clear:both}.iconpicker-popover .popover-footer .iconpicker-btn{margin-left:10px}.iconpicker-popover .popover-footer input[type=search].iconpicker-search{margin-bottom:12px}.iconpicker-popover.popover>.arrow,.iconpicker-popover.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.iconpicker-popover.popover>.arrow{border-width:11px}.iconpicker-popover.popover>.arrow:after{border-width:10px;content:""}.iconpicker-popover.popover.top>.arrow,.iconpicker-popover.popover.topLeft>.arrow,.iconpicker-popover.popover.topRight>.arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0,0,0,0.25);bottom:-11px}.iconpicker-popover.popover.top>.arrow:after,.iconpicker-popover.popover.topLeft>.arrow:after,.iconpicker-popover.popover.topRight>.arrow:after{content:" ";bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#fff}.iconpicker-popover.popover.topLeft>.arrow{left:8px;margin-left:0}.iconpicker-popover.popover.topRight>.arrow{left:auto;right:8px;margin-left:0}.iconpicker-popover.popover.right>.arrow,.iconpicker-popover.popover.rightTop>.arrow,.iconpicker-popover.popover.rightBottom>.arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0,0,0,0.25)}.iconpicker-popover.popover.right>.arrow:after,.iconpicker-popover.popover.rightTop>.arrow:after,.iconpicker-popover.popover.rightBottom>.arrow:after{content:" ";left:1px;bottom:-10px;border-left-width:0;border-right-color:#fff}.iconpicker-popover.popover.rightTop>.arrow{top:auto;bottom:8px;margin-top:0}.iconpicker-popover.popover.rightBottom>.arrow{top:8px;margin-top:0}.iconpicker-popover.popover.bottom>.arrow,.iconpicker-popover.popover.bottomRight>.arrow,.iconpicker-popover.popover.bottomLeft>.arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,0.25);top:-11px}.iconpicker-popover.popover.bottom>.arrow:after,.iconpicker-popover.popover.bottomRight>.arrow:after,.iconpicker-popover.popover.bottomLeft>.arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.iconpicker-popover.popover.bottomLeft>.arrow{left:8px;margin-left:0}.iconpicker-popover.popover.bottomRight>.arrow{left:auto;right:8px;margin-left:0}.iconpicker-popover.popover.left>.arrow,.iconpicker-popover.popover.leftBottom>.arrow,.iconpicker-popover.popover.leftTop>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,0.25)}.iconpicker-popover.popover.left>.arrow:after,.iconpicker-popover.popover.leftBottom>.arrow:after,.iconpicker-popover.popover.leftTop>.arrow:after{content:" ";right:1px;border-right-width:0;border-left-color:#fff;bottom:-10px}.iconpicker-popover.popover.leftBottom>.arrow{top:8px;margin-top:0}.iconpicker-popover.popover.leftTop>.arrow{top:auto;bottom:8px;margin-top:0}.iconpicker{position:relative;text-align:left;text-shadow:none;line-height:0;display:block;margin:0;overflow:hidden}.iconpicker *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;position:relative}.iconpicker:before,.iconpicker:after{content:" ";display:table}.iconpicker:after{clear:both}.iconpicker .iconpicker-items{position:relative;clear:both;float:none;padding:12px 0 0 12px;background:#fff;margin:0;overflow:hidden;overflow-y:auto;min-height:49px;max-height:246px}.iconpicker .iconpicker-items:before,.iconpicker .iconpicker-items:after{content:" ";display:table}.iconpicker .iconpicker-items:after{clear:both}.iconpicker .iconpicker-item{float:left;width:14px;height:14px;padding:12px;margin:0 12px 12px 0;text-align:center;cursor:pointer;border-radius:3px;font-size:14px;box-shadow:0 0 0 1px #ddd;color:inherit}.iconpicker .iconpicker-item:hover:not(.iconpicker-selected){background-color:#eee}.iconpicker .iconpicker-item.iconpicker-selected{box-shadow:none;color:#fff}.iconpicker-component{cursor:pointer} -------------------------------------------------------------------------------- /iconlink/media/css/fontawesome-iconpicker.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome Icon Picker 3 | * https://itsjavi.com/fontawesome-iconpicker/ 4 | * 5 | * Originally written by (c) 2016 Javi Aguilar 6 | * Licensed under the MIT License 7 | * https://github.com/itsjavi/fontawesome-iconpicker/blob/master/LICENSE 8 | * 9 | */ 10 | /* 11 | * Font Awesome Icon Picker 12 | * https://itsjavi.com/fontawesome-iconpicker/ 13 | * 14 | * Originally written by (c) 2016 Javi Aguilar 15 | * Licensed under the MIT License 16 | * https://github.com/itsjavi/fontawesome-iconpicker/blob/master/LICENSE 17 | * 18 | */ 19 | /* 20 | * Font Awesome Icon Picker 21 | * https://itsjavi.com/fontawesome-iconpicker/ 22 | * 23 | * Originally written by (c) 2016 Javi Aguilar 24 | * Licensed under the MIT License 25 | * https://github.com/itsjavi/fontawesome-iconpicker/blob/master/LICENSE 26 | * 27 | */ 28 | .iconpicker-popover.popover { 29 | position: absolute; 30 | top: 0; 31 | left: 0; 32 | display: none; 33 | max-width: none; 34 | padding: 1px; 35 | text-align: left; 36 | width: 216px; 37 | background: #f7f7f7; 38 | } 39 | .iconpicker-popover.popover.top, 40 | .iconpicker-popover.popover.topLeftCorner, 41 | .iconpicker-popover.popover.topLeft, 42 | .iconpicker-popover.popover.topRight, 43 | .iconpicker-popover.popover.topRightCorner { 44 | margin-top: -10px; 45 | } 46 | .iconpicker-popover.popover.right, 47 | .iconpicker-popover.popover.rightTop, 48 | .iconpicker-popover.popover.rightBottom { 49 | margin-left: 10px; 50 | } 51 | .iconpicker-popover.popover.bottom, 52 | .iconpicker-popover.popover.bottomRightCorner, 53 | .iconpicker-popover.popover.bottomRight, 54 | .iconpicker-popover.popover.bottomLeft, 55 | .iconpicker-popover.popover.bottomLeftCorner { 56 | margin-top: 10px; 57 | } 58 | .iconpicker-popover.popover.left, 59 | .iconpicker-popover.popover.leftBottom, 60 | .iconpicker-popover.popover.leftTop { 61 | margin-left: -10px; 62 | } 63 | .iconpicker-popover.popover.inline { 64 | margin: 0 0 12px 0; 65 | position: relative; 66 | display: inline-block; 67 | opacity: 1; 68 | top: auto; 69 | left: auto; 70 | bottom: auto; 71 | right: auto; 72 | max-width: 100%; 73 | box-shadow: none; 74 | z-index: auto; 75 | vertical-align: top; 76 | } 77 | .iconpicker-popover.popover.inline > .arrow { 78 | display: none; 79 | } 80 | .dropdown-menu .iconpicker-popover.inline { 81 | margin: 0; 82 | border: none; 83 | } 84 | .dropdown-menu.iconpicker-container { 85 | padding: 0; 86 | } 87 | .iconpicker-popover.popover .popover-title { 88 | padding: 12px; 89 | font-size: 13px; 90 | line-height: 15px; 91 | border-bottom: 1px solid #ebebeb; 92 | background-color: #f7f7f7; 93 | } 94 | .iconpicker-popover.popover .popover-title input[type=search].iconpicker-search { 95 | margin: 0 0 2px 0; 96 | } 97 | .iconpicker-popover.popover .popover-title-text ~ input[type=search].iconpicker-search { 98 | margin-top: 12px; 99 | } 100 | .iconpicker-popover.popover .popover-content { 101 | padding: 0px; 102 | text-align: center; 103 | } 104 | .iconpicker-popover .popover-footer { 105 | float: none; 106 | clear: both; 107 | padding: 12px; 108 | text-align: right; 109 | margin: 0; 110 | border-top: 1px solid #ebebeb; 111 | background-color: #f7f7f7; 112 | } 113 | .iconpicker-popover .popover-footer:before, 114 | .iconpicker-popover .popover-footer:after { 115 | content: " "; 116 | display: table; 117 | } 118 | .iconpicker-popover .popover-footer:after { 119 | clear: both; 120 | } 121 | .iconpicker-popover .popover-footer .iconpicker-btn { 122 | margin-left: 10px; 123 | } 124 | .iconpicker-popover .popover-footer input[type=search].iconpicker-search { 125 | /*width:auto; 126 | float:left;*/ 127 | margin-bottom: 12px; 128 | } 129 | .iconpicker-popover.popover > .arrow, 130 | .iconpicker-popover.popover > .arrow:after { 131 | position: absolute; 132 | display: block; 133 | width: 0; 134 | height: 0; 135 | border-color: transparent; 136 | border-style: solid; 137 | } 138 | .iconpicker-popover.popover > .arrow { 139 | border-width: 11px; 140 | } 141 | .iconpicker-popover.popover > .arrow:after { 142 | border-width: 10px; 143 | content: ""; 144 | } 145 | .iconpicker-popover.popover.top > .arrow, 146 | .iconpicker-popover.popover.topLeft > .arrow, 147 | .iconpicker-popover.popover.topRight > .arrow { 148 | left: 50%; 149 | margin-left: -11px; 150 | border-bottom-width: 0; 151 | border-top-color: #999999; 152 | border-top-color: rgba(0, 0, 0, 0.25); 153 | bottom: -11px; 154 | } 155 | .iconpicker-popover.popover.top > .arrow:after, 156 | .iconpicker-popover.popover.topLeft > .arrow:after, 157 | .iconpicker-popover.popover.topRight > .arrow:after { 158 | content: " "; 159 | bottom: 1px; 160 | margin-left: -10px; 161 | border-bottom-width: 0; 162 | border-top-color: #ffffff; 163 | } 164 | .iconpicker-popover.popover.topLeft > .arrow { 165 | left: 8px; 166 | margin-left: 0; 167 | } 168 | .iconpicker-popover.popover.topRight > .arrow { 169 | left: auto; 170 | right: 8px; 171 | margin-left: 0; 172 | } 173 | .iconpicker-popover.popover.right > .arrow, 174 | .iconpicker-popover.popover.rightTop > .arrow, 175 | .iconpicker-popover.popover.rightBottom > .arrow { 176 | top: 50%; 177 | left: -11px; 178 | margin-top: -11px; 179 | border-left-width: 0; 180 | border-right-color: #999999; 181 | border-right-color: rgba(0, 0, 0, 0.25); 182 | } 183 | .iconpicker-popover.popover.right > .arrow:after, 184 | .iconpicker-popover.popover.rightTop > .arrow:after, 185 | .iconpicker-popover.popover.rightBottom > .arrow:after { 186 | content: " "; 187 | left: 1px; 188 | bottom: -10px; 189 | border-left-width: 0; 190 | border-right-color: #ffffff; 191 | } 192 | .iconpicker-popover.popover.rightTop > .arrow { 193 | top: auto; 194 | bottom: 8px; 195 | margin-top: 0; 196 | } 197 | .iconpicker-popover.popover.rightBottom > .arrow { 198 | top: 8px; 199 | margin-top: 0; 200 | } 201 | .iconpicker-popover.popover.bottom > .arrow, 202 | .iconpicker-popover.popover.bottomRight > .arrow, 203 | .iconpicker-popover.popover.bottomLeft > .arrow { 204 | left: 50%; 205 | margin-left: -11px; 206 | border-top-width: 0; 207 | border-bottom-color: #999999; 208 | border-bottom-color: rgba(0, 0, 0, 0.25); 209 | top: -11px; 210 | } 211 | .iconpicker-popover.popover.bottom > .arrow:after, 212 | .iconpicker-popover.popover.bottomRight > .arrow:after, 213 | .iconpicker-popover.popover.bottomLeft > .arrow:after { 214 | content: " "; 215 | top: 1px; 216 | margin-left: -10px; 217 | border-top-width: 0; 218 | border-bottom-color: #ffffff; 219 | } 220 | .iconpicker-popover.popover.bottomLeft > .arrow { 221 | left: 8px; 222 | margin-left: 0; 223 | } 224 | .iconpicker-popover.popover.bottomRight > .arrow { 225 | left: auto; 226 | right: 8px; 227 | margin-left: 0; 228 | } 229 | .iconpicker-popover.popover.left > .arrow, 230 | .iconpicker-popover.popover.leftBottom > .arrow, 231 | .iconpicker-popover.popover.leftTop > .arrow { 232 | top: 50%; 233 | right: -11px; 234 | margin-top: -11px; 235 | border-right-width: 0; 236 | border-left-color: #999999; 237 | border-left-color: rgba(0, 0, 0, 0.25); 238 | } 239 | .iconpicker-popover.popover.left > .arrow:after, 240 | .iconpicker-popover.popover.leftBottom > .arrow:after, 241 | .iconpicker-popover.popover.leftTop > .arrow:after { 242 | content: " "; 243 | right: 1px; 244 | border-right-width: 0; 245 | border-left-color: #ffffff; 246 | bottom: -10px; 247 | } 248 | .iconpicker-popover.popover.leftBottom > .arrow { 249 | top: 8px; 250 | margin-top: 0; 251 | } 252 | .iconpicker-popover.popover.leftTop > .arrow { 253 | top: auto; 254 | bottom: 8px; 255 | margin-top: 0; 256 | } 257 | .iconpicker { 258 | position: relative; 259 | text-align: left; 260 | text-shadow: none; 261 | line-height: 0; 262 | display: block; 263 | margin: 0; 264 | overflow: hidden; 265 | } 266 | .iconpicker * { 267 | -webkit-box-sizing: content-box; 268 | -moz-box-sizing: content-box; 269 | box-sizing: content-box; 270 | position: relative; 271 | } 272 | .iconpicker:before, 273 | .iconpicker:after { 274 | content: " "; 275 | display: table; 276 | } 277 | .iconpicker:after { 278 | clear: both; 279 | } 280 | .iconpicker .iconpicker-items { 281 | position: relative; 282 | clear: both; 283 | float: none; 284 | padding: 12px 0 0 12px; 285 | background: #fff; 286 | margin: 0; 287 | overflow: hidden; 288 | overflow-y: auto; 289 | min-height: 49px; 290 | max-height: 246px; 291 | } 292 | .iconpicker .iconpicker-items:before, 293 | .iconpicker .iconpicker-items:after { 294 | content: " "; 295 | display: table; 296 | } 297 | .iconpicker .iconpicker-items:after { 298 | clear: both; 299 | } 300 | .iconpicker .iconpicker-item { 301 | float: left; 302 | width: 14px; 303 | height: 14px; 304 | padding: 12px; 305 | margin: 0 12px 12px 0; 306 | text-align: center; 307 | cursor: pointer; 308 | border-radius: 3px; 309 | font-size: 14px; 310 | box-shadow: 0 0 0 1px #dddddd; 311 | color: inherit; 312 | /*&:nth-child(4n+4) { 313 | margin-right: 0; 314 | } 315 | &:nth-last-child(-n+4) { 316 | margin-bottom: 0; 317 | }*/ 318 | } 319 | .iconpicker .iconpicker-item:hover:not(.iconpicker-selected) { 320 | background-color: #eeeeee; 321 | } 322 | .iconpicker .iconpicker-item.iconpicker-selected { 323 | box-shadow: none; 324 | color: #fff; 325 | } 326 | .iconpicker-component { 327 | cursor: pointer; 328 | } 329 | -------------------------------------------------------------------------------- /iconlink/media/js/bootstrap-iconpicker.min.js: -------------------------------------------------------------------------------- 1 | /*!======================================================================== 2 | * File: bootstrap-iconpicker.min.js v1.9.0 by @victor-valencia 3 | * https://victor-valencia.github.com/bootstrap-iconpicker 4 | * ======================================================================== 5 | * Copyright 2013-2017 Victor Valencia Rico. 6 | * Licensed under MIT license. 7 | * https://github.com/victor-valencia/bootstrap-iconpicker/blob/master/LICENSE 8 | * ======================================================================== 9 | */ 10 | 11 | !function($){"use strict";var Iconpicker=function(element,options){this.$element=$(element),this.options=$.extend({},Iconpicker.DEFAULTS,this.$element.data()),this.options=$.extend({},this.options,options)};Iconpicker.VERSION="1.9.0",Iconpicker.ICONSET_EMPTY={iconClass:"",iconClassFix:"",icons:[]},Iconpicker.ICONSET={_custom:null,elusiveicon:$.iconset_elusiveicon||Iconpicker.ICONSET_EMPTY,flagicon:$.iconset_flagicon||Iconpicker.ICONSET_EMPTY,fontawesome:$.iconset_fontawesome||Iconpicker.ICONSET_EMPTY,glyphicon:$.iconset_glyphicon||Iconpicker.ICONSET_EMPTY,ionicon:$.iconset_ionicon||Iconpicker.ICONSET_EMPTY,mapicon:$.iconset_mapicon||Iconpicker.ICONSET_EMPTY,materialdesign:$.iconset_materialdesign||Iconpicker.ICONSET_EMPTY,octicon:$.iconset_octicon||Iconpicker.ICONSET_EMPTY,typicon:$.iconset_typicon||Iconpicker.ICONSET_EMPTY,weathericon:$.iconset_weathericon||Iconpicker.ICONSET_EMPTY},Iconpicker.DEFAULTS={align:"center",arrowClass:"btn-primary",arrowNextIconClass:"glyphicon glyphicon-arrow-right",arrowPrevIconClass:"glyphicon glyphicon-arrow-left",cols:4,icon:"",iconset:"glyphicon",iconsetVersion:"lastest",header:!0,labelHeader:"{0} / {1}",footer:!0,labelFooter:"{0} - {1} of {2}",placement:"bottom",rows:4,search:!0,searchText:"Search icon",selectedClass:"btn-warning",unselectedClass:"btn-default"},Iconpicker.prototype.bindEvents=function(){var op=this.options,el=this;op.table.find(".btn-previous, .btn-next").off("click").on("click",function(e){if(e.preventDefault(),!$(this).hasClass("disabled")){var inc=parseInt($(this).val(),10);el.changeList(op.page+inc)}}),op.table.find(".btn-icon").off("click").on("click",function(e){e.preventDefault(),el.select($(this).val()),op.inline===!1?el.$element.popover("destroy"):op.table.find("i."+$(this).val()).parent().addClass(op.selectedClass)}),op.table.find(".search-control").off("keyup").on("keyup",function(){el.changeList(1)})},Iconpicker.prototype.changeList=function(page){this.filterIcons(),this.updateLabels(page),this.updateIcons(page),this.options.page=page,this.bindEvents()},Iconpicker.prototype.filterIcons=function(){var op=this.options,search=op.table.find(".search-control").val(),icons=[];if("lastest"!=op.iconsetVersion&&"undefined"!=typeof Iconpicker.ICONSET[op.iconset].allVersions?$.each(Iconpicker.ICONSET[op.iconset].allVersions,function(i,v){op.iconsetVersion==v.version&&(icons=v.icons)}):icons=Iconpicker.ICONSET[op.iconset].icons,""===search)op.icons=icons;else{var result=[];$.each(icons,function(i,v){v.toLowerCase().indexOf(search)>-1&&result.push(v)}),op.icons=result}},Iconpicker.prototype.removeAddClass=function(target,remove,add){return this.options.table.find(target).removeClass(remove).addClass(add),add},Iconpicker.prototype.reset=function(){this.updatePicker(),this.changeList(1)},Iconpicker.prototype.select=function(icon){var op=this.options,el=this.$element;op.selected=$.inArray(icon.replace(op.iconClassFix,""),op.icons),-1===op.selected&&(op.selected=0,icon=op.iconClassFix+op.icons[op.selected]),""!==icon&&op.selected>=0&&(op.icon=icon,op.inline===!1&&(el.find("input").val(icon),el.find("i").attr("class","").addClass(op.iconClass).addClass(icon)),icon===op.iconClassFix?el.trigger({type:"change",icon:"empty"}):(el.trigger({type:"change",icon:icon}),el.find("input").val(icon)),op.table.find("button."+op.selectedClass).removeClass(op.selectedClass))},Iconpicker.prototype.switchPage=function(icon){var op=this.options;if(op.selected=$.inArray(icon.replace(op.iconClassFix,""),op.icons),op.selected>=0){var page=Math.ceil((op.selected+1)/this.totalIconsPerPage());this.changeList(page)}""===icon?op.table.find("i."+op.iconClassFix).parent().addClass(op.selectedClass):op.table.find("i."+icon).parent().addClass(op.selectedClass)},Iconpicker.prototype.totalPages=function(){return Math.ceil(this.totalIcons()/this.totalIconsPerPage())},Iconpicker.prototype.totalIcons=function(){return this.options.icons.length},Iconpicker.prototype.totalIconsPerPage=function(){return 0===this.options.rows?this.options.icons.length:this.options.cols*this.options.rows},Iconpicker.prototype.updateArrows=function(page){var op=this.options,total_pages=this.totalPages();1===page?op.table.find(".btn-previous").addClass("disabled"):op.table.find(".btn-previous").removeClass("disabled"),page===total_pages||0===total_pages?op.table.find(".btn-next").addClass("disabled"):op.table.find(".btn-next").removeClass("disabled")},Iconpicker.prototype.updateIcons=function(page){var op=this.options,tbody=op.table.find("tbody").empty(),offset=(page-1)*this.totalIconsPerPage(),length=op.rows;0===op.rows&&(length=op.icons.length);for(var i=0;length>i;i++){for(var tr=$(""),j=0;j').hide();if(pos').show(),op.icon===v&&btn.addClass(op.selectedClass).addClass("btn-icon-selected")}tr.append($("").append(btn))}tbody.append(tr)}},Iconpicker.prototype.updateIconsCount=function(){var op=this.options;if(op.footer===!0){var icons_count=["",' ',' '," ",""];op.table.find("tfoot").empty().append(icons_count.join(""))}},Iconpicker.prototype.updateLabels=function(page){var op=this.options,total_icons=this.totalIcons(),total_pages=this.totalPages();op.table.find(".page-count").html(op.labelHeader.replace("{0}",0===total_pages?0:page).replace("{1}",total_pages));var offset=(page-1)*this.totalIconsPerPage(),total=page*this.totalIconsPerPage();op.table.find(".icons-count").html(op.labelFooter.replace("{0}",total_icons?offset+1:0).replace("{1}",total_icons>total?total:total_icons).replace("{2}",total_icons)),this.updateArrows(page)},Iconpicker.prototype.updatePagesCount=function(){var op=this.options;if(op.header===!0){for(var tr=$(""),i=0;i');if(0===i||i===op.cols-1){var arrow=['"];td.append(arrow.join("")),tr.append(td)}else 0===tr.find(".page-count").length&&(td.attr("colspan",op.cols-2).append(''),tr.append(td))}op.table.find("thead").empty().append(tr)}},Iconpicker.prototype.updatePicker=function(){var op=this.options;if(op.cols<4)throw"Iconpicker => The number of columns must be greater than or equal to 4. [option.cols = "+op.cols+"]";if(op.rows<0)throw"Iconpicker => The number of rows must be greater than or equal to 0. [option.rows = "+op.rows+"]";this.updatePagesCount(),this.updateSearch(),this.updateIconsCount()},Iconpicker.prototype.updateSearch=function(){var op=this.options,search=["",' ',' '," ",""];search=$(search.join("")),op.search===!0?search.show():search.hide(),op.table.find("thead").append(search)},Iconpicker.prototype.setAlign=function(value){this.$element.removeClass(this.options.align).addClass(value),this.options.align=value},Iconpicker.prototype.setArrowClass=function(value){this.options.arrowClass=this.removeAddClass(".btn-arrow",this.options.arrowClass,value)},Iconpicker.prototype.setArrowNextIconClass=function(value){this.options.arrowNextIconClass=this.removeAddClass(".btn-next > span",this.options.arrowNextIconClass,value)},Iconpicker.prototype.setArrowPrevIconClass=function(value){this.options.arrowPrevIconClass=this.removeAddClass(".btn-previous > span",this.options.arrowPrevIconClass,value)},Iconpicker.prototype.setCols=function(value){this.options.cols=value,this.reset()},Iconpicker.prototype.setFooter=function(value){var footer=this.options.table.find("tfoot");value===!0?footer.show():footer.hide(),this.options.footer=value},Iconpicker.prototype.setHeader=function(value){var header=this.options.table.find("thead");value===!0?header.show():header.hide(),this.options.header=value},Iconpicker.prototype.setIcon=function(value){this.select(value)},Iconpicker.prototype.setIconset=function(value){var op=this.options;$.isPlainObject(value)?(Iconpicker.ICONSET._custom=$.extend(Iconpicker.ICONSET_EMPTY,value),op.iconset="_custom"):Iconpicker.ICONSET.hasOwnProperty(value)?op.iconset=value:op.iconset=Iconpicker.DEFAULTS.iconset,op=$.extend(op,Iconpicker.ICONSET[op.iconset]),this.reset(),this.select(op.icon)},Iconpicker.prototype.setLabelHeader=function(value){this.options.labelHeader=value,this.updateLabels(this.options.page)},Iconpicker.prototype.setLabelFooter=function(value){this.options.labelFooter=value,this.updateLabels(this.options.page)},Iconpicker.prototype.setPlacement=function(value){this.options.placement=value},Iconpicker.prototype.setRows=function(value){this.options.rows=value,this.reset()},Iconpicker.prototype.setSearch=function(value){var search=this.options.table.find(".search-control");value===!0?search.show():search.hide(),search.val(""),this.changeList(1),this.options.search=value},Iconpicker.prototype.setSearchText=function(value){this.options.table.find(".search-control").attr("placeholder",value),this.options.searchText=value},Iconpicker.prototype.setSelectedClass=function(value){this.options.selectedClass=this.removeAddClass(".btn-icon-selected",this.options.selectedClass,value)},Iconpicker.prototype.setUnselectedClass=function(value){this.options.unselectedClass=this.removeAddClass(".btn-icon",this.options.unselectedClass,value)};var old=$.fn.iconpicker;$.fn.iconpicker=function(option,params){return this.each(function(){var $this=$(this),data=$this.data("bs.iconpicker"),options="object"==typeof option&&option;if(data||$this.data("bs.iconpicker",data=new Iconpicker(this,options)),"string"==typeof option){if("undefined"==typeof data[option])throw'Iconpicker => The "'+option+'" method does not exists.';data[option](params)}else{var op=data.options;op=$.extend(op,{inline:!1,page:1,selected:-1,table:$('
')});var name="undefined"!=typeof $this.attr("name")?'name="'+$this.attr("name")+'"':"";"BUTTON"===$this.prop("tagName")?($this.empty().append("").append('").append('').addClass("iconpicker"),data.setIconset(op.iconset),$this.on("click",function(e){e.preventDefault(),$this.popover({animation:!1,trigger:"manual",html:!0,content:op.table,container:"body",placement:op.placement}).on("shown.bs.popover",function(){data.switchPage(op.icon),data.bindEvents()}),$this.data("bs.popover").tip().addClass("iconpicker-popover"),$this.popover("show")})):(op.inline=!0,data.setIconset(op.iconset),$this.empty().append('").append(op.table).addClass("iconpicker").addClass(op.align),data.switchPage(op.icon),data.bindEvents())}})},$.fn.iconpicker.Constructor=Iconpicker,$.fn.iconpicker.noConflict=function(){return $.fn.iconpicker=old,this},$(document).on("click","body",function(e){$(".iconpicker").each(function(){$(this).is(e.target)||0!==$(this).has(e.target).length||0!==$(".popover").has(e.target).length||$(this).popover("destroy")})}),$('button[role="iconpicker"],div[role="iconpicker"]').iconpicker()}(jQuery); -------------------------------------------------------------------------------- /iconlink/media/js/bootstrap-iconpicker.js: -------------------------------------------------------------------------------- 1 | /*!======================================================================== 2 | * File: bootstrap-iconpicker.js v1.9.0 by @victor-valencia 3 | * https://victor-valencia.github.com/bootstrap-iconpicker 4 | * ======================================================================== 5 | * Copyright 2013-2017 Victor Valencia Rico. 6 | * Licensed under MIT license. 7 | * https://github.com/victor-valencia/bootstrap-iconpicker/blob/master/LICENSE 8 | * ======================================================================== 9 | */ 10 | 11 | ;(function($){ "use strict"; 12 | 13 | // ICONPICKER PUBLIC CLASS DEFINITION 14 | // ============================== 15 | var Iconpicker = function (element, options) { 16 | this.$element = $(element); 17 | this.options = $.extend({}, Iconpicker.DEFAULTS, this.$element.data()); 18 | this.options = $.extend({}, this.options, options); 19 | }; 20 | 21 | // ICONPICKER VERSION 22 | // ============================== 23 | Iconpicker.VERSION = '1.9.0'; 24 | 25 | // ICONPICKER ICONSET_EMPTY 26 | // ============================== 27 | Iconpicker.ICONSET_EMPTY = { 28 | iconClass: '', 29 | iconClassFix: '', 30 | icons: [] 31 | }; 32 | 33 | // ICONPICKER ICONSET 34 | // ============================== 35 | Iconpicker.ICONSET = { 36 | _custom: null, 37 | elusiveicon: $.iconset_elusiveicon || Iconpicker.ICONSET_EMPTY, 38 | flagicon: $.iconset_flagicon || Iconpicker.ICONSET_EMPTY, 39 | fontawesome: $.iconset_fontawesome || Iconpicker.ICONSET_EMPTY, 40 | glyphicon: $.iconset_glyphicon || Iconpicker.ICONSET_EMPTY, 41 | ionicon: $.iconset_ionicon || Iconpicker.ICONSET_EMPTY, 42 | mapicon: $.iconset_mapicon || Iconpicker.ICONSET_EMPTY, 43 | materialdesign: $.iconset_materialdesign || Iconpicker.ICONSET_EMPTY, 44 | octicon: $.iconset_octicon || Iconpicker.ICONSET_EMPTY, 45 | typicon: $.iconset_typicon || Iconpicker.ICONSET_EMPTY, 46 | weathericon: $.iconset_weathericon || Iconpicker.ICONSET_EMPTY 47 | }; 48 | 49 | // ICONPICKER DEFAULTS 50 | // ============================== 51 | Iconpicker.DEFAULTS = { 52 | align: 'center', 53 | arrowClass: 'btn-primary', 54 | arrowNextIconClass: 'glyphicon glyphicon-arrow-right', 55 | arrowPrevIconClass: 'glyphicon glyphicon-arrow-left', 56 | cols: 4, 57 | icon: '', 58 | iconset: 'glyphicon', 59 | iconsetVersion: 'lastest', 60 | header: true, 61 | labelHeader: '{0} / {1}', 62 | footer: true, 63 | labelFooter: '{0} - {1} of {2}', 64 | placement: 'bottom', 65 | rows: 4, 66 | search: true, 67 | searchText: 'Search icon', 68 | selectedClass: 'btn-warning', 69 | unselectedClass: 'btn-default' 70 | }; 71 | 72 | // ICONPICKER PRIVATE METHODS 73 | // ============================== 74 | Iconpicker.prototype.bindEvents = function () { 75 | var op = this.options; 76 | var el = this; 77 | op.table.find('.btn-previous, .btn-next').off('click').on('click', function(e) { 78 | e.preventDefault(); 79 | if(!$(this).hasClass('disabled')){ 80 | var inc = parseInt($(this).val(), 10); 81 | el.changeList(op.page + inc); 82 | } 83 | }); 84 | op.table.find('.btn-icon').off('click').on('click', function(e) { 85 | e.preventDefault(); 86 | el.select($(this).val()); 87 | if(op.inline === false){ 88 | el.$element.popover('destroy'); 89 | } 90 | else{ 91 | op.table.find('i.' + $(this).val()).parent().addClass(op.selectedClass); 92 | } 93 | }); 94 | op.table.find('.search-control').off('keyup').on('keyup', function() { 95 | el.changeList(1); 96 | }); 97 | }; 98 | 99 | Iconpicker.prototype.changeList = function (page) { 100 | this.filterIcons(); 101 | this.updateLabels(page); 102 | this.updateIcons(page); 103 | this.options.page = page; 104 | this.bindEvents(); 105 | }; 106 | 107 | Iconpicker.prototype.filterIcons = function () { 108 | var op = this.options; 109 | var search = op.table.find('.search-control').val(); 110 | var icons = []; 111 | if(op.iconsetVersion != 'lastest' && typeof Iconpicker.ICONSET[op.iconset].allVersions != 'undefined'){ 112 | $.each(Iconpicker.ICONSET[op.iconset].allVersions, function(i, v){ 113 | if(op.iconsetVersion == v.version){ 114 | icons = v.icons; 115 | } 116 | }); 117 | } 118 | else 119 | icons = Iconpicker.ICONSET[op.iconset].icons; 120 | 121 | if (search === "") { 122 | op.icons = icons; 123 | } 124 | else { 125 | var result = []; 126 | $.each(icons, function(i, v) { 127 | if (v.toLowerCase().indexOf(search) > -1) { 128 | result.push(v); 129 | } 130 | }); 131 | op.icons = result; 132 | } 133 | }; 134 | 135 | Iconpicker.prototype.removeAddClass = function (target, remove, add) { 136 | this.options.table.find(target).removeClass(remove).addClass(add); 137 | return add; 138 | }; 139 | 140 | Iconpicker.prototype.reset = function () { 141 | this.updatePicker(); 142 | this.changeList(1); 143 | }; 144 | 145 | Iconpicker.prototype.select = function (icon) { 146 | var op = this.options; 147 | var el = this.$element; 148 | op.selected = $.inArray(icon.replace(op.iconClassFix, ''), op.icons); 149 | if (op.selected === -1) { 150 | op.selected = 0; 151 | icon = op.iconClassFix + op.icons[op.selected]; 152 | } 153 | if (icon !== '' && op.selected >= 0) { 154 | op.icon = icon; 155 | if(op.inline === false){ 156 | el.find('input').val(icon); 157 | el.find('i').attr('class', '').addClass(op.iconClass).addClass(icon); 158 | } 159 | if(icon === op.iconClassFix){ 160 | el.trigger({ type: "change", icon: 'empty' }); 161 | } 162 | else { 163 | el.trigger({ type: "change", icon: icon }); 164 | el.find('input').val(icon); 165 | } 166 | op.table.find('button.' + op.selectedClass).removeClass(op.selectedClass); 167 | } 168 | }; 169 | 170 | Iconpicker.prototype.switchPage = function (icon) { 171 | var op = this.options; 172 | op.selected = $.inArray(icon.replace(op.iconClassFix, ''), op.icons); 173 | 174 | if(op.selected >= 0) { 175 | var page = Math.ceil((op.selected + 1) / this.totalIconsPerPage()); 176 | this.changeList(page); 177 | } 178 | if(icon === ''){ 179 | op.table.find('i.' + op.iconClassFix).parent().addClass(op.selectedClass); 180 | } 181 | else{ 182 | op.table.find('i.' + icon).parent().addClass(op.selectedClass); 183 | } 184 | }; 185 | 186 | Iconpicker.prototype.totalPages = function () { 187 | return Math.ceil(this.totalIcons() / this.totalIconsPerPage()); 188 | }; 189 | 190 | Iconpicker.prototype.totalIcons = function () { 191 | return this.options.icons.length; 192 | }; 193 | 194 | Iconpicker.prototype.totalIconsPerPage = function () { 195 | if(this.options.rows === 0){ 196 | return this.options.icons.length; 197 | } 198 | else{ 199 | return this.options.cols * this.options.rows; 200 | } 201 | }; 202 | 203 | Iconpicker.prototype.updateArrows = function (page) { 204 | var op = this.options; 205 | var total_pages = this.totalPages(); 206 | if (page === 1) { 207 | op.table.find('.btn-previous').addClass('disabled'); 208 | } 209 | else { 210 | op.table.find('.btn-previous').removeClass('disabled'); 211 | } 212 | if (page === total_pages || total_pages === 0) { 213 | op.table.find('.btn-next').addClass('disabled'); 214 | } 215 | else { 216 | op.table.find('.btn-next').removeClass('disabled'); 217 | } 218 | }; 219 | 220 | Iconpicker.prototype.updateIcons = function (page) { 221 | var op = this.options; 222 | var tbody = op.table.find('tbody').empty(); 223 | var offset = (page - 1) * this.totalIconsPerPage(); 224 | var length = op.rows; 225 | if(op.rows === 0){ 226 | length = op.icons.length; 227 | } 228 | for (var i = 0; i < length; i++) { 229 | var tr = $(''); 230 | for (var j = 0; j < op.cols; j++) { 231 | var pos = offset + (i * op.cols) + j; 232 | var btn = $('').hide(); 233 | if (pos < op.icons.length) { 234 | var v = op.iconClassFix + op.icons[pos]; 235 | btn.val(v).attr('title', v).append('').show(); 236 | if (op.icon === v) { 237 | btn.addClass(op.selectedClass).addClass('btn-icon-selected'); 238 | } 239 | } 240 | tr.append($('').append(btn)); 241 | } 242 | tbody.append(tr); 243 | } 244 | }; 245 | 246 | Iconpicker.prototype.updateIconsCount = function () { 247 | var op = this.options; 248 | if(op.footer === true){ 249 | var icons_count = [ 250 | '', 251 | ' ', 252 | ' ', 253 | ' ', 254 | '' 255 | ]; 256 | op.table.find('tfoot').empty().append(icons_count.join('')); 257 | } 258 | }; 259 | 260 | Iconpicker.prototype.updateLabels = function (page) { 261 | var op = this.options; 262 | var total_icons = this.totalIcons(); 263 | var total_pages = this.totalPages(); 264 | op.table.find('.page-count').html(op.labelHeader.replace('{0}', (total_pages === 0 ) ? 0 : page).replace('{1}', total_pages)); 265 | var offset = (page - 1) * this.totalIconsPerPage(); 266 | var total = page * this.totalIconsPerPage(); 267 | op.table.find('.icons-count').html(op.labelFooter.replace('{0}', total_icons ? offset + 1 : 0).replace('{1}', (total < total_icons) ? total: total_icons).replace('{2}', total_icons)); 268 | this.updateArrows(page); 269 | }; 270 | 271 | Iconpicker.prototype.updatePagesCount = function () { 272 | var op = this.options; 273 | if(op.header === true){ 274 | var tr = $(''); 275 | for (var i = 0; i < op.cols; i++) { 276 | var td = $(''); 277 | if (i === 0 || i === op.cols - 1) { 278 | var arrow = [ 279 | '' 282 | ]; 283 | td.append(arrow.join('')); 284 | tr.append(td); 285 | } 286 | else if (tr.find('.page-count').length === 0) { 287 | td.attr('colspan', op.cols - 2).append(''); 288 | tr.append(td); 289 | } 290 | } 291 | op.table.find('thead').empty().append(tr); 292 | } 293 | }; 294 | 295 | Iconpicker.prototype.updatePicker = function () { 296 | var op = this.options; 297 | if (op.cols < 4) { 298 | throw 'Iconpicker => The number of columns must be greater than or equal to 4. [option.cols = ' + op.cols + ']'; 299 | } 300 | else if (op.rows < 0) { 301 | throw 'Iconpicker => The number of rows must be greater than or equal to 0. [option.rows = ' + op.rows + ']'; 302 | } 303 | else { 304 | this.updatePagesCount(); 305 | this.updateSearch(); 306 | this.updateIconsCount(); 307 | } 308 | }; 309 | 310 | Iconpicker.prototype.updateSearch = function () { 311 | var op = this.options; 312 | var search = [ 313 | '', 314 | ' ', 315 | ' ', 316 | ' ', 317 | '' 318 | ]; 319 | search = $(search.join('')); 320 | if (op.search === true) { 321 | search.show(); 322 | } 323 | else { 324 | search.hide(); 325 | } 326 | op.table.find('thead').append(search); 327 | }; 328 | 329 | // ICONPICKER PUBLIC METHODS 330 | // ============================== 331 | Iconpicker.prototype.setAlign = function (value) { 332 | this.$element.removeClass(this.options.align).addClass(value); 333 | this.options.align = value; 334 | }; 335 | 336 | Iconpicker.prototype.setArrowClass = function (value) { 337 | this.options.arrowClass = this.removeAddClass('.btn-arrow', this.options.arrowClass, value); 338 | }; 339 | 340 | Iconpicker.prototype.setArrowNextIconClass = function (value) { 341 | this.options.arrowNextIconClass = this.removeAddClass('.btn-next > span', this.options.arrowNextIconClass, value); 342 | }; 343 | 344 | Iconpicker.prototype.setArrowPrevIconClass = function (value) { 345 | this.options.arrowPrevIconClass = this.removeAddClass('.btn-previous > span', this.options.arrowPrevIconClass, value); 346 | }; 347 | 348 | Iconpicker.prototype.setCols = function (value) { 349 | this.options.cols = value; 350 | this.reset(); 351 | }; 352 | 353 | Iconpicker.prototype.setFooter = function (value) { 354 | var footer = this.options.table.find('tfoot'); 355 | if (value === true) { 356 | footer.show(); 357 | } 358 | else { 359 | footer.hide(); 360 | } 361 | this.options.footer = value; 362 | }; 363 | 364 | Iconpicker.prototype.setHeader = function (value) { 365 | var header = this.options.table.find('thead'); 366 | if (value === true) { 367 | header.show(); 368 | } 369 | else { 370 | header.hide(); 371 | } 372 | this.options.header = value; 373 | }; 374 | 375 | Iconpicker.prototype.setIcon = function (value) { 376 | this.select(value); 377 | }; 378 | 379 | Iconpicker.prototype.setIconset = function (value) { 380 | var op = this.options; 381 | if ($.isPlainObject(value)) { 382 | Iconpicker.ICONSET._custom = $.extend(Iconpicker.ICONSET_EMPTY, value); 383 | op.iconset = '_custom'; 384 | } 385 | else if (!Iconpicker.ICONSET.hasOwnProperty(value)) { 386 | op.iconset = Iconpicker.DEFAULTS.iconset; 387 | } 388 | else { 389 | op.iconset = value; 390 | } 391 | op = $.extend(op, Iconpicker.ICONSET[op.iconset]); 392 | this.reset(); 393 | this.select(op.icon); 394 | }; 395 | 396 | Iconpicker.prototype.setLabelHeader = function (value) { 397 | this.options.labelHeader = value; 398 | this.updateLabels(this.options.page); 399 | }; 400 | 401 | Iconpicker.prototype.setLabelFooter = function (value) { 402 | this.options.labelFooter = value; 403 | this.updateLabels(this.options.page); 404 | }; 405 | 406 | Iconpicker.prototype.setPlacement = function (value) { 407 | this.options.placement = value; 408 | }; 409 | 410 | Iconpicker.prototype.setRows = function (value) { 411 | this.options.rows = value; 412 | this.reset(); 413 | }; 414 | 415 | Iconpicker.prototype.setSearch = function (value) { 416 | var search = this.options.table.find('.search-control'); 417 | if (value === true) { 418 | search.show(); 419 | } 420 | else { 421 | search.hide(); 422 | } 423 | search.val(''); 424 | this.changeList(1); 425 | this.options.search = value; 426 | }; 427 | 428 | Iconpicker.prototype.setSearchText = function (value) { 429 | this.options.table.find('.search-control').attr('placeholder', value); 430 | this.options.searchText = value; 431 | }; 432 | 433 | Iconpicker.prototype.setSelectedClass = function (value) { 434 | this.options.selectedClass = this.removeAddClass('.btn-icon-selected', this.options.selectedClass, value); 435 | }; 436 | 437 | Iconpicker.prototype.setUnselectedClass = function (value) { 438 | this.options.unselectedClass = this.removeAddClass('.btn-icon', this.options.unselectedClass, value); 439 | }; 440 | 441 | // ICONPICKER PLUGIN DEFINITION 442 | // ======================== 443 | var old = $.fn.iconpicker; 444 | $.fn.iconpicker = function (option, params) { 445 | return this.each(function () { 446 | var $this = $(this); 447 | var data = $this.data('bs.iconpicker'); 448 | var options = typeof option === 'object' && option; 449 | if (!data) { 450 | $this.data('bs.iconpicker', (data = new Iconpicker(this, options))); 451 | } 452 | if (typeof option === 'string') { 453 | if (typeof data[option] === 'undefined') { 454 | throw 'Iconpicker => The "' + option + '" method does not exists.'; 455 | } 456 | else { 457 | data[option](params); 458 | } 459 | } 460 | else{ 461 | var op = data.options; 462 | op = $.extend(op, { 463 | inline: false, 464 | page: 1, 465 | selected: -1, 466 | table: $('
') 467 | }); 468 | var name = (typeof $this.attr('name') !== 'undefined') ? 'name="' + $this.attr('name') + '"' : ''; 469 | 470 | if($this.prop('tagName') === 'BUTTON'){ 471 | $this.empty() 472 | .append('') 473 | .append('') 474 | .append('') 475 | .addClass('iconpicker'); 476 | data.setIconset(op.iconset); 477 | $this.on('click', function(e) { 478 | e.preventDefault(); 479 | $this.popover({ 480 | animation: false, 481 | trigger: 'manual', 482 | html: true, 483 | content: op.table, 484 | container: 'body', 485 | placement: op.placement 486 | }).on('shown.bs.popover', function () { 487 | data.switchPage(op.icon); 488 | data.bindEvents(); 489 | }); 490 | $this.data('bs.popover').tip().addClass('iconpicker-popover'); 491 | $this.popover('show'); 492 | }); 493 | } 494 | else{ 495 | op.inline = true; 496 | data.setIconset(op.iconset); 497 | $this.empty() 498 | .append('') 499 | .append(op.table) 500 | .addClass('iconpicker') 501 | .addClass(op.align); 502 | data.switchPage(op.icon); 503 | data.bindEvents(); 504 | } 505 | 506 | } 507 | }); 508 | }; 509 | 510 | $.fn.iconpicker.Constructor = Iconpicker; 511 | 512 | // ICONPICKER NO CONFLICT 513 | // ================== 514 | $.fn.iconpicker.noConflict = function () { 515 | $.fn.iconpicker = old; 516 | return this; 517 | }; 518 | 519 | // ICONPICKER DATA-API 520 | // =============== 521 | $(document).on('click', 'body', function (e) { 522 | $('.iconpicker').each(function () { 523 | //the 'is' for buttons that trigger popups 524 | //the 'has' for icons within a button that triggers a popup 525 | if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { 526 | $(this).popover('destroy'); 527 | } 528 | }); 529 | }); 530 | 531 | $('button[role="iconpicker"],div[role="iconpicker"]').iconpicker(); 532 | 533 | })(jQuery); 534 | -------------------------------------------------------------------------------- /iconlink/media/js/fontawesome-iconpicker.min.js: -------------------------------------------------------------------------------- 1 | !function(a,b){function c(a,b,c){return[parseFloat(a[0])*(n.test(a[0])?b/100:1),parseFloat(a[1])*(n.test(a[1])?c/100:1)]}function d(b,c){return parseInt(a.css(b,c),10)||0}function e(b){var c=b[0];return 9===c.nodeType?{width:b.width(),height:b.height(),offset:{top:0,left:0}}:a.isWindow(c)?{width:b.width(),height:b.height(),offset:{top:b.scrollTop(),left:b.scrollLeft()}}:c.preventDefault?{width:0,height:0,offset:{top:c.pageY,left:c.pageX}}:{width:b.outerWidth(),height:b.outerHeight(),offset:b.offset()}}a.ui=a.ui||{};var f,g=Math.max,h=Math.abs,i=Math.round,j=/left|center|right/,k=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,m=/^\w+/,n=/%$/,o=a.fn.pos;a.pos={scrollbarWidth:function(){if(f!==b)return f;var c,d,e=a("
"),g=e.children()[0];return a("body").append(e),c=g.offsetWidth,e.css("overflow","scroll"),d=g.offsetWidth,c===d&&(d=e[0].clientWidth),e.remove(),f=c-d},getScrollInfo:function(b){var c=b.isWindow||b.isDocument?"":b.element.css("overflow-x"),d=b.isWindow||b.isDocument?"":b.element.css("overflow-y"),e="scroll"===c||"auto"===c&&b.width0?"right":"center",vertical:f<0?"top":e>0?"bottom":"middle"};ng(h(e),h(f))?i.important="horizontal":i.important="vertical",b.using.call(this,a,i)}),k.offset(a.extend(A,{using:j}))})},a.ui.pos={_trigger:function(a,b,c,d){b.elem&&b.elem.trigger({type:c,position:a,positionData:b,triggered:d})},fit:{left:function(b,c){a.ui.pos._trigger(b,c,"posCollide","fitLeft");var d,e=c.within,f=e.isWindow?e.scrollLeft:e.offset.left,h=e.width,i=b.left-c.collisionPosition.marginLeft,j=f-i,k=i+c.collisionWidth-h-f;c.collisionWidth>h?j>0&&k<=0?(d=b.left+j+c.collisionWidth-h-f,b.left+=j-d):k>0&&j<=0?b.left=f:j>k?b.left=f+h-c.collisionWidth:b.left=f:j>0?b.left+=j:k>0?b.left-=k:b.left=g(b.left-i,b.left),a.ui.pos._trigger(b,c,"posCollided","fitLeft")},top:function(b,c){a.ui.pos._trigger(b,c,"posCollide","fitTop");var d,e=c.within,f=e.isWindow?e.scrollTop:e.offset.top,h=c.within.height,i=b.top-c.collisionPosition.marginTop,j=f-i,k=i+c.collisionHeight-h-f;c.collisionHeight>h?j>0&&k<=0?(d=b.top+j+c.collisionHeight-h-f,b.top+=j-d):k>0&&j<=0?b.top=f:j>k?b.top=f+h-c.collisionHeight:b.top=f:j>0?b.top+=j:k>0?b.top-=k:b.top=g(b.top-i,b.top),a.ui.pos._trigger(b,c,"posCollided","fitTop")}},flip:{left:function(b,c){a.ui.pos._trigger(b,c,"posCollide","flipLeft");var d,e,f=c.within,g=f.offset.left+f.scrollLeft,i=f.width,j=f.isWindow?f.scrollLeft:f.offset.left,k=b.left-c.collisionPosition.marginLeft,l=k-j,m=k+c.collisionWidth-i-j,n="left"===c.my[0]?-c.elemWidth:"right"===c.my[0]?c.elemWidth:0,o="left"===c.at[0]?c.targetWidth:"right"===c.at[0]?-c.targetWidth:0,p=-2*c.offset[0];l<0?(d=b.left+n+o+p+c.collisionWidth-i-g,(d<0||d0&&(e=b.left-c.collisionPosition.marginLeft+n+o+p-j,(e>0||h(e)l&&(e<0||e0&&(d=b.top-c.collisionPosition.marginTop+o+p+q-j,b.top+o+p+q>m&&(d>0||h(d)10&&e<11,b.innerHTML="",c.removeChild(b)}()}(jQuery),function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):window.jQuery&&!window.jQuery.fn.iconpicker&&a(window.jQuery)}(function(a){"use strict";var b={isEmpty:function(a){return a===!1||""===a||null===a||void 0===a},isEmptyObject:function(a){return this.isEmpty(a)===!0||0===a.length},isElement:function(b){return a(b).length>0},isString:function(a){return"string"==typeof a||a instanceof String},isArray:function(b){return a.isArray(b)},inArray:function(b,c){return a.inArray(b,c)!==-1},throwError:function(a){throw"Font Awesome Icon Picker Exception: "+a}},c=function(d,e){this._id=c._idCounter++,this.element=a(d).addClass("iconpicker-element"),this._trigger("iconpickerCreate"),this.options=a.extend({},c.defaultOptions,this.element.data(),e),this.options.templates=a.extend({},c.defaultOptions.templates,this.options.templates),this.options.originalPlacement=this.options.placement,this.container=!!b.isElement(this.options.container)&&a(this.options.container),this.container===!1&&(this.element.is(".dropdown-toggle")?this.container=a("~ .dropdown-menu:first",this.element):this.container=this.element.is("input,textarea,button,.btn")?this.element.parent():this.element),this.container.addClass("iconpicker-container"),this.isDropdownMenu()&&(this.options.templates.search=!1,this.options.templates.buttons=!1,this.options.placement="inline"),this.input=!!this.element.is("input,textarea")&&this.element.addClass("iconpicker-input"),this.input===!1&&(this.input=this.container.find(this.options.input),this.input.is("input,textarea")||(this.input=!1)),this.component=this.isDropdownMenu()?this.container.parent().find(this.options.component):this.container.find(this.options.component),0===this.component.length?this.component=!1:this.component.find("i").addClass("iconpicker-component"),this._createPopover(),this._createIconpicker(),0===this.getAcceptButton().length&&(this.options.mustAccept=!1),this.isInputGroup()?this.container.parent().append(this.popover):this.container.append(this.popover),this._bindElementEvents(),this._bindWindowEvents(),this.update(this.options.selected),this.isInline()&&this.show(),this._trigger("iconpickerCreated")};c._idCounter=0,c.defaultOptions={title:!1,selected:!1,defaultValue:!1,placement:"bottom",collision:"none",animation:!0,hideOnSelect:!1,showFooter:!1,searchInFooter:!1,mustAccept:!1,selectedCustomClass:"bg-primary",icons:[],fullClassFormatter:function(a){return"fa "+a},input:"input,.iconpicker-input",inputSearch:!1,container:!1,component:".input-group-addon,.iconpicker-component",templates:{popover:'
',footer:'',buttons:' ',search:'',iconpicker:'
',iconpickerItem:''}},c.batch=function(b,c){var d=Array.prototype.slice.call(arguments,2);return a(b).each(function(){var b=a(this).data("iconpicker");b&&b[c].apply(b,d)})},c.prototype={constructor:c,options:{},_id:0,_trigger:function(b,c){c=c||{},this.element.trigger(a.extend({type:b,iconpickerInstance:this},c))},_createPopover:function(){this.popover=a(this.options.templates.popover);var c=this.popover.find(".popover-title");if(this.options.title&&c.append(a('
'+this.options.title+"
")),this.hasSeparatedSearchInput()&&!this.options.searchInFooter?c.append(this.options.templates.search):this.options.title||c.remove(),this.options.showFooter&&!b.isEmpty(this.options.templates.footer)){var d=a(this.options.templates.footer);this.hasSeparatedSearchInput()&&this.options.searchInFooter&&d.append(a(this.options.templates.search)),b.isEmpty(this.options.templates.buttons)||d.append(a(this.options.templates.buttons)),this.popover.append(d)}return this.options.animation===!0&&this.popover.addClass("fade"),this.popover},_createIconpicker:function(){var b=this;this.iconpicker=a(this.options.templates.iconpicker);var c=function(c){var d=a(this);return d.is("i")&&(d=d.parent()),b._trigger("iconpickerSelect",{iconpickerItem:d,iconpickerValue:b.iconpickerValue}),b.options.mustAccept===!1?(b.update(d.data("iconpickerValue")),b._trigger("iconpickerSelected",{iconpickerItem:this,iconpickerValue:b.iconpickerValue})):b.update(d.data("iconpickerValue"),!0),b.options.hideOnSelect&&b.options.mustAccept===!1&&b.hide(),c.preventDefault(),!1};for(var d in this.options.icons)if("string"==typeof this.options.icons[d]){var e=a(this.options.templates.iconpickerItem);e.find("i").addClass(this.options.fullClassFormatter(this.options.icons[d])),e.data("iconpickerValue",this.options.icons[d]).on("click.iconpicker",c),this.iconpicker.find(".iconpicker-items").append(e.attr("title","."+this.options.icons[d]))}return this.popover.find(".popover-content").append(this.iconpicker),this.iconpicker},_isEventInsideIconpicker:function(b){var c=a(b.target);return!((!c.hasClass("iconpicker-element")||c.hasClass("iconpicker-element")&&!c.is(this.element))&&0===c.parents(".iconpicker-popover").length)},_bindElementEvents:function(){var c=this;this.getSearchInput().on("keyup.iconpicker",function(){c.filter(a(this).val().toLowerCase())}),this.getAcceptButton().on("click.iconpicker",function(){var a=c.iconpicker.find(".iconpicker-selected").get(0);c.update(c.iconpickerValue),c._trigger("iconpickerSelected",{iconpickerItem:a,iconpickerValue:c.iconpickerValue}),c.isInline()||c.hide()}),this.getCancelButton().on("click.iconpicker",function(){c.isInline()||c.hide()}),this.element.on("focus.iconpicker",function(a){c.show(),a.stopPropagation()}),this.hasComponent()&&this.component.on("click.iconpicker",function(){c.toggle()}),this.hasInput()&&this.input.on("keyup.iconpicker",function(d){b.inArray(d.keyCode,[38,40,37,39,16,17,18,9,8,91,93,20,46,186,190,46,78,188,44,86])?c._updateFormGroupStatus(c.getValid(this.value)!==!1):c.update(),c.options.inputSearch===!0&&c.filter(a(this).val().toLowerCase())})},_bindWindowEvents:function(){var b=a(window.document),c=this,d=".iconpicker.inst"+this._id;return a(window).on("resize.iconpicker"+d+" orientationchange.iconpicker"+d,function(a){c.popover.hasClass("in")&&c.updatePlacement()}),c.isInline()||b.on("mouseup"+d,function(a){return c._isEventInsideIconpicker(a)||c.isInline()||c.hide(),a.stopPropagation(),a.preventDefault(),!1}),!1},_unbindElementEvents:function(){this.popover.off(".iconpicker"),this.element.off(".iconpicker"),this.hasInput()&&this.input.off(".iconpicker"),this.hasComponent()&&this.component.off(".iconpicker"),this.hasContainer()&&this.container.off(".iconpicker")},_unbindWindowEvents:function(){a(window).off(".iconpicker.inst"+this._id),a(window.document).off(".iconpicker.inst"+this._id)},updatePlacement:function(b,c){b=b||this.options.placement,this.options.placement=b,c=c||this.options.collision,c=c===!0?"flip":c;var d={at:"right bottom",my:"right top",of:this.hasInput()&&!this.isInputGroup()?this.input:this.container,collision:c===!0?"flip":c,within:window};if(this.popover.removeClass("inline topLeftCorner topLeft top topRight topRightCorner rightTop right rightBottom bottomRight bottomRightCorner bottom bottomLeft bottomLeftCorner leftBottom left leftTop"),"object"==typeof b)return this.popover.pos(a.extend({},d,b));switch(b){case"inline":d=!1;break;case"topLeftCorner":d.my="right bottom",d.at="left top";break;case"topLeft":d.my="left bottom",d.at="left top";break;case"top":d.my="center bottom",d.at="center top";break;case"topRight":d.my="right bottom",d.at="right top";break;case"topRightCorner":d.my="left bottom",d.at="right top";break;case"rightTop":d.my="left bottom",d.at="right center";break;case"right":d.my="left center",d.at="right center";break;case"rightBottom":d.my="left top",d.at="right center";break;case"bottomRightCorner":d.my="left top",d.at="right bottom";break;case"bottomRight":d.my="right top",d.at="right bottom";break;case"bottom":d.my="center top",d.at="center bottom";break;case"bottomLeft":d.my="left top",d.at="left bottom";break;case"bottomLeftCorner":d.my="right top",d.at="left bottom";break;case"leftBottom":d.my="right top",d.at="left center";break;case"left":d.my="right center",d.at="left center";break;case"leftTop":d.my="right bottom",d.at="left center";break;default:return!1}return this.popover.css({display:"inline"===this.options.placement?"":"block"}),d!==!1?this.popover.pos(d).css("maxWidth",a(window).width()-this.container.offset().left-5):this.popover.css({top:"auto",right:"auto",bottom:"auto",left:"auto",maxWidth:"none"}),this.popover.addClass(this.options.placement),!0},_updateComponents:function(){if(this.iconpicker.find(".iconpicker-item.iconpicker-selected").removeClass("iconpicker-selected "+this.options.selectedCustomClass),this.iconpickerValue&&this.iconpicker.find("."+this.options.fullClassFormatter(this.iconpickerValue).replace(/ /g,".")).parent().addClass("iconpicker-selected "+this.options.selectedCustomClass),this.hasComponent()){var a=this.component.find("i");a.length>0?a.attr("class",this.options.fullClassFormatter(this.iconpickerValue)):this.component.html(this.getHtml())}},_updateFormGroupStatus:function(a){return!!this.hasInput()&&(a!==!1?this.input.parents(".form-group:first").removeClass("has-error"):this.input.parents(".form-group:first").addClass("has-error"),!0)},getValid:function(c){b.isString(c)||(c="");var d=""===c;return c=a.trim(c),!(!b.inArray(c,this.options.icons)&&!d)&&c},setValue:function(a){var b=this.getValid(a);return b!==!1?(this.iconpickerValue=b,this._trigger("iconpickerSetValue",{iconpickerValue:b}),this.iconpickerValue):(this._trigger("iconpickerInvalid",{iconpickerValue:a}),!1)},getHtml:function(){return''},setSourceValue:function(a){return a=this.setValue(a),a!==!1&&""!==a&&(this.hasInput()?this.input.val(this.iconpickerValue):this.element.data("iconpickerValue",this.iconpickerValue),this._trigger("iconpickerSetSourceValue",{iconpickerValue:a})),a},getSourceValue:function(a){a=a||this.options.defaultValue;var b=a;return b=this.hasInput()?this.input.val():this.element.data("iconpickerValue"),void 0!==b&&""!==b&&null!==b&&b!==!1||(b=a),b},hasInput:function(){return this.input!==!1},isInputSearch:function(){return this.hasInput()&&this.options.inputSearch===!0},isInputGroup:function(){return this.container.is(".input-group")},isDropdownMenu:function(){return this.container.is(".dropdown-menu")},hasSeparatedSearchInput:function(){return this.options.templates.search!==!1&&!this.isInputSearch()},hasComponent:function(){return this.component!==!1},hasContainer:function(){return this.container!==!1},getAcceptButton:function(){return this.popover.find(".iconpicker-btn-accept")},getCancelButton:function(){return this.popover.find(".iconpicker-btn-cancel")},getSearchInput:function(){return this.popover.find(".iconpicker-search")},filter:function(c){if(b.isEmpty(c))return this.iconpicker.find(".iconpicker-item").show(),a(!1);var d=[];return this.iconpicker.find(".iconpicker-item").each(function(){var b=a(this),e=b.attr("title").toLowerCase(),f=!1;try{f=new RegExp(c,"g")}catch(a){f=!1}f!==!1&&e.match(f)?(d.push(b),b.show()):b.hide()}),d},show:function(){return!this.popover.hasClass("in")&&(a.iconpicker.batch(a(".iconpicker-popover.in:not(.inline)").not(this.popover),"hide"),this._trigger("iconpickerShow"),this.updatePlacement(),this.popover.addClass("in"),void setTimeout(a.proxy(function(){this.popover.css("display",this.isInline()?"":"block"),this._trigger("iconpickerShown")},this),this.options.animation?300:1))},hide:function(){return!!this.popover.hasClass("in")&&(this._trigger("iconpickerHide"),this.popover.removeClass("in"),void setTimeout(a.proxy(function(){this.popover.css("display","none"),this.getSearchInput().val(""),this.filter(""),this._trigger("iconpickerHidden")},this),this.options.animation?300:1))},toggle:function(){this.popover.is(":visible")?this.hide():this.show(!0)},update:function(a,b){return a=a?a:this.getSourceValue(this.iconpickerValue),this._trigger("iconpickerUpdate"),b===!0?a=this.setValue(a):(a=this.setSourceValue(a),this._updateFormGroupStatus(a!==!1)),a!==!1&&this._updateComponents(),this._trigger("iconpickerUpdated"),a},destroy:function(){this._trigger("iconpickerDestroy"),this.element.removeData("iconpicker").removeData("iconpickerValue").removeClass("iconpicker-element"),this._unbindElementEvents(),this._unbindWindowEvents(),a(this.popover).remove(),this._trigger("iconpickerDestroyed")},disable:function(){return!!this.hasInput()&&(this.input.prop("disabled",!0),!0)},enable:function(){return!!this.hasInput()&&(this.input.prop("disabled",!1),!0)},isDisabled:function(){return!!this.hasInput()&&this.input.prop("disabled")===!0},isInline:function(){return"inline"===this.options.placement||this.popover.hasClass("inline")}},a.iconpicker=c,a.fn.iconpicker=function(b){return this.each(function(){var d=a(this);d.data("iconpicker")||d.data("iconpicker",new c(this,"object"==typeof b?b:{}))})},c.defaultOptions.icons=["fa-500px","fa-address-book","fa-address-book-o","fa-address-card","fa-address-card-o","fa-adjust","fa-adn","fa-align-center","fa-align-justify","fa-align-left","fa-align-right","fa-amazon","fa-ambulance","fa-american-sign-language-interpreting","fa-anchor","fa-android","fa-angellist","fa-angle-double-down","fa-angle-double-left","fa-angle-double-right","fa-angle-double-up","fa-angle-down","fa-angle-left","fa-angle-right","fa-angle-up","fa-apple","fa-archive","fa-area-chart","fa-arrow-circle-down","fa-arrow-circle-left","fa-arrow-circle-o-down","fa-arrow-circle-o-left","fa-arrow-circle-o-right","fa-arrow-circle-o-up","fa-arrow-circle-right","fa-arrow-circle-up","fa-arrow-down","fa-arrow-left","fa-arrow-right","fa-arrow-up","fa-arrows","fa-arrows-alt","fa-arrows-h","fa-arrows-v","fa-asl-interpreting","fa-assistive-listening-systems","fa-asterisk","fa-at","fa-audio-description","fa-automobile","fa-backward","fa-balance-scale","fa-ban","fa-bandcamp","fa-bank","fa-bar-chart","fa-bar-chart-o","fa-barcode","fa-bars","fa-bath","fa-bathtub","fa-battery","fa-battery-0","fa-battery-1","fa-battery-2","fa-battery-3","fa-battery-4","fa-battery-empty","fa-battery-full","fa-battery-half","fa-battery-quarter","fa-battery-three-quarters","fa-bed","fa-beer","fa-behance","fa-behance-square","fa-bell","fa-bell-o","fa-bell-slash","fa-bell-slash-o","fa-bicycle","fa-binoculars","fa-birthday-cake","fa-bitbucket","fa-bitbucket-square","fa-bitcoin","fa-black-tie","fa-blind","fa-bluetooth","fa-bluetooth-b","fa-bold","fa-bolt","fa-bomb","fa-book","fa-bookmark","fa-bookmark-o","fa-braille","fa-briefcase","fa-btc","fa-bug","fa-building","fa-building-o","fa-bullhorn","fa-bullseye","fa-bus","fa-buysellads","fa-cab","fa-calculator","fa-calendar","fa-calendar-check-o","fa-calendar-minus-o","fa-calendar-o","fa-calendar-plus-o","fa-calendar-times-o","fa-camera","fa-camera-retro","fa-car","fa-caret-down","fa-caret-left","fa-caret-right","fa-caret-square-o-down","fa-caret-square-o-left","fa-caret-square-o-right","fa-caret-square-o-up","fa-caret-up","fa-cart-arrow-down","fa-cart-plus","fa-cc","fa-cc-amex","fa-cc-diners-club","fa-cc-discover","fa-cc-jcb","fa-cc-mastercard","fa-cc-paypal","fa-cc-stripe","fa-cc-visa","fa-certificate","fa-chain","fa-chain-broken","fa-check","fa-check-circle","fa-check-circle-o","fa-check-square","fa-check-square-o","fa-chevron-circle-down","fa-chevron-circle-left","fa-chevron-circle-right","fa-chevron-circle-up","fa-chevron-down","fa-chevron-left","fa-chevron-right","fa-chevron-up","fa-child","fa-chrome","fa-circle","fa-circle-o","fa-circle-o-notch","fa-circle-thin","fa-clipboard","fa-clock-o","fa-clone","fa-close","fa-cloud","fa-cloud-download","fa-cloud-upload","fa-cny","fa-code","fa-code-fork","fa-codepen","fa-codiepie","fa-coffee","fa-cog","fa-cogs","fa-columns","fa-comment","fa-comment-o","fa-commenting","fa-commenting-o","fa-comments","fa-comments-o","fa-compass","fa-compress","fa-connectdevelop","fa-contao","fa-copy","fa-copyright","fa-creative-commons","fa-credit-card","fa-credit-card-alt","fa-crop","fa-crosshairs","fa-css3","fa-cube","fa-cubes","fa-cut","fa-cutlery","fa-dashboard","fa-dashcube","fa-database","fa-deaf","fa-deafness","fa-dedent","fa-delicious","fa-desktop","fa-deviantart","fa-diamond","fa-digg","fa-dollar","fa-dot-circle-o","fa-download","fa-dribbble","fa-drivers-license","fa-drivers-license-o","fa-dropbox","fa-drupal","fa-edge","fa-edit","fa-eercast","fa-eject","fa-ellipsis-h","fa-ellipsis-v","fa-empire","fa-envelope","fa-envelope-o","fa-envelope-open","fa-envelope-open-o","fa-envelope-square","fa-envira","fa-eraser","fa-etsy","fa-eur","fa-euro","fa-exchange","fa-exclamation","fa-exclamation-circle","fa-exclamation-triangle","fa-expand","fa-expeditedssl","fa-external-link","fa-external-link-square","fa-eye","fa-eye-slash","fa-eyedropper","fa-fa","fa-facebook","fa-facebook-f","fa-facebook-official","fa-facebook-square","fa-fast-backward","fa-fast-forward","fa-fax","fa-feed","fa-female","fa-fighter-jet","fa-file","fa-file-archive-o","fa-file-audio-o","fa-file-code-o","fa-file-excel-o","fa-file-image-o","fa-file-movie-o","fa-file-o","fa-file-pdf-o","fa-file-photo-o","fa-file-picture-o","fa-file-powerpoint-o","fa-file-sound-o","fa-file-text","fa-file-text-o","fa-file-video-o","fa-file-word-o","fa-file-zip-o","fa-files-o","fa-film","fa-filter","fa-fire","fa-fire-extinguisher","fa-firefox","fa-first-order","fa-flag","fa-flag-checkered","fa-flag-o","fa-flash","fa-flask","fa-flickr","fa-floppy-o","fa-folder","fa-folder-o","fa-folder-open","fa-folder-open-o","fa-font","fa-font-awesome","fa-fonticons","fa-fort-awesome","fa-forumbee","fa-forward","fa-foursquare","fa-free-code-camp","fa-frown-o","fa-futbol-o","fa-gamepad","fa-gavel","fa-gbp","fa-ge","fa-gear","fa-gears","fa-genderless","fa-get-pocket","fa-gg","fa-gg-circle","fa-gift","fa-git","fa-git-square","fa-github","fa-github-alt","fa-github-square","fa-gitlab","fa-gittip","fa-glass","fa-glide","fa-glide-g","fa-globe","fa-google","fa-google-plus","fa-google-plus-circle","fa-google-plus-official","fa-google-plus-square","fa-google-wallet","fa-graduation-cap","fa-gratipay","fa-grav","fa-group","fa-h-square","fa-hacker-news","fa-hand-grab-o","fa-hand-lizard-o","fa-hand-o-down","fa-hand-o-left","fa-hand-o-right","fa-hand-o-up","fa-hand-paper-o","fa-hand-peace-o","fa-hand-pointer-o","fa-hand-rock-o","fa-hand-scissors-o","fa-hand-spock-o","fa-hand-stop-o","fa-handshake-o","fa-hard-of-hearing","fa-hashtag","fa-hdd-o","fa-header","fa-headphones","fa-heart","fa-heart-o","fa-heartbeat","fa-history","fa-home","fa-hospital-o","fa-hotel","fa-hourglass","fa-hourglass-1","fa-hourglass-2","fa-hourglass-3","fa-hourglass-end","fa-hourglass-half","fa-hourglass-o","fa-hourglass-start","fa-houzz","fa-html5","fa-i-cursor","fa-id-badge","fa-id-card","fa-id-card-o","fa-ils","fa-image","fa-imdb","fa-inbox","fa-indent","fa-industry","fa-info","fa-info-circle","fa-inr","fa-instagram","fa-institution","fa-internet-explorer","fa-intersex","fa-ioxhost","fa-italic","fa-joomla","fa-jpy","fa-jsfiddle","fa-key","fa-keyboard-o","fa-krw","fa-language","fa-laptop","fa-lastfm","fa-lastfm-square","fa-leaf","fa-leanpub","fa-legal","fa-lemon-o","fa-level-down","fa-level-up","fa-life-bouy","fa-life-buoy","fa-life-ring","fa-life-saver","fa-lightbulb-o","fa-line-chart","fa-link","fa-linkedin","fa-linkedin-square","fa-linode","fa-linux","fa-list","fa-list-alt","fa-list-ol","fa-list-ul","fa-location-arrow","fa-lock","fa-long-arrow-down","fa-long-arrow-left","fa-long-arrow-right","fa-long-arrow-up","fa-low-vision","fa-magic","fa-magnet","fa-mail-forward","fa-mail-reply","fa-mail-reply-all","fa-male","fa-map","fa-map-marker","fa-map-o","fa-map-pin","fa-map-signs","fa-mars","fa-mars-double","fa-mars-stroke","fa-mars-stroke-h","fa-mars-stroke-v","fa-maxcdn","fa-meanpath","fa-medium","fa-medkit","fa-meetup","fa-meh-o","fa-mercury","fa-microchip","fa-microphone","fa-microphone-slash","fa-minus","fa-minus-circle","fa-minus-square","fa-minus-square-o","fa-mixcloud","fa-mobile","fa-mobile-phone","fa-modx","fa-money","fa-moon-o","fa-mortar-board","fa-motorcycle","fa-mouse-pointer","fa-music","fa-navicon","fa-neuter","fa-newspaper-o","fa-object-group","fa-object-ungroup","fa-odnoklassniki","fa-odnoklassniki-square","fa-opencart","fa-openid","fa-opera","fa-optin-monster","fa-outdent","fa-pagelines","fa-paint-brush","fa-paper-plane","fa-paper-plane-o","fa-paperclip","fa-paragraph","fa-paste","fa-pause","fa-pause-circle","fa-pause-circle-o","fa-paw","fa-paypal","fa-pencil","fa-pencil-square","fa-pencil-square-o","fa-percent","fa-phone","fa-phone-square","fa-photo","fa-picture-o","fa-pie-chart","fa-pied-piper","fa-pied-piper-alt","fa-pied-piper-pp","fa-pinterest","fa-pinterest-p","fa-pinterest-square","fa-plane","fa-play","fa-play-circle","fa-play-circle-o","fa-plug","fa-plus","fa-plus-circle","fa-plus-square","fa-plus-square-o","fa-podcast","fa-power-off","fa-print","fa-product-hunt","fa-puzzle-piece","fa-qq","fa-qrcode","fa-question","fa-question-circle","fa-question-circle-o","fa-quora","fa-quote-left","fa-quote-right","fa-ra","fa-random","fa-ravelry","fa-rebel","fa-recycle","fa-reddit","fa-reddit-alien","fa-reddit-square","fa-refresh","fa-registered","fa-remove","fa-renren","fa-reorder","fa-repeat","fa-reply","fa-reply-all","fa-resistance","fa-retweet","fa-rmb","fa-road","fa-rocket","fa-rotate-left","fa-rotate-right","fa-rouble","fa-rss","fa-rss-square","fa-rub","fa-ruble","fa-rupee","fa-s15","fa-safari","fa-save","fa-scissors","fa-scribd","fa-search","fa-search-minus","fa-search-plus","fa-sellsy","fa-send","fa-send-o","fa-server","fa-share","fa-share-alt","fa-share-alt-square","fa-share-square","fa-share-square-o","fa-shekel","fa-sheqel","fa-shield","fa-ship","fa-shirtsinbulk","fa-shopping-bag","fa-shopping-basket","fa-shopping-cart","fa-shower","fa-sign-in","fa-sign-language","fa-sign-out","fa-signal","fa-signing","fa-simplybuilt","fa-sitemap","fa-skyatlas","fa-skype","fa-slack","fa-sliders","fa-slideshare","fa-smile-o","fa-snapchat","fa-snapchat-ghost","fa-snapchat-square","fa-snowflake-o","fa-soccer-ball-o","fa-sort","fa-sort-alpha-asc","fa-sort-alpha-desc","fa-sort-amount-asc","fa-sort-amount-desc","fa-sort-asc","fa-sort-desc","fa-sort-down","fa-sort-numeric-asc","fa-sort-numeric-desc","fa-sort-up","fa-soundcloud","fa-space-shuttle","fa-spinner","fa-spoon","fa-spotify","fa-square","fa-square-o","fa-stack-exchange","fa-stack-overflow","fa-star","fa-star-half","fa-star-half-empty","fa-star-half-full","fa-star-half-o","fa-star-o","fa-steam","fa-steam-square","fa-step-backward","fa-step-forward","fa-stethoscope","fa-sticky-note","fa-sticky-note-o","fa-stop","fa-stop-circle","fa-stop-circle-o","fa-street-view","fa-strikethrough","fa-stumbleupon","fa-stumbleupon-circle","fa-subscript","fa-subway","fa-suitcase","fa-sun-o","fa-superpowers","fa-superscript","fa-support","fa-table","fa-tablet","fa-tachometer","fa-tag","fa-tags","fa-tasks","fa-taxi","fa-telegram","fa-television","fa-tencent-weibo","fa-terminal","fa-text-height","fa-text-width","fa-th","fa-th-large","fa-th-list","fa-themeisle","fa-thermometer","fa-thermometer-0","fa-thermometer-1","fa-thermometer-2","fa-thermometer-3","fa-thermometer-4","fa-thermometer-empty","fa-thermometer-full","fa-thermometer-half","fa-thermometer-quarter","fa-thermometer-three-quarters","fa-thumb-tack","fa-thumbs-down","fa-thumbs-o-down","fa-thumbs-o-up","fa-thumbs-up","fa-ticket","fa-times","fa-times-circle","fa-times-circle-o","fa-times-rectangle","fa-times-rectangle-o","fa-tint","fa-toggle-down","fa-toggle-left","fa-toggle-off","fa-toggle-on","fa-toggle-right","fa-toggle-up","fa-trademark","fa-train","fa-transgender","fa-transgender-alt","fa-trash","fa-trash-o","fa-tree","fa-trello","fa-tripadvisor","fa-trophy","fa-truck","fa-try","fa-tty","fa-tumblr","fa-tumblr-square","fa-turkish-lira","fa-tv","fa-twitch","fa-twitter","fa-twitter-square","fa-umbrella","fa-underline","fa-undo","fa-universal-access","fa-university","fa-unlink","fa-unlock","fa-unlock-alt","fa-unsorted","fa-upload","fa-usb","fa-usd","fa-user","fa-user-circle","fa-user-circle-o","fa-user-md","fa-user-o","fa-user-plus","fa-user-secret","fa-user-times","fa-users","fa-vcard","fa-vcard-o","fa-venus","fa-venus-double","fa-venus-mars","fa-viacoin","fa-viadeo","fa-viadeo-square","fa-video-camera","fa-vimeo","fa-vimeo-square","fa-vine","fa-vk","fa-volume-control-phone","fa-volume-down","fa-volume-off","fa-volume-up","fa-warning","fa-wechat","fa-weibo","fa-weixin","fa-whatsapp","fa-wheelchair","fa-wheelchair-alt","fa-wifi","fa-wikipedia-w","fa-window-close","fa-window-close-o","fa-window-maximize","fa-window-minimize","fa-window-restore","fa-windows","fa-won","fa-wordpress","fa-wpbeginner","fa-wpexplorer","fa-wpforms","fa-wrench","fa-xing","fa-xing-square","fa-y-combinator","fa-y-combinator-square","fa-yahoo","fa-yc","fa-yc-square","fa-yelp","fa-yen","fa-yoast","fa-youtube","fa-youtube-play","fa-youtube-square"]; 2 | }); -------------------------------------------------------------------------------- /iconlink/media/js/fontawesome-iconpicker.js: -------------------------------------------------------------------------------- 1 | (function(a, b) { 2 | a.ui = a.ui || {}; 3 | var c, d = Math.max, e = Math.abs, f = Math.round, g = /left|center|right/, h = /top|center|bottom/, i = /[\+\-]\d+(\.[\d]+)?%?/, j = /^\w+/, k = /%$/, l = a.fn.pos; 4 | function m(a, b, c) { 5 | return [ parseFloat(a[0]) * (k.test(a[0]) ? b / 100 : 1), parseFloat(a[1]) * (k.test(a[1]) ? c / 100 : 1) ]; 6 | } 7 | function n(b, c) { 8 | return parseInt(a.css(b, c), 10) || 0; 9 | } 10 | function o(b) { 11 | var c = b[0]; 12 | if (c.nodeType === 9) { 13 | return { 14 | width: b.width(), 15 | height: b.height(), 16 | offset: { 17 | top: 0, 18 | left: 0 19 | } 20 | }; 21 | } 22 | if (a.isWindow(c)) { 23 | return { 24 | width: b.width(), 25 | height: b.height(), 26 | offset: { 27 | top: b.scrollTop(), 28 | left: b.scrollLeft() 29 | } 30 | }; 31 | } 32 | if (c.preventDefault) { 33 | return { 34 | width: 0, 35 | height: 0, 36 | offset: { 37 | top: c.pageY, 38 | left: c.pageX 39 | } 40 | }; 41 | } 42 | return { 43 | width: b.outerWidth(), 44 | height: b.outerHeight(), 45 | offset: b.offset() 46 | }; 47 | } 48 | a.pos = { 49 | scrollbarWidth: function() { 50 | if (c !== b) { 51 | return c; 52 | } 53 | var d, e, f = a("
"), g = f.children()[0]; 54 | a("body").append(f); 55 | d = g.offsetWidth; 56 | f.css("overflow", "scroll"); 57 | e = g.offsetWidth; 58 | if (d === e) { 59 | e = f[0].clientWidth; 60 | } 61 | f.remove(); 62 | return c = d - e; 63 | }, 64 | getScrollInfo: function(b) { 65 | var c = b.isWindow || b.isDocument ? "" : b.element.css("overflow-x"), d = b.isWindow || b.isDocument ? "" : b.element.css("overflow-y"), e = c === "scroll" || c === "auto" && b.width < b.element[0].scrollWidth, f = d === "scroll" || d === "auto" && b.height < b.element[0].scrollHeight; 66 | return { 67 | width: f ? a.pos.scrollbarWidth() : 0, 68 | height: e ? a.pos.scrollbarWidth() : 0 69 | }; 70 | }, 71 | getWithinInfo: function(b) { 72 | var c = a(b || window), d = a.isWindow(c[0]), e = !!c[0] && c[0].nodeType === 9; 73 | return { 74 | element: c, 75 | isWindow: d, 76 | isDocument: e, 77 | offset: c.offset() || { 78 | left: 0, 79 | top: 0 80 | }, 81 | scrollLeft: c.scrollLeft(), 82 | scrollTop: c.scrollTop(), 83 | width: d ? c.width() : c.outerWidth(), 84 | height: d ? c.height() : c.outerHeight() 85 | }; 86 | } 87 | }; 88 | a.fn.pos = function(b) { 89 | if (!b || !b.of) { 90 | return l.apply(this, arguments); 91 | } 92 | b = a.extend({}, b); 93 | var c, k, p, q, r, s, t = a(b.of), u = a.pos.getWithinInfo(b.within), v = a.pos.getScrollInfo(u), w = (b.collision || "flip").split(" "), x = {}; 94 | s = o(t); 95 | if (t[0].preventDefault) { 96 | b.at = "left top"; 97 | } 98 | k = s.width; 99 | p = s.height; 100 | q = s.offset; 101 | r = a.extend({}, q); 102 | a.each([ "my", "at" ], function() { 103 | var a = (b[this] || "").split(" "), c, d; 104 | if (a.length === 1) { 105 | a = g.test(a[0]) ? a.concat([ "center" ]) : h.test(a[0]) ? [ "center" ].concat(a) : [ "center", "center" ]; 106 | } 107 | a[0] = g.test(a[0]) ? a[0] : "center"; 108 | a[1] = h.test(a[1]) ? a[1] : "center"; 109 | c = i.exec(a[0]); 110 | d = i.exec(a[1]); 111 | x[this] = [ c ? c[0] : 0, d ? d[0] : 0 ]; 112 | b[this] = [ j.exec(a[0])[0], j.exec(a[1])[0] ]; 113 | }); 114 | if (w.length === 1) { 115 | w[1] = w[0]; 116 | } 117 | if (b.at[0] === "right") { 118 | r.left += k; 119 | } else if (b.at[0] === "center") { 120 | r.left += k / 2; 121 | } 122 | if (b.at[1] === "bottom") { 123 | r.top += p; 124 | } else if (b.at[1] === "center") { 125 | r.top += p / 2; 126 | } 127 | c = m(x.at, k, p); 128 | r.left += c[0]; 129 | r.top += c[1]; 130 | return this.each(function() { 131 | var g, h, i = a(this), j = i.outerWidth(), l = i.outerHeight(), o = n(this, "marginLeft"), s = n(this, "marginTop"), y = j + o + n(this, "marginRight") + v.width, z = l + s + n(this, "marginBottom") + v.height, A = a.extend({}, r), B = m(x.my, i.outerWidth(), i.outerHeight()); 132 | if (b.my[0] === "right") { 133 | A.left -= j; 134 | } else if (b.my[0] === "center") { 135 | A.left -= j / 2; 136 | } 137 | if (b.my[1] === "bottom") { 138 | A.top -= l; 139 | } else if (b.my[1] === "center") { 140 | A.top -= l / 2; 141 | } 142 | A.left += B[0]; 143 | A.top += B[1]; 144 | if (!a.support.offsetFractions) { 145 | A.left = f(A.left); 146 | A.top = f(A.top); 147 | } 148 | g = { 149 | marginLeft: o, 150 | marginTop: s 151 | }; 152 | a.each([ "left", "top" ], function(d, e) { 153 | if (a.ui.pos[w[d]]) { 154 | a.ui.pos[w[d]][e](A, { 155 | targetWidth: k, 156 | targetHeight: p, 157 | elemWidth: j, 158 | elemHeight: l, 159 | collisionPosition: g, 160 | collisionWidth: y, 161 | collisionHeight: z, 162 | offset: [ c[0] + B[0], c[1] + B[1] ], 163 | my: b.my, 164 | at: b.at, 165 | within: u, 166 | elem: i 167 | }); 168 | } 169 | }); 170 | if (b.using) { 171 | h = function(a) { 172 | var c = q.left - A.left, f = c + k - j, g = q.top - A.top, h = g + p - l, m = { 173 | target: { 174 | element: t, 175 | left: q.left, 176 | top: q.top, 177 | width: k, 178 | height: p 179 | }, 180 | element: { 181 | element: i, 182 | left: A.left, 183 | top: A.top, 184 | width: j, 185 | height: l 186 | }, 187 | horizontal: f < 0 ? "left" : c > 0 ? "right" : "center", 188 | vertical: h < 0 ? "top" : g > 0 ? "bottom" : "middle" 189 | }; 190 | if (k < j && e(c + f) < k) { 191 | m.horizontal = "center"; 192 | } 193 | if (p < l && e(g + h) < p) { 194 | m.vertical = "middle"; 195 | } 196 | if (d(e(c), e(f)) > d(e(g), e(h))) { 197 | m.important = "horizontal"; 198 | } else { 199 | m.important = "vertical"; 200 | } 201 | b.using.call(this, a, m); 202 | }; 203 | } 204 | i.offset(a.extend(A, { 205 | using: h 206 | })); 207 | }); 208 | }; 209 | a.ui.pos = { 210 | _trigger: function(a, b, c, d) { 211 | if (b.elem) { 212 | b.elem.trigger({ 213 | type: c, 214 | position: a, 215 | positionData: b, 216 | triggered: d 217 | }); 218 | } 219 | }, 220 | fit: { 221 | left: function(b, c) { 222 | a.ui.pos._trigger(b, c, "posCollide", "fitLeft"); 223 | var e = c.within, f = e.isWindow ? e.scrollLeft : e.offset.left, g = e.width, h = b.left - c.collisionPosition.marginLeft, i = f - h, j = h + c.collisionWidth - g - f, k; 224 | if (c.collisionWidth > g) { 225 | if (i > 0 && j <= 0) { 226 | k = b.left + i + c.collisionWidth - g - f; 227 | b.left += i - k; 228 | } else if (j > 0 && i <= 0) { 229 | b.left = f; 230 | } else { 231 | if (i > j) { 232 | b.left = f + g - c.collisionWidth; 233 | } else { 234 | b.left = f; 235 | } 236 | } 237 | } else if (i > 0) { 238 | b.left += i; 239 | } else if (j > 0) { 240 | b.left -= j; 241 | } else { 242 | b.left = d(b.left - h, b.left); 243 | } 244 | a.ui.pos._trigger(b, c, "posCollided", "fitLeft"); 245 | }, 246 | top: function(b, c) { 247 | a.ui.pos._trigger(b, c, "posCollide", "fitTop"); 248 | var e = c.within, f = e.isWindow ? e.scrollTop : e.offset.top, g = c.within.height, h = b.top - c.collisionPosition.marginTop, i = f - h, j = h + c.collisionHeight - g - f, k; 249 | if (c.collisionHeight > g) { 250 | if (i > 0 && j <= 0) { 251 | k = b.top + i + c.collisionHeight - g - f; 252 | b.top += i - k; 253 | } else if (j > 0 && i <= 0) { 254 | b.top = f; 255 | } else { 256 | if (i > j) { 257 | b.top = f + g - c.collisionHeight; 258 | } else { 259 | b.top = f; 260 | } 261 | } 262 | } else if (i > 0) { 263 | b.top += i; 264 | } else if (j > 0) { 265 | b.top -= j; 266 | } else { 267 | b.top = d(b.top - h, b.top); 268 | } 269 | a.ui.pos._trigger(b, c, "posCollided", "fitTop"); 270 | } 271 | }, 272 | flip: { 273 | left: function(b, c) { 274 | a.ui.pos._trigger(b, c, "posCollide", "flipLeft"); 275 | var d = c.within, f = d.offset.left + d.scrollLeft, g = d.width, h = d.isWindow ? d.scrollLeft : d.offset.left, i = b.left - c.collisionPosition.marginLeft, j = i - h, k = i + c.collisionWidth - g - h, l = c.my[0] === "left" ? -c.elemWidth : c.my[0] === "right" ? c.elemWidth : 0, m = c.at[0] === "left" ? c.targetWidth : c.at[0] === "right" ? -c.targetWidth : 0, n = -2 * c.offset[0], o, p; 276 | if (j < 0) { 277 | o = b.left + l + m + n + c.collisionWidth - g - f; 278 | if (o < 0 || o < e(j)) { 279 | b.left += l + m + n; 280 | } 281 | } else if (k > 0) { 282 | p = b.left - c.collisionPosition.marginLeft + l + m + n - h; 283 | if (p > 0 || e(p) < k) { 284 | b.left += l + m + n; 285 | } 286 | } 287 | a.ui.pos._trigger(b, c, "posCollided", "flipLeft"); 288 | }, 289 | top: function(b, c) { 290 | a.ui.pos._trigger(b, c, "posCollide", "flipTop"); 291 | var d = c.within, f = d.offset.top + d.scrollTop, g = d.height, h = d.isWindow ? d.scrollTop : d.offset.top, i = b.top - c.collisionPosition.marginTop, j = i - h, k = i + c.collisionHeight - g - h, l = c.my[1] === "top", m = l ? -c.elemHeight : c.my[1] === "bottom" ? c.elemHeight : 0, n = c.at[1] === "top" ? c.targetHeight : c.at[1] === "bottom" ? -c.targetHeight : 0, o = -2 * c.offset[1], p, q; 292 | if (j < 0) { 293 | q = b.top + m + n + o + c.collisionHeight - g - f; 294 | if (b.top + m + n + o > j && (q < 0 || q < e(j))) { 295 | b.top += m + n + o; 296 | } 297 | } else if (k > 0) { 298 | p = b.top - c.collisionPosition.marginTop + m + n + o - h; 299 | if (b.top + m + n + o > k && (p > 0 || e(p) < k)) { 300 | b.top += m + n + o; 301 | } 302 | } 303 | a.ui.pos._trigger(b, c, "posCollided", "flipTop"); 304 | } 305 | }, 306 | flipfit: { 307 | left: function() { 308 | a.ui.pos.flip.left.apply(this, arguments); 309 | a.ui.pos.fit.left.apply(this, arguments); 310 | }, 311 | top: function() { 312 | a.ui.pos.flip.top.apply(this, arguments); 313 | a.ui.pos.fit.top.apply(this, arguments); 314 | } 315 | } 316 | }; 317 | (function() { 318 | var b, c, d, e, f, g = document.getElementsByTagName("body")[0], h = document.createElement("div"); 319 | b = document.createElement(g ? "div" : "body"); 320 | d = { 321 | visibility: "hidden", 322 | width: 0, 323 | height: 0, 324 | border: 0, 325 | margin: 0, 326 | background: "none" 327 | }; 328 | if (g) { 329 | a.extend(d, { 330 | position: "absolute", 331 | left: "-1000px", 332 | top: "-1000px" 333 | }); 334 | } 335 | for (f in d) { 336 | b.style[f] = d[f]; 337 | } 338 | b.appendChild(h); 339 | c = g || document.documentElement; 340 | c.insertBefore(b, c.firstChild); 341 | h.style.cssText = "position: absolute; left: 10.7432222px;"; 342 | e = a(h).offset().left; 343 | a.support.offsetFractions = e > 10 && e < 11; 344 | b.innerHTML = ""; 345 | c.removeChild(b); 346 | })(); 347 | })(jQuery); 348 | 349 | (function(a) { 350 | "use strict"; 351 | if (typeof define === "function" && define.amd) { 352 | define([ "jquery" ], a); 353 | } else if (window.jQuery && !window.jQuery.fn.iconpicker) { 354 | a(window.jQuery); 355 | } 356 | })(function(a) { 357 | "use strict"; 358 | var b = { 359 | isEmpty: function(a) { 360 | return a === false || a === "" || a === null || a === undefined; 361 | }, 362 | isEmptyObject: function(a) { 363 | return this.isEmpty(a) === true || a.length === 0; 364 | }, 365 | isElement: function(b) { 366 | return a(b).length > 0; 367 | }, 368 | isString: function(a) { 369 | return typeof a === "string" || a instanceof String; 370 | }, 371 | isArray: function(b) { 372 | return a.isArray(b); 373 | }, 374 | inArray: function(b, c) { 375 | return a.inArray(b, c) !== -1; 376 | }, 377 | throwError: function(a) { 378 | throw "Font Awesome Icon Picker Exception: " + a; 379 | } 380 | }; 381 | var c = function(d, e) { 382 | this._id = c._idCounter++; 383 | this.element = a(d).addClass("iconpicker-element"); 384 | this._trigger("iconpickerCreate"); 385 | this.options = a.extend({}, c.defaultOptions, this.element.data(), e); 386 | this.options.templates = a.extend({}, c.defaultOptions.templates, this.options.templates); 387 | this.options.originalPlacement = this.options.placement; 388 | this.container = b.isElement(this.options.container) ? a(this.options.container) : false; 389 | if (this.container === false) { 390 | if (this.element.is(".dropdown-toggle")) { 391 | this.container = a("~ .dropdown-menu:first", this.element); 392 | } else { 393 | this.container = this.element.is("input,textarea,button,.btn") ? this.element.parent() : this.element; 394 | } 395 | } 396 | this.container.addClass("iconpicker-container"); 397 | if (this.isDropdownMenu()) { 398 | this.options.templates.search = false; 399 | this.options.templates.buttons = false; 400 | this.options.placement = "inline"; 401 | } 402 | this.input = this.element.is("input,textarea") ? this.element.addClass("iconpicker-input") : false; 403 | if (this.input === false) { 404 | this.input = this.container.find(this.options.input); 405 | if (!this.input.is("input,textarea")) { 406 | this.input = false; 407 | } 408 | } 409 | this.component = this.isDropdownMenu() ? this.container.parent().find(this.options.component) : this.container.find(this.options.component); 410 | if (this.component.length === 0) { 411 | this.component = false; 412 | } else { 413 | this.component.find("i").addClass("iconpicker-component"); 414 | } 415 | this._createPopover(); 416 | this._createIconpicker(); 417 | if (this.getAcceptButton().length === 0) { 418 | this.options.mustAccept = false; 419 | } 420 | if (this.isInputGroup()) { 421 | this.container.parent().append(this.popover); 422 | } else { 423 | this.container.append(this.popover); 424 | } 425 | this._bindElementEvents(); 426 | this._bindWindowEvents(); 427 | this.update(this.options.selected); 428 | if (this.isInline()) { 429 | this.show(); 430 | } 431 | this._trigger("iconpickerCreated"); 432 | }; 433 | c._idCounter = 0; 434 | c.defaultOptions = { 435 | title: false, 436 | selected: false, 437 | defaultValue: false, 438 | placement: "bottom", 439 | collision: "none", 440 | animation: true, 441 | hideOnSelect: false, 442 | showFooter: false, 443 | searchInFooter: false, 444 | mustAccept: false, 445 | selectedCustomClass: "bg-primary", 446 | icons: [], 447 | fullClassFormatter: function(a) { 448 | return "fa " + a; 449 | }, 450 | input: "input,.iconpicker-input", 451 | inputSearch: false, 452 | container: false, 453 | component: ".input-group-addon,.iconpicker-component", 454 | templates: { 455 | popover: '
' + '
', 456 | footer: '', 457 | buttons: '' + ' ', 458 | search: '', 459 | iconpicker: '
', 460 | iconpickerItem: '' 461 | } 462 | }; 463 | c.batch = function(b, c) { 464 | var d = Array.prototype.slice.call(arguments, 2); 465 | return a(b).each(function() { 466 | var b = a(this).data("iconpicker"); 467 | if (!!b) { 468 | b[c].apply(b, d); 469 | } 470 | }); 471 | }; 472 | c.prototype = { 473 | constructor: c, 474 | options: {}, 475 | _id: 0, 476 | _trigger: function(b, c) { 477 | c = c || {}; 478 | this.element.trigger(a.extend({ 479 | type: b, 480 | iconpickerInstance: this 481 | }, c)); 482 | }, 483 | _createPopover: function() { 484 | this.popover = a(this.options.templates.popover); 485 | var c = this.popover.find(".popover-title"); 486 | if (!!this.options.title) { 487 | c.append(a('
' + this.options.title + "
")); 488 | } 489 | if (this.hasSeparatedSearchInput() && !this.options.searchInFooter) { 490 | c.append(this.options.templates.search); 491 | } else if (!this.options.title) { 492 | c.remove(); 493 | } 494 | if (this.options.showFooter && !b.isEmpty(this.options.templates.footer)) { 495 | var d = a(this.options.templates.footer); 496 | if (this.hasSeparatedSearchInput() && this.options.searchInFooter) { 497 | d.append(a(this.options.templates.search)); 498 | } 499 | if (!b.isEmpty(this.options.templates.buttons)) { 500 | d.append(a(this.options.templates.buttons)); 501 | } 502 | this.popover.append(d); 503 | } 504 | if (this.options.animation === true) { 505 | this.popover.addClass("fade"); 506 | } 507 | return this.popover; 508 | }, 509 | _createIconpicker: function() { 510 | var b = this; 511 | this.iconpicker = a(this.options.templates.iconpicker); 512 | var c = function(c) { 513 | var d = a(this); 514 | if (d.is("i")) { 515 | d = d.parent(); 516 | } 517 | b._trigger("iconpickerSelect", { 518 | iconpickerItem: d, 519 | iconpickerValue: b.iconpickerValue 520 | }); 521 | if (b.options.mustAccept === false) { 522 | b.update(d.data("iconpickerValue")); 523 | b._trigger("iconpickerSelected", { 524 | iconpickerItem: this, 525 | iconpickerValue: b.iconpickerValue 526 | }); 527 | } else { 528 | b.update(d.data("iconpickerValue"), true); 529 | } 530 | if (b.options.hideOnSelect && b.options.mustAccept === false) { 531 | b.hide(); 532 | } 533 | c.preventDefault(); 534 | return false; 535 | }; 536 | for (var d in this.options.icons) { 537 | if (typeof this.options.icons[d] === "string") { 538 | var e = a(this.options.templates.iconpickerItem); 539 | e.find("i").addClass(this.options.fullClassFormatter(this.options.icons[d])); 540 | e.data("iconpickerValue", this.options.icons[d]).on("click.iconpicker", c); 541 | this.iconpicker.find(".iconpicker-items").append(e.attr("title", "." + this.options.icons[d])); 542 | } 543 | } 544 | this.popover.find(".popover-content").append(this.iconpicker); 545 | return this.iconpicker; 546 | }, 547 | _isEventInsideIconpicker: function(b) { 548 | var c = a(b.target); 549 | if ((!c.hasClass("iconpicker-element") || c.hasClass("iconpicker-element") && !c.is(this.element)) && c.parents(".iconpicker-popover").length === 0) { 550 | return false; 551 | } 552 | return true; 553 | }, 554 | _bindElementEvents: function() { 555 | var c = this; 556 | this.getSearchInput().on("keyup.iconpicker", function() { 557 | c.filter(a(this).val().toLowerCase()); 558 | }); 559 | this.getAcceptButton().on("click.iconpicker", function() { 560 | var a = c.iconpicker.find(".iconpicker-selected").get(0); 561 | c.update(c.iconpickerValue); 562 | c._trigger("iconpickerSelected", { 563 | iconpickerItem: a, 564 | iconpickerValue: c.iconpickerValue 565 | }); 566 | if (!c.isInline()) { 567 | c.hide(); 568 | } 569 | }); 570 | this.getCancelButton().on("click.iconpicker", function() { 571 | if (!c.isInline()) { 572 | c.hide(); 573 | } 574 | }); 575 | this.element.on("focus.iconpicker", function(a) { 576 | c.show(); 577 | a.stopPropagation(); 578 | }); 579 | if (this.hasComponent()) { 580 | this.component.on("click.iconpicker", function() { 581 | c.toggle(); 582 | }); 583 | } 584 | if (this.hasInput()) { 585 | this.input.on("keyup.iconpicker", function(d) { 586 | if (!b.inArray(d.keyCode, [ 38, 40, 37, 39, 16, 17, 18, 9, 8, 91, 93, 20, 46, 186, 190, 46, 78, 188, 44, 86 ])) { 587 | c.update(); 588 | } else { 589 | c._updateFormGroupStatus(c.getValid(this.value) !== false); 590 | } 591 | if (c.options.inputSearch === true) { 592 | c.filter(a(this).val().toLowerCase()); 593 | } 594 | }); 595 | } 596 | }, 597 | _bindWindowEvents: function() { 598 | var b = a(window.document); 599 | var c = this; 600 | var d = ".iconpicker.inst" + this._id; 601 | a(window).on("resize.iconpicker" + d + " orientationchange.iconpicker" + d, function(a) { 602 | if (c.popover.hasClass("in")) { 603 | c.updatePlacement(); 604 | } 605 | }); 606 | if (!c.isInline()) { 607 | b.on("mouseup" + d, function(a) { 608 | if (!c._isEventInsideIconpicker(a) && !c.isInline()) { 609 | c.hide(); 610 | } 611 | a.stopPropagation(); 612 | a.preventDefault(); 613 | return false; 614 | }); 615 | } 616 | return false; 617 | }, 618 | _unbindElementEvents: function() { 619 | this.popover.off(".iconpicker"); 620 | this.element.off(".iconpicker"); 621 | if (this.hasInput()) { 622 | this.input.off(".iconpicker"); 623 | } 624 | if (this.hasComponent()) { 625 | this.component.off(".iconpicker"); 626 | } 627 | if (this.hasContainer()) { 628 | this.container.off(".iconpicker"); 629 | } 630 | }, 631 | _unbindWindowEvents: function() { 632 | a(window).off(".iconpicker.inst" + this._id); 633 | a(window.document).off(".iconpicker.inst" + this._id); 634 | }, 635 | updatePlacement: function(b, c) { 636 | b = b || this.options.placement; 637 | this.options.placement = b; 638 | c = c || this.options.collision; 639 | c = c === true ? "flip" : c; 640 | var d = { 641 | at: "right bottom", 642 | my: "right top", 643 | of: this.hasInput() && !this.isInputGroup() ? this.input : this.container, 644 | collision: c === true ? "flip" : c, 645 | within: window 646 | }; 647 | this.popover.removeClass("inline topLeftCorner topLeft top topRight topRightCorner " + "rightTop right rightBottom bottomRight bottomRightCorner " + "bottom bottomLeft bottomLeftCorner leftBottom left leftTop"); 648 | if (typeof b === "object") { 649 | return this.popover.pos(a.extend({}, d, b)); 650 | } 651 | switch (b) { 652 | case "inline": 653 | { 654 | d = false; 655 | } 656 | break; 657 | 658 | case "topLeftCorner": 659 | { 660 | d.my = "right bottom"; 661 | d.at = "left top"; 662 | } 663 | break; 664 | 665 | case "topLeft": 666 | { 667 | d.my = "left bottom"; 668 | d.at = "left top"; 669 | } 670 | break; 671 | 672 | case "top": 673 | { 674 | d.my = "center bottom"; 675 | d.at = "center top"; 676 | } 677 | break; 678 | 679 | case "topRight": 680 | { 681 | d.my = "right bottom"; 682 | d.at = "right top"; 683 | } 684 | break; 685 | 686 | case "topRightCorner": 687 | { 688 | d.my = "left bottom"; 689 | d.at = "right top"; 690 | } 691 | break; 692 | 693 | case "rightTop": 694 | { 695 | d.my = "left bottom"; 696 | d.at = "right center"; 697 | } 698 | break; 699 | 700 | case "right": 701 | { 702 | d.my = "left center"; 703 | d.at = "right center"; 704 | } 705 | break; 706 | 707 | case "rightBottom": 708 | { 709 | d.my = "left top"; 710 | d.at = "right center"; 711 | } 712 | break; 713 | 714 | case "bottomRightCorner": 715 | { 716 | d.my = "left top"; 717 | d.at = "right bottom"; 718 | } 719 | break; 720 | 721 | case "bottomRight": 722 | { 723 | d.my = "right top"; 724 | d.at = "right bottom"; 725 | } 726 | break; 727 | 728 | case "bottom": 729 | { 730 | d.my = "center top"; 731 | d.at = "center bottom"; 732 | } 733 | break; 734 | 735 | case "bottomLeft": 736 | { 737 | d.my = "left top"; 738 | d.at = "left bottom"; 739 | } 740 | break; 741 | 742 | case "bottomLeftCorner": 743 | { 744 | d.my = "right top"; 745 | d.at = "left bottom"; 746 | } 747 | break; 748 | 749 | case "leftBottom": 750 | { 751 | d.my = "right top"; 752 | d.at = "left center"; 753 | } 754 | break; 755 | 756 | case "left": 757 | { 758 | d.my = "right center"; 759 | d.at = "left center"; 760 | } 761 | break; 762 | 763 | case "leftTop": 764 | { 765 | d.my = "right bottom"; 766 | d.at = "left center"; 767 | } 768 | break; 769 | 770 | default: 771 | { 772 | return false; 773 | } 774 | break; 775 | } 776 | this.popover.css({ 777 | display: this.options.placement === "inline" ? "" : "block" 778 | }); 779 | if (d !== false) { 780 | this.popover.pos(d).css("maxWidth", a(window).width() - this.container.offset().left - 5); 781 | } else { 782 | this.popover.css({ 783 | top: "auto", 784 | right: "auto", 785 | bottom: "auto", 786 | left: "auto", 787 | maxWidth: "none" 788 | }); 789 | } 790 | this.popover.addClass(this.options.placement); 791 | return true; 792 | }, 793 | _updateComponents: function() { 794 | this.iconpicker.find(".iconpicker-item.iconpicker-selected").removeClass("iconpicker-selected " + this.options.selectedCustomClass); 795 | if (this.iconpickerValue) { 796 | this.iconpicker.find("." + this.options.fullClassFormatter(this.iconpickerValue).replace(/ /g, ".")).parent().addClass("iconpicker-selected " + this.options.selectedCustomClass); 797 | } 798 | if (this.hasComponent()) { 799 | var a = this.component.find("i"); 800 | if (a.length > 0) { 801 | a.attr("class", this.options.fullClassFormatter(this.iconpickerValue)); 802 | } else { 803 | this.component.html(this.getHtml()); 804 | } 805 | } 806 | }, 807 | _updateFormGroupStatus: function(a) { 808 | if (this.hasInput()) { 809 | if (a !== false) { 810 | this.input.parents(".form-group:first").removeClass("has-error"); 811 | } else { 812 | this.input.parents(".form-group:first").addClass("has-error"); 813 | } 814 | return true; 815 | } 816 | return false; 817 | }, 818 | getValid: function(c) { 819 | if (!b.isString(c)) { 820 | c = ""; 821 | } 822 | var d = c === ""; 823 | c = a.trim(c); 824 | if (b.inArray(c, this.options.icons) || d) { 825 | return c; 826 | } 827 | return false; 828 | }, 829 | setValue: function(a) { 830 | var b = this.getValid(a); 831 | if (b !== false) { 832 | this.iconpickerValue = b; 833 | this._trigger("iconpickerSetValue", { 834 | iconpickerValue: b 835 | }); 836 | return this.iconpickerValue; 837 | } else { 838 | this._trigger("iconpickerInvalid", { 839 | iconpickerValue: a 840 | }); 841 | return false; 842 | } 843 | }, 844 | getHtml: function() { 845 | return ''; 846 | }, 847 | setSourceValue: function(a) { 848 | a = this.setValue(a); 849 | if (a !== false && a !== "") { 850 | if (this.hasInput()) { 851 | this.input.val(this.iconpickerValue); 852 | } else { 853 | this.element.data("iconpickerValue", this.iconpickerValue); 854 | } 855 | this._trigger("iconpickerSetSourceValue", { 856 | iconpickerValue: a 857 | }); 858 | } 859 | return a; 860 | }, 861 | getSourceValue: function(a) { 862 | a = a || this.options.defaultValue; 863 | var b = a; 864 | if (this.hasInput()) { 865 | b = this.input.val(); 866 | } else { 867 | b = this.element.data("iconpickerValue"); 868 | } 869 | if (b === undefined || b === "" || b === null || b === false) { 870 | b = a; 871 | } 872 | return b; 873 | }, 874 | hasInput: function() { 875 | return this.input !== false; 876 | }, 877 | isInputSearch: function() { 878 | return this.hasInput() && this.options.inputSearch === true; 879 | }, 880 | isInputGroup: function() { 881 | return this.container.is(".input-group"); 882 | }, 883 | isDropdownMenu: function() { 884 | return this.container.is(".dropdown-menu"); 885 | }, 886 | hasSeparatedSearchInput: function() { 887 | return this.options.templates.search !== false && !this.isInputSearch(); 888 | }, 889 | hasComponent: function() { 890 | return this.component !== false; 891 | }, 892 | hasContainer: function() { 893 | return this.container !== false; 894 | }, 895 | getAcceptButton: function() { 896 | return this.popover.find(".iconpicker-btn-accept"); 897 | }, 898 | getCancelButton: function() { 899 | return this.popover.find(".iconpicker-btn-cancel"); 900 | }, 901 | getSearchInput: function() { 902 | return this.popover.find(".iconpicker-search"); 903 | }, 904 | filter: function(c) { 905 | if (b.isEmpty(c)) { 906 | this.iconpicker.find(".iconpicker-item").show(); 907 | return a(false); 908 | } else { 909 | var d = []; 910 | this.iconpicker.find(".iconpicker-item").each(function() { 911 | var b = a(this); 912 | var e = b.attr("title").toLowerCase(); 913 | var f = false; 914 | try { 915 | f = new RegExp(c, "g"); 916 | } catch (a) { 917 | f = false; 918 | } 919 | if (f !== false && e.match(f)) { 920 | d.push(b); 921 | b.show(); 922 | } else { 923 | b.hide(); 924 | } 925 | }); 926 | return d; 927 | } 928 | }, 929 | show: function() { 930 | if (this.popover.hasClass("in")) { 931 | return false; 932 | } 933 | a.iconpicker.batch(a(".iconpicker-popover.in:not(.inline)").not(this.popover), "hide"); 934 | this._trigger("iconpickerShow"); 935 | this.updatePlacement(); 936 | this.popover.addClass("in"); 937 | setTimeout(a.proxy(function() { 938 | this.popover.css("display", this.isInline() ? "" : "block"); 939 | this._trigger("iconpickerShown"); 940 | }, this), this.options.animation ? 300 : 1); 941 | }, 942 | hide: function() { 943 | if (!this.popover.hasClass("in")) { 944 | return false; 945 | } 946 | this._trigger("iconpickerHide"); 947 | this.popover.removeClass("in"); 948 | setTimeout(a.proxy(function() { 949 | this.popover.css("display", "none"); 950 | this.getSearchInput().val(""); 951 | this.filter(""); 952 | this._trigger("iconpickerHidden"); 953 | }, this), this.options.animation ? 300 : 1); 954 | }, 955 | toggle: function() { 956 | if (this.popover.is(":visible")) { 957 | this.hide(); 958 | } else { 959 | this.show(true); 960 | } 961 | }, 962 | update: function(a, b) { 963 | a = a ? a : this.getSourceValue(this.iconpickerValue); 964 | this._trigger("iconpickerUpdate"); 965 | if (b === true) { 966 | a = this.setValue(a); 967 | } else { 968 | a = this.setSourceValue(a); 969 | this._updateFormGroupStatus(a !== false); 970 | } 971 | if (a !== false) { 972 | this._updateComponents(); 973 | } 974 | this._trigger("iconpickerUpdated"); 975 | return a; 976 | }, 977 | destroy: function() { 978 | this._trigger("iconpickerDestroy"); 979 | this.element.removeData("iconpicker").removeData("iconpickerValue").removeClass("iconpicker-element"); 980 | this._unbindElementEvents(); 981 | this._unbindWindowEvents(); 982 | a(this.popover).remove(); 983 | this._trigger("iconpickerDestroyed"); 984 | }, 985 | disable: function() { 986 | if (this.hasInput()) { 987 | this.input.prop("disabled", true); 988 | return true; 989 | } 990 | return false; 991 | }, 992 | enable: function() { 993 | if (this.hasInput()) { 994 | this.input.prop("disabled", false); 995 | return true; 996 | } 997 | return false; 998 | }, 999 | isDisabled: function() { 1000 | if (this.hasInput()) { 1001 | return this.input.prop("disabled") === true; 1002 | } 1003 | return false; 1004 | }, 1005 | isInline: function() { 1006 | return this.options.placement === "inline" || this.popover.hasClass("inline"); 1007 | } 1008 | }; 1009 | a.iconpicker = c; 1010 | a.fn.iconpicker = function(b) { 1011 | return this.each(function() { 1012 | var d = a(this); 1013 | if (!d.data("iconpicker")) { 1014 | d.data("iconpicker", new c(this, typeof b === "object" ? b : {})); 1015 | } 1016 | }); 1017 | }; 1018 | c.defaultOptions.icons = [ "fa-500px", "fa-address-book", "fa-address-book-o", "fa-address-card", "fa-address-card-o", "fa-adjust", "fa-adn", "fa-align-center", "fa-align-justify", "fa-align-left", "fa-align-right", "fa-amazon", "fa-ambulance", "fa-american-sign-language-interpreting", "fa-anchor", "fa-android", "fa-angellist", "fa-angle-double-down", "fa-angle-double-left", "fa-angle-double-right", "fa-angle-double-up", "fa-angle-down", "fa-angle-left", "fa-angle-right", "fa-angle-up", "fa-apple", "fa-archive", "fa-area-chart", "fa-arrow-circle-down", "fa-arrow-circle-left", "fa-arrow-circle-o-down", "fa-arrow-circle-o-left", "fa-arrow-circle-o-right", "fa-arrow-circle-o-up", "fa-arrow-circle-right", "fa-arrow-circle-up", "fa-arrow-down", "fa-arrow-left", "fa-arrow-right", "fa-arrow-up", "fa-arrows", "fa-arrows-alt", "fa-arrows-h", "fa-arrows-v", "fa-asl-interpreting", "fa-assistive-listening-systems", "fa-asterisk", "fa-at", "fa-audio-description", "fa-automobile", "fa-backward", "fa-balance-scale", "fa-ban", "fa-bandcamp", "fa-bank", "fa-bar-chart", "fa-bar-chart-o", "fa-barcode", "fa-bars", "fa-bath", "fa-bathtub", "fa-battery", "fa-battery-0", "fa-battery-1", "fa-battery-2", "fa-battery-3", "fa-battery-4", "fa-battery-empty", "fa-battery-full", "fa-battery-half", "fa-battery-quarter", "fa-battery-three-quarters", "fa-bed", "fa-beer", "fa-behance", "fa-behance-square", "fa-bell", "fa-bell-o", "fa-bell-slash", "fa-bell-slash-o", "fa-bicycle", "fa-binoculars", "fa-birthday-cake", "fa-bitbucket", "fa-bitbucket-square", "fa-bitcoin", "fa-black-tie", "fa-blind", "fa-bluetooth", "fa-bluetooth-b", "fa-bold", "fa-bolt", "fa-bomb", "fa-book", "fa-bookmark", "fa-bookmark-o", "fa-braille", "fa-briefcase", "fa-btc", "fa-bug", "fa-building", "fa-building-o", "fa-bullhorn", "fa-bullseye", "fa-bus", "fa-buysellads", "fa-cab", "fa-calculator", "fa-calendar", "fa-calendar-check-o", "fa-calendar-minus-o", "fa-calendar-o", "fa-calendar-plus-o", "fa-calendar-times-o", "fa-camera", "fa-camera-retro", "fa-car", "fa-caret-down", "fa-caret-left", "fa-caret-right", "fa-caret-square-o-down", "fa-caret-square-o-left", "fa-caret-square-o-right", "fa-caret-square-o-up", "fa-caret-up", "fa-cart-arrow-down", "fa-cart-plus", "fa-cc", "fa-cc-amex", "fa-cc-diners-club", "fa-cc-discover", "fa-cc-jcb", "fa-cc-mastercard", "fa-cc-paypal", "fa-cc-stripe", "fa-cc-visa", "fa-certificate", "fa-chain", "fa-chain-broken", "fa-check", "fa-check-circle", "fa-check-circle-o", "fa-check-square", "fa-check-square-o", "fa-chevron-circle-down", "fa-chevron-circle-left", "fa-chevron-circle-right", "fa-chevron-circle-up", "fa-chevron-down", "fa-chevron-left", "fa-chevron-right", "fa-chevron-up", "fa-child", "fa-chrome", "fa-circle", "fa-circle-o", "fa-circle-o-notch", "fa-circle-thin", "fa-clipboard", "fa-clock-o", "fa-clone", "fa-close", "fa-cloud", "fa-cloud-download", "fa-cloud-upload", "fa-cny", "fa-code", "fa-code-fork", "fa-codepen", "fa-codiepie", "fa-coffee", "fa-cog", "fa-cogs", "fa-columns", "fa-comment", "fa-comment-o", "fa-commenting", "fa-commenting-o", "fa-comments", "fa-comments-o", "fa-compass", "fa-compress", "fa-connectdevelop", "fa-contao", "fa-copy", "fa-copyright", "fa-creative-commons", "fa-credit-card", "fa-credit-card-alt", "fa-crop", "fa-crosshairs", "fa-css3", "fa-cube", "fa-cubes", "fa-cut", "fa-cutlery", "fa-dashboard", "fa-dashcube", "fa-database", "fa-deaf", "fa-deafness", "fa-dedent", "fa-delicious", "fa-desktop", "fa-deviantart", "fa-diamond", "fa-digg", "fa-dollar", "fa-dot-circle-o", "fa-download", "fa-dribbble", "fa-drivers-license", "fa-drivers-license-o", "fa-dropbox", "fa-drupal", "fa-edge", "fa-edit", "fa-eercast", "fa-eject", "fa-ellipsis-h", "fa-ellipsis-v", "fa-empire", "fa-envelope", "fa-envelope-o", "fa-envelope-open", "fa-envelope-open-o", "fa-envelope-square", "fa-envira", "fa-eraser", "fa-etsy", "fa-eur", "fa-euro", "fa-exchange", "fa-exclamation", "fa-exclamation-circle", "fa-exclamation-triangle", "fa-expand", "fa-expeditedssl", "fa-external-link", "fa-external-link-square", "fa-eye", "fa-eye-slash", "fa-eyedropper", "fa-fa", "fa-facebook", "fa-facebook-f", "fa-facebook-official", "fa-facebook-square", "fa-fast-backward", "fa-fast-forward", "fa-fax", "fa-feed", "fa-female", "fa-fighter-jet", "fa-file", "fa-file-archive-o", "fa-file-audio-o", "fa-file-code-o", "fa-file-excel-o", "fa-file-image-o", "fa-file-movie-o", "fa-file-o", "fa-file-pdf-o", "fa-file-photo-o", "fa-file-picture-o", "fa-file-powerpoint-o", "fa-file-sound-o", "fa-file-text", "fa-file-text-o", "fa-file-video-o", "fa-file-word-o", "fa-file-zip-o", "fa-files-o", "fa-film", "fa-filter", "fa-fire", "fa-fire-extinguisher", "fa-firefox", "fa-first-order", "fa-flag", "fa-flag-checkered", "fa-flag-o", "fa-flash", "fa-flask", "fa-flickr", "fa-floppy-o", "fa-folder", "fa-folder-o", "fa-folder-open", "fa-folder-open-o", "fa-font", "fa-font-awesome", "fa-fonticons", "fa-fort-awesome", "fa-forumbee", "fa-forward", "fa-foursquare", "fa-free-code-camp", "fa-frown-o", "fa-futbol-o", "fa-gamepad", "fa-gavel", "fa-gbp", "fa-ge", "fa-gear", "fa-gears", "fa-genderless", "fa-get-pocket", "fa-gg", "fa-gg-circle", "fa-gift", "fa-git", "fa-git-square", "fa-github", "fa-github-alt", "fa-github-square", "fa-gitlab", "fa-gittip", "fa-glass", "fa-glide", "fa-glide-g", "fa-globe", "fa-google", "fa-google-plus", "fa-google-plus-circle", "fa-google-plus-official", "fa-google-plus-square", "fa-google-wallet", "fa-graduation-cap", "fa-gratipay", "fa-grav", "fa-group", "fa-h-square", "fa-hacker-news", "fa-hand-grab-o", "fa-hand-lizard-o", "fa-hand-o-down", "fa-hand-o-left", "fa-hand-o-right", "fa-hand-o-up", "fa-hand-paper-o", "fa-hand-peace-o", "fa-hand-pointer-o", "fa-hand-rock-o", "fa-hand-scissors-o", "fa-hand-spock-o", "fa-hand-stop-o", "fa-handshake-o", "fa-hard-of-hearing", "fa-hashtag", "fa-hdd-o", "fa-header", "fa-headphones", "fa-heart", "fa-heart-o", "fa-heartbeat", "fa-history", "fa-home", "fa-hospital-o", "fa-hotel", "fa-hourglass", "fa-hourglass-1", "fa-hourglass-2", "fa-hourglass-3", "fa-hourglass-end", "fa-hourglass-half", "fa-hourglass-o", "fa-hourglass-start", "fa-houzz", "fa-html5", "fa-i-cursor", "fa-id-badge", "fa-id-card", "fa-id-card-o", "fa-ils", "fa-image", "fa-imdb", "fa-inbox", "fa-indent", "fa-industry", "fa-info", "fa-info-circle", "fa-inr", "fa-instagram", "fa-institution", "fa-internet-explorer", "fa-intersex", "fa-ioxhost", "fa-italic", "fa-joomla", "fa-jpy", "fa-jsfiddle", "fa-key", "fa-keyboard-o", "fa-krw", "fa-language", "fa-laptop", "fa-lastfm", "fa-lastfm-square", "fa-leaf", "fa-leanpub", "fa-legal", "fa-lemon-o", "fa-level-down", "fa-level-up", "fa-life-bouy", "fa-life-buoy", "fa-life-ring", "fa-life-saver", "fa-lightbulb-o", "fa-line-chart", "fa-link", "fa-linkedin", "fa-linkedin-square", "fa-linode", "fa-linux", "fa-list", "fa-list-alt", "fa-list-ol", "fa-list-ul", "fa-location-arrow", "fa-lock", "fa-long-arrow-down", "fa-long-arrow-left", "fa-long-arrow-right", "fa-long-arrow-up", "fa-low-vision", "fa-magic", "fa-magnet", "fa-mail-forward", "fa-mail-reply", "fa-mail-reply-all", "fa-male", "fa-map", "fa-map-marker", "fa-map-o", "fa-map-pin", "fa-map-signs", "fa-mars", "fa-mars-double", "fa-mars-stroke", "fa-mars-stroke-h", "fa-mars-stroke-v", "fa-maxcdn", "fa-meanpath", "fa-medium", "fa-medkit", "fa-meetup", "fa-meh-o", "fa-mercury", "fa-microchip", "fa-microphone", "fa-microphone-slash", "fa-minus", "fa-minus-circle", "fa-minus-square", "fa-minus-square-o", "fa-mixcloud", "fa-mobile", "fa-mobile-phone", "fa-modx", "fa-money", "fa-moon-o", "fa-mortar-board", "fa-motorcycle", "fa-mouse-pointer", "fa-music", "fa-navicon", "fa-neuter", "fa-newspaper-o", "fa-object-group", "fa-object-ungroup", "fa-odnoklassniki", "fa-odnoklassniki-square", "fa-opencart", "fa-openid", "fa-opera", "fa-optin-monster", "fa-outdent", "fa-pagelines", "fa-paint-brush", "fa-paper-plane", "fa-paper-plane-o", "fa-paperclip", "fa-paragraph", "fa-paste", "fa-pause", "fa-pause-circle", "fa-pause-circle-o", "fa-paw", "fa-paypal", "fa-pencil", "fa-pencil-square", "fa-pencil-square-o", "fa-percent", "fa-phone", "fa-phone-square", "fa-photo", "fa-picture-o", "fa-pie-chart", "fa-pied-piper", "fa-pied-piper-alt", "fa-pied-piper-pp", "fa-pinterest", "fa-pinterest-p", "fa-pinterest-square", "fa-plane", "fa-play", "fa-play-circle", "fa-play-circle-o", "fa-plug", "fa-plus", "fa-plus-circle", "fa-plus-square", "fa-plus-square-o", "fa-podcast", "fa-power-off", "fa-print", "fa-product-hunt", "fa-puzzle-piece", "fa-qq", "fa-qrcode", "fa-question", "fa-question-circle", "fa-question-circle-o", "fa-quora", "fa-quote-left", "fa-quote-right", "fa-ra", "fa-random", "fa-ravelry", "fa-rebel", "fa-recycle", "fa-reddit", "fa-reddit-alien", "fa-reddit-square", "fa-refresh", "fa-registered", "fa-remove", "fa-renren", "fa-reorder", "fa-repeat", "fa-reply", "fa-reply-all", "fa-resistance", "fa-retweet", "fa-rmb", "fa-road", "fa-rocket", "fa-rotate-left", "fa-rotate-right", "fa-rouble", "fa-rss", "fa-rss-square", "fa-rub", "fa-ruble", "fa-rupee", "fa-s15", "fa-safari", "fa-save", "fa-scissors", "fa-scribd", "fa-search", "fa-search-minus", "fa-search-plus", "fa-sellsy", "fa-send", "fa-send-o", "fa-server", "fa-share", "fa-share-alt", "fa-share-alt-square", "fa-share-square", "fa-share-square-o", "fa-shekel", "fa-sheqel", "fa-shield", "fa-ship", "fa-shirtsinbulk", "fa-shopping-bag", "fa-shopping-basket", "fa-shopping-cart", "fa-shower", "fa-sign-in", "fa-sign-language", "fa-sign-out", "fa-signal", "fa-signing", "fa-simplybuilt", "fa-sitemap", "fa-skyatlas", "fa-skype", "fa-slack", "fa-sliders", "fa-slideshare", "fa-smile-o", "fa-snapchat", "fa-snapchat-ghost", "fa-snapchat-square", "fa-snowflake-o", "fa-soccer-ball-o", "fa-sort", "fa-sort-alpha-asc", "fa-sort-alpha-desc", "fa-sort-amount-asc", "fa-sort-amount-desc", "fa-sort-asc", "fa-sort-desc", "fa-sort-down", "fa-sort-numeric-asc", "fa-sort-numeric-desc", "fa-sort-up", "fa-soundcloud", "fa-space-shuttle", "fa-spinner", "fa-spoon", "fa-spotify", "fa-square", "fa-square-o", "fa-stack-exchange", "fa-stack-overflow", "fa-star", "fa-star-half", "fa-star-half-empty", "fa-star-half-full", "fa-star-half-o", "fa-star-o", "fa-steam", "fa-steam-square", "fa-step-backward", "fa-step-forward", "fa-stethoscope", "fa-sticky-note", "fa-sticky-note-o", "fa-stop", "fa-stop-circle", "fa-stop-circle-o", "fa-street-view", "fa-strikethrough", "fa-stumbleupon", "fa-stumbleupon-circle", "fa-subscript", "fa-subway", "fa-suitcase", "fa-sun-o", "fa-superpowers", "fa-superscript", "fa-support", "fa-table", "fa-tablet", "fa-tachometer", "fa-tag", "fa-tags", "fa-tasks", "fa-taxi", "fa-telegram", "fa-television", "fa-tencent-weibo", "fa-terminal", "fa-text-height", "fa-text-width", "fa-th", "fa-th-large", "fa-th-list", "fa-themeisle", "fa-thermometer", "fa-thermometer-0", "fa-thermometer-1", "fa-thermometer-2", "fa-thermometer-3", "fa-thermometer-4", "fa-thermometer-empty", "fa-thermometer-full", "fa-thermometer-half", "fa-thermometer-quarter", "fa-thermometer-three-quarters", "fa-thumb-tack", "fa-thumbs-down", "fa-thumbs-o-down", "fa-thumbs-o-up", "fa-thumbs-up", "fa-ticket", "fa-times", "fa-times-circle", "fa-times-circle-o", "fa-times-rectangle", "fa-times-rectangle-o", "fa-tint", "fa-toggle-down", "fa-toggle-left", "fa-toggle-off", "fa-toggle-on", "fa-toggle-right", "fa-toggle-up", "fa-trademark", "fa-train", "fa-transgender", "fa-transgender-alt", "fa-trash", "fa-trash-o", "fa-tree", "fa-trello", "fa-tripadvisor", "fa-trophy", "fa-truck", "fa-try", "fa-tty", "fa-tumblr", "fa-tumblr-square", "fa-turkish-lira", "fa-tv", "fa-twitch", "fa-twitter", "fa-twitter-square", "fa-umbrella", "fa-underline", "fa-undo", "fa-universal-access", "fa-university", "fa-unlink", "fa-unlock", "fa-unlock-alt", "fa-unsorted", "fa-upload", "fa-usb", "fa-usd", "fa-user", "fa-user-circle", "fa-user-circle-o", "fa-user-md", "fa-user-o", "fa-user-plus", "fa-user-secret", "fa-user-times", "fa-users", "fa-vcard", "fa-vcard-o", "fa-venus", "fa-venus-double", "fa-venus-mars", "fa-viacoin", "fa-viadeo", "fa-viadeo-square", "fa-video-camera", "fa-vimeo", "fa-vimeo-square", "fa-vine", "fa-vk", "fa-volume-control-phone", "fa-volume-down", "fa-volume-off", "fa-volume-up", "fa-warning", "fa-wechat", "fa-weibo", "fa-weixin", "fa-whatsapp", "fa-wheelchair", "fa-wheelchair-alt", "fa-wifi", "fa-wikipedia-w", "fa-window-close", "fa-window-close-o", "fa-window-maximize", "fa-window-minimize", "fa-window-restore", "fa-windows", "fa-won", "fa-wordpress", "fa-wpbeginner", "fa-wpexplorer", "fa-wpforms", "fa-wrench", "fa-xing", "fa-xing-square", "fa-y-combinator", "fa-y-combinator-square", "fa-yahoo", "fa-yc", "fa-yc-square", "fa-yelp", "fa-yen", "fa-yoast", "fa-youtube", "fa-youtube-play", "fa-youtube-square" ]; 1019 | }); --------------------------------------------------------------------------------