forked from bombledmonk/advancedsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
advancedsearch.user.js
5962 lines (5208 loc) · 250 KB
/
advancedsearch.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ==UserScript==
// @name advancedsearch
// @namespace advancedsearch
// @description an advanced search
// @include http*www.digikey.*/product-search*
// @include http*www.digikey.*/products*
// @include http*digikeytest.digikey.*/product-search*
// @include http*digikeytest.digikey.*/products*
// @include http*www.digikey.*/scripts/dksearch*
// @include http*search.digikey.*/*
// @include http*www.digikey.*/product-detail/en/*
// @include http*digikey.*/product-detail/*/*
// @include http*digikey.*/short/*
// @exclude http*digikey.*/classic/Ordering/FastAdd*
// @exclude http://www.digikey.com
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/highcharts.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/jquery.localScroll.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/jquery.hoverIntent.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/jquery.spellchecker.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/quantities.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/jquery.jqpagination.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/dklib.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/fixedsticky.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/tooltipster.bundle.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/jquery.lazyloadxt.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/jquery.dragtable.js
// @require https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.8/clipboard.min.js
// @require https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/familyimages.js
// @resource buttonCSS https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/buttons.css
// @resource jQueryUICSS https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/themes/smoothness/jquery-ui.css
// @resource advCSS https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/advancedsearch.css
// @resource normalizeCSS https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/base.css
// @resource pureCSS https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/pure.css
// @resource stickyCSS https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/fixedsticky.css
// @resource tooltipsterCSS https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/tooltipster.bundle.css
// @resource tooltipster-shadowCSS https://raw.githubusercontent.com/bombledmonk/advancedsearch/master/tooltipster-sideTip-shadow.min.css
// @connect self
// @connect digikey.com
// @updateURL https://hest.pro/s/advancedupdate
// @downloadURL https://hest.pro/s/advanceddownload
// @run-at document-end
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @grant GM_getResourceText
// @grant GM_getResourceURL
// @grant GM_openInTab
// @version 4.3.4.2
// ==/UserScript==
// Copyright (c) 2018, Ben Hest
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// The views and conclusions contained in the software and documentation are those
// of the authors and should not be interpreted as representing official policies,
// either expressed or implied, of the FreeBSD Project.
//author can be emailed at gmail.com bombledmonk@
//1.7.3 gave the detail page a softer look, changed the text voltage input helper to be more user friendly
//1.7.6 Download link changed to bit.ly to keep track of downloads. https://dl.dropbox.com/u/26263360/advancedsearch.user.js
//1.7.7 Userscripts.org release http://userscripts.org/scripts/show/157205
//1.7.8 Added more alternate highlighting terms. ie search for "10k" and all the resistors and pots will be highlighted,
// started checkboxes feature, changed the "initially sort by price" feature to re-filter on desired quantity when changed
//1.7.9 Added indexInstantFilter function. Instantly filter down product families as user types in search box. Disabled by default.
//1.8.0 Added Cart Hover and item count in header.
//1.8.1 Fixed sort by price @ Qty bug. Improved cart hover. Added price break popup when hovering over prices.
//1.8.2 Added simple column hiding. Refactored code, bug fixes.
//1.8.2.1 Added some error catching code
//1.8.3 Added Hover function to Associated Products Links, For Use With Links, and added a browse and filter function to both spots on the Product detail page.
//1.8.3.1 Fixed Chrome problems by using runat document-end instead of document-start.
// Fixed breadcrumbs to include sort order/in stock/lead free/rohs and quantity modifiers
//1.8.4 Added Breadcrumb Category Hover. Made Jump to Category scrollable. Fixed some bugs introduced by styling changes made by DK.
//1.8.5 Added Associated Product Carousel on product detail pages. Fixed the chrome auto scrolling bug. Added jquery plugins as "at require".
// Added Compare Feature
//1.8.6 Added Reverse Filtering from product Detail pages
//1.8.6.1 Added feedback to the reverse filtering and compare features and exposed a more intuitive interface
//1.8.6.2 Fixed issue where multiple product families messed with the Carousel.
//1.8.7 Started bringing in CSS externally, Added wrapping feature for Parameter Multiselect Boxes, Added accordion select box tech demo
// Added show hidden columns button
//1.8.7.1 New version of compare, pops up from bottom, no more hoverover.
//1.8.7.2 Fixed annoying headers not lining up,
//1.8.8 Added icons in jump to area
//1.8.8.1 Turned Icons into sprites. Fixed bugs with carousel. Rearranged some of the Controls menu
//1.8.9 Revamped the cart quantity changing. Added the main cart page to the script added functionality.
//1.8.9.1 Added pictures to the cart areas.
//1.9.0 Added Explore Mode - gives little popups with pictures of each parameter when hovered
//1.9.0.1 Tweaked Explore Mode - gave a medium preview box in the Explore Mode hover
//2.0.0 Fixed bugs introduced by updates to digikey's site
//2.0.0.1 Fixed more bugs introduced by updates to digikey's site
//2.0.1 Added horizontal scrolling feature to Apply Filters, Added feature allow checkbox inputs to comma separated values in a multiselect input.
//2.0.2 Added Search Within: feature on Drill Down Results Page. Bug Fixes
//2.0.2.1 Hid some lengthy text to improve density
//2.0.3 First Attempt at Internationalizing the script. In theory it should work on all English digikey websites from now on.
//2.0.3.1 Fixed Sorting bugs
//2.0.4 Fixed the bloated sequential timing to get script loadtime down to 10%, Introduced applied filters removal
//2.0.4.1 Fixed cart bug, added some more speed optimizations.
//2.0.4.2 Tuned some of the hover over timings.
//2.0.4.3 Fixed No records matching bug.
//2.0.5 Added index column feature, fixed category highlighting with Jump To Category feature
//2.0.5.1 Refined some of the index page features, including column
//2.0.5.2 Added a control for location of quick pick box
//2.0.5.3 Some quick fixes
//2.0.5.4 Refinement of quick pick controls, fixed bug with forward slash in breadcrumb
//2.0.6 Finished wrapping the filters to avoid side scrolling.
//2.0.6.1 Added some more parameter titles to work with the voltage helper, added button to switch on explore mode
//2.0.6.2 Fixed the voltage helper used with wrapping, fixed clear buttons, added control for wrapping divs
//2.0.6.3 Style changes, gray headers
//2.0.7 Polished. Changed style of the filters, input text boxes, fixed buttons, changed the floating apply buttons
// fixed applyfilters bug, put buttons in tabs
//2.0.7.1 fixed a few display bugs in Chrome
//2.0.7.2 fixed formatFilterResults page error
//2.0.8 added datasheet autoloader
//2.0.8.1 fixed some errors introduced by changes on digikey's website
//2.0.8.2 minor cleanup, error alerts, and fixes
//2.0.8.5 weekend refactoring
//2.0.9 fixed compare parts feature
//2.0.10 fixed error occurring on the detail page where user could not delete parts, added always expand checkbox to wrapping filters
//2.1.0 added customizable delay time for Explore mode in the control panel
//2.1.1 added jump down to datasheet button
//2.1.2 fixed errors where filters cannot be removed
//2.1.3 added back caching for the removable filters
//2.1.4 hopefully fixed errors associated with foreign languages
//2.2 Added query term highlighting on the filter results page, fixed formatting errors introduced by new defualt font.
// Changed color of help icon, changes also in CSS
//2.2.1 added null string check to fix bug with query term highlighting
//2.2.2 made the header respond better to different size windows
//2.2.3 added partial .jp support for range search
//2.3 reworked the voltage range search algorithm to include comma separated values
//2.4 Added search button highlighting, fixed so all floating filters appear in-line, added next price break calculator.
// Fixed errors due to Digi-Key website changes
//2.4.1 Fixed doubling up bug in the quick picks box, fixed stacked explore mode box in chrome
//2.5 Added ORing checkboxes to the package type inputs
//2.5.1 Fixed bug on fastadd page, added quickpaste function on fastadd page
//2.5.2 Code cleanup, added BSD license
//2.6 Quick Fix for Quick Picks update on dk site
//2.6.1 Fix for digikey site bug.
//2.6.2 Added My Digi-Key link
//2.6.3 My Digi-Key link international bug fix
//2.6.4 Fix for Explore mode and example pictures on some sites
//2.7 Fixed issues introduced by cart changes, code cleanup
//2.7.1 Code cleanup, added id
//2.7.2 quick fix
//2.7.3 fixed the uniqueness of the checkbox helper
//2.7.4 fix for new header on dk website.
//2.7.5 fixed bug in the Search Within feature
//2.8 added a more functional associated parts filtering mechanism,
// added Hide Identical Columns feature, tweaked instant filter with wildcard search
//2.9 added Column Math and picture carousel
//2.9.1 added graphing/charting, fixed picture carousel, refining value parser
//2.9.2 refactored associated product, fixed header link bugs, removed beablock blue, various other bug fixes
//2.9.3 hid customers who evaluated box
//2.9.4 added fonts, restyled checkboxes, filter page bug fixes
//2.9.5 fixed bugs in similar to feature, fixed button highlighting problems, style changes
//2.9.6 added clear button rules, worked on speed, sending ot to fix dropbox serving error
//2.9.6.1 chrome fix for selectbox width
//2.9.6.3 fixed bugs in wrap filters area
//2.9.7 handled change in breadcrumbs, styled index page
//2.9.8 Started wizards, added LEDwiz, changed qty form, fixed double fill bug in associated product, moved detail image.
//3.0 Large refactor, fixed price break hover
//3.0.1 Fixed Temperature Range helper
//3.0.2 Fixed European price formatting error, added some icons
//3.1 Started reformatting the Index page
//3.1.1 Fixed indexpicpreview
//3.2 Added Visual Picker, finished header redesign, fixed search focus, added link to category.
//3.3 Added images to families, removed explore mode, improved pick with pictures feature.
//3.4 No longer runs in cart, fixed CSS issues, removed some unused javascript libs
//3.4.1 Fixed index image problems going to the wrong url.
//3.5 refactored for speed improvements. index pictures, header, control widget.
//3.5.1 fixed checkbox bug
//3.5.2 delayed the init of settings box for speed, fixed table width issues.
//3.6 fixed upper case issues with instant search, fixed compare z-level, replaced * and - text with name and title text
// added learn more about capacitors link, fixed matching-records bug, added "new products" link
//3.6.1 added image hover over supplier portal links, fixed the associated product view all links.
//3.6.2 added https in product search, added view more button at bottom of product table
//3.6.3 added search help
//4.0 Major overhaul needed because of digikey website update
//4.0.2 Added image bar back.
//4.0.3 Retooled voltage range helper. Clippy!!!
//4.0.4 added [at]connect declarations for tampermonkey 4.0, fixed sideindex background issue,
//4.0.5 added dark theme/night mode, added auto search to results not found page, bug fixes
//4.0.6 added back associated product, fixed night mode for chrome
//4.0.7 actually fixed chrome night mode
//4.1 fixed associated product bugs, updated font awesome, made the switch from getResourceText to getResourceURL for css, addtocart on filterpage
//4.1 added show/hide TR, DKR button and function in options
//4.1.1 started fixing detail page bugs introduced by changes on the website
//4.2 fixed datasheet loader, added copy to clipboard on detail page, updated tooltipster
//4.2.1 fixed bug in addMorePartsToTable
//4.2.2 fixed part status bug
//4.2.3 fixed url bug
//4.2.4 fixed normally stocking box
//4.2.5 augmented compare parts, copy content, visual picker fixes , attform fix
//4.2.6 added quickfilter, fixed bugs with product-search url changes
//4.2.7 added Direct Manufacturer URL, fixed datasheets for https website, added detail page part compare.
//4.2.8 fixed datasheet autoloader bug
//4.2.9 added copy button to filter results table page, big speed optimizations, compare parts page features
//4.3.0 added normally stocking feature to header, added image to related product, fixed floating apply, range height fixed
//4.3.0.1 actually fixed floating apply
//4.3.1 added canonical link on detail page, moved mfg links on associations, dead code cull, switched resources to github links
//4.3.1.1 changed pure resource to github
//4.3.1.2 changed downloadURL to rawgit
//4.3.1.3 changed downloadURL and updateURL to hest.pro short url
//4.3.1.4 fixed checkboxes, limited canonical url, fixed sprites, remaining dropbox links
//4.3.1.5 fixed logo link
//4.3.2 Pushed warning message for FF57 update
//4.3.2.1 removed no search results found page from scope
//4.3.2.2 updated family images
//4.3.2.3 fixed jump to image on filterresultspage
//4.3.2.4 fixed clippy, all https
//4.3.2.5 put in clippy date detection
//4.3.2.6 fixed col math and chart errors
//4.3.2.7 fixed price break helper, fixed carthover bug
//4.3.2.8 fixed associated product hover, hacked cart count
//4.3.2.9 fixed rounding error on col math, css tweaks
//4.3.3 fixed col math styling, cut cruff
//4.3.3.1 fixed shortlink bug
//4.3.3.2 removed copyPN button from detail page, officially part of DK website now
//4.3.4 slectable filter layout, minor fixes
//4.3.4.1 fixed pick with images
//4.3.4.2 pick with images tweek
//TODO explore easy voltage search when there is a min and max column
//TODO fix colmath sorting isues
//TODO add copy info button possibly on filter results page
//TODO add a messages/update
//TODO offer no reload, infinite scroll? at end of product index page.
//TODO display percentage of parameter on page, possibly graph
//TODO think about logging lib, global vars
//TODO Make graphs into filter inputs. look in drawChart function
//TODO Add graphs to the show pricing curve, call all packaging types and plot in different colors.
//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
//TODO fuzzy similar to, start in opamps
//TODO add a google like "advanced search" to the header
//TODO implement offscreen table wrap
//TODO add more voltage ranges
//TODO fix differentiation of 3d models and cad models in filter pages
// [at]include http*digikey.*/classic/Orderi2ng/FastAdd* add the fastadd features
var starttimestamp = Date.now();
var sincelast = Date.now();
var version = GM_info.script.version;
var lastUpdate = '11/7/18'; // I usually forget this
var downloadLink = 'https://hest.pro/s/advancedmanualupdate';
// redirects to https://rawgit.com/bombledmonk/advancedsearch/master/advancedsearch.user.js
var DLOG = false; //control detailed logging.
// var DLOG = true; //control detailed logging.
// var MAX_PAGE_LOAD = 20;
// var selectReset = null;
var theTLD = window.location.hostname.replace('digikey.','').replace('www.', '');
var sitemaplink = $('#header').find('a:contains("Site Map"):first').attr('href');
var mydklink = getMyDigiKeyLink();
var gIndexLink = getIndexLink();
var cacheflag = false;
//loads before document status is ready
function preloadFormat(){
_log('preloadFormat() Start',DLOG);
try{
if(GM.info.version){
if(parseFloat(GM.info.version) >= 4 && GM.info.scriptHandler == "Greasemonkey"){
alert(
`Advancedsearch Userscript for Digikey.com Message:
Firefox 57 has introduced compatability issues with Greasemonkey.
If you would like to continue using this script please install Tampermonkey for Firefox.
https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/
You will then need to install the advancedsearch userscript for digikey.com from
https://eewiki.net/display/Motley/advancedsearch+Greasemonkey+Userscript+for+Digikey.com
FF version: ${navigator.userAgent}
greasemonkey version: ${GM.info.version}
`);
}
}
}
catch(e){}
// $('#content').hide();
$('#content form[name="attform"]').attr('id', 'mainform'); // this form is only on filter page
$('.breadcrumbs').css({'margin': '0', 'padding': '5 0 0 0'});
GM_addStyle(
`#header {display: none;}
#content hr {display:none;}
#footer{position:relative; top:45px;}
#content>form:first-child {display:none}
#content>p {display:none;}
.content-keywordSearch-form{display:none;}
.ui-dialog-title{padding-left:60px;}
`
);
// GM_addStyle("#header {display: none;} #content hr {display:none;} #footer {display:none;} #content>p {display:none;} ");
// $('#header').detach();
$('#header').hide();
$('body').css('background-image','none');
$('#footer').before('<div style="height:10px;"></div>');
$('#content').append('<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">')
tc(addNightMode, 'addNightMode');
// $('#footer').css({'position':'absolute', 'bottom':'0px', 'left': '0px', 'width':'100%'});
// formatPagesPreReady();
_log('preloadFormat() End',DLOG);
}
if ($('#ctl00_ctl00_topContentPlaceHolder_lblWebIDTitle').length == 0){preloadFormat();}
$(document).ready(function() {
_log(`[ready] advanced search starts here. Jquery version ${jQuery.fn.jquery}`);
_log('[ready] hostname is '+ window.location.hostname,DLOG);
_log('[ready] pathname is '+ window.location.pathname,DLOG);
_log('[ready] search is '+ window.location.search,DLOG);
if ($('#ctl00_ctl00_topContentPlaceHolder_lblWebIDTitle').length == 0){formatPagesPostReady();}
_log('[ready] end of document ready function');
});
//
function addResourceCSS(){
var cssNames = [
"buttonCSS",
"advCSS",
"normalizeCSS",
"pureCSS",
"jQueryUICSS",
"fontAwesomeCSS",
"stickyCSS",
"tooltipsterCSS",
"tooltipster-shadowCSS"
];
for ( var x in cssNames){
var thetext = GM_getResourceURL(cssNames[x]);
_log('style tick 1'+ cssNames[x], DLOG);
$('body').prepend('<link rel="stylesheet" href="'+thetext+'">');
// $('body').prepend('<link rel="stylesheet" href="data:text/css;base64,'+thetext+'">')
_log('style tick end'+ cssNames[x], DLOG);
// _log('style tick start '+cssNames[x], DLOG);
}
}
function tc(thefunc, name){ // tc = try catch
try{
thefunc();
}catch(err){
console.log("%c"+err.message, 'color:red;');
console.log( err);
console.log("%c edd of error", 'color:red;');
alert('failed on '+ name + '\n' + err.message +
'\n\n If you are getting repeated errors try manually updating by clicking on the ++settings++ box in the upper right hand corner and then hit the manual update link.'+
'\n\n Alternatively, copy and paste this link into your browser: https://hest.pro/s/advanceddownload'+
'\n\n Tampermonkey users, please make sure you go to Tampermonkey Settings and change the Externals Update Interval to "Always".'
);
}
}
function formatPagesPostReady() {
_log('formatPagesPostReady() Start', DLOG);
formatPagesPreReady();
addResourceCSS();
tc(replaceQuestionMark, 'replaceQuestionMark');
// tc(updateCache, 'updateCache');
// tc(addCustomHeader, 'addCustomHeader');
// tc(addControlWidget,'addControlWidget'); // TODO FIX function order dependence on addCustomHeader
tc(preFormatDetailPage, 'preformatDetailPage');
tc(formatFilterResultsPage, 'formatFilterResultsPage');
// $('#content').show();
tc(formatDetailPage, 'formatDetailPage');
tc(formatFastAddPage, 'formatFastAddPage');
tc(addEvents, 'addEvents');
tc(formatIndexResultsPage, 'formatIndexResultsPage');
tc(addBreadcrumbHover, 'addBreadcrumbHover');
tc(formatComparePartsPage, 'formatComparePartsPage');
// tc(addCartHover, 'addCartHover');
// tc(lazyLoadFix, 'lazyLoadFix');
cleanup();
tc(tryClippy, 'tryClippy');
// $('.dk-sharelink').addClass('pure-button');
_log('formatPagesPostReady() End', DLOG);
}
function tryClippy() {
var force = localStorage.getItem('aprilf') == 1;
var date = new Date();
var options = { "day": 'numeric', "month": 'short' };
var today = date.toLocaleDateString('en-US', options);
var theAppointedTime = ('Apr 1' == today | 'Mar 31' == today | 'Apr 2' == today | 'Apr 0' == today);
console.log(date.toLocaleDateString('en-US', options));
if (force | theAppointedTime) {
setTimeout(function () { addClippy(); }, 1);
}
}
function addClippy() {
_log('addClippy() Start', DLOG);
$('head')
.append('<link rel="stylesheet" type="text/css" href="https://hest.pro/userscript/advancedsearch/clippy.js-master/build/clippy.css" media="all">')
var script = document.createElement('script');
script.setAttribute('src', 'https://hest.pro/userscript/advancedsearch/clippy.js-master/build/clippy.js');
script.setAttribute('async', 'async');
script.setAttribute('type', 'text/javascript');
var dochead = document.head || document.getElementsByTagName('head')[0];
dochead.appendChild(script);
setTimeout(function () {
window.eval(`
var jokearray = [
"If at first you don’t succeed; call it version 1.0.",
"The code that is the hardest to debug is the code that you know cannot possibly be wrong",
"Hand over the calculator, friends don’t let friends derive drunk.",
"To err is human – and to blame it on a computer is even more so.",
"There are only 10 types of people in the world: those that understand binary and those that don’t.",
"Electrical Engineers deal with current events.",
"If you're not part of the solution, you're part of the precipitate.",
"To err is human, to forgive divine, but to check--that's engineering",
"If at first you don't succeed, redefine success.",
"Never trust an atom. They make every thing up.",
'A Nuetron walks into a bar and asks for a drink. The bartender says "for you, no charge."',
"Where does bad light end up? In Prism.",
"Why is the PH of Youtube very stable? It constantly buffers.",
"Why did I divide SIN by TAN...... Just COS",
'A cop pulls Heisenberg over and asks "do you know how fast you were going?" Heisenberg replies "No, but I know where I am"',
"Why did the hipster burn his mouth? He ate it BEFORE it was cool.",
"Two hydrogen atoms walk into a bar. One says, I think I’ve lost an electron. The other says, Are you sure? The first replies, Yes, I’m positive.",
'A physicist sees a young man about to jump off the Empire State Building. He yells, "Dont jump, you have so much potential!"',
"What did the pirate say on his 80th birthday? AYE MATEY!",
"How do you think the unthinkable? With an ithberg",
"Whiteboards are remarkable.",
"The dead batteries were given out free of charge.",
"Sixteen sodium atoms walk into a bar…followed by Batman. ",
"Lost an Electron? You really have to keep an ION them.",
"I'd tell you chemistry jokes, but I'm afraid they wouldn't get a good reaction",
"How many software engineers does it take to change a light bulb. None, that's a hardware problem.",
];
clippy.load('Clippy', function(agent) {
// Do anything with the loaded agent
// console.log('clippy show', jokearray);
agent.show();
agent.speak("Hi, I'm Clippy. I'll also work as a bodge wire in a pinch.");
setTimeout(function(){
agent.speak(jokearray[Math.floor(Math.random() * (jokearray.length - 0)) + 0]);
}, 5000)
// agent.speak(jokearray[0]);
});
`);
}, 2000);
_log('addClippy() End', DLOG);
}
function formatPagesPreReady() {
_log('formatPagesPreReady() Start',DLOG);
$.tooltipster.setDefaults({
content: '...loading',
trigger: 'hover',
delay: 350,
interactive: true,
side: 'bottom',
updateAnimation: null,
animation: 'fade',
theme: 'tooltipster-shadow',
});
tc(addCustomHeader, 'addCustomHeader');
tc(addControlWidget,'addControlWidget'); // TODO FIX function order dependence on addCustomHeader
tc(addCartHover, 'addCartHover');
// tc(formatNoResultsFoundPage, 'formatNoResultsFoundPage');
tc(addCanonicalLinkToBreadCrumbs, 'addCanonicalLinkToBreadCrumbs');
// tc(preFormatDetailPage, 'preformatDetailPage');
_log('formatPagesPreReady() End',DLOG);
}
function formatNoResultsFoundPage(){
_log('formatNoResultsFoundPage() Start',DLOG);
if($('#noResultsTable').length){
$('p').show();
$('#noResultsTable').parent().parent().parent().css({'position':'relative', 'top':'35px'})
var loc = window.location.href;
var fixedLoc = loc.replace(/(stock|rohs|pbfree|new|has3d)\=1\&?/g,'');
$.get(fixedLoc, function(data){
var resultCount = parseInt($(data).find('#matching-records-count').text());
if(resultCount>0){
$('#noResultsTable p:first').html('There were 0 results using the In Stock, Lead Free, or RoHS provided. '+
'<br><br><a style="font-size:16pt; color:blue; " href="'+fixedLoc+'">Click to see ' + resultCount +' results which may be out of stock.</a>');
}
})
}
_log('formatNoResultsFoundPage() End',DLOG);
}
function getMyDigiKeyLink(){
var retval ='';
tc(function(){
if ($('.header-dropdown-content').length){
retval =$('#header-login').find('.header-dropdown-content a:first').attr('href');
}
}, 'getMyDigiKeyLink');
if (retval == undefined){ retval = 'https://www.digikey.com/classic/RegisteredUser/Login.aspx';}
return retval;
}
function getIndexLink(){
var ret = $('#header-middle').find('.header-resource').attr('href');
return (ret == undefined)? 'http://www.digikey.com/products/en' : ret;
}
function replaceQuestionMark(){
_log('replaceQuestionMark() Start',DLOG);
GM_addStyle(`img[src$="help.png"]{
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}`)
// var $img = $('img[src$="help.png"]');
// // $('img[src*="help.png"]').attr('src', 'https://dl.dropboxusercontent.com/u/26263360/img/newhelp.png');
// // $img.addClass('qmark').hide();
// $img.hide();
// $img.after('<i class="fa fa-question-circle fa-lg" style="color:#999;"></i>');// css used to replace image as a background image
_log('replaceQuestionMark() End',DLOG);
}
function cleanup () {
_log('cleanup() Start',DLOG);
askpermission(version);
$('input[type=submit],input[type=reset],input[type=button]').addClass('button-small pure-button')
.css({
// 'margin': '2px',
'background-image': ''
});
$('.button').css({
'background-image': 'none',
// margin:'2px'
});
$('p:contains("No records match your")').show();
$('.alert').show();
_log('cleanup() End',DLOG);
}
//TODO FINISH UNUSED
function updateCache(){
if(Date.now() > parseInt(localStorage.getItem('lastCacheRefresh')) + 604800000){
cacheflag = true;
}
else{
localStorage.setItem('lastCacheRefresh', 604800000);
cacheflag = false;
}
}
function addNightMode(){
if(localStorage.getItem('nightMode') == 1){
GM_addStyle(`
#content {filter: invert(100%);-webkit-filter: invert(100%);}
body {background-color:white;}
.mainFlexWrapper {background-color:white;}
#content {background-color:white;}
#content img {filter: invert(90%);-webkit-filter:invert(100%);}
html {background-color:black;}
`
);
// $('.mainFlexWrapper').css({'top':'50px'});
}
}
function addCustomFiltersPanel(){
GM_addStyle(`
.filters-group-2{
flex-wrap: unset !important;
overflow: visible !important;
}
.filters-group-2>div{
align-self: flex-end !important;
}
.filters-group-2>div>div{
display:inline-flex;
}
.filter-selectors2{
max-width: 100%;
min-width: 100%;
}
.filters-panel-2 .filters-group-more-less{
display:none !important;
}
#wrap-nowrap-container{
display:inline-flex;
margin-left:10px;
}
.filters-panel-2{
display:inline-block;
}
#nowrap-filters i{font-size:8px;}
#nowrap-filters {width:60px;}
#default-filters {width: 60px;}
`)
$('#search-within-results')
.after(`
<div id=wrap-nowrap-container title="Filter Layout">
<input id=wrapfilterschooser name=wrapfilterschooser value=1 class="saveState" type='hidden'>
<button id=nowrap-filters value=0 class="button pure-button button-small">
<i class="fa fa-stop fa-sm"></i> <i class="fa fa-stop fa-sm"></i>
<i class="fa fa-stop fa-sm"></i>
</button>
<button id=default-filters value=1 class="button pure-button button-small">
<i class="fa fa-th"></i>
</button>
</div>`);
$('#nowrap-filters').on('click', function (e) {
e.preventDefault();
setHorizontalFilterLayout()
localStorage.setItem('wrapfilterschooser', 0)
});
$('#default-filters').on('click', function (e) {
e.preventDefault();
setWrappingFilterLayout()
localStorage.setItem('wrapfilterschooser', 1)
});
restoreInputState($('#wrapfilterschooser'));
if ($('#wrapfilterschooser').val() == 0){
setHorizontalFilterLayout();
}else{
setWrappingFilterLayout();
//do nothing because you have default page layout
}
}
function setHorizontalFilterLayout(){
$('#nowrap-filters').addClass('pure-button-active')
$('#default-filters').removeClass('pure-button-active')
$('.filters-group').addClass('filters-group-2')
$('.filter-selectors').removeClass('filter-selectors').addClass('filter-selectors2');
$('#filters-panel').addClass('filters-panel-2')
}
function setWrappingFilterLayout(){
$('#default-filters').addClass('pure-button-active')
$('#nowrap-filters').removeClass('pure-button-active')
console.log('do something')
$('.filters-group').removeClass('filters-group-2')
$('#filters-panel').removeClass('filters-panel-2')
$('.filter-selectors2').removeClass('filter-selectors2').addClass('filter-selectors')
}
function removeTableScrolling(){
//kills the scrolling product table
GM_addStyle(`
.noscrolltable{
overflow-x:visible !important;
}
.fl-scrolls{ display: none!important; }
`)
$('form[name=compform]').addClass('noscrolltable')
}
function addCustomHeader(){
try{
_log('addCustomHeader() Start',DLOG);
//TODO style the form with purecss
var mydklink2 = 'https://www.digikey.com/classic/RegisteredUser/Login.aspx';
gIndexLink = 'http://www.digikey.com/products/en';
theTLD = 'com';
var customform = '<div id="cHeader" style="display:block; background:black; color:white;"><a href="http://digikey.'+theTLD+'">'+
'<img align=left top="50px" height=50 src="https://www.digikey.com/Web%20Export/hp/common/logo_black.jpg"></a>'+
'<form id="headForm" method="get" action="/scripts/dksearch/dksus.dll?KeywordSearch">'+
'<a href="http://dkc1.digikey.com/us/en/help/help10.html">'+
'<b>Keywords:</b></a> <input type="search" value="" style="padding:3px; margin:3px 3px 1px 3px;" id="headKeySearch" maxlength="250" size="35" class="dkdirchanger2" name="keywords">'+
'<input align=right type="submit" value="New Search" id="searchbutton">'+
' <input type="checkbox" style="margin:0 2px;" value="1" name="stock" id="hstock" class="saveState css-checkbox"><label for="hstock" class="css-label">In stock </label>'+
' <input type="checkbox" style="margin:0 2px;" value="0" name="nstock" id="activePart" class="saveState css-checkbox"><label for="activePart" class="css-label">Normally Stocking</label>'+
// ' <input type="hidden" style="margin:0 2px;" value="5" name="pv1989" id="shadowNew" disabled=true class="css-checkbox" >'+
// ' <input type="hidden" style="margin:0 2px;" value="0" name="pv1989" id="shadowNew2" disabled=true class="css-checkbox" >'+
' <input type="checkbox" style="padding-left:5px;" value="1" name="has3d" id="has3d" class="css-checkbox"><label style="margin-left:8px;" for="has3d" class="css-label">Has 3D Model</label>'+
' <input type="checkbox" style="padding-left:5px;" value="1" name="newproducts" id="newproducts" class="css-checkbox"><label style="margin-left:8px;" for="newproducts" class="css-label" title="Added in the last 90 days.">New</label>'+
// '<span id="resnum"></span>'+
'<a id="advancedsearchlink" style="margin-left:20px; cursor:pointer;">search help</a>'+
'<span id=quicklinks><a href="'+gIndexLink+'">Product Index</a> | '+
'<a href="'+mydklink2+'">My Digi-Key</a> | '+
'<a id="cartlink" href="https://www.digikey.'+theTLD+'/classic/Ordering/AddPart.aspx?"><i class="fa fa-shopping-cart fa-lg" style="color:red;"></i> Cart<span id=cartquant></span> <i class="fa fa-caret-down fa-lg" style="color:red;"></i></a> | '+
// '<a href="'+sitemaplink+'">Site Map</a></span>'+
'<div class="dropShadow" />'+
'</div>';
var keywordval = '';
var stockval = $('#stock').prop('checked');
var pbfreeval = $('#pbfree').prop('checked');
var rohsval = $('#rohs').prop('checked');
$('.deapplied-filters').not('#deapplyFilter').find('.deapply-form').each(function(){
keywordval += $(this).find('#deapply-text-link').text()+' ';
})
_log('stockval is'+ stockval+ ' checked status is '+ $('#stock').prop('checked'),DLOG);
$('#content').after(customform);
if($('#noResultsTable').length){
$('#_body').append(customform)
}
// $('.dkdirchanger2').val(keywordval).focus();
$('.dkdirchanger2').val(keywordval);
$('#stock').prop('checked', stockval);
$('#content p.matching-records').show();
$('.content-keywordSearch-form').detach();
$('#headForm').on('submit', function(data){
console.log('#headForm submit data: ', data)
if($('#activePart:checked').length == 1){
$('input[name=pv1989]').removeAttr('disabled');
}
// console.log($(this).serializeArray())
// alert(data);
return true;
})
// console.log('>>>>>>>>>>>>>>>>>tld', theTLD, ' gIndexLink ', gIndexLink, ' mydklink2 ', mydklink2);
// $('#content').wrap('<div class="mainFlexWrapper" style="position:relative; top:65px;"></div>');
$('body').prepend('<div class="mainFlexWrapper" style="position:relative; top:50px;"></div>');
$('.mainFlexWrapper').append($('#content'));
// $('.dk-url-shortener').css({position:'fixed', right: '135px', top:'18px','z-index':'30'}); //move url shortener
// $('.dk-url-shortener').css({position:'relative', left: '-43px','z-index':'30'}); //move url shortener
// var thebody = document.querySelector('body');
// var wrapper = document.createElement('div');
// var content = document.querySelector('#content')
// wrapper.classList.add("mainFlexWrapper");
// wrapper.style.position = 'relative';
// wrapper.style.top = '50px';
// thebody.insertBefore(wrapper, thebody.firstChild)
// wrapper.appendChild(content)
_log('custome header tick',DLOG);
tc(searchButtonHighlight, 'searchButtonHighlight');
keywordSearchWizard()
_log('addCustomHeader() End',DLOG);
}catch(e){
console.log('addCustomHeader failed',e);
alert(e);
}
}
function keywordSearchWizard(){
var searchForm = '<div id="advancedsearchdiv" style="display:none; ">'+
'<div>'+
'<table class="advancedsearchtable">'+
'<tbody>'+
'<tr>'+
'<td>Function</td>'+
'<td>Operator</td>'+
'<td>Usage</td>'+
'</tr>'+
'<tr>'+
'<td>NOT</td>'+
'<td><span style="font-weight:bold; font-size:1.2em;">~</span> or <span style="font-weight:bold;">.not.</span> </td>'+
'<td> <span style="font-weight:bold;">mcu ~dip</span> (removes all instances of dip from results) <br> <span style="font-weight:bold;">mcu .not. dip</span></td>'+
'</tr>'+
'<tr>'+
'<td>AND</td>'+
'<td><span style="font-weight:bold;"><space></span> or <span style="font-weight:bold;">.and.</span> </td>'+
'<td> <span style="font-weight:bold;">mcu 32bit</span><br> <span style="font-weight:bold;">mcu .and. 32bit</span></td>'+
'</tr>'+
'<tr>'+
'<td>OR</td>'+
'<td><span style="font-weight:bold;">|</span> or <span style="font-weight:bold;">.or.</span> </td>'+
'<td> <span style="font-weight:bold;">mcu atmel | mcu microchip</span><br> <span style="font-weight:bold;">mcu atmel .or. mcu microchip</span></td>'+
'</tr>'+
'<tr>'+
'<td>"exact phrase"</td>'+
'<td><span style="font-weight:bold;">" "</span>'+
'<td> <span style="font-weight:bold;">"DC DC"</span></td>'+
'</tr>'+
'</tbody>'+
'</table>'+
'<table class="advancedsearchtable" style="margin-top:20px;">'+
'<tbody>'+
'<tr>'+
'<td>Search Tips</td>'+
'</tr>'+
'<tr>'+
'<td>All keywords are case insensitive and treated as substring matches (also known as wildcards). '+
'The keyword <b style="color:red;">LED</b> will match control<b style="color:red;">led</b>,'+' O<b style="color:red;">LED</b> and LTC3458<b style="color:red;">LED</b>E#PBF </td>'+
'</tr>'+
'<tr>'+
'<td>Using keywords with too much specificity may artificially limit results. It's best to treat keyword searches as a guide to help find where product is hiding rather than expect ALL results to be spoonfed.'+
' It's often better to find the families of interest and then filter and browse the full contents of that family unless you are sure'+
' there there is an exact keyword found in product listing pages. </td>'+
'</tr>'+
'</tbody>'+
'</table>'+
'</div>'+
'</div>';
$('#content').append(searchForm);
$('#advancedsearchlink').click(function(){
_log('advanced wizard opening', DLOG)
$('#advancedsearchdiv').dialog({
autoOpen: true,
resizable: true,
// draggable: false,
height:600,
width:800,
modal: false,
buttons: {
"Close": function() {
// $(this).css('color', 'lightgrey');
$( this ).dialog( "close" );
},
}
});
})
}
function addControlWidget() {
_log('addControlWidget() Start',DLOG);
// setTimeout(function(){
$('#content').after('<div id="controlDiv" class="gray-grad firstopen" style="display:none;" title="settings for advancedsearch v'+version+'">'+
'<a href="'+downloadLink+'" class="button-small pure-button" style="float:right;"> click to manually update</a> ' +
// '<button id="closeControlDiv" class="clean-gray close">X</button>' +
'<div class="settingscontainer" >'+
'<img src="https://hest.pro/s/logo">'+
'<br><span style="font-weight:bold">Filter Results Page</span><br>'+
'<input type=checkbox id=qtydefault class="saveState css-checkbox " value="1"><label class="css-label" for="qtydefault">Always initially sort by price @ Qty</label> <input type="text" id="qtydefaulttext" class="saveState css-checkbox" value="1" size="7" defval="1"><br>' +
'<input type=checkbox id="combinePN" class="saveState css-checkbox " value="1"> <label class="css-label" for="combinePN">Combine Manufacturer PN, DK PN, and Manufacturer into one column to save horizontal space</label> (breaks hover headers in chrome)<br>' +
'<input type=checkbox id=pricehoverControl class="saveState css-checkbox " value="1"><label class="css-label" for="pricehoverControl">Turn on price break popup on hovering over prices</label><br>' +
'<input type=checkbox id=queryHighlight class="saveState css-checkbox " value="1"><label class="css-label" for="queryHighlight">Turn on query term highlighting in on filter pages</label><br>' +
'<input type=checkbox id=hideShowTRFlag class="saveState css-checkbox " value="0"><label class="css-label" for="hideShowTRFlag">Automatically Hide Tape & Reel and Digi-Reel rows in the filter results page</label><br>' +
'<label>Explore Mode Popup Delay time <input type="text" id="exploreModeDelay" class="saveState" value="300" size="7" defval="300">ms</label><br>'+
'<br><span style="font-weight:bold">Index/Keyword Results Page</span><br>'+
'<label><input type=checkbox id=picPrevControl class="saveState css-checkbox " value="1"> <label class="css-label" for="picPrevControl">Turn on picture previews when hovering over Family links on the Index/Keyword Results page</label><br>' +
// '<label><input type=checkbox id=qfControl class="saveState css-checkbox " value="1"> <label class="css-label" for="qfControl">Turn on Quick Pick Box</label><br>' +
'<label><input type=checkbox id=familyHighlight class="saveState css-checkbox " value="1"> <label class="css-label" for="familyHighlight">Turn on the bolding and text size increase of matched family names on index results page</label><br>' +
'<label><input type=checkbox id=instantfilter class="saveState css-checkbox " value="1"><label class="css-label" for="instantfilter">Turn on the Product Index Instant Filter to immediately show matching search box keywords</label><br>' +
'<br><span style="font-weight:bold">Experimental</span><br>'+
'<input type=checkbox id=nightMode class="saveState css-checkbox " value="0"> <label class="css-label" for="nightMode">Night Mode </label><br>' +
'<input type=checkbox id=analytics class="saveState css-checkbox " value="0"> <label class="css-label" for="analytics">Help improve this script with analytics. Only used by author to help with the search experience. </label><br>' +
'<input type=checkbox id=spellcheck class="saveState css-checkbox " value="0"> <label class="css-label" for="spellcheck">Turn on rudimentary spell check and suggested search terms</label><br>' +
'<input type=checkbox id=stickyfilters class="saveState css-checkbox " value="0"><label class="css-label" for="stickyfilters">Turn on sticky filter selections on filter page to elminate the need for ctrl+click (known shift click bug)</label><br>' +
'<input type=checkbox id=squishedFilters class="saveState css-checkbox " value="0"><label class="css-label" for="squishedFilters">Turn on expandemonium feature (squished multiselect filters) ...only a tech demo...</label><br>' +
'<input type=checkbox id=aprilf class="saveState css-checkbox " value="0"><label class="css-label" for="aprilf">April fools joke.</label><br>' +
'</div><br><br>'+
'<button id=restoredefaults class="button-small pure-button" style="margin-left:20px"> restore defaults </button>'+
'<br><br><div class="centerme">Have questions or comments? email my <b>gmail.com</b> account <br> <b>bombledmonk@</b></div>'+
'</div>'
);
$('.settingscontainer .css-checkbox').css('z-index',2005);
$('#content').after('<div id="controlSpan" class="pure-button"><i class="fa fa-cog"></i> settings v' + version + '</div>');
_log('control dialog tick start ', DLOG);
// $('#controlDiv').dialog({
// autoOpen: false,
// resizable: false,
// // draggable: false,
// height:600,
// width:800,
// modal: true,
// buttons: {
// "Apply & Refesh Page": function() {
// $(this).css('color', 'lightgrey');
// $( this ).dialog( "close" );
// document.location.reload();
// },
// Cancel: function() {
// $( this ).dialog( "close" );
// }
// }
// });
// $('#controlspan')
_log('control dialog tick end ', DLOG);
// $('#controlSpan').click(function(){
// $('#controlDiv').dialog('open');
// hoveringHelpHighlighter();
// });
$('#controlSpan').click(function(){
if($('#controlDiv.firstopen')){
$('#controlDiv').dialog({
autoOpen: true,
resizable: false,
// draggable: false,
height:650,
width:800,
modal: true,
buttons: {
"Apply & Refesh Page": function() {
$(this).css('color', 'lightgrey');
$( this ).dialog( "close" );
document.location.reload();
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
$('#controlDiv').removeClass('firstopen')
}else{
$('#controlDiv').dialog('open');
hoveringHelpHighlighter();
}
});
_log(encodeURIComponent(window.location), true);
$('#applyControls').click(function(){
$(this).css('color', 'lightgrey');
document.location.reload();
});
$('#restoredefaults').click(function(){
$(this).css('color', 'lightgrey');
_log(Object.keys(localStorage));
localStorage.clear();
_log(Object.keys(localStorage));
});
$('#controlSpan').css({
'position': 'fixed',
'right': '10px',
'top': '20px',
'z-index': '19',
'cursor':'pointer'
});
addControlWidgetActions2();
// },1500);
_log('addControlWidget() End',DLOG);
}
function hoveringHelpHighlighter(){
_log('hoveringHelpHighlighter() Start',DLOG);
// var hlarray = [
// [$('#exploremodecheckbox').parent(), $('select[multiple]')],
// [$('#qtydefault').parent(), $('select[multiple]')],
// ];
var zind = $('#headKeySearch').css('z-index');