From 1e43811e33cdfab290a91cce575c2bdd85e0f9fd Mon Sep 17 00:00:00 2001 From: balambasik Date: Sun, 14 Apr 2019 16:59:46 +0300 Subject: [PATCH 01/15] fix --- docs/index.html | 22 ------- index.html | 10 +++ package.json | 7 --- sselect.css | 32 ---------- sselect.js | 162 ------------------------------------------------ sselect.min.css | 1 - sselect.min.js | 1 - 7 files changed, 10 insertions(+), 225 deletions(-) delete mode 100644 docs/index.html create mode 100644 index.html delete mode 100644 package.json delete mode 100644 sselect.css delete mode 100644 sselect.js delete mode 100644 sselect.min.css delete mode 100644 sselect.min.js diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index ea929d9..0000000 --- a/docs/index.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - Hello, world! - - -

Hello, world!

- - - - - - - - diff --git a/index.html b/index.html new file mode 100644 index 0000000..0f8af32 --- /dev/null +++ b/index.html @@ -0,0 +1,10 @@ + + + + + Document + + + + + \ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index 430f17d..0000000 --- a/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "@balambasik/sselect", "version": "1.0.1", "description": "Input text field tips. jQuery plugin.", "main": "sselect.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, "keywords": [ - "input" - ], "author": "balambasik@gmail.com", "license": "MIT" -} diff --git a/sselect.css b/sselect.css deleted file mode 100644 index 55f1f61..0000000 --- a/sselect.css +++ /dev/null @@ -1,32 +0,0 @@ -.sselect-wrap{ - position: relative; -} - -.sselect-box{ - position: absolute; - border: 1px solid #D0D0D0; - padding: 5px; - box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.45); - border-radius: 3px; -} - -.sselect-li{ - border-radius: 3px; - padding: 5px; - background: #fff; - list-style: none; - cursor: pointer; - color: #5A5A5A; - transition: all .2s; -} - -.sselect-li:hover{ - background: #1C91FC; - color: #fff; -} - -.sselect-li-noresults{ - list-style: none; - text-align: center; - color: #D0D0D0; -} \ No newline at end of file diff --git a/sselect.js b/sselect.js deleted file mode 100644 index 680973b..0000000 --- a/sselect.js +++ /dev/null @@ -1,162 +0,0 @@ -(function(factory) { - if (typeof define === 'function' && define.amd) { - // AMD (Register as an anonymous module) - define(['jquery'], factory); - } else if (typeof exports === 'object') { - // Node/CommonJS - module.exports = factory(require('jquery')); - } else { - // Browser globals - factory(jQuery); - } -}(function($) { - $.fn.sselect = function(options, data) { - - var self = this; - - var settings = $.extend({ - data: [], - placeholder: '', - text_noresults: 'Not results', - prepLi: prepLi, - prepSelectedLi: prepSelectedLi, - onInput: function() {}, - onSelect: function() {}, - onNoresults: function() {}, - onShow: function() {}, - onClose: function() {} - }, options); - - - if (options === 'setData') { - settings.data = data; - } - - - function prepInput() { - $(self).attr('autocomplete', 'off'); - - if (settings.placeholder) { - $(self).attr('placeholder', settings.placeholder); - } - - $(self).wrap("
"); - } - - function prepLi(item) { - - if ($.isArray(item)) { - return '
  • ' + item.join(',') + '
  • '; - } - - return '
  • ' + item + '
  • '; - } - - function prepSelectedLi($li) { - return $li.text(); - } - - function insertSearchBox() { - - var input_w = $(self).outerWidth(); - var input_h = $(self).outerHeight(); - - $('.sselect-wrap').append(''); - - $('.sselect-box').css({ - position: 'absolute', - width: input_w + 'px', - top: input_h + 5 + 'px', - left: 0, - display: 'none' - }); - } - - function search(item, query) { - - var ret = false; - - if (typeof item === "string") { - return (item.indexOf(query) !== -1); - } - - // search from array - $.each(item, function(i, str) { - if (str.indexOf(query) !== -1) { - ret = true; - return; - } - }); - - return ret; - } - - function insertLi(query) { - - var query = query || ''; - var html = ''; - - $.each(settings.data, function(i, item) { - - if (!query) { - html += settings.prepLi(item); - } else if (search(item, query)) { - html += settings.prepLi(item); - } - }); - - if (html) { - $('.sselect-box').html(html); - } else { - $('.sselect-box').html('
  • ' + settings.text_noresults + '
  • '); - settings.onNoresults(query); - } - } - - // Init -------------------------------------------------------- - - prepInput(); - insertSearchBox(); - insertLi(); - - // Events -------------------------------------------------------- - - // search - $(this).on('input paste focus', function() { - var query = $(this).val().trim(); - insertLi(query); - settings.onInput(query); - }); - - // show - $(this).on('focus', function() { - $('.sselect-box').show(); - settings.onShow(); - }); - - // hide - $(document).click(function(event) { - - if ($(event.target).closest(".sselect-box").length || $(event.target).hasClass('input-text')) { - return; - } - - $(".sselect-box").hide(); - event.stopPropagation(); - settings.onClose(); - }); - - // click li - $(document).on('click', '.sselect-li', function() { - - var li_text = settings.prepSelectedLi($(this)); - - $(self).val(li_text); - $('.sselect-box').hide(); - settings.onSelect(li_text); - }); - - return this; - }; - -})); \ No newline at end of file diff --git a/sselect.min.css b/sselect.min.css deleted file mode 100644 index df3a97f..0000000 --- a/sselect.min.css +++ /dev/null @@ -1 +0,0 @@ -.sselect-wrap{position:relative}.sselect-box{position:absolute;border:1px solid #d0d0d0;padding:5px;box-shadow:3px 3px 5px 0 rgba(0,0,0,.45);border-radius:3px}.sselect-li{border-radius:3px;padding:5px;background:#fff;list-style:none;cursor:pointer;color:#5a5a5a;transition:all .2s}.sselect-li:hover{background:#1c91fc;color:#fff}.sselect-li-noresults{list-style:none;text-align:center;color:#d0d0d0} \ No newline at end of file diff --git a/sselect.min.js b/sselect.min.js deleted file mode 100644 index 8b1c162..0000000 --- a/sselect.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){"function" == typeof define && define.amd?define(["jquery"], e):"object" == typeof exports?module.exports = e(require("jquery")):e(jQuery)}(function(r){r.fn.sselect = function(e, t){var o, s, n = this, c = r.extend({data:[], placeholder:"", text_noresults:"Not results", prepLi:function(e){if (r.isArray(e))return'
  • ' + e.join(",") + "
  • "; return'
  • ' + e + "
  • "}, prepSelectedLi:function(e){return e.text()}, onInput:function(){}, onSelect:function(){}, onNoresults:function(){}, onShow:function(){}, onClose:function(){}}, e); function l(l){l = l || ""; var i = ""; r.each(c.data, function(e, t){var o, s, n; l?(s = l, n = !1, ("string" == typeof (o = t)? - 1 !== o.indexOf(s):(r.each(o, function(e, t){ - 1 === t.indexOf(s) || (n = !0)}), n)) && (i += c.prepLi(t))):i += c.prepLi(t)}), i?r(".sselect-box").html(i):(r(".sselect-box").html('
  • ' + c.text_noresults + "
  • "), c.onNoresults(l))}return"setData" === e && (c.data = t), r(n).attr("autocomplete", "off"), c.placeholder && r(n).attr("placeholder", c.placeholder), r(n).wrap("
    "), o = r(n).outerWidth(), s = r(n).outerHeight(), r(".sselect-wrap").append(''), r(".sselect-box").css({position:"absolute", width:o + "px", top:s + 5 + "px", left:0, display:"none"}), l(), r(this).on("input paste focus", function(){var e = r(this).val().trim(); l(e), c.onInput(e)}), r(this).on("focus", function(){r(".sselect-box").show(), c.onShow()}), r(document).click(function(e){r(e.target).closest(".sselect-box").length || r(e.target).hasClass("input-text") || (r(".sselect-box").hide(), e.stopPropagation(), c.onClose())}), r(document).on("click", ".sselect-li", function(){var e = c.prepSelectedLi(r(this)); r(n).val(e), r(".sselect-box").hide(), c.onSelect(e)}), this}}); \ No newline at end of file From 2858d58bfcb4653fcbaf1b7cddf86ce0c14c78ab Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Sun, 14 Apr 2019 17:02:43 +0300 Subject: [PATCH 02/15] Set theme jekyll-theme-cayman --- _config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 _config.yml diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file From bafadcacff91fb38d905f029147eb5376c7d11f3 Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Sun, 14 Apr 2019 17:05:30 +0300 Subject: [PATCH 03/15] Set theme jekyll-theme-cayman From f4890c9165393e46ba41fcd9dd2363bc4c546c61 Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Sun, 14 Apr 2019 17:12:18 +0300 Subject: [PATCH 04/15] Add files via upload --- index.md | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 index.md diff --git a/index.md b/index.md new file mode 100644 index 0000000..12cef21 --- /dev/null +++ b/index.md @@ -0,0 +1,126 @@ +--- +layout: default +--- + + + + +Text can be **bold**, _italic_, or ~~strikethrough~~. + +[Link to another page](./another-page.html). + +There should be whitespace between paragraphs. + +There should be whitespace between paragraphs. We recommend including a README, or a file with information about your project. + +# Header 1 + +This is a normal paragraph following a header. GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. + +## Header 2 + +> This is a blockquote following a header. +> +> When something is important enough, you do it even if the odds are not in your favor. + +### Header 3 + +```js +// Javascript code with syntax highlighting. +var fun = function lang(l) { + dateformat.i18n = require('./lang/' + l) + return true; +} +``` + +```ruby +# Ruby code with syntax highlighting +GitHubPages::Dependencies.gems.each do |gem, version| + s.add_dependency(gem, "= #{version}") +end +``` + +#### Header 4 + +* This is an unordered list following a header. +* This is an unordered list following a header. +* This is an unordered list following a header. + +##### Header 5 + +1. This is an ordered list following a header. +2. This is an ordered list following a header. +3. This is an ordered list following a header. + +###### Header 6 + +| head1 | head two | three | +|:-------------|:------------------|:------| +| ok | good swedish fish | nice | +| out of stock | good and plenty | nice | +| ok | good `oreos` | hmm | +| ok | good `zoute` drop | yumm | + +### There's a horizontal rule below this. + +* * * + +### Here is an unordered list: + +* Item foo +* Item bar +* Item baz +* Item zip + +### And an ordered list: + +1. Item one +1. Item two +1. Item three +1. Item four + +### And a nested list: + +- level 1 item + - level 2 item + - level 2 item + - level 3 item + - level 3 item +- level 1 item + - level 2 item + - level 2 item + - level 2 item +- level 1 item + - level 2 item + - level 2 item +- level 1 item + +### Small image + +![Octocat](https://assets-cdn.github.com/images/icons/emoji/octocat.png) + +### Large image + +![Branching](https://guides.github.com/activities/hello-world/branching.png) + + +### Definition lists can be used with HTML syntax. + +
    +
    Name
    +
    Godzilla
    +
    Born
    +
    1952
    +
    Birthplace
    +
    Japan
    +
    Color
    +
    Green
    +
    + +``` +Long, single-line code blocks should not wrap. They should horizontally scroll if they are too long. This line should be long enough to demonstrate this. +``` + +``` +The final element. +``` From 54b49249f37eec41a286eb3ac435c738f24cdbb2 Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Sun, 14 Apr 2019 17:12:37 +0300 Subject: [PATCH 05/15] Delete index.html --- index.html | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index 0f8af32..0000000 --- a/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Document - - - - - \ No newline at end of file From f28a5775ff6384162c6a3c7039125adad854722f Mon Sep 17 00:00:00 2001 From: balambasik Date: Sun, 14 Apr 2019 17:20:09 +0300 Subject: [PATCH 06/15] index --- .gitignore | 1 + index.html | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..14bc68c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/nbproject/private/ \ No newline at end of file diff --git a/index.html b/index.html index 0f8af32..826f59c 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,22 @@ - - - - - Document - - - - + + + + + + + + + + + Hello, world! + + +

    Hello, world!

    + + + + + + + \ No newline at end of file From 3a937b025c5b83dc1105d8f9c2186392b241d757 Mon Sep 17 00:00:00 2001 From: balambasik Date: Sun, 14 Apr 2019 17:21:17 +0300 Subject: [PATCH 07/15] Merge origin/gh-pages into gh-pages Conflicts: index.html --- index.html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..ea929d9 --- /dev/null +++ b/index.html @@ -0,0 +1,22 @@ + + + + + + + + + + + Hello, world! + + +

    Hello, world!

    + + + + + + + + From e33d61e655220e4d8c6298f8a05333974e68da28 Mon Sep 17 00:00:00 2001 From: balambasik Date: Sun, 14 Apr 2019 17:22:53 +0300 Subject: [PATCH 08/15] Merge origin/gh-pages into gh-pages Conflicts: index.html --- _config.yml | 1 - index.md | 126 ---------------------------------------------------- 2 files changed, 127 deletions(-) delete mode 100644 _config.yml delete mode 100644 index.md diff --git a/_config.yml b/_config.yml deleted file mode 100644 index c419263..0000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/index.md b/index.md deleted file mode 100644 index 12cef21..0000000 --- a/index.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -layout: default ---- - - - - -Text can be **bold**, _italic_, or ~~strikethrough~~. - -[Link to another page](./another-page.html). - -There should be whitespace between paragraphs. - -There should be whitespace between paragraphs. We recommend including a README, or a file with information about your project. - -# Header 1 - -This is a normal paragraph following a header. GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. - -## Header 2 - -> This is a blockquote following a header. -> -> When something is important enough, you do it even if the odds are not in your favor. - -### Header 3 - -```js -// Javascript code with syntax highlighting. -var fun = function lang(l) { - dateformat.i18n = require('./lang/' + l) - return true; -} -``` - -```ruby -# Ruby code with syntax highlighting -GitHubPages::Dependencies.gems.each do |gem, version| - s.add_dependency(gem, "= #{version}") -end -``` - -#### Header 4 - -* This is an unordered list following a header. -* This is an unordered list following a header. -* This is an unordered list following a header. - -##### Header 5 - -1. This is an ordered list following a header. -2. This is an ordered list following a header. -3. This is an ordered list following a header. - -###### Header 6 - -| head1 | head two | three | -|:-------------|:------------------|:------| -| ok | good swedish fish | nice | -| out of stock | good and plenty | nice | -| ok | good `oreos` | hmm | -| ok | good `zoute` drop | yumm | - -### There's a horizontal rule below this. - -* * * - -### Here is an unordered list: - -* Item foo -* Item bar -* Item baz -* Item zip - -### And an ordered list: - -1. Item one -1. Item two -1. Item three -1. Item four - -### And a nested list: - -- level 1 item - - level 2 item - - level 2 item - - level 3 item - - level 3 item -- level 1 item - - level 2 item - - level 2 item - - level 2 item -- level 1 item - - level 2 item - - level 2 item -- level 1 item - -### Small image - -![Octocat](https://assets-cdn.github.com/images/icons/emoji/octocat.png) - -### Large image - -![Branching](https://guides.github.com/activities/hello-world/branching.png) - - -### Definition lists can be used with HTML syntax. - -
    -
    Name
    -
    Godzilla
    -
    Born
    -
    1952
    -
    Birthplace
    -
    Japan
    -
    Color
    -
    Green
    -
    - -``` -Long, single-line code blocks should not wrap. They should horizontally scroll if they are too long. This line should be long enough to demonstrate this. -``` - -``` -The final element. -``` From 963b8705df1e5292313255dd74f9621842b097fc Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Mon, 15 Apr 2019 22:49:19 +0300 Subject: [PATCH 09/15] Set theme jekyll-theme-cayman --- _config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 _config.yml diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file From fd7ffd7d30994326c5a1a252b2fa78a7d9556b52 Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Mon, 15 Apr 2019 22:52:02 +0300 Subject: [PATCH 10/15] Delete index.html --- index.html | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index ea929d9..0000000 --- a/index.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - Hello, world! - - -

    Hello, world!

    - - - - - - - - From 2b3551eb28191f3cb5d910efb514cca06f899bbf Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Mon, 15 Apr 2019 22:53:11 +0300 Subject: [PATCH 11/15] Set theme jekyll-theme-cayman From 9ca3343509afc8953293169e569f7341870ada1d Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Mon, 15 Apr 2019 22:53:54 +0300 Subject: [PATCH 12/15] Create index.md --- index.md | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 index.md diff --git a/index.md b/index.md new file mode 100644 index 0000000..5d03c80 --- /dev/null +++ b/index.md @@ -0,0 +1,105 @@ +# Sselect +## Input text field tips. jQuery plugin. +Drop-down list of hints for text input. + +## Install + +NPM: +```sh +$ npm i @balambasik/sselect +``` + +CDN: +```sh +https://cdn.jsdelivr.net/gh/balambasik/sselect/sselect.js +https://cdn.jsdelivr.net/gh/balambasik/sselect/sselect.css +``` +TAGS: +```sh + + +``` + + +## Use + +```sh + +``` + +```sh +$('#input-tips').sselect({ + data: [], + placeholder: 'Placeholder', + text_noresults: 'Not results', + prepLi: function() {}, + prepSelectedLi: function() {}, + prepQuery: function() {}, + onInput: function() {}, + onSelect: function() {}, + onNoresults: function() {}, + onShow: function() {}, + onClose: function() {} +}); +``` + +### data +```sh +var data = ['foo', 'bar', 'baz']; // tips array + +$('#input-tips').sselect({ + data: data, // tips data +}); +``` + +### prep +```sh +// +var data = [ + ['foo', 'bar'], + ['foo1', 'bar1'], + ['foo2', 'bar2'], +]; + +$('#input-tips').sselect({ + + // prep item var data + prepLi: function(item) { + if ($.isArray(item)) { + return '
  • ' + item.join(',') + '
  • '; + } + return '
  • ' + item + '
  • '; + }, + + // selected li elem + prepSelectedLi: function($li){ + return $li.text(); + }, + + // prep query string + prepQuery: function(query){ + return query.trim(); + }, +}); +``` + +### events +```sh +$('#input-tips').sselect({ + onInput: function(query) { + console.log(query); + }, + onSelect: function(selected_text) { + console.log(selected_text); + }, + onNoresults: function() { + // No results + }, + onShow: function() { + // Show tips drop menu + }, + onClose: function() { + // Close tips drop menu + } +}); +``` From b8f2ab37cf633275edaa82b3c080f1005e3cf159 Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Mon, 15 Apr 2019 23:00:07 +0300 Subject: [PATCH 13/15] Update _config.yml --- _config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index c419263..62ced34 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1,3 @@ -theme: jekyll-theme-cayman \ No newline at end of file +title: Sselect. Input text field tips. jQuery plugin. +description: Drop-down list of hints for text input. +theme: jekyll-theme-cayman From 11a5b1d850f998143b5686afaa871e6156332d9a Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Mon, 15 Apr 2019 23:01:27 +0300 Subject: [PATCH 14/15] Update _config.yml --- _config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_config.yml b/_config.yml index 62ced34..fa9d6e5 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,5 @@ title: Sselect. Input text field tips. jQuery plugin. description: Drop-down list of hints for text input. theme: jekyll-theme-cayman +show_downloads: true +google_analytics: From f0b0f72d0f41f68117b2ec9beccc4fd788e16194 Mon Sep 17 00:00:00 2001 From: balambasik <13239633+balambasik@users.noreply.github.com> Date: Mon, 15 Apr 2019 23:02:45 +0300 Subject: [PATCH 15/15] Update index.md --- index.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.md b/index.md index 5d03c80..72afa7d 100644 --- a/index.md +++ b/index.md @@ -1,6 +1,5 @@ -# Sselect -## Input text field tips. jQuery plugin. -Drop-down list of hints for text input. +# Sselect. Input text field tips. jQuery plugin. +## Drop-down list of hints for text input. ## Install