aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-09-05 23:37:52 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-09-05 23:37:52 +0200
commit6fa3003cc351eef3c7a9f525f2a323f8730b8048 (patch)
tree1223df5bbea7f822176f28b3ec5ea355adf44bc1
parent78384b403196ff95fb14ec00de7a116d7db39aea (diff)
downloadsonarqube-6fa3003cc351eef3c7a9f525f2a323f8730b8048.tar.gz
sonarqube-6fa3003cc351eef3c7a9f525f2a323f8730b8048.zip
SONAR-3742 and SONAR-3779 : drop prototip.js
-rw-r--r--sonar-server/pom.xml1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_footer.html.erb16
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/_complexity_chart.html.erb20
-rw-r--r--sonar-server/src/main/webapp/javascripts/prototip.js281
5 files changed, 6 insertions, 313 deletions
diff --git a/sonar-server/pom.xml b/sonar-server/pom.xml
index 4494aac9a0f..5e94cf94961 100644
--- a/sonar-server/pom.xml
+++ b/sonar-server/pom.xml
@@ -242,7 +242,6 @@
<include>**/prototype-min.js</include>
<include>**/scriptaculous-min.js</include>
<include>**/tablekit-min.js</include>
- <include>**/prototip-min.js</include>
<include>**/dashboard-min.js</include>
<include>**/protovis-min.js</include>
<include>**/protovis-sonar-min.js</include>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_footer.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_footer.html.erb
index 5830d071c99..e5279862a19 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_footer.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_footer.html.erb
@@ -1,18 +1,4 @@
-</body><script type="text/javascript">
-Event.observe(window, 'load', function(){
-$$('.tipable').each(function(element){
-title = element.readAttribute('title');
-if(!element.rel.blank()) {
-if(title ==null) {
-new Tip(element, element.rel);
-} else {
-new Tip(element, element.rel, {title: title});
-}
-} else if (title!=null && !title.blank()) {
-new Tip(element, title);
-}
-});
-});
+</body><script>
<% if flash[:notice] %>info('<%=escape_javascript(flash[:notice])-%>');<% end %>
<% if flash[:warning] %>warning('<%=escape_javascript(flash[:warning])-%>');<% end %>
<% if flash[:error] %>error('<%=escape_javascript(flash[:error])-%>');<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
index 3b8e5bb7bfc..2354810bbf5 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
@@ -25,7 +25,6 @@
<%= javascript_include_tag 'prototype' %>
<%= javascript_include_tag 'scriptaculous' %>
<%= javascript_include_tag 'tablekit' %>
-<%= javascript_include_tag 'prototip' %>
<%= javascript_include_tag 'dashboard' %>
<%= javascript_include_tag 'protovis' %>
<%= javascript_include_tag 'protovis-sonar' %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/_complexity_chart.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/_complexity_chart.html.erb
index 4f893fcce30..029fb9d47ab 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/_complexity_chart.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/_complexity_chart.html.erb
@@ -1,18 +1,8 @@
-<% dist_measure = measure(metric)
+<% dist_measure = measure(metric)
if dist_measure && !dist_measure.data.blank?
+ query="w=220&h=100&fs=10&bgc=ffffff&ck=distbar&c=777777&v=" + u(dist_measure.data)
%>
-<div id="chart_<%=metric -%>" class="chart" style="display: <%= visible ? "block" : "none" %>">
-<%
- query="ck=distbar&c=777777&v=" + u(dist_measure.data)
- small_size_query=query + '&w=220&h=100&fs=8&bgc=ffffff'
- big_size_query=query + '&w=300&h=150&fs=12&bgc=CAE3F2'
-%><%= chart(small_size_query, :id => 'chart_img_' + metric, :alt => title) -%>
-
- <script type='text/javascript'>
- //<![CDATA[
- new Tip('chart_img_<%=metric-%>', '<div style="width:300px;"><b><%= title -%></b><br>'+
- '<%= chart(big_size_query, :id => 'chart_img_' + metric, :alt => title) -%></div>');
- //]]>
- </script>
-</div>
+ <div id="chart_<%= metric -%>" class="chart" style="display: <%= visible ? "block" : "none" %>">
+ <%= chart(query, :id => 'chart_img_' + metric, :alt => title) -%>
+ </div>
<% end %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/javascripts/prototip.js b/sonar-server/src/main/webapp/javascripts/prototip.js
deleted file mode 100644
index d3e73862a3b..00000000000
--- a/sonar-server/src/main/webapp/javascripts/prototip.js
+++ /dev/null
@@ -1,281 +0,0 @@
-// Prototip 1.0.2
-// by Nick Stakenburg - http://www.nickstakenburg.com
-// 08-08-2007
-//
-// More information on this project:
-// http://www.nickstakenburg.com/projects/prototip/
-//
-// Licensed under the Creative Commons Attribution 3.0 License
-// http://creativecommons.org/licenses/by/3.0/
-//
-
-var Tips = {
- tips: [],
- zIndex: 1200,
-
- add: function(tip) {
- this.tips.push(tip);
- },
-
- remove: function(element) {
- var tip = this.tips.find(function(t){ return t.element == $(element); });
- if (!tip) return;
-
- this.tips = this.tips.reject(function(t) { return t==tip; });
- tip.deactivate();
- if(tip.tooltip) tip.wrapper.remove();
- if(tip.underlay) tip.underlay.remove();
- }
-}
-
-var Tip = Class.create();
-Tip.prototype = {
-
- initialize: function(element, content) {
- this.element = $(element);
- Tips.remove(this.element);
-
- this.content = content;
-
- this.options = Object.extend({
- className: 'tooltip',
- duration: 0.3, // duration of the effect
- effect: false, // false, 'appear' or 'blind'
- hook: false, // { element: {'topLeft|topRight|bottomLeft|bottomRight'}, tip: {'topLeft|topRight|bottomLeft|bottomRight'}
- offset: (arguments[2] && arguments[2].hook) ? {x:0, y:0} : {x:16, y:16},
- fixed: false, // follow the mouse if false
- target: this.element, // or another element
- title: false,
- viewport: true // keep within viewport if mouse is followed
- }, arguments[2] || {});
-
- this.target = $(this.options.target);
-
- if (this.options.hook) {
- this.options.fixed = true;
- this.options.viewport = false;
- }
-
- if (this.options.effect) {
- this.queue = { position: 'end', limit: 1, scope: ''}
- var c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
- for (var i=0; i<6; i++) {
- var r = Math.floor(Math.random() * c.length);
- this.queue.scope += c.substring(r,r+1);
- }
- }
-
- this.buildWrapper();
-
- Tips.add(this);
- this.activate();
- },
-
- activate: function() {
- this.eventShow = this.showTip.safeBind(this);
- this.eventHide = this.hideTip.safeBind(this);
-
- this.element.observe('mousemove', this.eventShow);
- this.element.observe('mouseout', this.eventHide);
- },
-
- deactivate: function() {
- this.element.stopObserving('mousemove', this.eventShow);
- this.element.stopObserving('mouseout', this.eventHide);
- },
-
- buildWrapper: function() {
- this.wrapper = document.createElement('div');
- Element.setStyle(this.wrapper, {
- position: 'absolute',
- zIndex: Tips.zIndex+1,
- display: 'none'
- });
-
- // IE select fix
- if (Prototype.Browser.IE) {
- this.underlay = document.createElement('iframe');
- this.underlay.src = 'javascript:;';
- Element.setStyle(this.underlay, {
- position: 'absolute',
- display: 'none',
- border: 0,
- margin: 0,
- opacity: 0.01,
- padding: 0,
- background: 'none',
- zIndex: Tips.zIndex
- });
- }
- },
-
- buildTip: function() {
- if(Prototype.Browser.IE) document.body.appendChild(this.underlay); // IE selectbox fix
-
- // add the tooltip
- this.tooltip = this.wrapper.appendChild(document.createElement('div'));
- this.tooltip.className = this.options.className;
- this.tooltip.style.position = 'relative';
-
- // add the title
- if (this.options.title) {
- this.title = this.tooltip.appendChild(document.createElement('div'));
- this.title.className = 'title';
- Element.update(this.title, this.options.title);
- }
-
- // content
- this.tip = this.tooltip.appendChild(document.createElement('div'));
- this.tip.className = 'content';
- Element.update(this.tip, this.content);
-
- // add wrapper to the body
- document.body.appendChild(this.wrapper);
-
- // prepare for effects
- var w = this.wrapper.getDimensions();
- this.wrapper.setStyle({ width: w.width+'px', height: w.height+'px' });
- if (Prototype.Browser.IE) this.underlay.setStyle({ width: w.width+'px', height: w.height+'px' });
- Element.hide(this.tooltip);
- },
-
- showTip: function(event){
- if (!this.tooltip) this.buildTip();
- this.positionTip(event); // follow mouse
- if (this.wrapper.visible() && this.options.effect != 'appear') return;
-
- if (Prototype.Browser.IE) this.underlay.show(); // IE select fix
- this.wrapper.show();
-
- if (!this.options.effect) {
- this.tooltip.show();
- } else {
- // stop running effect
- if (this.activeEffect) Effect.Queues.get(this.queue.scope).remove(this.activeEffect);
- // start new
- this.activeEffect = Effect[Effect.PAIRS[this.options.effect][0]](this.tooltip, { duration: this.options.duration, queue: this.queue});
- }
- },
-
- hideTip: function(event){
- if(!this.wrapper.visible()) return;
-
- if (!this.options.effect) {
- if (Prototype.Browser.IE) { this.underlay.hide(); } // select fix
- this.tooltip.hide();
- this.wrapper.hide();
- }
- else {
- // stop running effect
- if (this.activeEffect) Effect.Queues.get(this.queue.scope).remove(this.activeEffect);
- // start new
- this.activeEffect = Effect[Effect.PAIRS[this.options.effect][1]](this.tooltip, { duration: this.options.duration, queue: this.queue, afterFinish: function(){
- if (Prototype.Browser.IE) this.underlay.hide(); // select fix
- this.wrapper.hide();
- }.bind(this)});
- }
- },
-
- positionTip: function(event){
- // calculate
- var offset = {'left': this.options.offset.x,'top': this.options.offset.y};
- var targetPosition = Position.cumulativeOffset(this.target);
- var tipd = this.wrapper.getDimensions();
- var pos = {
- 'left': (this.options.fixed) ? targetPosition[0] : Event.pointerX(event),
- 'top': (this.options.fixed) ? targetPosition[1] : Event.pointerY(event)
- }
-
- // add offsets
- pos.left += offset.left;
- pos.top += offset.top;
-
- if (this.options.hook) {
- var dims = {'target': this.target.getDimensions(), 'tip': tipd}
- var hooks = {'target': Position.cumulativeOffset(this.target), 'tip': Position.cumulativeOffset(this.target)}
-
- for(var z in hooks) {
- switch(this.options.hook[z]){
- case 'topRight':
- hooks[z][0] += dims[z].width;
- break;
- case 'bottomLeft':
- hooks[z][1] += dims[z].height;
- break;
- case 'bottomRight':
- hooks[z][0] += dims[z].width;
- hooks[z][1] += dims[z].height;
- break;
- }
- }
-
- // move based on hooks
- pos.left += -1*(hooks.tip[0] - hooks.target[0]);
- pos.top += -1*(hooks.tip[1] - hooks.target[1]);
- }
-
- // move tooltip when there is a different target when following mouse
- if (!this.options.fixed && this.element !== this.target) {
- var elementPosition = Position.cumulativeOffset(this.element);
- pos.left += -1*(elementPosition[0] - targetPosition[0]);
- pos.top += -1*(elementPosition[1] - targetPosition[1]);
- }
-
- if (!this.options.fixed && this.options.viewport) {
- var scroll = this.getScrollOffsets();
- var viewport = this.viewportSize();
- var pair = {'left': 'width', 'top': 'height'};
-
- for(var z in pair) {
- if ((pos[z] + tipd[pair[z]] - scroll[z]) > viewport[pair[z]]) {
- pos[z] = pos[z] - tipd[pair[z]] - 2*offset[z];
- }
- }
- }
-
- // position
- this.wrapper.setStyle({
- left: pos.left + 'px',
- top: pos.top + 'px'
- });
-
- if (Prototype.Browser.IE) this.underlay.setStyle({ left: pos.left+'px', top: pos.top+'px' });
- },
-
- // Functions below hopefully won't be needed with prototype 1.6
- viewportWidth: function(){
- if (Prototype.Browser.Opera) return document.body.clientWidth;
- return document.documentElement.clientWidth;
- },
-
- viewportHeight: function(){
- if (Prototype.Browser.Opera) return document.body.clientHeight;
- if (Prototype.Browser.WebKit) return this.innerHeight;
- return document.documentElement.clientHeight;
- },
-
- viewportSize : function(){
- return {'height': this.viewportHeight(), 'width': this.viewportWidth()};
- },
-
- getScrollLeft: function(){
- return this.pageXOffset || document.documentElement.scrollLeft;
- },
-
- getScrollTop: function(){
- return this.pageYOffset || document.documentElement.scrollTop;
- },
-
- getScrollOffsets: function(){
- return {'left': this.getScrollLeft(), 'top': this.getScrollTop()}
- }
-}
-
-/* fix for $A is not defined on Firefox */
-Function.prototype.safeBind = function() {
- var __method = this, args = $A(arguments), object = args.shift();
- return function() {
- if (typeof $A == 'function')
- return __method.apply(object, args.concat($A(arguments)));
- }
-} \ No newline at end of file