From 0494244e8068198707bf602199413cd216b0d515 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 3 Feb 2013 18:48:30 -0500 Subject: Super first pass: - jQuery 1.90 - jQuery UI 1.10 - Superfish 1.5.1 (minus all plugins) - jQuery Form 3.26.0-2013.01.28 Deleted all other jQuery plugins for now. - Reworked autocomplete to use the latest jQuery code. - Deleted references to $.browser.msie, no longer supported - Basic CSS support for autocomplete - lots more work needed there --- modules/tag/controllers/tags.php | 9 ++++----- modules/tag/helpers/tag_event.php | 3 +-- modules/tag/views/tag_block.html.php | 16 +++++++--------- 3 files changed, 12 insertions(+), 16 deletions(-) (limited to 'modules') diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index 77d45a95..32e857c6 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -48,18 +48,17 @@ class Tags_Controller extends Controller { public function autocomplete() { $tags = array(); - $tag_parts = explode(",", Input::instance()->get("q")); - $limit = Input::instance()->get("limit"); + $tag_parts = explode(",", Input::instance()->get("term")); $tag_part = ltrim(end($tag_parts)); $tag_list = ORM::factory("tag") ->where("name", "LIKE", Database::escape_for_like($tag_part) . "%") ->order_by("name", "ASC") - ->limit($limit) + ->limit(100) ->find_all(); foreach ($tag_list as $tag) { - $tags[] = html::clean($tag->name); + $tags[] = (string)html::clean($tag->name); } - ajax::response(implode("\n", $tags)); + ajax::response(json_encode($tags)); } } diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index d62ae36e..79d6e0bc 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -72,8 +72,7 @@ class tag_event_Core { $url = url::site("tags/autocomplete"); $form->script("") ->text("$('form input[name=tags]').ready(function() { - $('form input[name=tags]').gallery_autocomplete( - '$url', {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1}); + $('form input[name=tags]').gallery_autocomplete('$url', {multiple: true}); });"); $tag_names = array(); diff --git a/modules/tag/views/tag_block.html.php b/modules/tag/views/tag_block.html.php index d25b8dcb..afa61b15 100644 --- a/modules/tag/views/tag_block.html.php +++ b/modules/tag/views/tag_block.html.php @@ -2,15 +2,13 @@ diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 79d6e0bc..08d5d53a 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -124,7 +124,7 @@ class tag_event_Core { ->text("$('input[name=tags]') .gallery_autocomplete( '$autocomplete_url', - {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1} + {multiple: true} ); $('input[name=tags]') .change(function (event) { -- cgit v1.2.3 From a000540565dacd0c83418d88dfda63e8e255dbc3 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 17 Feb 2013 00:30:56 -0500 Subject: Updated for the new jQuery tabs API. --- modules/g2_import/views/admin_g2_import.html.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index 22e19f5b..09aa6fae 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -25,9 +25,9 @@ $("document").ready(function() { .tabs("disable", 1) .tabs("disable", 2) .9 * $g2_resource_count): ?> - .tabs("select", 2) + .tabs({active: 2}) - .tabs("select", 1) + .tabs({active: 1}) ; -- cgit v1.2.3 From 9345dde83e1f092a9309c45282dc21e3fd408875 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 17 Feb 2013 00:39:30 -0500 Subject: Fix autocomplete for admin_g2_import. --- modules/g2_import/controllers/admin_g2_import.php | 6 +++--- modules/g2_import/views/admin_g2_import.html.php | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'modules') diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index c4f03907..08007b85 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -101,10 +101,10 @@ class Admin_g2_import_Controller extends Admin_Controller { public function autocomplete() { $directories = array(); - $path_prefix = Input::instance()->get("q"); + $path_prefix = Input::instance()->get("term"); foreach (glob("{$path_prefix}*") as $file) { if (is_dir($file) && !is_link($file)) { - $file = html::clean($file); + $file = (string)html::clean($file); $directories[] = $file; // If we find an embed.php, include it as well @@ -114,7 +114,7 @@ class Admin_g2_import_Controller extends Admin_Controller { } } - ajax::response(implode("\n", $directories)); + ajax::response(json_encode($directories)); } private function _get_import_form() { diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index 09aa6fae..fd9487e4 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -5,10 +5,7 @@ $("document").ready(function() { $("form input[name=embed_path]").gallery_autocomplete( "".replace("__ARGS__", "admin/g2_import/autocomplete"), - { - max: 256, - loadingClass: "g-loading-small", - }); + {}); }); -- cgit v1.2.3 From 4f779e90831e9746083564ac82d4105dfc994262 Mon Sep 17 00:00:00 2001 From: shadlaws Date: Mon, 18 Feb 2013 18:09:29 +0100 Subject: Password strength indicator fixed for new jQuery. Also cleaned up formatting. --- modules/user/js/password_strength.js | 71 ++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 36 deletions(-) (limited to 'modules') diff --git a/modules/user/js/password_strength.js b/modules/user/js/password_strength.js index 2442b8de..5764e332 100644 --- a/modules/user/js/password_strength.js +++ b/modules/user/js/password_strength.js @@ -1,39 +1,38 @@ (function($) { - // Based on the Password Strength Indictor By Benjamin Sterling - // http://benjaminsterling.com/password-strength-indicator-and-generator/ - $.widget("ui.user_password_strength", { - _init: function() { - var self = this; - $(this.element).keyup(function() { - var strength = self.calculateStrength (this.value); - var index = Math.min(Math.floor( strength / 10 ), 10); - $("#g-password-gauge") - .removeAttr('class') - .addClass( "g-password-strength0" ) - .addClass( self.options.classes[ index ] ); - }).after("
"); - }, + // Based on the Password Strength Indictor By Benjamin Sterling + // http://benjaminsterling.com/password-strength-indicator-and-generator/ + $.widget("ui.user_password_strength", { + options: { + classes: ['g-password-strength10', 'g-password-strength20', 'g-password-strength30', + 'g-password-strength40', 'g-password-strength50', 'g-password-strength60', + 'g-password-strength70', 'g-password-strength80', 'g-password-strength90', + 'g-password-strength100'] + }, - calculateStrength: function(value) { - // Factor in the length of the password - var strength = Math.min(5, value.length) * 10 - 20; - // Factor in the number of numbers - strength += Math.min(3, value.length - value.replace(/[0-9]/g,"").length) * 10; - // Factor in the number of non word characters - strength += Math.min(3, value.length - value.replace(/\W/g,"").length) * 15; - // Factor in the number of Upper case letters - strength += Math.min(3, value.length - value.replace(/[A-Z]/g,"").length) * 10; + _init: function() { + var self = this; + $(this.element).keyup(function() { + var strength = self.calculateStrength(this.value); + var index = Math.min(Math.floor(strength / 10), 10); + $("#g-password-gauge") + .removeAttr("class") + .addClass("g-password-strength0") + .addClass(self.options.classes[index]); + }).after("
"); + }, - // Normalizxe between 0 and 100 - return Math.max(0, Math.min(100, strength)); - } - }); - $.extend($.ui.user_password_strength, { - defaults: { - classes : ['g-password-strength10', 'g-password-strength20', 'g-password-strength30', - 'g-password-strength40', 'g-password-strength50', 'g-password-strength60', - 'g-password-strength70',' g-password-strength80',' g-password-strength90', - 'g-password-strength100'] - } - }); - })(jQuery); + calculateStrength: function(value) { + // Factor in the length of the password + var strength = Math.min(5, value.length) * 10 - 20; + // Factor in the number of numbers + strength += Math.min(3, value.length - value.replace(/[0-9]/g,"").length) * 10; + // Factor in the number of non word characters + strength += Math.min(3, value.length - value.replace(/\W/g,"").length) * 15; + // Factor in the number of Upper case letters + strength += Math.min(3, value.length - value.replace(/[A-Z]/g,"").length) * 10; + + // Normalize between 0 and 100 + return Math.max(0, Math.min(100, strength)); + } + }); +})(jQuery); -- cgit v1.2.3 From 4bf41377b8aca8dff15ccce398662e428268fa09 Mon Sep 17 00:00:00 2001 From: shadlaws Date: Mon, 18 Feb 2013 18:29:31 +0100 Subject: Moved autocomplete CSS to gallery.css to ensure it works for all themes (including admin_wind). --- modules/gallery/css/gallery.css | 6 ++++++ themes/wind/css/screen.css | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css index d3f7dcca..73b8ab4e 100644 --- a/modules/gallery/css/gallery.css +++ b/modules/gallery/css/gallery.css @@ -158,6 +158,12 @@ z-index: 1000 } +/* Autocomplete ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.ui-autocomplete { + text-align: left; +} + /** ******************************************************************* * 2) Admin **********************************************************************/ diff --git a/themes/wind/css/screen.css b/themes/wind/css/screen.css index 6f98cbba..0ece722e 100644 --- a/themes/wind/css/screen.css +++ b/themes/wind/css/screen.css @@ -948,12 +948,6 @@ button { display: inline-block; } -/* Autocomplete */ - -.ui-autocomplete { - text-align: left; -} - /* Status and validation messages ~~~~ */ .g-message-block { -- cgit v1.2.3