Skip to content

Commit

Permalink
4.3.5 added apply to filters, added info to image filters
Browse files Browse the repository at this point in the history
  • Loading branch information
bombledmonk committed May 16, 2019
1 parent ad51e88 commit 3d98c24
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 8 deletions.
2 changes: 1 addition & 1 deletion advancedsearch.css
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ p.alert{

#itemInfo {
position: absolute;
z-index: 8;
z-index: 1005;
background-color: white;
padding: 10px;
border: 2px solid grey;
Expand Down
68 changes: 61 additions & 7 deletions advancedsearch.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
// @grant GM_getResourceText
// @grant GM_getResourceURL
// @grant GM_openInTab
// @version 4.3.4.5
// @version 4.3.5
// ==/UserScript==

// Copyright (c) 2019, Ben Hest
Expand Down Expand Up @@ -242,6 +242,7 @@
//4.3.4.2 pick with images tweak
//4.3.4.4 fixed more filters button.
//4.3.4.5 switched from rawgit to raw.githack.com
//4.3.5 added apply next to filter, added data to imagefilters

//TODO explore easy voltage search when there is a min and max column
//TODO fix colmath sorting isues
Expand All @@ -255,7 +256,6 @@
//TODO split family names on "\s-\s" and stick into subcats
//TODO Toggle Hide filter block
//TODO add feature to re-search on "no results found" when in stock checkboxes are checked.
//TODO check out IndexedDB for caching
//TODO add footprints and symbols
//TODO add a most recently visited/ most visited families feature to top of page (chris)
//TODO add obsolete product direct subs to top of page PCC101CQCT-ND
Expand Down Expand Up @@ -1240,6 +1240,9 @@ function formatFilterResultsPage() {
replaceStarDash();
addMorePartsToTable();
setTimeout(addQuickFilterButton, 1000)

addSmallApply();

//addOpAmpWiz();
//setTimeout(function(){addDocRetrieve()}, 2500); //keep for posterity
// addClipboardCopyToResultsTable();
Expand Down Expand Up @@ -1668,6 +1671,8 @@ function addVisualPicker() {
$('#mainform').submit();
});
mediumImageHover();
// addVisualPickerInfoHover();

//add special case for manufacturer, pull logo?
_log('addVisualPicker() End', DLOG);
}
Expand Down Expand Up @@ -1831,7 +1836,22 @@ function getSingleOptionImageSet($option, filtername) {

_log('matching', dd.find('#matching-records-count').text())
var matching = (dd.find('#matching-records-count').length > 0) ? dd.find('#matching-records-count').text().trim() : '1';
var $headerRow = dd.find('#productTable>thead>tr:first th')
console.log($headerRow.html())
var $images = dd.find('.pszoomer').addClass('pszoomervp').removeClass('pszoomer');
$images.each(function(index,value){
var thisdata = '';
$(this).closest('tr').find('td').each( function(mykey, myval){
// console.log('my key is'+ mykey)
// console.log(dd.find('#producTable>thead>tr:first th').length)
thisdata += '<b>' + $headerRow.eq(mykey + 1).text() + '</b> : ' +
$(this).text() + '<br>';
// thisdata += mykey;
})
$(this).data('parameters', thisdata);
// console.log($(this).data('parameters'));
})
// console.log(dd.find('#productTable>tbody>tr'));
$('#pickerid' + optionval).find('.matchnum').text(matching);

$images.css({ 'height': '64px', 'width': '64px' });
Expand Down Expand Up @@ -1895,8 +1915,8 @@ function mediumImageHover() {
$('#mzoomie').attr('src', src.replace('tmb', 'sml'));
$('#mzoomie').show().position({
'my': 'left top',
'at': 'left bottom',
'of': $(this),
'at': 'right top',
'of': $('#itemInfo'),
'collision': 'flip',
'offset': '0 0',
}).hide().css('z-index', 2000).show();
Expand All @@ -1906,10 +1926,34 @@ function mediumImageHover() {
},
'.pszoomervp'
);

// $('.pickerbody').hoverIntent(visualPickerHoverIn, infoHoverOut, '.pszoomervp')
$('.pickerbody').on('mouseenter', '.pszoomervp', visualPickerHoverIn);
$('.pickerbody').on('mouseleave', '.pszoomervp', infoHoverOut);
_log('mediumImageHover() End', DLOG);
}


function visualPickerHoverIn(e) {
var info = '';
var thisitem = $(this);
console.log(thisitem.data('parameters'))
$('#itemInfo').html(thisitem.data('parameters')).css('z-index',2000);
$('#itemInfo').show();
$('#itemInfo').position({
'my': 'left top',
'at': 'right top',
'of': thisitem,
'collision': 'fit',
'offset': '0 0',
});

}

function getImageHoverData(){

}

// function addMatchingRecordsToApply(){
// _log('addMatchingRecordsToApply() Start',DLOG);
// $('.filters-buttons').append('<div class="matching-records" style="display:inline; margin-left:30px; position:relative;">'+$('.matching-records').text()+'</div>');
Expand Down Expand Up @@ -2625,6 +2669,14 @@ function squishedFilters() {
$selects.parent().addClass('fullwidth');
}

function addSmallApply(){
$('.clear-filters').after('<span class="smallapply" style="display:none;float:right; cursor:pointer; text-decoration:underline;">apply</span>')
$('.smallapply').click(function () { $('.search-form').submit()});
$('.search-form select').change(function () {
$(this).closest('div').find('.smallapply').show();
})
}

// function enableDefaultQty(){
// _log('enableDefaultQty() Start',DLOG);
// if(localStorage.getItem('qtydefault') == 1) {
Expand Down Expand Up @@ -4218,8 +4270,10 @@ function addImageBar() {
// $('#mainform').after('<div id="accDiv" class="collapsed"><div id="accContent">loading...</div></div>');
$('#filters-panel').after(
'<div id="accDiv" class="collapsed">' +
'<div style="height:' + titleheight + 'px; font-weight:bold; width:100%; border-bottom:1px solid lightgray;" id=accTitle>Find By Image</div>' +
'<div id="accContent">loading...</div>' +
'<div style="height:' + titleheight +
'px; font-weight:bold; width:100%; border-bottom:1px solid lightgray;" id=accTitle>Find By Image'+
'</div>' +
'<div id="accContent">loading...</div>' +
'</div>');
$('#accTitle').append('<div id="expand1"><div id="expand2">+ More Images +</div></div>');
$('#accDiv').css({
Expand Down Expand Up @@ -5716,7 +5770,7 @@ function infoHoverOut(e) {
}

function showAccelTmb(e) {
$('#bigpic').fadeIn(300);
$('#bigpic').fadeIn(150);
$('#bigpic').html('<img src="' + $(this).attr('src').replace('_tmb', '') + '" height="250" width="250">');
$('#bigpic').position({
'my': 'left top',
Expand Down

0 comments on commit 3d98c24

Please sign in to comment.