Skip to content

Commit

Permalink
Adding a migration css jquery-ui-dul-theme-shim which has some of the…
Browse files Browse the repository at this point in the history
… old styling from the earlier custom version of jquery ui css. Also redefining the combobox.js definition to one up to date with the newest combobox spec
  • Loading branch information
iccole committed Nov 21, 2024
1 parent add3e24 commit eb163e0
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 121 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions pn-site/css/custom-theme/jquery-ui-dul-theme-shim.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #c0d3bc url(images/ui-bg_glass_75_c0d3bc_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #ebf1e8 url(images/ui-bg_glass_75_ebf1e8_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #a6c698 url(images/ui-bg_glass_65_a6c698_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
.ui-widget :active { outline: none; }

/* Component containers
----------------------------------*/
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
.ui-widget-content a { color: #222222; }
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
.ui-widget-header a { color: #222222; }

/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #c0d3bc url(images/ui-bg_glass_75_c0d3bc_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #ebf1e8 url(images/ui-bg_glass_75_ebf1e8_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #a6c698 url(images/ui-bg_glass_65_a6c698_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
.ui-widget :active { outline: none; }

/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_inset-soft_95_fef1ec_1x100.png) 50% bottom repeat-x; color: #cd0a0a; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }

.custom-combobox { position: relative; display: inline-block; }
.custom-combobox-toggle { position: absolute; top: 0; bottom: 0; margin-left: -1px; padding: 0; float: right }
.custom-combobox-input { margin: 0; padding: 5px 10px; float: left}
10 changes: 8 additions & 2 deletions pn-site/facetbrowse.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<link rel="stylesheet" href="/css/yui/reset-fonts-grids.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="/css/master.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="/css/custom-theme/jquery-ui-1.14.1.min.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="/css/custom-theme/jquery-ui-dul-theme-shim.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="/css/jquery.bubblepopup.v2.1.5.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="/css/autocomplete/autocomplete.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="/js/jquery-3.7.1.min.js" type="text/javascript" charset="utf-8"></script>
Expand Down Expand Up @@ -177,7 +178,6 @@

.facet-widget select, .facet-widget input{

float: right;
padding-top: 0;
margin-top: 0;

Expand Down Expand Up @@ -707,13 +707,19 @@

#after-era-selector, #before-era-selector{

float: left;
float: inline-end;
position: relative;
margin-left: 2em;
padding-top: 2px;

}

.custom-combobox {
float: right;
margin-right: 1em;
vertical-align: middle;
}

#after-era-selector input, #before-era-selector input{

float: none;
Expand Down
227 changes: 112 additions & 115 deletions pn-site/js/combobox.js
Original file line number Diff line number Diff line change
@@ -1,133 +1,130 @@
/*
* jQuery UI Combobox 1.0.0
*
* Copyright 2011, Eric Mann and Jumping Duck Media (http://jumping-duck.com)
* Dual licensed under the MIT or GPL Version 2 (or later) licenses.
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.position.js
* jquery.ui.autocomplete.js
*
* Button positioning, modifications to regex matching , and copying of attributes added thill 2012.03.06
*
*/
(function ($) {
$.widget("ui.combobox", {
_create: function () {
var self = this,
select = this.element.hide(),
selected = select.children(":selected"),
(function($) {
$.widget( "custom.combobox", {
_create: function() {
this.wrapper = $( "<span>" )
.addClass( "custom-combobox" )
.insertAfter( this.element );

this.element.hide();
this._createAutocomplete();
this._createShowAllButton();
},

_createAutocomplete: function() {
var selected = this.element.children( ":selected" ),
value = selected.val() ? selected.text() : "";
var input = this.input = $("<input class=\"combobox\">")
.attr('id', select.attr('id') + '_input')
.attr('tabIndex', select.attr('tabIndex') + 1)
.attr('name', select.attr('name'))
.attr('width', 50)
.insertAfter(select)
.val(value)

this.input = $( "<input>" )
.appendTo( this.wrapper )
.val( value )
.attr( "title", "" )
.addClass( "custom-combobox-input ui-widget ui-widget-content ui-corner-left" )
.autocomplete({
delay: 0,
minLength: 0,
source: function (request, response) {
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
response(select.children("option").map(function () {
var text = $(this).text();
if (this.value && (!request.term || matcher.test(text.replace(/\(\d+\)\s*$/, ""))))
source: this._source.bind( this )
})
.tooltip({
classes: {
"ui-tooltip": "ui-state-highlight"
}
});

this._on( this.input, {
autocompleteselect: function( event, ui ) {
ui.item.option.selected = true;
this._trigger( "select", event, {
item: ui.item.option
});
},

autocompletechange: "_removeIfInvalid"
});
},

_createShowAllButton: function() {
var input = this.input,
wasOpen = false;

$( "<a>" )
.attr( "tabIndex", -1 )
.attr( "title", "Show All Items" )
.tooltip()
.appendTo( this.wrapper )
.button({
icon: "ui-icon-triangle-1-s",
showLabel: false
})
.removeClass( "ui-corner-all" )
.addClass( "custom-combobox-toggle ui-state-default ui-corner-right" )
.on( "mousedown", function() {
wasOpen = input.autocomplete( "widget" ).is( ":visible" );
})
.on( "click", function() {
input.trigger( "focus" );

// Close if already visible
if ( wasOpen ) {
return;
}

// Pass empty string as value to search for, displaying all results
input.autocomplete( "search", "" );
});
},

_source: function( request, response ) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
response( this.element.children( "option" ).map(function() {
var text = $( this ).text();
if ( this.value && ( !request.term || matcher.test(text) ) )
return {
label: text.replace(
new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" +
$.ui.autocomplete.escapeRegex(request.term) +
")(?![^<>]*>)(?![^&;]+;)", "gi"
), "<strong>$1</strong>"),
label: text,
value: text,
option: this
};
}));
},
select: function (event, ui) {
ui.item.option.selected = true;
self._trigger("selected", event, {
item: ui.item.option
});
var controlbutton = $(this).next("button");
controlbutton.css("outline-color", $(this).css("outline-color"));
controlbutton.css("outline-width", $(this).css("outline-width"));
controlbutton.css("outline-style", $(this).css("outline-style"));
window.setTimeout(info.papyri.thill.guidesearch.tidyQueryString, 10);
}) );
},
change: function (event, ui) {
if (!ui.item) {
var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),

_removeIfInvalid: function( event, ui ) {

// Selected an item, nothing to do
if ( ui.item ) {
return;
}

// Search for a match (case-insensitive)
var value = this.input.val(),
valueLowerCase = value.toLowerCase(),
valid = false;
select.children("option").each(function () {
if ($(this).text().match(matcher)) {
this.element.children( "option" ).each(function() {
if ( $( this ).text().toLowerCase() === valueLowerCase ) {
this.selected = valid = true;
return false;
}
});
}
}
})
.addClass("ui-widget ui-widget-content ui-corner-left");

// https://stackoverflow.com/questions/9513251/cannot-set-property-renderitem-of-undefined-jquery-ui-autocomplete-with-html
input.data("ui-autocomplete")._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + item.label + "</a>")
.appendTo(ul);
};
var surround_height = input.parent().height();
this.button = $("<button type='button'>&nbsp;</button>")
.attr("tabIndex", -1)
.attr("title", "Show All Items")
.insertAfter(input)
.button({
icons: {
primary: "ui-icon-triangle-1-s"
},
text: false
})
.removeClass("ui-corner-all")
.addClass("ui-corner-right ui-button-icon combobox-button")
.click(function () {
// close if already visible
if (input.autocomplete("widget").is(":visible")) {
input.autocomplete("close");

// Found a match, nothing to do
if ( valid ) {
return;
}

// work around a bug (likely same cause as #5265)
$(this).blur();
input.focus();
// pass empty string as value to search for, displaying all results
input.autocomplete("search", "");
input.focus();
});
// need to play with these values to get them working x-browser
var ht = input.outerHeight();
var wd = this.button.width();
var leftness = input.position().left + input.outerWidth();
var topness = input.position().top;
var stylestring = "height:" + ht + "px; position:absolute; top:" + topness + "px; left:" + leftness + "px";
this.button.attr("style", stylestring);
if(input.attr("disabled")) this.button.attr("disabled", "disabled");
if(select.attr("disabled")){

input.attr("disabled", "disabled");
this.button.attr("disabled", "disabled");

}
},

destroy: function () {
this.input.remove();
this.button.remove();
// Remove invalid value
this.input
.val( "" )
.attr( "title", value + " didn't match any item" )
.tooltip( "open" );
this.element.val( "" );
this._delay(function() {
this.input.tooltip( "close" ).attr( "title", "" );
}, 2500 );
this.input.autocomplete( "instance" ).term = "";
},

_destroy: function() {
this.wrapper.remove();
this.element.show();
$.Widget.prototype.destroy.call(this);
}
});
})(jQuery);
}
});
} )( jQuery );
11 changes: 7 additions & 4 deletions pn-site/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ function init() {
jQuery(this).after("<li><a href=\"#\" onclick=\"javascript:jQuery('#" + this.id + "c').dialog({height:100,modal:true})\">" + this.title + "</a></li>");
jQuery(this).hide();
});
jQuery("ul.nav li").not(".dialog").not(jQuery("#footer ul.nav li")).not(".current").has("a").hover("mouseenter", () => {
jQuery(this).css('background-color', '#F8F6F4');
}).on("mouseleave", () => {
jQuery(this).css('background-color', 'transparent');
jQuery("ul.nav li").not(".dialog").not(jQuery("#footer ul.nav li")).not(".current").has("a").on({
mouseenter: function() {
jQuery(this).css('background-color', '#F8F6F4');
},
mouseleave: function() {
jQuery(this).css('background-color', 'initial'); //set it back to its initial state
}
});
jQuery("div.controls input").each(function() {
if (!this.checked) {
Expand Down

0 comments on commit eb163e0

Please sign in to comment.