From 74687b0e65e0f5e49dcd6ffe032b8a5cd5171610 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Mon, 1 Oct 2018 16:34:28 +0200 Subject: [PATCH] search function --- bl-kernel/admin/themes/booty/css/bludit.css | 11 + bl-kernel/admin/views/dashboard.php | 19 + bl-kernel/boot/rules/60.plugins.php | 3 +- bl-kernel/boot/rules/99.paginator.php | 14 +- bl-kernel/boot/site.php | 1 - bl-kernel/helpers/text.class.php | 12 +- bl-kernel/site.class.php | 2 - bl-languages/en.json | 5 +- bl-plugins/search/css/easy-autocomplete.css | 320 ++++ .../search/css/easy-autocomplete.min.css | 11 + .../search/css/easy-autocomplete.themes.css | 208 +++ .../css/easy-autocomplete.themes.min.css | 11 + bl-plugins/search/css/jquery.modal.min.css | 1 + .../search/css/remodal-default-theme.css | 323 ++++ bl-plugins/search/css/remodal.css | 93 + bl-plugins/search/css/search.css | 8 + .../search/js/jquery.easy-autocomplete.js | 1623 +++++++++++++++++ .../search/js/jquery.easy-autocomplete.min.js | 10 + bl-plugins/search/js/jquery.modal.min.js | 5 + bl-plugins/search/js/remodal.min.js | 10 + bl-plugins/search/js/search.js | 15 + bl-plugins/search/languages/de_CH.json | 8 + bl-plugins/search/languages/de_DE.json | 8 + bl-plugins/search/languages/en.json | 7 + bl-plugins/search/languages/es.json | 9 + bl-plugins/search/languages/fr_FR.json | 9 + bl-plugins/search/languages/it.json | 9 + bl-plugins/search/languages/ru_RU.json | 9 + bl-plugins/search/languages/tr_TR.json | 9 + bl-plugins/search/metadata.json | 10 + bl-plugins/search/plugin.php | 220 +++ 31 files changed, 2987 insertions(+), 16 deletions(-) create mode 100755 bl-plugins/search/css/easy-autocomplete.css create mode 100755 bl-plugins/search/css/easy-autocomplete.min.css create mode 100755 bl-plugins/search/css/easy-autocomplete.themes.css create mode 100755 bl-plugins/search/css/easy-autocomplete.themes.min.css create mode 100755 bl-plugins/search/css/jquery.modal.min.css create mode 100755 bl-plugins/search/css/remodal-default-theme.css create mode 100755 bl-plugins/search/css/remodal.css create mode 100644 bl-plugins/search/css/search.css create mode 100755 bl-plugins/search/js/jquery.easy-autocomplete.js create mode 100755 bl-plugins/search/js/jquery.easy-autocomplete.min.js create mode 100755 bl-plugins/search/js/jquery.modal.min.js create mode 100755 bl-plugins/search/js/remodal.min.js create mode 100644 bl-plugins/search/js/search.js create mode 100644 bl-plugins/search/languages/de_CH.json create mode 100644 bl-plugins/search/languages/de_DE.json create mode 100644 bl-plugins/search/languages/en.json create mode 100644 bl-plugins/search/languages/es.json create mode 100644 bl-plugins/search/languages/fr_FR.json create mode 100644 bl-plugins/search/languages/it.json create mode 100644 bl-plugins/search/languages/ru_RU.json create mode 100644 bl-plugins/search/languages/tr_TR.json create mode 100644 bl-plugins/search/metadata.json create mode 100644 bl-plugins/search/plugin.php diff --git a/bl-kernel/admin/themes/booty/css/bludit.css b/bl-kernel/admin/themes/booty/css/bludit.css index c8cde06e..e2c477ce 100644 --- a/bl-kernel/admin/themes/booty/css/bludit.css +++ b/bl-kernel/admin/themes/booty/css/bludit.css @@ -91,6 +91,10 @@ body.login { #dashboard ul.list-group.list-group-striped li { border: none; + word-break: break-word; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; } #dashboard ul.list-group.list-group-striped li:nth-of-type(even) { @@ -112,6 +116,13 @@ body.login { color: #4586d4; } +#good-message { + margin-bottom: 20px; + border: 1px solid #f1f1f1; + padding: 20px; + color: #777; +} + .ct-series-a .ct-line { /* Set the colour of this series line */ stroke: #4a90e2; diff --git a/bl-kernel/admin/views/dashboard.php b/bl-kernel/admin/views/dashboard.php index b3076241..f154c029 100644 --- a/bl-kernel/admin/views/dashboard.php +++ b/bl-kernel/admin/views/dashboard.php @@ -2,6 +2,25 @@
+ +
+

Hello!

+ +
+

p('Quick links') ?>

diff --git a/bl-kernel/boot/rules/60.plugins.php b/bl-kernel/boot/rules/60.plugins.php index 89f7cccb..5d12ccd4 100644 --- a/bl-kernel/boot/rules/60.plugins.php +++ b/bl-kernel/boot/rules/60.plugins.php @@ -24,10 +24,11 @@ $plugins = array( 'adminContentSidebar'=>array(), 'dashboard'=>array(), - 'beforeRulesLoad'=>array(), 'beforeAll'=>array(), 'afterAll'=>array(), + 'paginator'=>array(), + 'afterPageCreate'=>array(), 'afterPageModify'=>array(), 'afterPageDelete'=>array(), diff --git a/bl-kernel/boot/rules/99.paginator.php b/bl-kernel/boot/rules/99.paginator.php index cd1ffb12..6324398e 100644 --- a/bl-kernel/boot/rules/99.paginator.php +++ b/bl-kernel/boot/rules/99.paginator.php @@ -4,25 +4,25 @@ $currentPage = $url->pageNumber(); Paginator::set('currentPage', $currentPage); -if($url->whereAmI()=='admin') { +if ($url->whereAmI()=='admin') { $itemsPerPage = ITEMS_PER_PAGE_ADMIN; $numberOfItems = $pages->count(true); -} -elseif($url->whereAmI()=='tag') { +} elseif ($url->whereAmI()=='tag') { $itemsPerPage = $site->itemsPerPage(); $tagKey = $url->slug(); $numberOfItems = $tags->numberOfPages($tagKey); -} -elseif($url->whereAmI()=='category') { +} elseif ($url->whereAmI()=='category') { $itemsPerPage = $site->itemsPerPage(); $categoryKey = $url->slug(); $numberOfItems = $categories->numberOfPages($categoryKey); -} -else { +} else { $itemsPerPage = $site->itemsPerPage(); $numberOfItems = $pages->count(true); } +// Execute hook from plugins +Theme::plugins('paginator'); + // Items per page Paginator::set('itemsPerPage', $itemsPerPage); diff --git a/bl-kernel/boot/site.php b/bl-kernel/boot/site.php index 5616c768..e41590dc 100644 --- a/bl-kernel/boot/site.php +++ b/bl-kernel/boot/site.php @@ -33,4 +33,3 @@ Theme::plugins('afterSiteLoad'); // Plugins after all Theme::plugins('afterAll'); - diff --git a/bl-kernel/helpers/text.class.php b/bl-kernel/helpers/text.class.php index 59c89f3a..ec1e4573 100644 --- a/bl-kernel/helpers/text.class.php +++ b/bl-kernel/helpers/text.class.php @@ -190,14 +190,18 @@ class Text { } // Find position of first occurrence of substring in a string otherwise returns FALSE. - public static function stringPosition($string, $substring) + public static function stringPosition($string, $substring, $caseSensitive=true) { - return mb_strpos($string, $substring, 0, CHARSET); + if ($caseSensitive) { + return mb_strpos($string, $substring, 0, CHARSET); + } + + return mb_stripos($string, $substring, 0, CHARSET); } - public static function stringContains($string, $substring) + public static function stringContains($string, $substring, $caseSensitive=true) { - return (self::stringPosition($string, $substring) !== false); + return (self::stringPosition($string, $substring, $caseSensitive) !== false); } // Returns the portion of string specified by the start and length parameters. diff --git a/bl-kernel/site.class.php b/bl-kernel/site.class.php index 178a941c..93d9949c 100644 --- a/bl-kernel/site.class.php +++ b/bl-kernel/site.class.php @@ -248,8 +248,6 @@ class Site extends dbJSON { return $this->getField('url'); } - - // Returns the protocol and the domain, without the base url // For example, http://www.domain.com public function domain() diff --git a/bl-languages/en.json b/bl-languages/en.json index 4938c77f..e983372e 100644 --- a/bl-languages/en.json +++ b/bl-languages/en.json @@ -356,5 +356,8 @@ "last": "Last", "there-are-no-pages-at-this-moment": "There are no pages at this moment.", "there-are-no-static-pages-at-this-moment": "There are no static pages at this moment.", - "there-are-no-draft-pages-at-this-moment": "There are no draft pages at this moment." + "there-are-no-draft-pages-at-this-moment": "There are no draft pages at this moment.", + "good-morning": "Good morning!", + "good-afternoon": "Good afternoon!", + "good-evening": "Good evening!" } \ No newline at end of file diff --git a/bl-plugins/search/css/easy-autocomplete.css b/bl-plugins/search/css/easy-autocomplete.css new file mode 100755 index 00000000..3351771b --- /dev/null +++ b/bl-plugins/search/css/easy-autocomplete.css @@ -0,0 +1,320 @@ +/* + * easy-autocomplete + * jQuery plugin for autocompletion + * + * @author Łukasz Pawełczak (http://github.com/pawelczak) + * @version 1.3.5 + * Copyright License: + */ + +.easy-autocomplete { + position: relative; +} +.easy-autocomplete input { + border-color: #ccc; + border-radius: 4px; + border-style: solid; + border-width: 1px; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset; + color: #555; + float: none; + padding: 6px 12px; +} +.easy-autocomplete input:hover, .easy-autocomplete input:focus { + box-shadow: none; +} +.easy-autocomplete a { + display: block; +} +.easy-autocomplete.eac-blue-light input:hover, .easy-autocomplete.eac-blue-light input:focus { + border-color: #66afe9; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6); +} +.easy-autocomplete.eac-blue-light ul { + border-color: #66afe9; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6); +} +.easy-autocomplete.eac-blue-light ul li, .easy-autocomplete.eac-blue-light ul .eac-category { + border-color: #66afe9; +} +.easy-autocomplete.eac-blue-light ul li.selected, .easy-autocomplete.eac-blue-light ul .eac-category.selected { + background-color: #ecf5fc; +} +.easy-autocomplete.eac-green-light input:hover, .easy-autocomplete.eac-green-light input:focus { + border-color: #41DB00; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(146, 237, 107, 0.6); +} +.easy-autocomplete.eac-green-light ul { + border-color: #41DB00; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(146, 237, 107, 0.6); +} +.easy-autocomplete.eac-green-light ul li, .easy-autocomplete.eac-green-light ul .eac-category { + border-color: #41DB00; +} +.easy-autocomplete.eac-green-light ul li.selected, .easy-autocomplete.eac-green-light ul .eac-category.selected { + background-color: #9eff75; +} +.easy-autocomplete.eac-red-light input:hover, .easy-autocomplete.eac-red-light input:focus { + border-color: #ff5b5b; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(255, 90, 90, 0.6); +} +.easy-autocomplete.eac-red-light ul { + border-color: #ff5b5b; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(255, 90, 90, 0.6); +} +.easy-autocomplete.eac-red-light ul li, .easy-autocomplete.eac-red-light ul .eac-category { + border-color: #ff5b5b; +} +.easy-autocomplete.eac-red-light ul li.selected, .easy-autocomplete.eac-red-light ul .eac-category.selected { + background-color: #ff8e8e; +} +.easy-autocomplete.eac-yellow-light input:hover, .easy-autocomplete.eac-yellow-light input:focus { + border-color: #ffdb00; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(255, 231, 84, 0.6); +} +.easy-autocomplete.eac-yellow-light ul { + border-color: #ffdb00; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(255, 231, 84, 0.6); +} +.easy-autocomplete.eac-yellow-light ul li, .easy-autocomplete.eac-yellow-light ul .eac-category { + border-color: #ffdb00; +} +.easy-autocomplete.eac-yellow-light ul li.selected, .easy-autocomplete.eac-yellow-light ul .eac-category.selected { + background-color: #ffe233; +} +.easy-autocomplete.eac-dark-light input:hover, .easy-autocomplete.eac-dark-light input:focus { + border-color: #333; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(55, 55, 55, 0.6); +} +.easy-autocomplete.eac-dark-light ul { + border-color: #333; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(55, 55, 55, 0.6); +} +.easy-autocomplete.eac-dark-light ul li, .easy-autocomplete.eac-dark-light ul .eac-category { + border-color: #333; +} +.easy-autocomplete.eac-dark-light ul li.selected, .easy-autocomplete.eac-dark-light ul .eac-category.selected { + background-color: #4d4d4d; + color: #fff; +} +.easy-autocomplete.eac-dark { + color: #fff; +} +.easy-autocomplete.eac-dark input { + background-color: #404040; + border-radius: 4px; + box-shadow: 0; + color: #f6f6f6; +} +.easy-autocomplete.eac-dark input:hover, .easy-autocomplete.eac-dark input:focus { + border-color: #333; + box-shadow: 0; +} +.easy-autocomplete.eac-dark ul { + border-color: #333; +} +.easy-autocomplete.eac-dark ul li, .easy-autocomplete.eac-dark ul .eac-category { + background-color: #404040; + border-color: #333; +} +.easy-autocomplete.eac-dark ul li.selected, .easy-autocomplete.eac-dark ul .eac-category.selected { + background-color: #737373; + color: #f6f6f6; +} +.easy-autocomplete.eac-dark-glass { + color: #fff; +} +.easy-autocomplete.eac-dark-glass input { + background-color: rgba(0, 0, 0, 0.8); + border-radius: 4px; + box-shadow: 0; + color: #f6f6f6; +} +.easy-autocomplete.eac-dark-glass input:hover, .easy-autocomplete.eac-dark-glass input:focus { + border-color: rgba(0, 0, 0, 0.8); + box-shadow: 0; +} +.easy-autocomplete.eac-dark-glass ul { + border-color: rgba(0, 0, 0, 0.8); +} +.easy-autocomplete.eac-dark-glass ul li, .easy-autocomplete.eac-dark-glass ul .eac-category { + background-color: rgba(0, 0, 0, 0.8); + border-color: rgba(0, 0, 0, 0.8); +} +.easy-autocomplete.eac-dark-glass ul li.selected, .easy-autocomplete.eac-dark-glass ul .eac-category.selected { + background-color: rgba(64, 64, 64, 0.8); + color: #f6f6f6; +} +.easy-autocomplete.eac-dark-glass ul li:last-child, .easy-autocomplete.eac-dark-glass ul .eac-category:last-child { + border-radius: 0 0 4px 4px; +} +.easy-autocomplete.eac-blue { + color: #fff; +} +.easy-autocomplete.eac-blue input { + background-color: #6d9ed1; + border-radius: 4px; + box-shadow: 0; + color: #f6f6f6; +} +.easy-autocomplete.eac-blue input::-webkit-input-placeholder { + color: #f6f6f6; +} +.easy-autocomplete.eac-blue input:-moz-placeholder { + color: #f6f6f6; +} +.easy-autocomplete.eac-blue input::-moz-placeholder { + color: #f6f6f6; +} +.easy-autocomplete.eac-blue input:-ms-input-placeholder { + color: #f6f6f6; +} +.easy-autocomplete.eac-blue input:hover, .easy-autocomplete.eac-blue input:focus { + border-color: #5A91CB; + box-shadow: 0; +} +.easy-autocomplete.eac-blue ul { + border-color: #5A91CB; +} +.easy-autocomplete.eac-blue ul li, .easy-autocomplete.eac-blue ul .eac-category { + background-color: #6d9ed1; + border-color: #5A91CB; +} +.easy-autocomplete.eac-blue ul li.selected, .easy-autocomplete.eac-blue ul .eac-category.selected { + background-color: #94b8dd; + color: #f6f6f6; +} +.easy-autocomplete.eac-yellow { + color: #333; +} +.easy-autocomplete.eac-yellow input { + background-color: #ffdb7e; + border-color: #333; + border-radius: 4px; + box-shadow: 0; + color: #333; +} +.easy-autocomplete.eac-yellow input:hover, .easy-autocomplete.eac-yellow input:focus { + border-color: #333; + box-shadow: 0; +} +.easy-autocomplete.eac-yellow ul { + border-color: #333; +} +.easy-autocomplete.eac-yellow ul li, .easy-autocomplete.eac-yellow ul .eac-category { + background-color: #ffdb7e; + border-color: #333; +} +.easy-autocomplete.eac-yellow ul li.selected, .easy-autocomplete.eac-yellow ul .eac-category.selected { + background-color: #ffe9b1; + color: #333; +} +.easy-autocomplete.eac-purple { + color: #333; +} +.easy-autocomplete.eac-purple input { + background-color: #d6d1e7; + border-color: #b8afd5; + box-shadow: 0; + color: #333; +} +.easy-autocomplete.eac-purple input:hover, .easy-autocomplete.eac-purple input:focus { + border-color: #333; + box-shadow: 0; +} +.easy-autocomplete.eac-purple ul { + border-color: #333; +} +.easy-autocomplete.eac-purple ul li, .easy-autocomplete.eac-purple ul .eac-category { + background-color: #d6d1e7; + border-color: #333; +} +.easy-autocomplete.eac-purple ul li.selected, .easy-autocomplete.eac-purple ul .eac-category.selected { + background-color: #ebe8f3; + color: #333; +} +.easy-autocomplete.eac-bootstrap input { + border-color: #ccc; + border-radius: 4px; + border-style: solid; + border-width: 1px; + color: #555; + padding: 6px 12px; +} + +.easy-autocomplete-container { + left: 0; + position: absolute; + width: 100%; + z-index: 2; +} +.easy-autocomplete-container ul { + background: none repeat scroll 0 0 #ffffff; + border-top: 1px dotted #ccc; + display: none; + margin-top: 0; + padding-bottom: 0; + padding-left: 0; + position: relative; + top: -1px; +} +.easy-autocomplete-container ul li, .easy-autocomplete-container ul .eac-category { + background: inherit; + border-color: #ccc; + border-image: none; + border-style: solid; + border-width: 0 1px; + display: block; + font-size: 14px; + font-weight: normal; + padding: 4px 12px; +} +.easy-autocomplete-container ul li:last-child { + border-radius: 0 0 2px 2px; + border-width: 0 1px 1px; +} +.easy-autocomplete-container ul li.selected { + background: none repeat scroll 0 0 #ebebeb; + cursor: pointer; +} +.easy-autocomplete-container ul li.selected div { + font-weight: normal; +} +.easy-autocomplete-container ul li div { + display: block; + font-weight: normal; + word-break: break-all; +} +.easy-autocomplete-container ul li b { + font-weight: bold; +} +.easy-autocomplete-container ul .eac-category { + font-color: #aaa; + font-style: italic; +} + +.eac-description .eac-item span { + color: #aaa; + font-style: italic; + font-size: 0.9em; +} + +.eac-icon-left .eac-item img { + margin-right: 4px; + max-height: 30px; +} + +.eac-icon-right .eac-item { + margin-top: 8px; + min-height: 24px; + position: relative; +} +.eac-icon-right .eac-item img { + margin-left: 4px; + max-height: 30px; + position: absolute; + right: -4px; + top: -8px; +} + +/*# sourceMappingURL=easy-autocomplete.css.map */ diff --git a/bl-plugins/search/css/easy-autocomplete.min.css b/bl-plugins/search/css/easy-autocomplete.min.css new file mode 100755 index 00000000..b5c08750 --- /dev/null +++ b/bl-plugins/search/css/easy-autocomplete.min.css @@ -0,0 +1,11 @@ +/* + * easy-autocomplete + * jQuery plugin for autocompletion + * + * @author Łukasz Pawełczak (http://github.com/pawelczak) + * @version 1.3.5 + * Copyright License: + */ + +.easy-autocomplete{position:relative}.easy-autocomplete input{border-color:#ccc;border-radius:4px;border-style:solid;border-width:1px;box-shadow:0 1px 2px rgba(0,0,0,0.1) inset;color:#555;float:none;padding:6px 12px}.easy-autocomplete input:hover,.easy-autocomplete input:focus{box-shadow:none}.easy-autocomplete a{display:block}.easy-autocomplete.eac-blue-light input:hover,.easy-autocomplete.eac-blue-light input:focus{border-color:#66afe9;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(102,175,233,0.6)}.easy-autocomplete.eac-blue-light ul{border-color:#66afe9;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(102,175,233,0.6)}.easy-autocomplete.eac-blue-light ul li,.easy-autocomplete.eac-blue-light ul .eac-category{border-color:#66afe9}.easy-autocomplete.eac-blue-light ul li.selected,.easy-autocomplete.eac-blue-light ul .eac-category.selected{background-color:#ecf5fc}.easy-autocomplete.eac-green-light input:hover,.easy-autocomplete.eac-green-light input:focus{border-color:#41DB00;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(146,237,107,0.6)}.easy-autocomplete.eac-green-light ul{border-color:#41DB00;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(146,237,107,0.6)}.easy-autocomplete.eac-green-light ul li,.easy-autocomplete.eac-green-light ul .eac-category{border-color:#41DB00}.easy-autocomplete.eac-green-light ul li.selected,.easy-autocomplete.eac-green-light ul .eac-category.selected{background-color:#9eff75}.easy-autocomplete.eac-red-light input:hover,.easy-autocomplete.eac-red-light input:focus{border-color:#ff5b5b;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(255,90,90,0.6)}.easy-autocomplete.eac-red-light ul{border-color:#ff5b5b;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(255,90,90,0.6)}.easy-autocomplete.eac-red-light ul li,.easy-autocomplete.eac-red-light ul .eac-category{border-color:#ff5b5b}.easy-autocomplete.eac-red-light ul li.selected,.easy-autocomplete.eac-red-light ul .eac-category.selected{background-color:#ff8e8e}.easy-autocomplete.eac-yellow-light input:hover,.easy-autocomplete.eac-yellow-light input:focus{border-color:#ffdb00;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(255,231,84,0.6)}.easy-autocomplete.eac-yellow-light ul{border-color:#ffdb00;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(255,231,84,0.6)}.easy-autocomplete.eac-yellow-light ul li,.easy-autocomplete.eac-yellow-light ul .eac-category{border-color:#ffdb00}.easy-autocomplete.eac-yellow-light ul li.selected,.easy-autocomplete.eac-yellow-light ul .eac-category.selected{background-color:#ffe233}.easy-autocomplete.eac-dark-light input:hover,.easy-autocomplete.eac-dark-light input:focus{border-color:#333;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(55,55,55,0.6)}.easy-autocomplete.eac-dark-light ul{border-color:#333;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset,0 0 8px rgba(55,55,55,0.6)}.easy-autocomplete.eac-dark-light ul li,.easy-autocomplete.eac-dark-light ul .eac-category{border-color:#333}.easy-autocomplete.eac-dark-light ul li.selected,.easy-autocomplete.eac-dark-light ul .eac-category.selected{background-color:#4d4d4d;color:#fff}.easy-autocomplete.eac-dark{color:#fff}.easy-autocomplete.eac-dark input{background-color:#404040;border-radius:4px;box-shadow:0;color:#f6f6f6}.easy-autocomplete.eac-dark input:hover,.easy-autocomplete.eac-dark input:focus{border-color:#333;box-shadow:0}.easy-autocomplete.eac-dark ul{border-color:#333}.easy-autocomplete.eac-dark ul li,.easy-autocomplete.eac-dark ul .eac-category{background-color:#404040;border-color:#333}.easy-autocomplete.eac-dark ul li.selected,.easy-autocomplete.eac-dark ul .eac-category.selected{background-color:#737373;color:#f6f6f6}.easy-autocomplete.eac-dark-glass{color:#fff}.easy-autocomplete.eac-dark-glass input{background-color:rgba(0,0,0,0.8);border-radius:4px;box-shadow:0;color:#f6f6f6}.easy-autocomplete.eac-dark-glass input:hover,.easy-autocomplete.eac-dark-glass input:focus{border-color:rgba(0,0,0,0.8);box-shadow:0}.easy-autocomplete.eac-dark-glass ul{border-color:rgba(0,0,0,0.8)}.easy-autocomplete.eac-dark-glass ul li,.easy-autocomplete.eac-dark-glass ul .eac-category{background-color:rgba(0,0,0,0.8);border-color:rgba(0,0,0,0.8)}.easy-autocomplete.eac-dark-glass ul li.selected,.easy-autocomplete.eac-dark-glass ul .eac-category.selected{background-color:rgba(64,64,64,0.8);color:#f6f6f6}.easy-autocomplete.eac-dark-glass ul li:last-child,.easy-autocomplete.eac-dark-glass ul .eac-category:last-child{border-radius:0 0 4px 4px}.easy-autocomplete.eac-blue{color:#fff}.easy-autocomplete.eac-blue input{background-color:#6d9ed1;border-radius:4px;box-shadow:0;color:#f6f6f6}.easy-autocomplete.eac-blue input::-webkit-input-placeholder{color:#f6f6f6}.easy-autocomplete.eac-blue input:-moz-placeholder{color:#f6f6f6}.easy-autocomplete.eac-blue input::-moz-placeholder{color:#f6f6f6}.easy-autocomplete.eac-blue input:-ms-input-placeholder{color:#f6f6f6}.easy-autocomplete.eac-blue input:hover,.easy-autocomplete.eac-blue input:focus{border-color:#5A91CB;box-shadow:0}.easy-autocomplete.eac-blue ul{border-color:#5A91CB}.easy-autocomplete.eac-blue ul li,.easy-autocomplete.eac-blue ul .eac-category{background-color:#6d9ed1;border-color:#5A91CB}.easy-autocomplete.eac-blue ul li.selected,.easy-autocomplete.eac-blue ul .eac-category.selected{background-color:#94b8dd;color:#f6f6f6}.easy-autocomplete.eac-yellow{color:#333}.easy-autocomplete.eac-yellow input{background-color:#ffdb7e;border-color:#333;border-radius:4px;box-shadow:0;color:#333}.easy-autocomplete.eac-yellow input:hover,.easy-autocomplete.eac-yellow input:focus{border-color:#333;box-shadow:0}.easy-autocomplete.eac-yellow ul{border-color:#333}.easy-autocomplete.eac-yellow ul li,.easy-autocomplete.eac-yellow ul .eac-category{background-color:#ffdb7e;border-color:#333}.easy-autocomplete.eac-yellow ul li.selected,.easy-autocomplete.eac-yellow ul .eac-category.selected{background-color:#ffe9b1;color:#333}.easy-autocomplete.eac-purple{color:#333}.easy-autocomplete.eac-purple input{background-color:#d6d1e7;border-color:#b8afd5;box-shadow:0;color:#333}.easy-autocomplete.eac-purple input:hover,.easy-autocomplete.eac-purple input:focus{border-color:#333;box-shadow:0}.easy-autocomplete.eac-purple ul{border-color:#333}.easy-autocomplete.eac-purple ul li,.easy-autocomplete.eac-purple ul .eac-category{background-color:#d6d1e7;border-color:#333}.easy-autocomplete.eac-purple ul li.selected,.easy-autocomplete.eac-purple ul .eac-category.selected{background-color:#ebe8f3;color:#333}.easy-autocomplete.eac-bootstrap input{border-color:#ccc;border-radius:4px;border-style:solid;border-width:1px;color:#555;padding:6px 12px}.easy-autocomplete-container{left:0;position:absolute;width:100%;z-index:2}.easy-autocomplete-container ul{background:none repeat scroll 0 0 #ffffff;border-top:1px dotted #ccc;display:none;margin-top:0;padding-bottom:0;padding-left:0;position:relative;top:-1px}.easy-autocomplete-container ul li,.easy-autocomplete-container ul .eac-category{background:inherit;border-color:#ccc;border-image:none;border-style:solid;border-width:0 1px;display:block;font-size:14px;font-weight:normal;padding:4px 12px}.easy-autocomplete-container ul li:last-child{border-radius:0 0 2px 2px;border-width:0 1px 1px}.easy-autocomplete-container ul li.selected{background:none repeat scroll 0 0 #ebebeb;cursor:pointer}.easy-autocomplete-container ul li.selected div{font-weight:normal}.easy-autocomplete-container ul li div{display:block;font-weight:normal;word-break:break-all}.easy-autocomplete-container ul li b{font-weight:bold}.easy-autocomplete-container ul .eac-category{font-color:#aaa;font-style:italic}.eac-description .eac-item span{color:#aaa;font-style:italic;font-size:0.9em}.eac-icon-left .eac-item img{margin-right:4px;max-height:30px}.eac-icon-right .eac-item{margin-top:8px;min-height:24px;position:relative}.eac-icon-right .eac-item img{margin-left:4px;max-height:30px;position:absolute;right:-4px;top:-8px} +/*# sourceMappingURL=easy-autocomplete.min.css.map */ diff --git a/bl-plugins/search/css/easy-autocomplete.themes.css b/bl-plugins/search/css/easy-autocomplete.themes.css new file mode 100755 index 00000000..e005d7a9 --- /dev/null +++ b/bl-plugins/search/css/easy-autocomplete.themes.css @@ -0,0 +1,208 @@ +/* + * easy-autocomplete + * jQuery plugin for autocompletion + * + * @author Łukasz Pawełczak (http://github.com/pawelczak) + * @version 1.3.5 + * Copyright License: + */ + +.easy-autocomplete { + /* Theme Square */ + /* Round */ + /* Funky */ + /* Solid */ + /* Plate */ +} +.easy-autocomplete.eac-square { + font-family: "Roboto", "Helvetica Neue",Helvetica,Arial,sans-serif; +} +.easy-autocomplete.eac-square input { + border: 1px solid #7f8c8d; + border-radius: 0; + color: #7f8c8d; + font-family: inherit; + font-size: 18px; + font-style: italic; + font-weight: 300; + margin: 0; + min-width: 350px; + padding: 12px 43px 12px 15px; +} +.easy-autocomplete.eac-square ul { + border-color: #7f8c8d; + border-top: 0; + box-shadow: none; + top: 0; +} +.easy-autocomplete.eac-square ul li, .easy-autocomplete.eac-square ul .eac-category { + border-color: #7f8c8d; + font-family: inherit; + font-size: 16px; + font-weight: 300; + padding: 6px 12px; + transition: all 0.4s ease 0s; +} +.easy-autocomplete.eac-square ul li *, .easy-autocomplete.eac-square ul .eac-category * { + font-weight: 300; +} +.easy-autocomplete.eac-square ul li.selected, .easy-autocomplete.eac-square ul .eac-category.selected { + background-color: #f1f1f1; + font-weight: 300; +} +.easy-autocomplete.eac-square ul li b, .easy-autocomplete.eac-square ul .eac-category b { + font-weight: 600; +} +.easy-autocomplete.eac-round { + font-family: "Open Sans", "Helvetica Neue",Helvetica,Arial,sans-serif; +} +.easy-autocomplete.eac-round input { + border: 2px solid #888; + border-radius: 10px; + color: #888; + font-family: inherit; + font-size: 16px; + font-weight: 400; + margin: 0; + min-width: 300px; + padding: 10px; +} +.easy-autocomplete.eac-round input:hover, .easy-autocomplete.eac-round input:focus { + border-color: #3079ed; +} +.easy-autocomplete.eac-round ul { + background: none; + border-color: #888; + border-width: 0; + box-shadow: none; + min-width: 300px; + top: 20px; +} +.easy-autocomplete.eac-round ul li, .easy-autocomplete.eac-round ul .eac-category { + background: #fff; + border-color: #3079ed; + border-width: 0 2px; + font-size: 14px; + padding: 8px 12px; + transition: all 0.4s ease 0s; +} +.easy-autocomplete.eac-round ul li.selected, .easy-autocomplete.eac-round ul .eac-category.selected { + background-color: #d4e3fb; +} +.easy-autocomplete.eac-round ul li:first-child, .easy-autocomplete.eac-round ul .eac-category:first-child { + border-radius: 10px 10px 0 0; + border-width: 2px 2px 0; +} +.easy-autocomplete.eac-round ul li:last-child, .easy-autocomplete.eac-round ul .eac-category:last-child { + border-radius: 0 0 10px 10px; + border-width: 0 2px 2px; +} +.easy-autocomplete.eac-round ul li b, .easy-autocomplete.eac-round ul .eac-category b { + font-weight: 700; +} +.easy-autocomplete.eac-funky { + font-family: "Inconsolata", "Helvetica Neue",Helvetica,Arial,sans-serif; +} +.easy-autocomplete.eac-funky input { + background: #07ED89; + border: 0; + border-radius: 0; + color: #ED076B; + font-family: inherit; + font-size: 18px; + min-width: 240px; + padding: 12px; +} +.easy-autocomplete.eac-funky ul { + background: transparent; + border: 0; +} +.easy-autocomplete.eac-funky ul li, .easy-autocomplete.eac-funky ul .eac-category { + background: transparent; + border: 0; + color: #ED076B; + font-size: 18px; + padding: 4px 12px; + transition: all 0.4s ease 0s; +} +.easy-autocomplete.eac-funky ul li.selected, .easy-autocomplete.eac-funky ul .eac-category.selected { + color: #8907ED; +} +.easy-autocomplete.eac-solid input { + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) inset; + border-color: #ddd; + color: #666; + font-size: 13px; + min-height: 0; + padding: 6px 12px; +} +.easy-autocomplete.eac-solid ul li, .easy-autocomplete.eac-solid ul .eac-category { + transition: all 0.4s ease 0s; +} +.easy-autocomplete.eac-solid ul li.selected, .easy-autocomplete.eac-solid ul .eac-category.selected { + background-color: #f2f2f2; +} +.easy-autocomplete.eac-plate { + font-family: "Open Sans", "Helvetica Neue",Helvetica,Arial,sans-serif; +} +.easy-autocomplete.eac-plate input { + font-size: 13px; + padding: 6px 12px; +} +.easy-autocomplete.eac-plate ul { + background: #b5b5b5; + border-radius: 6px; + border-width: 0; + top: 10px; +} +.easy-autocomplete.eac-plate ul li, .easy-autocomplete.eac-plate ul .eac-category { + background: #b5b5b5; + color: #FAFAFA; + font-size: 12px; + transition: all 0.4s ease 0s; +} +.easy-autocomplete.eac-plate ul li b, .easy-autocomplete.eac-plate ul .eac-category b { + color: #ffd464; +} +.easy-autocomplete.eac-plate ul li.selected, .easy-autocomplete.eac-plate ul .eac-category.selected { + background: #656565; +} +.easy-autocomplete.eac-plate ul li:first-child, .easy-autocomplete.eac-plate ul .eac-category:first-child { + border-radius: 6px 6px 0 0; +} +.easy-autocomplete.eac-plate ul li:last-child, .easy-autocomplete.eac-plate ul .eac-category:last-child { + border-radius: 0 0 6px 6px; +} +.easy-autocomplete.eac-plate-dark { + font-family: "Open Sans", "Helvetica Neue",Helvetica,Arial,sans-serif; +} +.easy-autocomplete.eac-plate-dark input { + font-size: 13px; + padding: 6px 12px; +} +.easy-autocomplete.eac-plate-dark ul { + background: #212121; + border-radius: 6px; + border-width: 0; + top: 10px; +} +.easy-autocomplete.eac-plate-dark ul li, .easy-autocomplete.eac-plate-dark ul .eac-category { + background: #212121; + color: #FAFAFA; + font-size: 12px; + transition: all 0.4s ease 0s; +} +.easy-autocomplete.eac-plate-dark ul li b, .easy-autocomplete.eac-plate-dark ul .eac-category b { + color: #ffd464; +} +.easy-autocomplete.eac-plate-dark ul li.selected, .easy-autocomplete.eac-plate-dark ul .eac-category.selected { + background: #656565; +} +.easy-autocomplete.eac-plate-dark ul li:first-child, .easy-autocomplete.eac-plate-dark ul .eac-category:first-child { + border-radius: 6px 6px 0 0; +} +.easy-autocomplete.eac-plate-dark ul li:last-child, .easy-autocomplete.eac-plate-dark ul .eac-category:last-child { + border-radius: 0 0 6px 6px; +} + +/*# sourceMappingURL=easy-autocomplete.themes.css.map */ diff --git a/bl-plugins/search/css/easy-autocomplete.themes.min.css b/bl-plugins/search/css/easy-autocomplete.themes.min.css new file mode 100755 index 00000000..37ac6938 --- /dev/null +++ b/bl-plugins/search/css/easy-autocomplete.themes.min.css @@ -0,0 +1,11 @@ +/* + * easy-autocomplete + * jQuery plugin for autocompletion + * + * @author Łukasz Pawełczak (http://github.com/pawelczak) + * @version 1.3.5 + * Copyright License: + */ + +.easy-autocomplete.eac-square{font-family:"Roboto", "Helvetica Neue",Helvetica,Arial,sans-serif}.easy-autocomplete.eac-square input{border:1px solid #7f8c8d;border-radius:0;color:#7f8c8d;font-family:inherit;font-size:18px;font-style:italic;font-weight:300;margin:0;min-width:350px;padding:12px 43px 12px 15px}.easy-autocomplete.eac-square ul{border-color:#7f8c8d;border-top:0;box-shadow:none;top:0}.easy-autocomplete.eac-square ul li,.easy-autocomplete.eac-square ul .eac-category{border-color:#7f8c8d;font-family:inherit;font-size:16px;font-weight:300;padding:6px 12px;transition:all 0.4s ease 0s}.easy-autocomplete.eac-square ul li *,.easy-autocomplete.eac-square ul .eac-category *{font-weight:300}.easy-autocomplete.eac-square ul li.selected,.easy-autocomplete.eac-square ul .eac-category.selected{background-color:#f1f1f1;font-weight:300}.easy-autocomplete.eac-square ul li b,.easy-autocomplete.eac-square ul .eac-category b{font-weight:600}.easy-autocomplete.eac-round{font-family:"Open Sans", "Helvetica Neue",Helvetica,Arial,sans-serif}.easy-autocomplete.eac-round input{border:2px solid #888;border-radius:10px;color:#888;font-family:inherit;font-size:16px;font-weight:400;margin:0;min-width:300px;padding:10px}.easy-autocomplete.eac-round input:hover,.easy-autocomplete.eac-round input:focus{border-color:#3079ed}.easy-autocomplete.eac-round ul{background:none;border-color:#888;border-width:0;box-shadow:none;min-width:300px;top:20px}.easy-autocomplete.eac-round ul li,.easy-autocomplete.eac-round ul .eac-category{background:#fff;border-color:#3079ed;border-width:0 2px;font-size:14px;padding:8px 12px;transition:all 0.4s ease 0s}.easy-autocomplete.eac-round ul li.selected,.easy-autocomplete.eac-round ul .eac-category.selected{background-color:#d4e3fb}.easy-autocomplete.eac-round ul li:first-child,.easy-autocomplete.eac-round ul .eac-category:first-child{border-radius:10px 10px 0 0;border-width:2px 2px 0}.easy-autocomplete.eac-round ul li:last-child,.easy-autocomplete.eac-round ul .eac-category:last-child{border-radius:0 0 10px 10px;border-width:0 2px 2px}.easy-autocomplete.eac-round ul li b,.easy-autocomplete.eac-round ul .eac-category b{font-weight:700}.easy-autocomplete.eac-funky{font-family:"Inconsolata", "Helvetica Neue",Helvetica,Arial,sans-serif}.easy-autocomplete.eac-funky input{background:#07ED89;border:0;border-radius:0;color:#ED076B;font-family:inherit;font-size:18px;min-width:240px;padding:12px}.easy-autocomplete.eac-funky ul{background:transparent;border:0}.easy-autocomplete.eac-funky ul li,.easy-autocomplete.eac-funky ul .eac-category{background:transparent;border:0;color:#ED076B;font-size:18px;padding:4px 12px;transition:all 0.4s ease 0s}.easy-autocomplete.eac-funky ul li.selected,.easy-autocomplete.eac-funky ul .eac-category.selected{color:#8907ED}.easy-autocomplete.eac-solid input{box-shadow:0 1px 2px rgba(0,0,0,0.15) inset;border-color:#ddd;color:#666;font-size:13px;min-height:0;padding:6px 12px}.easy-autocomplete.eac-solid ul li,.easy-autocomplete.eac-solid ul .eac-category{transition:all 0.4s ease 0s}.easy-autocomplete.eac-solid ul li.selected,.easy-autocomplete.eac-solid ul .eac-category.selected{background-color:#f2f2f2}.easy-autocomplete.eac-plate{font-family:"Open Sans", "Helvetica Neue",Helvetica,Arial,sans-serif}.easy-autocomplete.eac-plate input{font-size:13px;padding:6px 12px}.easy-autocomplete.eac-plate ul{background:#b5b5b5;border-radius:6px;border-width:0;top:10px}.easy-autocomplete.eac-plate ul li,.easy-autocomplete.eac-plate ul .eac-category{background:#b5b5b5;color:#FAFAFA;font-size:12px;transition:all 0.4s ease 0s}.easy-autocomplete.eac-plate ul li b,.easy-autocomplete.eac-plate ul .eac-category b{color:#ffd464}.easy-autocomplete.eac-plate ul li.selected,.easy-autocomplete.eac-plate ul .eac-category.selected{background:#656565}.easy-autocomplete.eac-plate ul li:first-child,.easy-autocomplete.eac-plate ul .eac-category:first-child{border-radius:6px 6px 0 0}.easy-autocomplete.eac-plate ul li:last-child,.easy-autocomplete.eac-plate ul .eac-category:last-child{border-radius:0 0 6px 6px}.easy-autocomplete.eac-plate-dark{font-family:"Open Sans", "Helvetica Neue",Helvetica,Arial,sans-serif}.easy-autocomplete.eac-plate-dark input{font-size:13px;padding:6px 12px}.easy-autocomplete.eac-plate-dark ul{background:#212121;border-radius:6px;border-width:0;top:10px}.easy-autocomplete.eac-plate-dark ul li,.easy-autocomplete.eac-plate-dark ul .eac-category{background:#212121;color:#FAFAFA;font-size:12px;transition:all 0.4s ease 0s}.easy-autocomplete.eac-plate-dark ul li b,.easy-autocomplete.eac-plate-dark ul .eac-category b{color:#ffd464}.easy-autocomplete.eac-plate-dark ul li.selected,.easy-autocomplete.eac-plate-dark ul .eac-category.selected{background:#656565}.easy-autocomplete.eac-plate-dark ul li:first-child,.easy-autocomplete.eac-plate-dark ul .eac-category:first-child{border-radius:6px 6px 0 0}.easy-autocomplete.eac-plate-dark ul li:last-child,.easy-autocomplete.eac-plate-dark ul .eac-category:last-child{border-radius:0 0 6px 6px} +/*# sourceMappingURL=easy-autocomplete.themes.min.css.map */ diff --git a/bl-plugins/search/css/jquery.modal.min.css b/bl-plugins/search/css/jquery.modal.min.css new file mode 100755 index 00000000..f568c621 --- /dev/null +++ b/bl-plugins/search/css/jquery.modal.min.css @@ -0,0 +1 @@ +.blocker{position:fixed;top:0;right:0;bottom:0;left:0;width:100%;height:100%;overflow:auto;z-index:1;padding:20px;box-sizing:border-box;background-color:#000;background-color:rgba(0,0,0,0.75);text-align:center}.blocker:before{content:"";display:inline-block;height:100%;vertical-align:middle;margin-right:-0.05em}.blocker.behind{background-color:transparent}.modal{display:none;vertical-align:middle;position:relative;z-index:2;max-width:500px;box-sizing:border-box;width:90%;background:#fff;padding:15px 30px;-webkit-border-radius:8px;-moz-border-radius:8px;-o-border-radius:8px;-ms-border-radius:8px;border-radius:8px;-webkit-box-shadow:0 0 10px #000;-moz-box-shadow:0 0 10px #000;-o-box-shadow:0 0 10px #000;-ms-box-shadow:0 0 10px #000;box-shadow:0 0 10px #000;text-align:left}.modal a.close-modal{position:absolute;top:-12.5px;right:-12.5px;display:block;width:30px;height:30px;text-indent:-9999px;background-size:contain;background-repeat:no-repeat;background-position:center center;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAA3hJREFUaAXlm8+K00Acx7MiCIJH/yw+gA9g25O49SL4AO3Bp1jw5NvktC+wF88qevK4BU97EmzxUBCEolK/n5gp3W6TTJPfpNPNF37MNsl85/vN/DaTmU6PknC4K+pniqeKJ3k8UnkvDxXJzzy+q/yaxxeVHxW/FNHjgRSeKt4rFoplzaAuHHDBGR2eS9G54reirsmienDCTRt7xwsp+KAoEmt9nLaGitZxrBbPFNaGfPloGw2t4JVamSt8xYW6Dg1oCYo3Yv+rCGViV160oMkcd8SYKnYV1Nb1aEOjCe6L5ZOiLfF120EjWhuBu3YIZt1NQmujnk5F4MgOpURzLfAwOBSTmzp3fpDxuI/pabxpqOoz2r2HLAb0GMbZKlNV5/Hg9XJypguryA7lPF5KMdTZQzHjqxNPhWhzIuAruOl1eNqKEx1tSh5rfbxdw7mOxCq4qS68ZTjKS1YVvilu559vWvFHhh4rZrdyZ69Vmpgdj8fJbDZLJpNJ0uv1cnr/gjrUhQMuI+ANjyuwftQ0bbL6Erp0mM/ny8Fg4M3LtdRxgMtKl3jwmIHVxYXChFy94/Rmpa/pTbNUhstKV+4Rr8lLQ9KlUvJKLyG8yvQ2s9SBy1Jb7jV5a0yapfF6apaZLjLLcWtd4sNrmJUMHyM+1xibTjH82Zh01TNlhsrOhdKTe00uAzZQmN6+KW+sDa/JD2PSVQ873m29yf+1Q9VDzfEYlHi1G5LKBBWZbtEsHbFwb1oYDwr1ZiF/2bnCSg1OBE/pfr9/bWx26UxJL3ONPISOLKUvQza0LZUxSKyjpdTGa/vDEr25rddbMM0Q3O6Lx3rqFvU+x6UrRKQY7tyrZecmD9FODy8uLizTmilwNj0kraNcAJhOp5aGVwsAGD5VmJBrWWbJSgWT9zrzWepQF47RaGSiKfeGx6Szi3gzmX/HHbihwBser4B9UJYpFBNX4R6vTn3VQnez0SymnrHQMsRYGTr1dSk34ljRqS/EMd2pLQ8YBp3a1PLfcqCpo8gtHkZFHKkTX6fs3MY0blKnth66rKCnU0VRGu37ONrQaA4eZDFtWAu2fXj9zjFkxTBOo8F7t926gTp/83Kyzzcy2kZD6xiqxTYnHLRFm3vHiRSwNSjkz3hoIzo8lCKWUlg/YtGs7tObunDAZfpDLbfEI15zsEIY3U/x/gHHc/G1zltnAgAAAABJRU5ErkJggg==')}.modal-spinner{display:none;position:fixed;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);padding:12px 16px;border-radius:5px;background-color:#111;height:20px}.modal-spinner>div{border-radius:100px;background-color:#fff;height:20px;width:2px;margin:0 1px;display:inline-block;-webkit-animation:sk-stretchdelay 1.2s infinite ease-in-out;animation:sk-stretchdelay 1.2s infinite ease-in-out}.modal-spinner .rect2{-webkit-animation-delay:-1.1s;animation-delay:-1.1s}.modal-spinner .rect3{-webkit-animation-delay:-1.0s;animation-delay:-1.0s}.modal-spinner .rect4{-webkit-animation-delay:-0.9s;animation-delay:-0.9s}@-webkit-keyframes sk-stretchdelay{0%,40%,100%{-webkit-transform:scaleY(0.5)}20%{-webkit-transform:scaleY(1.0)}}@keyframes sk-stretchdelay{0%,40%,100%{transform:scaleY(0.5);-webkit-transform:scaleY(0.5)}20%{transform:scaleY(1.0);-webkit-transform:scaleY(1.0)}} \ No newline at end of file diff --git a/bl-plugins/search/css/remodal-default-theme.css b/bl-plugins/search/css/remodal-default-theme.css new file mode 100755 index 00000000..c996c054 --- /dev/null +++ b/bl-plugins/search/css/remodal-default-theme.css @@ -0,0 +1,323 @@ +/* + * Remodal - v1.1.1 + * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. + * http://vodkabears.github.io/remodal/ + * + * Made by Ilya Makarov + * Under MIT License + */ + +/* ========================================================================== + Remodal's default mobile first theme + ========================================================================== */ + +/* Default theme styles for the background */ + +.remodal-bg.remodal-is-opening, +.remodal-bg.remodal-is-opened { + -webkit-filter: blur(3px); + filter: blur(3px); +} + +/* Default theme styles of the overlay */ + +.remodal-overlay { + background: rgba(43, 46, 56, 0.9); +} + +.remodal-overlay.remodal-is-opening, +.remodal-overlay.remodal-is-closing { + -webkit-animation-duration: 0.3s; + animation-duration: 0.3s; + -webkit-animation-fill-mode: forwards; + animation-fill-mode: forwards; +} + +.remodal-overlay.remodal-is-opening { + -webkit-animation-name: remodal-overlay-opening-keyframes; + animation-name: remodal-overlay-opening-keyframes; +} + +.remodal-overlay.remodal-is-closing { + -webkit-animation-name: remodal-overlay-closing-keyframes; + animation-name: remodal-overlay-closing-keyframes; +} + +/* Default theme styles of the wrapper */ + +.remodal-wrapper { + padding: 10px 10px 0; +} + +/* Default theme styles of the modal dialog */ + +.remodal { + box-sizing: border-box; + width: 100%; + margin-bottom: 10px; + padding: 35px; + + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + + color: #2b2e38; + background: #fff; +} + +.remodal.remodal-is-opening, +.remodal.remodal-is-closing { + -webkit-animation-duration: 0.3s; + animation-duration: 0.3s; + -webkit-animation-fill-mode: forwards; + animation-fill-mode: forwards; +} + +.remodal.remodal-is-opening { + -webkit-animation-name: remodal-opening-keyframes; + animation-name: remodal-opening-keyframes; +} + +.remodal.remodal-is-closing { + -webkit-animation-name: remodal-closing-keyframes; + animation-name: remodal-closing-keyframes; +} + +/* Vertical align of the modal dialog */ + +.remodal, +.remodal-wrapper:after { + vertical-align: middle; +} + +/* Close button */ + +.remodal-close { + position: absolute; + top: 0; + left: 0; + + display: block; + overflow: visible; + + width: 35px; + height: 35px; + margin: 0; + padding: 0; + + cursor: pointer; + -webkit-transition: color 0.2s; + transition: color 0.2s; + text-decoration: none; + + color: #95979c; + border: 0; + outline: 0; + background: transparent; +} + +.remodal-close:hover, +.remodal-close:focus { + color: #2b2e38; +} + +.remodal-close:before { + font-family: Arial, "Helvetica CY", "Nimbus Sans L", sans-serif !important; + font-size: 25px; + line-height: 35px; + + position: absolute; + top: 0; + left: 0; + + display: block; + + width: 35px; + + content: "\00d7"; + text-align: center; +} + +/* Dialog buttons */ + +.remodal-confirm, +.remodal-cancel { + font: inherit; + + display: inline-block; + overflow: visible; + + min-width: 110px; + margin: 0; + padding: 12px 0; + + cursor: pointer; + -webkit-transition: background 0.2s; + transition: background 0.2s; + text-align: center; + vertical-align: middle; + text-decoration: none; + + border: 0; + outline: 0; +} + +.remodal-confirm { + color: #fff; + background: #81c784; +} + +.remodal-confirm:hover, +.remodal-confirm:focus { + background: #66bb6a; +} + +.remodal-cancel { + color: #fff; + background: #e57373; +} + +.remodal-cancel:hover, +.remodal-cancel:focus { + background: #ef5350; +} + +/* Remove inner padding and border in Firefox 4+ for the button tag. */ + +.remodal-confirm::-moz-focus-inner, +.remodal-cancel::-moz-focus-inner, +.remodal-close::-moz-focus-inner { + padding: 0; + + border: 0; +} + +/* Keyframes + ========================================================================== */ + +@-webkit-keyframes remodal-opening-keyframes { + from { + -webkit-transform: scale(1.05); + transform: scale(1.05); + + opacity: 0; + } + to { + -webkit-transform: none; + transform: none; + + opacity: 1; + + -webkit-filter: blur(0); + filter: blur(0); + } +} + +@keyframes remodal-opening-keyframes { + from { + -webkit-transform: scale(1.05); + transform: scale(1.05); + + opacity: 0; + } + to { + -webkit-transform: none; + transform: none; + + opacity: 1; + + -webkit-filter: blur(0); + filter: blur(0); + } +} + +@-webkit-keyframes remodal-closing-keyframes { + from { + -webkit-transform: scale(1); + transform: scale(1); + + opacity: 1; + } + to { + -webkit-transform: scale(0.95); + transform: scale(0.95); + + opacity: 0; + + -webkit-filter: blur(0); + filter: blur(0); + } +} + +@keyframes remodal-closing-keyframes { + from { + -webkit-transform: scale(1); + transform: scale(1); + + opacity: 1; + } + to { + -webkit-transform: scale(0.95); + transform: scale(0.95); + + opacity: 0; + + -webkit-filter: blur(0); + filter: blur(0); + } +} + +@-webkit-keyframes remodal-overlay-opening-keyframes { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +@keyframes remodal-overlay-opening-keyframes { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +@-webkit-keyframes remodal-overlay-closing-keyframes { + from { + opacity: 1; + } + to { + opacity: 0; + } +} + +@keyframes remodal-overlay-closing-keyframes { + from { + opacity: 1; + } + to { + opacity: 0; + } +} + +/* Media queries + ========================================================================== */ + +@media only screen and (min-width: 641px) { + .remodal { + max-width: 700px; + } +} + +/* IE8 + ========================================================================== */ + +.lt-ie9 .remodal-overlay { + background: #2b2e38; +} + +.lt-ie9 .remodal { + width: 700px; +} diff --git a/bl-plugins/search/css/remodal.css b/bl-plugins/search/css/remodal.css new file mode 100755 index 00000000..fa2ea128 --- /dev/null +++ b/bl-plugins/search/css/remodal.css @@ -0,0 +1,93 @@ +/* + * Remodal - v1.1.1 + * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. + * http://vodkabears.github.io/remodal/ + * + * Made by Ilya Makarov + * Under MIT License + */ + +/* ========================================================================== + Remodal's necessary styles + ========================================================================== */ + +/* Hide scroll bar */ + +html.remodal-is-locked { + overflow: hidden; + + -ms-touch-action: none; + touch-action: none; +} + +/* Anti FOUC */ + +.remodal, +[data-remodal-id] { + display: none; +} + +/* Necessary styles of the overlay */ + +.remodal-overlay { + position: fixed; + z-index: 9999; + top: -5000px; + right: -5000px; + bottom: -5000px; + left: -5000px; + + display: none; +} + +/* Necessary styles of the wrapper */ + +.remodal-wrapper { + position: fixed; + z-index: 10000; + top: 0; + right: 0; + bottom: 0; + left: 0; + + display: none; + overflow: auto; + + text-align: center; + + -webkit-overflow-scrolling: touch; +} + +.remodal-wrapper:after { + display: inline-block; + + height: 100%; + margin-left: -0.05em; + + content: ""; +} + +/* Fix iPad, iPhone glitches */ + +.remodal-overlay, +.remodal-wrapper { + -webkit-backface-visibility: hidden; + backface-visibility: hidden; +} + +/* Necessary styles of the modal dialog */ + +.remodal { + position: relative; + + outline: none; + + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + text-size-adjust: 100%; +} + +.remodal-is-initialized { + /* Disable Anti-FOUC */ + display: inline-block; +} diff --git a/bl-plugins/search/css/search.css b/bl-plugins/search/css/search.css new file mode 100644 index 00000000..a2ae10a2 --- /dev/null +++ b/bl-plugins/search/css/search.css @@ -0,0 +1,8 @@ +.easy-autocomplete { + width: 100% !important; + text-align: left; +} + +#plugin-search-input { + width: 100% !important; +} \ No newline at end of file diff --git a/bl-plugins/search/js/jquery.easy-autocomplete.js b/bl-plugins/search/js/jquery.easy-autocomplete.js new file mode 100755 index 00000000..c582c0f2 --- /dev/null +++ b/bl-plugins/search/js/jquery.easy-autocomplete.js @@ -0,0 +1,1623 @@ +/* + * easy-autocomplete + * jQuery plugin for autocompletion + * + * @author Łukasz Pawełczak (http://github.com/pawelczak) + * @version 1.3.5 + * Copyright License: + */ + +/* + * EasyAutocomplete - Configuration + */ +var EasyAutocomplete = (function(scope){ + + scope.Configuration = function Configuration(options) { + var defaults = { + data: "list-required", + url: "list-required", + dataType: "json", + + listLocation: function(data) { + return data; + }, + + xmlElementName: "", + + getValue: function(element) { + return element; + }, + + autocompleteOff: true, + + placeholder: false, + + ajaxCallback: function() {}, + + matchResponseProperty: false, + + list: { + sort: { + enabled: false, + method: function(a, b) { + a = defaults.getValue(a); + b = defaults.getValue(b); + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + }, + + maxNumberOfElements: 6, + + hideOnEmptyPhrase: true, + + match: { + enabled: false, + caseSensitive: false, + method: function(element, phrase) { + + if (element.search(phrase) > -1) { + return true; + } else { + return false; + } + } + }, + + showAnimation: { + type: "normal", //normal|slide|fade + time: 400, + callback: function() {} + }, + + hideAnimation: { + type: "normal", + time: 400, + callback: function() {} + }, + + /* Events */ + onClickEvent: function() {}, + onSelectItemEvent: function() {}, + onLoadEvent: function() {}, + onChooseEvent: function() {}, + onKeyEnterEvent: function() {}, + onMouseOverEvent: function() {}, + onMouseOutEvent: function() {}, + onShowListEvent: function() {}, + onHideListEvent: function() {} + }, + + highlightPhrase: true, + + theme: "", + + cssClasses: "", + + minCharNumber: 0, + + requestDelay: 0, + + adjustWidth: true, + + ajaxSettings: {}, + + preparePostData: function(data, inputPhrase) {return data;}, + + loggerEnabled: true, + + template: "", + + categoriesAssigned: false, + + categories: [{ + maxNumberOfElements: 4 + }] + + }; + + var externalObjects = ["ajaxSettings", "template"]; + + this.get = function(propertyName) { + return defaults[propertyName]; + }; + + this.equals = function(name, value) { + if (isAssigned(name)) { + if (defaults[name] === value) { + return true; + } + } + + return false; + }; + + this.checkDataUrlProperties = function() { + if (defaults.url === "list-required" && defaults.data === "list-required") { + return false; + } + return true; + }; + this.checkRequiredProperties = function() { + for (var propertyName in defaults) { + if (defaults[propertyName] === "required") { + logger.error("Option " + propertyName + " must be defined"); + return false; + } + } + return true; + }; + + this.printPropertiesThatDoesntExist = function(consol, optionsToCheck) { + printPropertiesThatDoesntExist(consol, optionsToCheck); + }; + + + prepareDefaults(); + + mergeOptions(); + + if (defaults.loggerEnabled === true) { + printPropertiesThatDoesntExist(console, options); + } + + addAjaxSettings(); + + processAfterMerge(); + function prepareDefaults() { + + if (options.dataType === "xml") { + + if (!options.getValue) { + + options.getValue = function(element) { + return $(element).text(); + }; + } + + + if (!options.list) { + + options.list = {}; + } + + if (!options.list.sort) { + options.list.sort = {}; + } + + + options.list.sort.method = function(a, b) { + a = options.getValue(a); + b = options.getValue(b); + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + }; + + if (!options.list.match) { + options.list.match = {}; + } + + options.list.match.method = function(element, phrase) { + + if (element.search(phrase) > -1) { + return true; + } else { + return false; + } + }; + + } + if (options.categories !== undefined && options.categories instanceof Array) { + + var categories = []; + + for (var i = 0, length = options.categories.length; i < length; i += 1) { + + var category = options.categories[i]; + + for (var property in defaults.categories[0]) { + + if (category[property] === undefined) { + category[property] = defaults.categories[0][property]; + } + } + + categories.push(category); + } + + options.categories = categories; + } + } + + function mergeOptions() { + + defaults = mergeObjects(defaults, options); + + function mergeObjects(source, target) { + var mergedObject = source || {}; + + for (var propertyName in source) { + if (target[propertyName] !== undefined && target[propertyName] !== null) { + + if (typeof target[propertyName] !== "object" || + target[propertyName] instanceof Array) { + mergedObject[propertyName] = target[propertyName]; + } else { + mergeObjects(source[propertyName], target[propertyName]); + } + } + } + + /* If data is an object */ + if (target.data !== undefined && target.data !== null && typeof target.data === "object") { + mergedObject.data = target.data; + } + + return mergedObject; + } + } + + + function processAfterMerge() { + + if (defaults.url !== "list-required" && typeof defaults.url !== "function") { + var defaultUrl = defaults.url; + defaults.url = function() { + return defaultUrl; + }; + } + + if (defaults.ajaxSettings.url !== undefined && typeof defaults.ajaxSettings.url !== "function") { + var defaultUrl = defaults.ajaxSettings.url; + defaults.ajaxSettings.url = function() { + return defaultUrl; + }; + } + + if (typeof defaults.listLocation === "string") { + var defaultlistLocation = defaults.listLocation; + + if (defaults.dataType.toUpperCase() === "XML") { + defaults.listLocation = function(data) { + return $(data).find(defaultlistLocation); + }; + } else { + defaults.listLocation = function(data) { + return data[defaultlistLocation]; + }; + } + } + + if (typeof defaults.getValue === "string") { + var defaultsGetValue = defaults.getValue; + defaults.getValue = function(element) { + return element[defaultsGetValue]; + }; + } + + if (options.categories !== undefined) { + defaults.categoriesAssigned = true; + } + + } + + function addAjaxSettings() { + + if (options.ajaxSettings !== undefined && typeof options.ajaxSettings === "object") { + defaults.ajaxSettings = options.ajaxSettings; + } else { + defaults.ajaxSettings = {}; + } + + } + + function isAssigned(name) { + if (defaults[name] !== undefined && defaults[name] !== null) { + return true; + } else { + return false; + } + } + function printPropertiesThatDoesntExist(consol, optionsToCheck) { + + checkPropertiesIfExist(defaults, optionsToCheck); + + function checkPropertiesIfExist(source, target) { + for(var property in target) { + if (source[property] === undefined) { + consol.log("Property '" + property + "' does not exist in EasyAutocomplete options API."); + } + + if (typeof source[property] === "object" && $.inArray(property, externalObjects) === -1) { + checkPropertiesIfExist(source[property], target[property]); + } + } + } + } + }; + + return scope; + +})(EasyAutocomplete || {}); + + +/* + * EasyAutocomplete - Logger + */ +var EasyAutocomplete = (function(scope){ + + scope.Logger = function Logger() { + + this.error = function(message) { + console.log("ERROR: " + message); + }; + + this.warning = function(message) { + console.log("WARNING: " + message); + }; + }; + + return scope; + +})(EasyAutocomplete || {}); + + +/* + * EasyAutocomplete - Constans + */ +var EasyAutocomplete = (function(scope){ + + scope.Constans = function Constans() { + var constants = { + CONTAINER_CLASS: "easy-autocomplete-container", + CONTAINER_ID: "eac-container-", + + WRAPPER_CSS_CLASS: "easy-autocomplete" + }; + + this.getValue = function(propertyName) { + return constants[propertyName]; + }; + + }; + + return scope; + +})(EasyAutocomplete || {}); + +/* + * EasyAutocomplete - ListBuilderService + * + * @author Łukasz Pawełczak + * + */ +var EasyAutocomplete = (function(scope) { + + scope.ListBuilderService = function ListBuilderService(configuration, proccessResponseData) { + + + this.init = function(data) { + var listBuilder = [], + builder = {}; + + builder.data = configuration.get("listLocation")(data); + builder.getValue = configuration.get("getValue"); + builder.maxListSize = configuration.get("list").maxNumberOfElements; + + + listBuilder.push(builder); + + return listBuilder; + }; + + this.updateCategories = function(listBuilder, data) { + + if (configuration.get("categoriesAssigned")) { + + listBuilder = []; + + for(var i = 0; i < configuration.get("categories").length; i += 1) { + + var builder = convertToListBuilder(configuration.get("categories")[i], data); + + listBuilder.push(builder); + } + + } + + return listBuilder; + }; + + this.convertXml = function(listBuilder) { + if(configuration.get("dataType").toUpperCase() === "XML") { + + for(var i = 0; i < listBuilder.length; i += 1) { + listBuilder[i].data = convertXmlToList(listBuilder[i]); + } + } + + return listBuilder; + }; + + this.processData = function(listBuilder, inputPhrase) { + + for(var i = 0, length = listBuilder.length; i < length; i+=1) { + listBuilder[i].data = proccessResponseData(configuration, listBuilder[i], inputPhrase); + } + + return listBuilder; + }; + + this.checkIfDataExists = function(listBuilders) { + + for(var i = 0, length = listBuilders.length; i < length; i += 1) { + + if (listBuilders[i].data !== undefined && listBuilders[i].data instanceof Array) { + if (listBuilders[i].data.length > 0) { + return true; + } + } + } + + return false; + }; + + + function convertToListBuilder(category, data) { + + var builder = {}; + + if(configuration.get("dataType").toUpperCase() === "XML") { + + builder = convertXmlToListBuilder(); + } else { + + builder = convertDataToListBuilder(); + } + + + if (category.header !== undefined) { + builder.header = category.header; + } + + if (category.maxNumberOfElements !== undefined) { + builder.maxNumberOfElements = category.maxNumberOfElements; + } + + if (configuration.get("list").maxNumberOfElements !== undefined) { + + builder.maxListSize = configuration.get("list").maxNumberOfElements; + } + + if (category.getValue !== undefined) { + + if (typeof category.getValue === "string") { + var defaultsGetValue = category.getValue; + builder.getValue = function(element) { + return element[defaultsGetValue]; + }; + } else if (typeof category.getValue === "function") { + builder.getValue = category.getValue; + } + + } else { + builder.getValue = configuration.get("getValue"); + } + + + return builder; + + + function convertXmlToListBuilder() { + + var builder = {}, + listLocation; + + if (category.xmlElementName !== undefined) { + builder.xmlElementName = category.xmlElementName; + } + + if (category.listLocation !== undefined) { + + listLocation = category.listLocation; + } else if (configuration.get("listLocation") !== undefined) { + + listLocation = configuration.get("listLocation"); + } + + if (listLocation !== undefined) { + if (typeof listLocation === "string") { + builder.data = $(data).find(listLocation); + } else if (typeof listLocation === "function") { + + builder.data = listLocation(data); + } + } else { + + builder.data = data; + } + + return builder; + } + + + function convertDataToListBuilder() { + + var builder = {}; + + if (category.listLocation !== undefined) { + + if (typeof category.listLocation === "string") { + builder.data = data[category.listLocation]; + } else if (typeof category.listLocation === "function") { + builder.data = category.listLocation(data); + } + } else { + builder.data = data; + } + + return builder; + } + } + + function convertXmlToList(builder) { + var simpleList = []; + + if (builder.xmlElementName === undefined) { + builder.xmlElementName = configuration.get("xmlElementName"); + } + + + $(builder.data).find(builder.xmlElementName).each(function() { + simpleList.push(this); + }); + + return simpleList; + } + + }; + + return scope; + +})(EasyAutocomplete || {}); + + +/* + * EasyAutocomplete - Data proccess module + * + * Process list to display: + * - sort + * - decrease number to specific number + * - show only matching list + * + */ +var EasyAutocomplete = (function(scope) { + + scope.proccess = function proccessData(config, listBuilder, phrase) { + + scope.proccess.match = match; + + var list = listBuilder.data, + inputPhrase = phrase;//TODO REFACTOR + + list = findMatch(list, inputPhrase); + list = reduceElementsInList(list); + list = sort(list); + + return list; + + + function findMatch(list, phrase) { + var preparedList = [], + value = ""; + + if (config.get("list").match.enabled) { + + for(var i = 0, length = list.length; i < length; i += 1) { + + value = config.get("getValue")(list[i]); + + if (match(value, phrase)) { + preparedList.push(list[i]); + } + + } + + } else { + preparedList = list; + } + + return preparedList; + } + + function match(value, phrase) { + + if (!config.get("list").match.caseSensitive) { + + if (typeof value === "string") { + value = value.toLowerCase(); + } + + phrase = phrase.toLowerCase(); + } + if (config.get("list").match.method(value, phrase)) { + return true; + } else { + return false; + } + } + + function reduceElementsInList(list) { + if (listBuilder.maxNumberOfElements !== undefined && list.length > listBuilder.maxNumberOfElements) { + list = list.slice(0, listBuilder.maxNumberOfElements); + } + + return list; + } + + function sort(list) { + if (config.get("list").sort.enabled) { + list.sort(config.get("list").sort.method); + } + + return list; + } + + }; + + + return scope; + + +})(EasyAutocomplete || {}); + + +/* + * EasyAutocomplete - Template + * + * + * + */ +var EasyAutocomplete = (function(scope){ + + scope.Template = function Template(options) { + + + var genericTemplates = { + basic: { + type: "basic", + method: function(element) { return element; }, + cssClass: "" + }, + description: { + type: "description", + fields: { + description: "description" + }, + method: function(element) { return element + " - description"; }, + cssClass: "eac-description" + }, + iconLeft: { + type: "iconLeft", + fields: { + icon: "" + }, + method: function(element) { + return element; + }, + cssClass: "eac-icon-left" + }, + iconRight: { + type: "iconRight", + fields: { + iconSrc: "" + }, + method: function(element) { + return element; + }, + cssClass: "eac-icon-right" + }, + links: { + type: "links", + fields: { + link: "" + }, + method: function(element) { + return element; + }, + cssClass: "" + }, + custom: { + type: "custom", + method: function() {}, + cssClass: "" + } + }, + + + + /* + * Converts method with {{text}} to function + */ + convertTemplateToMethod = function(template) { + + + var _fields = template.fields, + buildMethod; + + if (template.type === "description") { + + buildMethod = genericTemplates.description.method; + + if (typeof _fields.description === "string") { + buildMethod = function(elementValue, element) { + return elementValue + " - " + element[_fields.description] + ""; + }; + } else if (typeof _fields.description === "function") { + buildMethod = function(elementValue, element) { + return elementValue + " - " + _fields.description(element) + ""; + }; + } + + return buildMethod; + } + + if (template.type === "iconRight") { + + if (typeof _fields.iconSrc === "string") { + buildMethod = function(elementValue, element) { + return elementValue + "" ; + }; + } else if (typeof _fields.iconSrc === "function") { + buildMethod = function(elementValue, element) { + return elementValue + "" ; + }; + } + + return buildMethod; + } + + + if (template.type === "iconLeft") { + + if (typeof _fields.iconSrc === "string") { + buildMethod = function(elementValue, element) { + return "" + elementValue; + }; + } else if (typeof _fields.iconSrc === "function") { + buildMethod = function(elementValue, element) { + return "" + elementValue; + }; + } + + return buildMethod; + } + + if(template.type === "links") { + + if (typeof _fields.link === "string") { + buildMethod = function(elementValue, element) { + return "" + elementValue + ""; + }; + } else if (typeof _fields.link === "function") { + buildMethod = function(elementValue, element) { + return "" + elementValue + ""; + }; + } + + return buildMethod; + } + + + if (template.type === "custom") { + + return template.method; + } + + return genericTemplates.basic.method; + + }, + + + prepareBuildMethod = function(options) { + if (!options || !options.type) { + + return genericTemplates.basic.method; + } + + if (options.type && genericTemplates[options.type]) { + + return convertTemplateToMethod(options); + } else { + + return genericTemplates.basic.method; + } + + }, + + templateClass = function(options) { + var emptyStringFunction = function() {return "";}; + + if (!options || !options.type) { + + return emptyStringFunction; + } + + if (options.type && genericTemplates[options.type]) { + return (function () { + var _cssClass = genericTemplates[options.type].cssClass; + return function() { return _cssClass;}; + })(); + } else { + return emptyStringFunction; + } + }; + + + this.getTemplateClass = templateClass(options); + + this.build = prepareBuildMethod(options); + + + }; + + return scope; + +})(EasyAutocomplete || {}); + + +/* + * EasyAutocomplete - jQuery plugin for autocompletion + * + */ +var EasyAutocomplete = (function(scope) { + + + scope.main = function Core($input, options) { + + var module = { + name: "EasyAutocomplete", + shortcut: "eac" + }; + + var consts = new scope.Constans(), + config = new scope.Configuration(options), + logger = new scope.Logger(), + template = new scope.Template(options.template), + listBuilderService = new scope.ListBuilderService(config, scope.proccess), + checkParam = config.equals, + + $field = $input, + $container = "", + elementsList = [], + selectedElement = -1, + requestDelayTimeoutId; + + scope.consts = consts; + + this.getConstants = function() { + return consts; + }; + + this.getConfiguration = function() { + return config; + }; + + this.getContainer = function() { + return $container; + }; + + this.getSelectedItemIndex = function() { + return selectedElement; + }; + + this.getItems = function () { + return elementsList; + }; + + this.getItemData = function(index) { + + if (elementsList.length < index || elementsList[index] === undefined) { + return -1; + } else { + return elementsList[index]; + } + }; + + this.getSelectedItemData = function() { + return this.getItemData(selectedElement); + }; + + this.build = function() { + prepareField(); + }; + + this.init = function() { + init(); + }; + function init() { + + if ($field.length === 0) { + logger.error("Input field doesn't exist."); + return; + } + + if (!config.checkDataUrlProperties()) { + logger.error("One of options variables 'data' or 'url' must be defined."); + return; + } + + if (!config.checkRequiredProperties()) { + logger.error("Will not work without mentioned properties."); + return; + } + + + prepareField(); + bindEvents(); + + } + function prepareField() { + + + if ($field.parent().hasClass(consts.getValue("WRAPPER_CSS_CLASS"))) { + removeContainer(); + removeWrapper(); + } + + createWrapper(); + createContainer(); + + $container = $("#" + getContainerId()); + if (config.get("placeholder")) { + $field.attr("placeholder", config.get("placeholder")); + } + + + function createWrapper() { + var $wrapper = $("
"), + classes = consts.getValue("WRAPPER_CSS_CLASS"); + + + if (config.get("theme") && config.get("theme") !== "") { + classes += " eac-" + config.get("theme"); + } + + if (config.get("cssClasses") && config.get("cssClasses") !== "") { + classes += " " + config.get("cssClasses"); + } + + if (template.getTemplateClass() !== "") { + classes += " " + template.getTemplateClass(); + } + + + $wrapper + .addClass(classes); + $field.wrap($wrapper); + + + if (config.get("adjustWidth") === true) { + adjustWrapperWidth(); + } + + + } + + function adjustWrapperWidth() { + var fieldWidth = $field.outerWidth(); + + $field.parent().css("width", fieldWidth); + } + + function removeWrapper() { + $field.unwrap(); + } + + function createContainer() { + var $elements_container = $("
").addClass(consts.getValue("CONTAINER_CLASS")); + + $elements_container + .attr("id", getContainerId()) + .prepend($("
    ")); + + + (function() { + + $elements_container + /* List show animation */ + .on("show.eac", function() { + + switch(config.get("list").showAnimation.type) { + + case "slide": + var animationTime = config.get("list").showAnimation.time, + callback = config.get("list").showAnimation.callback; + + $elements_container.find("ul").slideDown(animationTime, callback); + break; + + case "fade": + var animationTime = config.get("list").showAnimation.time, + callback = config.get("list").showAnimation.callback; + + $elements_container.find("ul").fadeIn(animationTime), callback; + break; + + default: + $elements_container.find("ul").show(); + break; + } + + config.get("list").onShowListEvent(); + + }) + /* List hide animation */ + .on("hide.eac", function() { + + switch(config.get("list").hideAnimation.type) { + + case "slide": + var animationTime = config.get("list").hideAnimation.time, + callback = config.get("list").hideAnimation.callback; + + $elements_container.find("ul").slideUp(animationTime, callback); + break; + + case "fade": + var animationTime = config.get("list").hideAnimation.time, + callback = config.get("list").hideAnimation.callback; + + $elements_container.find("ul").fadeOut(animationTime, callback); + break; + + default: + $elements_container.find("ul").hide(); + break; + } + + config.get("list").onHideListEvent(); + + }) + .on("selectElement.eac", function() { + $elements_container.find("ul li").removeClass("selected"); + $elements_container.find("ul li").eq(selectedElement).addClass("selected"); + + config.get("list").onSelectItemEvent(); + }) + .on("loadElements.eac", function(event, listBuilders, phrase) { + + + var $item = "", + $listContainer = $elements_container.find("ul"); + + $listContainer + .empty() + .detach(); + + elementsList = []; + var counter = 0; + for(var builderIndex = 0, listBuildersLength = listBuilders.length; builderIndex < listBuildersLength; builderIndex += 1) { + + var listData = listBuilders[builderIndex].data; + + if (listData.length === 0) { + continue; + } + + if (listBuilders[builderIndex].header !== undefined && listBuilders[builderIndex].header.length > 0) { + $listContainer.append("
    " + listBuilders[builderIndex].header + "
    "); + } + + for(var i = 0, listDataLength = listData.length; i < listDataLength && counter < listBuilders[builderIndex].maxListSize; i += 1) { + $item = $("
  • "); + + + (function() { + var j = i, + itemCounter = counter, + elementsValue = listBuilders[builderIndex].getValue(listData[j]); + + $item.find(" > div") + .on("click", function() { + + $field.val(elementsValue).trigger("change"); + + selectedElement = itemCounter; + selectElement(itemCounter); + + config.get("list").onClickEvent(); + config.get("list").onChooseEvent(); + }) + .mouseover(function() { + + selectedElement = itemCounter; + selectElement(itemCounter); + + config.get("list").onMouseOverEvent(); + }) + .mouseout(function() { + config.get("list").onMouseOutEvent(); + }) + .html(template.build(highlight(elementsValue, phrase), listData[j])); + })(); + + $listContainer.append($item); + elementsList.push(listData[i]); + counter += 1; + } + } + + $elements_container.append($listContainer); + + config.get("list").onLoadEvent(); + }); + + })(); + + $field.after($elements_container); + } + + function removeContainer() { + $field.next("." + consts.getValue("CONTAINER_CLASS")).remove(); + } + + function highlight(string, phrase) { + + if(config.get("highlightPhrase") && phrase !== "") { + return highlightPhrase(string, phrase); + } else { + return string; + } + + } + + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + + function highlightPhrase(string, phrase) { + var escapedPhrase = escapeRegExp(phrase); + return (string + "").replace(new RegExp("(" + escapedPhrase + ")", "gi") , "$1"); + } + + + + } + function getContainerId() { + + var elementId = $field.attr("id"); + + elementId = consts.getValue("CONTAINER_ID") + elementId; + + return elementId; + } + function bindEvents() { + + bindAllEvents(); + + + function bindAllEvents() { + if (checkParam("autocompleteOff", true)) { + removeAutocomplete(); + } + + bindFocusOut(); + bindKeyup(); + bindKeydown(); + bindKeypress(); + bindFocus(); + bindBlur(); + } + + function bindFocusOut() { + $field.focusout(function () { + + var fieldValue = $field.val(), + phrase; + + if (!config.get("list").match.caseSensitive) { + fieldValue = fieldValue.toLowerCase(); + } + + for (var i = 0, length = elementsList.length; i < length; i += 1) { + + phrase = config.get("getValue")(elementsList[i]); + if (!config.get("list").match.caseSensitive) { + phrase = phrase.toLowerCase(); + } + + if (phrase === fieldValue) { + selectedElement = i; + selectElement(selectedElement); + return; + } + } + }); + } + + function bindKeyup() { + $field + .off("keyup") + .keyup(function(event) { + + switch(event.keyCode) { + + case 27: + + hideContainer(); + loseFieldFocus(); + break; + + case 38: + + event.preventDefault(); + + if(elementsList.length > 0 && selectedElement > 0) { + + selectedElement -= 1; + + $field.val(config.get("getValue")(elementsList[selectedElement])); + + selectElement(selectedElement); + + } + break; + + case 40: + + event.preventDefault(); + + if(elementsList.length > 0 && selectedElement < elementsList.length - 1) { + + selectedElement += 1; + + $field.val(config.get("getValue")(elementsList[selectedElement])); + + selectElement(selectedElement); + + } + + break; + + default: + + if (event.keyCode > 40 || event.keyCode === 8) { + + var inputPhrase = $field.val(); + + if (!(config.get("list").hideOnEmptyPhrase === true && event.keyCode === 8 && inputPhrase === "")) { + + if (config.get("requestDelay") > 0) { + if (requestDelayTimeoutId !== undefined) { + clearTimeout(requestDelayTimeoutId); + } + + requestDelayTimeoutId = setTimeout(function () { loadData(inputPhrase);}, config.get("requestDelay")); + } else { + loadData(inputPhrase); + } + + } else { + hideContainer(); + } + + } + + + break; + } + + + function loadData(inputPhrase) { + + + if (inputPhrase.length < config.get("minCharNumber")) { + return; + } + + + if (config.get("data") !== "list-required") { + + var data = config.get("data"); + + var listBuilders = listBuilderService.init(data); + + listBuilders = listBuilderService.updateCategories(listBuilders, data); + + listBuilders = listBuilderService.processData(listBuilders, inputPhrase); + + loadElements(listBuilders, inputPhrase); + + if ($field.parent().find("li").length > 0) { + showContainer(); + } else { + hideContainer(); + } + + } + + var settings = createAjaxSettings(); + + if (settings.url === undefined || settings.url === "") { + settings.url = config.get("url"); + } + + if (settings.dataType === undefined || settings.dataType === "") { + settings.dataType = config.get("dataType"); + } + + + if (settings.url !== undefined && settings.url !== "list-required") { + + settings.url = settings.url(inputPhrase); + + settings.data = config.get("preparePostData")(settings.data, inputPhrase); + + $.ajax(settings) + .done(function(data) { + + var listBuilders = listBuilderService.init(data); + + listBuilders = listBuilderService.updateCategories(listBuilders, data); + + listBuilders = listBuilderService.convertXml(listBuilders); + if (checkInputPhraseMatchResponse(inputPhrase, data)) { + + listBuilders = listBuilderService.processData(listBuilders, inputPhrase); + + loadElements(listBuilders, inputPhrase); + + } + + if (listBuilderService.checkIfDataExists(listBuilders) && $field.parent().find("li").length > 0) { + showContainer(); + } else { + hideContainer(); + } + + config.get("ajaxCallback")(); + + }) + .fail(function() { + logger.warning("Fail to load response data"); + }) + .always(function() { + + }); + } + + + + function createAjaxSettings() { + + var settings = {}, + ajaxSettings = config.get("ajaxSettings") || {}; + + for (var set in ajaxSettings) { + settings[set] = ajaxSettings[set]; + } + + return settings; + } + + function checkInputPhraseMatchResponse(inputPhrase, data) { + + if (config.get("matchResponseProperty") !== false) { + if (typeof config.get("matchResponseProperty") === "string") { + return (data[config.get("matchResponseProperty")] === inputPhrase); + } + + if (typeof config.get("matchResponseProperty") === "function") { + return (config.get("matchResponseProperty")(data) === inputPhrase); + } + + return true; + } else { + return true; + } + + } + + } + + + }); + } + + function bindKeydown() { + $field + .on("keydown", function(evt) { + evt = evt || window.event; + var keyCode = evt.keyCode; + if (keyCode === 38) { + suppressKeypress = true; + return false; + } + }) + .keydown(function(event) { + + if (event.keyCode === 13 && selectedElement > -1) { + + $field.val(config.get("getValue")(elementsList[selectedElement])); + + config.get("list").onKeyEnterEvent(); + config.get("list").onChooseEvent(); + + selectedElement = -1; + hideContainer(); + + event.preventDefault(); + } + }); + } + + function bindKeypress() { + $field + .off("keypress"); + } + + function bindFocus() { + $field.focus(function() { + + if ($field.val() !== "" && elementsList.length > 0) { + + selectedElement = -1; + showContainer(); + } + + }); + } + + function bindBlur() { + $field.blur(function() { + setTimeout(function() { + + selectedElement = -1; + hideContainer(); + }, 250); + }); + } + + function removeAutocomplete() { + $field.attr("autocomplete","off"); + } + + } + + function showContainer() { + $container.trigger("show.eac"); + } + + function hideContainer() { + $container.trigger("hide.eac"); + } + + function selectElement(index) { + + $container.trigger("selectElement.eac", index); + } + + function loadElements(list, phrase) { + $container.trigger("loadElements.eac", [list, phrase]); + } + + function loseFieldFocus() { + $field.trigger("blur"); + } + + + }; + scope.eacHandles = []; + + scope.getHandle = function(id) { + return scope.eacHandles[id]; + }; + + scope.inputHasId = function(input) { + + if($(input).attr("id") !== undefined && $(input).attr("id").length > 0) { + return true; + } else { + return false; + } + + }; + + scope.assignRandomId = function(input) { + + var fieldId = ""; + + do { + fieldId = "eac-" + Math.floor(Math.random() * 10000); + } while ($("#" + fieldId).length !== 0); + + elementId = scope.consts.getValue("CONTAINER_ID") + fieldId; + + $(input).attr("id", fieldId); + + }; + + scope.setHandle = function(handle, id) { + scope.eacHandles[id] = handle; + }; + + + return scope; + +})(EasyAutocomplete || {}); + +(function($) { + + $.fn.easyAutocomplete = function(options) { + + return this.each(function() { + var $this = $(this), + eacHandle = new EasyAutocomplete.main($this, options); + + if (!EasyAutocomplete.inputHasId($this)) { + EasyAutocomplete.assignRandomId($this); + } + + eacHandle.init(); + + EasyAutocomplete.setHandle(eacHandle, $this.attr("id")); + + }); + }; + + $.fn.getSelectedItemIndex = function() { + + var inputId = $(this).attr("id"); + + if (inputId !== undefined) { + return EasyAutocomplete.getHandle(inputId).getSelectedItemIndex(); + } + + return -1; + }; + + $.fn.getItems = function () { + + var inputId = $(this).attr("id"); + + if (inputId !== undefined) { + return EasyAutocomplete.getHandle(inputId).getItems(); + } + + return -1; + }; + + $.fn.getItemData = function(index) { + + var inputId = $(this).attr("id"); + + if (inputId !== undefined && index > -1) { + return EasyAutocomplete.getHandle(inputId).getItemData(index); + } + + return -1; + }; + + $.fn.getSelectedItemData = function() { + + var inputId = $(this).attr("id"); + + if (inputId !== undefined) { + return EasyAutocomplete.getHandle(inputId).getSelectedItemData(); + } + + return -1; + }; + +})(jQuery); diff --git a/bl-plugins/search/js/jquery.easy-autocomplete.min.js b/bl-plugins/search/js/jquery.easy-autocomplete.min.js new file mode 100755 index 00000000..926b946b --- /dev/null +++ b/bl-plugins/search/js/jquery.easy-autocomplete.min.js @@ -0,0 +1,10 @@ +/* + * easy-autocomplete + * jQuery plugin for autocompletion + * + * @author Łukasz Pawełczak (http://github.com/pawelczak) + * @version 1.3.5 + * Copyright License: + */ + +var EasyAutocomplete=function(a){return a.Configuration=function(a){function b(){if("xml"===a.dataType&&(a.getValue||(a.getValue=function(a){return $(a).text()}),a.list||(a.list={}),a.list.sort||(a.list.sort={}),a.list.sort.method=function(b,c){return b=a.getValue(b),c=a.getValue(c),c>b?-1:b>c?1:0},a.list.match||(a.list.match={}),a.list.match.method=function(a,b){return a.search(b)>-1}),void 0!==a.categories&&a.categories instanceof Array){for(var b=[],c=0,d=a.categories.length;d>c;c+=1){var e=a.categories[c];for(var f in h.categories[0])void 0===e[f]&&(e[f]=h.categories[0][f]);b.push(e)}a.categories=b}}function c(){function b(a,c){var d=a||{};for(var e in a)void 0!==c[e]&&null!==c[e]&&("object"!=typeof c[e]||c[e]instanceof Array?d[e]=c[e]:b(a[e],c[e]));return void 0!==c.data&&null!==c.data&&"object"==typeof c.data&&(d.data=c.data),d}h=b(h,a)}function d(){if("list-required"!==h.url&&"function"!=typeof h.url){var b=h.url;h.url=function(){return b}}if(void 0!==h.ajaxSettings.url&&"function"!=typeof h.ajaxSettings.url){var b=h.ajaxSettings.url;h.ajaxSettings.url=function(){return b}}if("string"==typeof h.listLocation){var c=h.listLocation;"XML"===h.dataType.toUpperCase()?h.listLocation=function(a){return $(a).find(c)}:h.listLocation=function(a){return a[c]}}if("string"==typeof h.getValue){var d=h.getValue;h.getValue=function(a){return a[d]}}void 0!==a.categories&&(h.categoriesAssigned=!0)}function e(){void 0!==a.ajaxSettings&&"object"==typeof a.ajaxSettings?h.ajaxSettings=a.ajaxSettings:h.ajaxSettings={}}function f(a){return void 0!==h[a]&&null!==h[a]}function g(a,b){function c(b,d){for(var e in d)void 0===b[e]&&a.log("Property '"+e+"' does not exist in EasyAutocomplete options API."),"object"==typeof b[e]&&-1===$.inArray(e,i)&&c(b[e],d[e])}c(h,b)}var h={data:"list-required",url:"list-required",dataType:"json",listLocation:function(a){return a},xmlElementName:"",getValue:function(a){return a},autocompleteOff:!0,placeholder:!1,ajaxCallback:function(){},matchResponseProperty:!1,list:{sort:{enabled:!1,method:function(a,b){return a=h.getValue(a),b=h.getValue(b),b>a?-1:a>b?1:0}},maxNumberOfElements:6,hideOnEmptyPhrase:!0,match:{enabled:!1,caseSensitive:!1,method:function(a,b){return a.search(b)>-1}},showAnimation:{type:"normal",time:400,callback:function(){}},hideAnimation:{type:"normal",time:400,callback:function(){}},onClickEvent:function(){},onSelectItemEvent:function(){},onLoadEvent:function(){},onChooseEvent:function(){},onKeyEnterEvent:function(){},onMouseOverEvent:function(){},onMouseOutEvent:function(){},onShowListEvent:function(){},onHideListEvent:function(){}},highlightPhrase:!0,theme:"",cssClasses:"",minCharNumber:0,requestDelay:0,adjustWidth:!0,ajaxSettings:{},preparePostData:function(a,b){return a},loggerEnabled:!0,template:"",categoriesAssigned:!1,categories:[{maxNumberOfElements:4}]},i=["ajaxSettings","template"];this.get=function(a){return h[a]},this.equals=function(a,b){return!(!f(a)||h[a]!==b)},this.checkDataUrlProperties=function(){return"list-required"!==h.url||"list-required"!==h.data},this.checkRequiredProperties=function(){for(var a in h)if("required"===h[a])return logger.error("Option "+a+" must be defined"),!1;return!0},this.printPropertiesThatDoesntExist=function(a,b){g(a,b)},b(),c(),h.loggerEnabled===!0&&g(console,a),e(),d()},a}(EasyAutocomplete||{}),EasyAutocomplete=function(a){return a.Logger=function(){this.error=function(a){console.log("ERROR: "+a)},this.warning=function(a){console.log("WARNING: "+a)}},a}(EasyAutocomplete||{}),EasyAutocomplete=function(a){return a.Constans=function(){var a={CONTAINER_CLASS:"easy-autocomplete-container",CONTAINER_ID:"eac-container-",WRAPPER_CSS_CLASS:"easy-autocomplete"};this.getValue=function(b){return a[b]}},a}(EasyAutocomplete||{}),EasyAutocomplete=function(a){return a.ListBuilderService=function(a,b){function c(b,c){function d(){var d,e={};return void 0!==b.xmlElementName&&(e.xmlElementName=b.xmlElementName),void 0!==b.listLocation?d=b.listLocation:void 0!==a.get("listLocation")&&(d=a.get("listLocation")),void 0!==d?"string"==typeof d?e.data=$(c).find(d):"function"==typeof d&&(e.data=d(c)):e.data=c,e}function e(){var a={};return void 0!==b.listLocation?"string"==typeof b.listLocation?a.data=c[b.listLocation]:"function"==typeof b.listLocation&&(a.data=b.listLocation(c)):a.data=c,a}var f={};if(f="XML"===a.get("dataType").toUpperCase()?d():e(),void 0!==b.header&&(f.header=b.header),void 0!==b.maxNumberOfElements&&(f.maxNumberOfElements=b.maxNumberOfElements),void 0!==a.get("list").maxNumberOfElements&&(f.maxListSize=a.get("list").maxNumberOfElements),void 0!==b.getValue)if("string"==typeof b.getValue){var g=b.getValue;f.getValue=function(a){return a[g]}}else"function"==typeof b.getValue&&(f.getValue=b.getValue);else f.getValue=a.get("getValue");return f}function d(b){var c=[];return void 0===b.xmlElementName&&(b.xmlElementName=a.get("xmlElementName")),$(b.data).find(b.xmlElementName).each(function(){c.push(this)}),c}this.init=function(b){var c=[],d={};return d.data=a.get("listLocation")(b),d.getValue=a.get("getValue"),d.maxListSize=a.get("list").maxNumberOfElements,c.push(d),c},this.updateCategories=function(b,d){if(a.get("categoriesAssigned")){b=[];for(var e=0;ee;e+=1)c[e].data=b(a,c[e],d);return c},this.checkIfDataExists=function(a){for(var b=0,c=a.length;c>b;b+=1)if(void 0!==a[b].data&&a[b].data instanceof Array&&a[b].data.length>0)return!0;return!1}},a}(EasyAutocomplete||{}),EasyAutocomplete=function(a){return a.proccess=function(b,c,d){function e(a,c){var d=[],e="";if(b.get("list").match.enabled)for(var g=0,h=a.length;h>g;g+=1)e=b.get("getValue")(a[g]),f(e,c)&&d.push(a[g]);else d=a;return d}function f(a,c){return b.get("list").match.caseSensitive||("string"==typeof a&&(a=a.toLowerCase()),c=c.toLowerCase()),!!b.get("list").match.method(a,c)}function g(a){return void 0!==c.maxNumberOfElements&&a.length>c.maxNumberOfElements&&(a=a.slice(0,c.maxNumberOfElements)),a}function h(a){return b.get("list").sort.enabled&&a.sort(b.get("list").sort.method),a}a.proccess.match=f;var i=c.data,j=d;return i=e(i,j),i=g(i),i=h(i)},a}(EasyAutocomplete||{}),EasyAutocomplete=function(a){return a.Template=function(a){var b={basic:{type:"basic",method:function(a){return a},cssClass:""},description:{type:"description",fields:{description:"description"},method:function(a){return a+" - description"},cssClass:"eac-description"},iconLeft:{type:"iconLeft",fields:{icon:""},method:function(a){return a},cssClass:"eac-icon-left"},iconRight:{type:"iconRight",fields:{iconSrc:""},method:function(a){return a},cssClass:"eac-icon-right"},links:{type:"links",fields:{link:""},method:function(a){return a},cssClass:""},custom:{type:"custom",method:function(){},cssClass:""}},c=function(a){var c,d=a.fields;return"description"===a.type?(c=b.description.method,"string"==typeof d.description?c=function(a,b){return a+" - "+b[d.description]+""}:"function"==typeof d.description&&(c=function(a,b){return a+" - "+d.description(b)+""}),c):"iconRight"===a.type?("string"==typeof d.iconSrc?c=function(a,b){return a+""}:"function"==typeof d.iconSrc&&(c=function(a,b){return a+""}),c):"iconLeft"===a.type?("string"==typeof d.iconSrc?c=function(a,b){return""+a}:"function"==typeof d.iconSrc&&(c=function(a,b){return""+a}),c):"links"===a.type?("string"==typeof d.link?c=function(a,b){return""+a+""}:"function"==typeof d.link&&(c=function(a,b){return""+a+""}),c):"custom"===a.type?a.method:b.basic.method},d=function(a){return a&&a.type&&a.type&&b[a.type]?c(a):b.basic.method},e=function(a){var c=function(){return""};return a&&a.type&&a.type&&b[a.type]?function(){var c=b[a.type].cssClass;return function(){return c}}():c};this.getTemplateClass=e(a),this.build=d(a)},a}(EasyAutocomplete||{}),EasyAutocomplete=function(a){return a.main=function(b,c){function d(){return 0===t.length?void p.error("Input field doesn't exist."):o.checkDataUrlProperties()?o.checkRequiredProperties()?(e(),void g()):void p.error("Will not work without mentioned properties."):void p.error("One of options variables 'data' or 'url' must be defined.")}function e(){function a(){var a=$("
    "),c=n.getValue("WRAPPER_CSS_CLASS");o.get("theme")&&""!==o.get("theme")&&(c+=" eac-"+o.get("theme")),o.get("cssClasses")&&""!==o.get("cssClasses")&&(c+=" "+o.get("cssClasses")),""!==q.getTemplateClass()&&(c+=" "+q.getTemplateClass()),a.addClass(c),t.wrap(a),o.get("adjustWidth")===!0&&b()}function b(){var a=t.outerWidth();t.parent().css("width",a)}function c(){t.unwrap()}function d(){var a=$("
    ").addClass(n.getValue("CONTAINER_CLASS"));a.attr("id",f()).prepend($("
      ")),function(){a.on("show.eac",function(){switch(o.get("list").showAnimation.type){case"slide":var b=o.get("list").showAnimation.time,c=o.get("list").showAnimation.callback;a.find("ul").slideDown(b,c);break;case"fade":var b=o.get("list").showAnimation.time,c=o.get("list").showAnimation.callback;a.find("ul").fadeIn(b),c;break;default:a.find("ul").show()}o.get("list").onShowListEvent()}).on("hide.eac",function(){switch(o.get("list").hideAnimation.type){case"slide":var b=o.get("list").hideAnimation.time,c=o.get("list").hideAnimation.callback;a.find("ul").slideUp(b,c);break;case"fade":var b=o.get("list").hideAnimation.time,c=o.get("list").hideAnimation.callback;a.find("ul").fadeOut(b,c);break;default:a.find("ul").hide()}o.get("list").onHideListEvent()}).on("selectElement.eac",function(){a.find("ul li").removeClass("selected"),a.find("ul li").eq(w).addClass("selected"),o.get("list").onSelectItemEvent()}).on("loadElements.eac",function(b,c,d){var e="",f=a.find("ul");f.empty().detach(),v=[];for(var h=0,i=0,k=c.length;k>i;i+=1){var l=c[i].data;if(0!==l.length){void 0!==c[i].header&&c[i].header.length>0&&f.append("
      "+c[i].header+"
      ");for(var m=0,n=l.length;n>m&&h
      "),function(){var a=m,b=h,f=c[i].getValue(l[a]);e.find(" > div").on("click",function(){t.val(f).trigger("change"),w=b,j(b),o.get("list").onClickEvent(),o.get("list").onChooseEvent()}).mouseover(function(){w=b,j(b),o.get("list").onMouseOverEvent()}).mouseout(function(){o.get("list").onMouseOutEvent()}).html(q.build(g(f,d),l[a]))}(),f.append(e),v.push(l[m]),h+=1}}a.append(f),o.get("list").onLoadEvent()})}(),t.after(a)}function e(){t.next("."+n.getValue("CONTAINER_CLASS")).remove()}function g(a,b){return o.get("highlightPhrase")&&""!==b?i(a,b):a}function h(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function i(a,b){var c=h(b);return(a+"").replace(new RegExp("("+c+")","gi"),"$1")}t.parent().hasClass(n.getValue("WRAPPER_CSS_CLASS"))&&(e(),c()),a(),d(),u=$("#"+f()),o.get("placeholder")&&t.attr("placeholder",o.get("placeholder"))}function f(){var a=t.attr("id");return a=n.getValue("CONTAINER_ID")+a}function g(){function a(){s("autocompleteOff",!0)&&n(),b(),c(),d(),e(),f(),g()}function b(){t.focusout(function(){var a,b=t.val();o.get("list").match.caseSensitive||(b=b.toLowerCase());for(var c=0,d=v.length;d>c;c+=1)if(a=o.get("getValue")(v[c]),o.get("list").match.caseSensitive||(a=a.toLowerCase()),a===b)return w=c,void j(w)})}function c(){t.off("keyup").keyup(function(a){function b(a){function b(){var a={},b=o.get("ajaxSettings")||{};for(var c in b)a[c]=b[c];return a}function c(a,b){return o.get("matchResponseProperty")!==!1?"string"==typeof o.get("matchResponseProperty")?b[o.get("matchResponseProperty")]===a:"function"==typeof o.get("matchResponseProperty")?o.get("matchResponseProperty")(b)===a:!0:!0}if(!(a.length0?h():i()}var f=b();void 0!==f.url&&""!==f.url||(f.url=o.get("url")),void 0!==f.dataType&&""!==f.dataType||(f.dataType=o.get("dataType")),void 0!==f.url&&"list-required"!==f.url&&(f.url=f.url(a),f.data=o.get("preparePostData")(f.data,a),$.ajax(f).done(function(b){var d=r.init(b);d=r.updateCategories(d,b),d=r.convertXml(d),c(a,b)&&(d=r.processData(d,a),k(d,a)),r.checkIfDataExists(d)&&t.parent().find("li").length>0?h():i(),o.get("ajaxCallback")()}).fail(function(){p.warning("Fail to load response data")}).always(function(){}))}}switch(a.keyCode){case 27:i(),l();break;case 38:a.preventDefault(),v.length>0&&w>0&&(w-=1,t.val(o.get("getValue")(v[w])),j(w));break;case 40:a.preventDefault(),v.length>0&&w40||8===a.keyCode){var c=t.val();o.get("list").hideOnEmptyPhrase!==!0||8!==a.keyCode||""!==c?o.get("requestDelay")>0?(void 0!==m&&clearTimeout(m),m=setTimeout(function(){b(c)},o.get("requestDelay"))):b(c):i()}}})}function d(){t.on("keydown",function(a){a=a||window.event;var b=a.keyCode;return 38===b?(suppressKeypress=!0,!1):void 0}).keydown(function(a){13===a.keyCode&&w>-1&&(t.val(o.get("getValue")(v[w])),o.get("list").onKeyEnterEvent(),o.get("list").onChooseEvent(),w=-1,i(),a.preventDefault())})}function e(){t.off("keypress")}function f(){t.focus(function(){""!==t.val()&&v.length>0&&(w=-1,h())})}function g(){t.blur(function(){setTimeout(function(){w=-1,i()},250)})}function n(){t.attr("autocomplete","off")}a()}function h(){u.trigger("show.eac")}function i(){u.trigger("hide.eac")}function j(a){u.trigger("selectElement.eac",a)}function k(a,b){u.trigger("loadElements.eac",[a,b])}function l(){t.trigger("blur")}var m,n=new a.Constans,o=new a.Configuration(c),p=new a.Logger,q=new a.Template(c.template),r=new a.ListBuilderService(o,a.proccess),s=o.equals,t=b,u="",v=[],w=-1;a.consts=n,this.getConstants=function(){return n},this.getConfiguration=function(){return o},this.getContainer=function(){return u},this.getSelectedItemIndex=function(){return w},this.getItems=function(){return v},this.getItemData=function(a){return v.length0},a.assignRandomId=function(b){var c="";do c="eac-"+Math.floor(1e4*Math.random());while(0!==$("#"+c).length);elementId=a.consts.getValue("CONTAINER_ID")+c,$(b).attr("id",c)},a.setHandle=function(b,c){a.eacHandles[c]=b},a}(EasyAutocomplete||{});!function(a){a.fn.easyAutocomplete=function(b){return this.each(function(){var c=a(this),d=new EasyAutocomplete.main(c,b);EasyAutocomplete.inputHasId(c)||EasyAutocomplete.assignRandomId(c),d.init(),EasyAutocomplete.setHandle(d,c.attr("id"))})},a.fn.getSelectedItemIndex=function(){var b=a(this).attr("id");return void 0!==b?EasyAutocomplete.getHandle(b).getSelectedItemIndex():-1},a.fn.getItems=function(){var b=a(this).attr("id");return void 0!==b?EasyAutocomplete.getHandle(b).getItems():-1},a.fn.getItemData=function(b){var c=a(this).attr("id");return void 0!==c&&b>-1?EasyAutocomplete.getHandle(c).getItemData(b):-1},a.fn.getSelectedItemData=function(){var b=a(this).attr("id");return void 0!==b?EasyAutocomplete.getHandle(b).getSelectedItemData():-1}}(jQuery); \ No newline at end of file diff --git a/bl-plugins/search/js/jquery.modal.min.js b/bl-plugins/search/js/jquery.modal.min.js new file mode 100755 index 00000000..690d5092 --- /dev/null +++ b/bl-plugins/search/js/jquery.modal.min.js @@ -0,0 +1,5 @@ +/* + A simple jQuery modal (http://github.com/kylefox/jquery-modal) + Version 0.9.1 +*/ +!function(o){"object"==typeof module&&"object"==typeof module.exports?o(require("jquery"),window,document):o(jQuery,window,document)}(function(o,t,i,e){var s=[],l=function(){return s.length?s[s.length-1]:null},n=function(){var o,t=!1;for(o=s.length-1;o>=0;o--)s[o].$blocker&&(s[o].$blocker.toggleClass("current",!t).toggleClass("behind",t),t=!0)};o.modal=function(t,i){var e,n;if(this.$body=o("body"),this.options=o.extend({},o.modal.defaults,i),this.options.doFade=!isNaN(parseInt(this.options.fadeDuration,10)),this.$blocker=null,this.options.closeExisting)for(;o.modal.isActive();)o.modal.close();if(s.push(this),t.is("a"))if(n=t.attr("href"),this.anchor=t,/^#/.test(n)){if(this.$elm=o(n),1!==this.$elm.length)return null;this.$body.append(this.$elm),this.open()}else this.$elm=o("
      "),this.$body.append(this.$elm),e=function(o,t){t.elm.remove()},this.showSpinner(),t.trigger(o.modal.AJAX_SEND),o.get(n).done(function(i){if(o.modal.isActive()){t.trigger(o.modal.AJAX_SUCCESS);var s=l();s.$elm.empty().append(i).on(o.modal.CLOSE,e),s.hideSpinner(),s.open(),t.trigger(o.modal.AJAX_COMPLETE)}}).fail(function(){t.trigger(o.modal.AJAX_FAIL);var i=l();i.hideSpinner(),s.pop(),t.trigger(o.modal.AJAX_COMPLETE)});else this.$elm=t,this.anchor=t,this.$body.append(this.$elm),this.open()},o.modal.prototype={constructor:o.modal,open:function(){var t=this;this.block(),this.anchor.blur(),this.options.doFade?setTimeout(function(){t.show()},this.options.fadeDuration*this.options.fadeDelay):this.show(),o(i).off("keydown.modal").on("keydown.modal",function(o){var t=l();27===o.which&&t.options.escapeClose&&t.close()}),this.options.clickClose&&this.$blocker.click(function(t){t.target===this&&o.modal.close()})},close:function(){s.pop(),this.unblock(),this.hide(),o.modal.isActive()||o(i).off("keydown.modal")},block:function(){this.$elm.trigger(o.modal.BEFORE_BLOCK,[this._ctx()]),this.$body.css("overflow","hidden"),this.$blocker=o('
      ').appendTo(this.$body),n(),this.options.doFade&&this.$blocker.css("opacity",0).animate({opacity:1},this.options.fadeDuration),this.$elm.trigger(o.modal.BLOCK,[this._ctx()])},unblock:function(t){!t&&this.options.doFade?this.$blocker.fadeOut(this.options.fadeDuration,this.unblock.bind(this,!0)):(this.$blocker.children().appendTo(this.$body),this.$blocker.remove(),this.$blocker=null,n(),o.modal.isActive()||this.$body.css("overflow",""))},show:function(){this.$elm.trigger(o.modal.BEFORE_OPEN,[this._ctx()]),this.options.showClose&&(this.closeButton=o(''+this.options.closeText+""),this.$elm.append(this.closeButton)),this.$elm.addClass(this.options.modalClass).appendTo(this.$blocker),this.options.doFade?this.$elm.css({opacity:0,display:"inline-block"}).animate({opacity:1},this.options.fadeDuration):this.$elm.css("display","inline-block"),this.$elm.trigger(o.modal.OPEN,[this._ctx()])},hide:function(){this.$elm.trigger(o.modal.BEFORE_CLOSE,[this._ctx()]),this.closeButton&&this.closeButton.remove();var t=this;this.options.doFade?this.$elm.fadeOut(this.options.fadeDuration,function(){t.$elm.trigger(o.modal.AFTER_CLOSE,[t._ctx()])}):this.$elm.hide(0,function(){t.$elm.trigger(o.modal.AFTER_CLOSE,[t._ctx()])}),this.$elm.trigger(o.modal.CLOSE,[this._ctx()])},showSpinner:function(){this.options.showSpinner&&(this.spinner=this.spinner||o('
      ').append(this.options.spinnerHtml),this.$body.append(this.spinner),this.spinner.show())},hideSpinner:function(){this.spinner&&this.spinner.remove()},_ctx:function(){return{elm:this.$elm,$elm:this.$elm,$blocker:this.$blocker,options:this.options}}},o.modal.close=function(t){if(o.modal.isActive()){t&&t.preventDefault();var i=l();return i.close(),i.$elm}},o.modal.isActive=function(){return s.length>0},o.modal.getCurrent=l,o.modal.defaults={closeExisting:!0,escapeClose:!0,clickClose:!0,closeText:"Close",closeClass:"",modalClass:"modal",blockerClass:"jquery-modal",spinnerHtml:'
      ',showSpinner:!0,showClose:!0,fadeDuration:null,fadeDelay:1},o.modal.BEFORE_BLOCK="modal:before-block",o.modal.BLOCK="modal:block",o.modal.BEFORE_OPEN="modal:before-open",o.modal.OPEN="modal:open",o.modal.BEFORE_CLOSE="modal:before-close",o.modal.CLOSE="modal:close",o.modal.AFTER_CLOSE="modal:after-close",o.modal.AJAX_SEND="modal:ajax:send",o.modal.AJAX_SUCCESS="modal:ajax:success",o.modal.AJAX_FAIL="modal:ajax:fail",o.modal.AJAX_COMPLETE="modal:ajax:complete",o.fn.modal=function(t){return 1===this.length&&new o.modal(this,t),this},o(i).on("click.modal",'a[rel~="modal:close"]',o.modal.close),o(i).on("click.modal",'a[rel~="modal:open"]',function(t){t.preventDefault(),o(this).modal()})}); \ No newline at end of file diff --git a/bl-plugins/search/js/remodal.min.js b/bl-plugins/search/js/remodal.min.js new file mode 100755 index 00000000..cffd08ea --- /dev/null +++ b/bl-plugins/search/js/remodal.min.js @@ -0,0 +1,10 @@ +/* + * Remodal - v1.1.1 + * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. + * http://vodkabears.github.io/remodal/ + * + * Made by Ilya Makarov + * Under MIT License + */ + +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return b(a,c)}):"object"==typeof exports?b(a,require("jquery")):b(a,a.jQuery||a.Zepto)}(this,function(a,b){"use strict";function c(a){if(w&&"none"===a.css("animation-name")&&"none"===a.css("-webkit-animation-name")&&"none"===a.css("-moz-animation-name")&&"none"===a.css("-o-animation-name")&&"none"===a.css("-ms-animation-name"))return 0;var b,c,d,e,f=a.css("animation-duration")||a.css("-webkit-animation-duration")||a.css("-moz-animation-duration")||a.css("-o-animation-duration")||a.css("-ms-animation-duration")||"0s",g=a.css("animation-delay")||a.css("-webkit-animation-delay")||a.css("-moz-animation-delay")||a.css("-o-animation-delay")||a.css("-ms-animation-delay")||"0s",h=a.css("animation-iteration-count")||a.css("-webkit-animation-iteration-count")||a.css("-moz-animation-iteration-count")||a.css("-o-animation-iteration-count")||a.css("-ms-animation-iteration-count")||"1";for(f=f.split(", "),g=g.split(", "),h=h.split(", "),e=0,c=f.length,b=Number.NEGATIVE_INFINITY;eb&&(b=d);return b}function d(){if(b(document).height()<=b(window).height())return 0;var a,c,d=document.createElement("div"),e=document.createElement("div");return d.style.visibility="hidden",d.style.width="100px",document.body.appendChild(d),a=d.offsetWidth,d.style.overflow="scroll",e.style.width="100%",d.appendChild(e),c=e.offsetWidth,d.parentNode.removeChild(d),a-c}function e(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)||(c=b(document.body),a=parseInt(c.css("padding-right"),10)+d(),c.css("padding-right",a+"px"),e.addClass(f))}}function f(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)&&(c=b(document.body),a=parseInt(c.css("padding-right"),10)-d(),c.css("padding-right",a+"px"),e.removeClass(f))}}function g(a,b,c,d){var e=k("is",b),f=[k("is",u.CLOSING),k("is",u.OPENING),k("is",u.CLOSED),k("is",u.OPENED)].join(" ");a.$bg.removeClass(f).addClass(e),a.$overlay.removeClass(f).addClass(e),a.$wrapper.removeClass(f).addClass(e),a.$modal.removeClass(f).addClass(e),a.state=b,!c&&a.$modal.trigger({type:b,reason:d},[{reason:d}])}function h(a,d,e){var f=0,g=function(a){a.target===this&&f++},h=function(a){a.target===this&&0===--f&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())};b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].on(r,g).on(s,h)}),a(),0===c(e.$bg)&&0===c(e.$overlay)&&0===c(e.$wrapper)&&0===c(e.$modal)&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())}function i(a){a.state!==u.CLOSED&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(b,c){a[c].off(r+" "+s)}),a.$bg.removeClass(a.settings.modifier),a.$overlay.removeClass(a.settings.modifier).hide(),a.$wrapper.hide(),f(),g(a,u.CLOSED,!0))}function j(a){var b,c,d,e,f={};for(a=a.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,","),b=a.split(","),e=0,c=b.length;e").addClass(k("overlay")+" "+k("is",u.CLOSED)).hide(),e.append(f.$overlay)),f.$bg=b("."+k("bg")).addClass(k("is",u.CLOSED)),f.$modal=a.addClass(q+" "+k("is-initialized")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).attr("tabindex","-1"),f.$wrapper=b("
      ").addClass(k("wrapper")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).hide().append(f.$modal),e.append(f.$wrapper),f.$wrapper.on("click."+q,'[data-remodal-action="close"]',function(a){a.preventDefault(),f.close()}),f.$wrapper.on("click."+q,'[data-remodal-action="cancel"]',function(a){a.preventDefault(),f.$modal.trigger(v.CANCELLATION),f.settings.closeOnCancel&&f.close(v.CANCELLATION)}),f.$wrapper.on("click."+q,'[data-remodal-action="confirm"]',function(a){a.preventDefault(),f.$modal.trigger(v.CONFIRMATION),f.settings.closeOnConfirm&&f.close(v.CONFIRMATION)}),f.$wrapper.on("click."+q,function(a){var c=b(a.target);c.hasClass(k("wrapper"))&&f.settings.closeOnOutsideClick&&f.close()})}var n,o,p="remodal",q=a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.NAMESPACE||p,r=b.map(["animationstart","webkitAnimationStart","MSAnimationStart","oAnimationStart"],function(a){return a+"."+q}).join(" "),s=b.map(["animationend","webkitAnimationEnd","MSAnimationEnd","oAnimationEnd"],function(a){return a+"."+q}).join(" "),t=b.extend({hashTracking:!0,closeOnConfirm:!0,closeOnCancel:!0,closeOnEscape:!0,closeOnOutsideClick:!0,modifier:"",appendTo:null},a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.DEFAULTS),u={CLOSING:"closing",CLOSED:"closed",OPENING:"opening",OPENED:"opened"},v={CONFIRMATION:"confirmation",CANCELLATION:"cancellation"},w=function(){var a=document.createElement("div").style;return void 0!==a.animationName||void 0!==a.WebkitAnimationName||void 0!==a.MozAnimationName||void 0!==a.msAnimationName||void 0!==a.OAnimationName}(),x=/iPad|iPhone|iPod/.test(navigator.platform);m.prototype.open=function(){var a,c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&(a=c.$modal.attr("data-remodal-id"),a&&c.settings.hashTracking&&(o=b(window).scrollTop(),location.hash=a),n&&n!==c&&i(n),n=c,e(),c.$bg.addClass(c.settings.modifier),c.$overlay.addClass(c.settings.modifier).show(),c.$wrapper.show().scrollTop(0),c.$modal.focus(),h(function(){g(c,u.OPENING)},function(){g(c,u.OPENED)},c))},m.prototype.close=function(a){var c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&c.state!==u.CLOSED&&(c.settings.hashTracking&&c.$modal.attr("data-remodal-id")===location.hash.substr(1)&&(location.hash="",b(window).scrollTop(o)),h(function(){g(c,u.CLOSING,!1,a)},function(){c.$bg.removeClass(c.settings.modifier),c.$overlay.removeClass(c.settings.modifier).hide(),c.$wrapper.hide(),f(),g(c,u.CLOSED,!1,a)},c))},m.prototype.getState=function(){return this.state},m.prototype.destroy=function(){var a,c=b[p].lookup;i(this),this.$wrapper.remove(),delete c[this.index],a=b.grep(c,function(a){return!!a}).length,0===a&&(this.$overlay.remove(),this.$bg.removeClass(k("is",u.CLOSING)+" "+k("is",u.OPENING)+" "+k("is",u.CLOSED)+" "+k("is",u.OPENED)))},b[p]={lookup:[]},b.fn[p]=function(a){var c,d;return this.each(function(e,f){d=b(f),null==d.data(p)?(c=new m(d,a),d.data(p,c.index),c.settings.hashTracking&&d.attr("data-remodal-id")===location.hash.substr(1)&&c.open()):c=b[p].lookup[d.data(p)]}),c},b(document).ready(function(){b(document).on("click","[data-remodal-target]",function(a){a.preventDefault();var c=a.currentTarget,d=c.getAttribute("data-remodal-target"),e=b('[data-remodal-id="'+d+'"]');b[p].lookup[e.data(p)].open()}),b(document).find("."+q).each(function(a,c){var d=b(c),e=d.data("remodal-options");e?("string"==typeof e||e instanceof String)&&(e=j(e)):e={},d[p](e)}),b(document).on("keydown."+q,function(a){n&&n.settings.closeOnEscape&&n.state===u.OPENED&&27===a.keyCode&&n.close()}),b(window).on("hashchange."+q,l)})}); \ No newline at end of file diff --git a/bl-plugins/search/js/search.js b/bl-plugins/search/js/search.js new file mode 100644 index 00000000..20c53e53 --- /dev/null +++ b/bl-plugins/search/js/search.js @@ -0,0 +1,15 @@ +var options = { + url: "http://localhost:8000/search", + getValue: "title", + template: { + type: "custom", + method: function(value, item) { + return ''+value+''+item.content; + } + } +}; +$( document ).ready(function() { + + $("#plugin-search-input").easyAutocomplete(options); + +}); \ No newline at end of file diff --git a/bl-plugins/search/languages/de_CH.json b/bl-plugins/search/languages/de_CH.json new file mode 100644 index 00000000..4545f3e3 --- /dev/null +++ b/bl-plugins/search/languages/de_CH.json @@ -0,0 +1,8 @@ +{ + "plugin-data": + { + "name": "RSS Feed", + "description": "Das Plugin erstellt erstellt einen RSS Feed der Inhalte." + }, + "amount-of-items-to-show-on-the-feed": "Anzahl der gezeigten Inhalte." +} diff --git a/bl-plugins/search/languages/de_DE.json b/bl-plugins/search/languages/de_DE.json new file mode 100644 index 00000000..4545f3e3 --- /dev/null +++ b/bl-plugins/search/languages/de_DE.json @@ -0,0 +1,8 @@ +{ + "plugin-data": + { + "name": "RSS Feed", + "description": "Das Plugin erstellt erstellt einen RSS Feed der Inhalte." + }, + "amount-of-items-to-show-on-the-feed": "Anzahl der gezeigten Inhalte." +} diff --git a/bl-plugins/search/languages/en.json b/bl-plugins/search/languages/en.json new file mode 100644 index 00000000..cfa18ea9 --- /dev/null +++ b/bl-plugins/search/languages/en.json @@ -0,0 +1,7 @@ +{ + "plugin-data": + { + "name": "Search", + "description": "" + } +} \ No newline at end of file diff --git a/bl-plugins/search/languages/es.json b/bl-plugins/search/languages/es.json new file mode 100644 index 00000000..fb01dc73 --- /dev/null +++ b/bl-plugins/search/languages/es.json @@ -0,0 +1,9 @@ +{ + "plugin-data": + { + "name": "RSS Feed", + "description": "Este plugin genera contenido dinamico en formato RSS de tu sitio.
      El plugin genera la URL https://example.com/rss.xml" + }, + "amount-of-items-to-show-on-the-feed": "Cantidad de artículos para mostrar.", + "rss-url": "URL del RSS" +} \ No newline at end of file diff --git a/bl-plugins/search/languages/fr_FR.json b/bl-plugins/search/languages/fr_FR.json new file mode 100644 index 00000000..0cc8e9b3 --- /dev/null +++ b/bl-plugins/search/languages/fr_FR.json @@ -0,0 +1,9 @@ +{ + "plugin-data": + { + "name": "Flux RSS", + "description": "Ce plugin génère un flux RSS de votre site.
      Le flux est accessible a l'URL de ce genre : https://example.com/rss.xml" + }, + "amount-of-items-to-show-on-the-feed": "Nombre d'éléments à afficher sur le flux.", + "rss-url": "URL RSS" +} diff --git a/bl-plugins/search/languages/it.json b/bl-plugins/search/languages/it.json new file mode 100644 index 00000000..67a12fc0 --- /dev/null +++ b/bl-plugins/search/languages/it.json @@ -0,0 +1,9 @@ +{ + "plugin-data": + { + "name": "Feed RSS", + "description": "Questo plugin genera un feed RSS del tuo sito.
      Il feed si trova all' URL https://esempio.com/rss.xml" + }, + "amount-of-items-to-show-on-the-feed": "Quantità di voci da mostrare nel feed.", + "rss-url": "URL RSS" +} diff --git a/bl-plugins/search/languages/ru_RU.json b/bl-plugins/search/languages/ru_RU.json new file mode 100644 index 00000000..6096a213 --- /dev/null +++ b/bl-plugins/search/languages/ru_RU.json @@ -0,0 +1,9 @@ +{ + "plugin-data": + { + "name": "RSS трансляция", + "description": "Этот плагин создаёт RSS канал для вашего сайта
      Трансляция доступна по URL https://example.com/rss.xml" + }, + "amount-of-items-to-show-on-the-feed": "Количество позиций в трансляции.", + "rss-url": "RSS URL" +} diff --git a/bl-plugins/search/languages/tr_TR.json b/bl-plugins/search/languages/tr_TR.json new file mode 100644 index 00000000..36e06617 --- /dev/null +++ b/bl-plugins/search/languages/tr_TR.json @@ -0,0 +1,9 @@ +{ + "plugin-data": + { + "name": "RSS Beslemesi", + "description": "Bu eklenti, sitenizin RSS beslemesini üretir.
      Besleme URL'si https://example.com/rss.xml gibi görünür." + }, + "amount-of-items-to-show-on-the-feed": "Özet akışında gösterilecek öğe miktarı.", + "rss-url": "RSS URL" +} diff --git a/bl-plugins/search/metadata.json b/bl-plugins/search/metadata.json new file mode 100644 index 00000000..f2d3a7f4 --- /dev/null +++ b/bl-plugins/search/metadata.json @@ -0,0 +1,10 @@ +{ + "author": "Bludit", + "email": "", + "website": "https://plugins.bludit.com", + "version": "3.0", + "releaseDate": "2018-01-23", + "license": "MIT", + "compatible": "3.0", + "notes": "" +} \ No newline at end of file diff --git a/bl-plugins/search/plugin.php b/bl-plugins/search/plugin.php new file mode 100644 index 00000000..e6ef56f4 --- /dev/null +++ b/bl-plugins/search/plugin.php @@ -0,0 +1,220 @@ +dbFields = array( + 'label'=>'search', + 'numberOfItems'=>5 + ); + } + + // Method called for settings + public function form() + { + global $L; + + $html = ''; + + $html .= '
      '; + $html .= ''; + $html .= ''.Theme::rssUrl().''; + $html .= '
      '; + + $html .= '
      '; + $html .= ''; + $html .= ''; + $html .= ''.$L->get('Amount of items to show on the feed').''; + $html .= '
      '; + + return $html; + } + + // HTML for sidebar + public function siteSidebar() + { + $html = ''; + + return $html; + } + + public function install($position=0) + { + parent::install($position); + return $this->createCache(); + } + + public function post() + { + // Call the method + parent::post(); + + // After POST request + $this->createCache(); + } + + public function afterPageCreate() + { + $this->createCache(); + } + + public function afterPageModify() + { + $this->createCache(); + } + + public function afterPageDelete() + { + $this->createCache(); + } + + public function beforeAll() + { + // Check if the URL match with the webhook + $webhook = 'search'; + if ($this->webhook($webhook, false, false)) { + global $site; + global $url; + + // Change the whereAmI to avoid load pages in the rule 69.pages + // This is only for performance propose + $url->setWhereAmI('search'); + + // Get the string to search from the URL + $stringToSearch = $this->webhook($webhook, true, false); + $stringToSearch = trim($stringToSearch, '/'); + + // Search the string in the cache and get all pages with matches + $list = $this->search($stringToSearch); + + $this->numberOfItems = count($list); + + // Split the content in pages + // The first page number is 1, so the real is 0 + $realPageNumber = $url->pageNumber() - 1; + $itemsPerPage = $site->itemsPerPage(); + $chunks = array_chunk($list, $itemsPerPage); + if (isset($chunks[$realPageNumber])) { + $this->pagesFound = $chunks[$realPageNumber]; + } + } + } + + public function paginator() + { + $webhook = 'search'; + if ($this->webhook($webhook, false, false)) { + // Get the pre-defined variable from the rule 99.paginator.php + // Is necessary to change this variable to fit the paginator with the result from the search + global $numberOfItems; + $numberOfItems = $this->numberOfItems; + } + } + + public function beforeSiteLoad() + { + $webhook = 'search'; + if ($this->webhook($webhook, false, false)) { + + global $url; + + // Get the pre-defined variable from the rule 69.pages.php + // We change the content to show in the website + global $content; + $content = array(); + foreach ($this->pagesFound as $pageKey) { + try { + $page = new Page($pageKey); + array_push($content, $page); + } catch (Exception $e) { + // continue + } + } + } + } + + // Generate the cache file + private function createCache() + { + // Include Pages-Object to manage the database of pages + global $pages; + + // Number of items to retrive from the database + // -1 means all of them + $numberOfItems = -1; + + // Page number is not take in count because we retrive all the pages + $pageNumber = 1; + + // Only published pages + $onlyPublished = true; + + // Get the list of pages + $list = $pages->getList($pageNumber, $numberOfItems, $onlyPublished); + + $cache = array(); + foreach ($list as $pageKey) { + $page = buildPage($pageKey); + + // Process content + $content = $page->content(); + $content = Text::removeHTMLTags($content); + $content = Text::truncate($content, 1200, ''); + + // Include page to the cache + $cache[$pageKey]['title'] = $page->title(); + $cache[$pageKey]['permalink'] = $page->permalink(); + $cache[$pageKey]['content'] = $content; + $cache[$pageKey]['key'] = $pageKey; + } + + // Generate JSON file with the cache + $json = json_encode($cache); + return file_put_contents($this->cacheFile(), $json, LOCK_EX); + } + + // Returns the absolute path where is the cache file stored + private function cacheFile() + { + return $this->workspace().'cache.json'; + } + + // Search text inside the cache + // Returns an array with the pages related to the text + // The array is order by score + private function search($text) + { + $json = file_get_contents($this->cacheFile()); + $cache = json_decode($json, true); + + $found = array(); + foreach ($cache as $page) { + $score = 0; + if (Text::stringContains($page['title'], $text, false)) { + $score += 10; + } + if (Text::stringContains($page['content'], $text, false)) { + $score += rand(1,5); + } + if ($score>0) { + $found[$score] = $page['key']; + } + } + //arsort($found); + return $found; + } + +} \ No newline at end of file