Bläddra i källkod

Fix tooltips blocking clicks

Scott Lahteine 10 år sedan
förälder
incheckning
c99f1de9f3

+ 13
- 25
Marlin/configurator/css/configurator.css Visa fil

3
 
3
 
4
 body { margin: 0; padding: 0; background: #56A; color: #FFC; font-family: sans-serif; }
4
 body { margin: 0; padding: 0; background: #56A; color: #FFC; font-family: sans-serif; }
5
 
5
 
6
-#main { max-width: 1000px; margin: 0 auto; }
6
+#main { max-width: 1000px; margin: 0 auto; position: relative; }
7
 #main { padding: 0 4%; width: 92%; }
7
 #main { padding: 0 4%; width: 92%; }
8
 #main { font-family: monospace; }
8
 #main { font-family: monospace; }
9
 h1, #message { text-align: center; }
9
 h1, #message { text-align: center; }
73
 #serial_stepper { padding-top: 0.75em; display: block; float: left; }
73
 #serial_stepper { padding-top: 0.75em; display: block; float: left; }
74
 #SERIAL_PORT { display: none; }
74
 #SERIAL_PORT { display: none; }
75
 
75
 
76
-.tooltip { position: relative; }
77
-.tooltip::before {
78
-	content: attr(data-tooltip);
79
-	font-family: sans-serif;
80
-	font-size: 85%;
81
-	text-align: left;
76
+#tooltip {
77
+	display: none;
78
+	max-width: 30em;
79
+	padding: 8px;
80
+	border: 2px solid #73d699;
81
+	border-radius: 1em;
82
 	position: absolute;
82
 	position: absolute;
83
 	z-index: 999;
83
 	z-index: 999;
84
-	/*white-space:pre-wrap;*/
85
-	bottom: 9999px;
86
-	left: 110px;
84
+	font-family: sans-serif;
85
+	font-size: 85%;
87
 	color: #000;
86
 	color: #000;
88
-	padding: 8px;
89
 	line-height: 1.1;
87
 	line-height: 1.1;
90
-	max-width: 30em;
91
-	opacity: 0;
92
-	border-radius: 1em;
93
-	border: 2px solid #73d699;
94
 	background: #e2ff99; /* Old browsers */
88
 	background: #e2ff99; /* Old browsers */
95
 	background: -moz-linear-gradient(top,  #e2ff99 0%, #73d699 100%); /* FF3.6+ */
89
 	background: -moz-linear-gradient(top,  #e2ff99 0%, #73d699 100%); /* FF3.6+ */
96
 	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e2ff99), color-stop(100%,#73d699)); /* Chrome,Safari4+ */
90
 	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e2ff99), color-stop(100%,#73d699)); /* Chrome,Safari4+ */
103
 	-moz-box-shadow: 0px 6px 25px -4px rgba(0,0,0,0.75);
97
 	-moz-box-shadow: 0px 6px 25px -4px rgba(0,0,0,0.75);
104
 	box-shadow: 0px 6px 25px -4px rgba(0,0,0,0.75);
98
 	box-shadow: 0px 6px 25px -4px rgba(0,0,0,0.75);
105
 	}
99
 	}
106
-.tooltip:hover::before {
107
-	opacity: 1;
108
-	bottom: 30px;
109
-	}
110
-.tooltip:hover::after {
100
+#tooltip>span {
101
+	position: absolute;
111
 	content: "";
102
 	content: "";
112
-	opacity: 1;
113
 	width: 0;
103
 	width: 0;
114
 	height: 0;
104
 	height: 0;
115
 	border-left: 8px solid transparent;
105
 	border-left: 8px solid transparent;
116
 	border-right: 8px solid transparent;
106
 	border-right: 8px solid transparent;
117
 	border-top: 8px solid #73d699;
107
 	border-top: 8px solid #73d699;
118
 	z-index: 999;
108
 	z-index: 999;
119
-	position: absolute;
120
-	/*white-space: nowrap;*/
121
-	top: 2px;
122
-	left: 130px;
109
+	bottom: -10px;
110
+	left: 20px;
123
 	}
111
 	}

+ 1
- 0
Marlin/configurator/index.html Visa fil

20
       </div>
20
       </div>
21
 
21
 
22
       <div id="tabs"></div>
22
       <div id="tabs"></div>
23
+      <div id="tooltip"></div>
23
 
24
 
24
       <form id="config_form">
25
       <form id="config_form">
25
 
26
 

+ 28
- 10
Marlin/configurator/js/configurator.js Visa fil

60
       boards_list = {},
60
       boards_list = {},
61
       therms_list = {},
61
       therms_list = {},
62
       total_config_lines,
62
       total_config_lines,
63
-      total_config_adv_lines;
63
+      total_config_adv_lines,
64
+      hover_timer;
64
 
65
 
65
   // Return this anonymous object as configuratorApp
66
   // Return this anonymous object as configuratorApp
66
   return {
67
   return {
111
       var loaded_items = {};
112
       var loaded_items = {};
112
       var config_files = [boards_file, config_file, config_adv_file];
113
       var config_files = [boards_file, config_file, config_adv_file];
113
       $.each(config_files, function(i,fname){
114
       $.each(config_files, function(i,fname){
114
-        self.log("Loading " + fname + "...", 3);
115
         $.ajax({
115
         $.ajax({
116
           url: marlin_config+'/'+fname,
116
           url: marlin_config+'/'+fname,
117
           type: 'GET',
117
           type: 'GET',
118
           async: true,
118
           async: true,
119
           cache: false,
119
           cache: false,
120
           success: function(txt) {
120
           success: function(txt) {
121
-            self.log("Loaded " + fname + "...", 3);
122
             loaded_items[fname] = function(){ self.fileLoaded(fname, txt); };
121
             loaded_items[fname] = function(){ self.fileLoaded(fname, txt); };
123
             success_count++;
122
             success_count++;
124
           },
123
           },
358
       if (elm.defineInfo == null) {
357
       if (elm.defineInfo == null) {
359
         var inf = elm.defineInfo = this.getDefineInfo(name, adv);
358
         var inf = elm.defineInfo = this.getDefineInfo(name, adv);
360
         $elm.on($elm.attr('type') == 'text' ? 'input' : 'change', this.handleChange);
359
         $elm.on($elm.attr('type') == 'text' ? 'input' : 'change', this.handleChange);
361
-        var comm = inf.comment;
362
-        var $tipme = $elm.prev('label');
363
-        if ($tipme.length) {
364
-          comm ?
365
-            $tipme.addClass('tooltip').attr('data-tooltip',comm) :
366
-            $tipme.removeClass('tooltip').removeAttr('data-tooltip');
360
+
361
+        if (inf.comment) {
362
+          var $tipme = $elm.prev('label');
363
+          if (inf.comment && $tipme.length) {
364
+            var $tt = $('#tooltip');
365
+            $tipme.hover(
366
+              function() {
367
+                var offs = $tipme.offset();
368
+                $tt.text(inf.comment)
369
+                  .append('<span>')
370
+                  .css({bottom:($tt.parent().height()-offs.top+20)+'px',left:(offs.left+70)+'px'})
371
+                  .show();
372
+                if (hover_timer) {
373
+                  clearTimeout(hover_timer);
374
+                  hover_timer = null;
375
+                }
376
+              },
377
+              function() {
378
+                hover_timer = setTimeout(function(){
379
+                  hover_timer = null;
380
+                  $tt.fadeOut(400);
381
+                }, 400);
382
+              }
383
+            );
384
+          }
367
         }
385
         }
368
       }
386
       }
369
       this.setFieldFromDefine(name);
387
       this.setFieldFromDefine(name);
622
           var r, s;
640
           var r, s;
623
           findDef = new RegExp('([ \\t]*(//|#)[^\n]+\n){1,4}\\s{0,1}' + info.line, 'g');
641
           findDef = new RegExp('([ \\t]*(//|#)[^\n]+\n){1,4}\\s{0,1}' + info.line, 'g');
624
           if (r = findDef.exec(txt)) {
642
           if (r = findDef.exec(txt)) {
625
-            findDef = new RegExp('^[ \\t]*//+[ \\t]*(.*)[ \\t]*$', 'gm');
643
+            findDef = new RegExp('^[ \\t]*//+[ \\t]*([^#].*)[ \\t]*$', 'gm');
626
             while((s = findDef.exec(r[0])) !== null) {
644
             while((s = findDef.exec(r[0])) !== null) {
627
               if (s[1].match(/\/\/[ \\t]*#define/) == null)
645
               if (s[1].match(/\/\/[ \\t]*#define/) == null)
628
                 comment += s[1] + "\n";
646
                 comment += s[1] + "\n";

Laddar…
Avbryt
Spara