Index: trunk/extensions/ArticleAssessmentPilot/css/ArticleAssessment.css |
— | — | @@ -14,38 +14,130 @@ |
15 | 15 | * $Build: 35 (2010-05-01) |
16 | 16 | * |
17 | 17 | */ |
18 | | -.ui-stars-star, |
19 | | -.ui-stars-cancel { |
| 18 | +.ui-stars-star { |
20 | 19 | float: left; |
21 | 20 | display: block; |
22 | 21 | overflow: hidden; |
23 | 22 | text-indent: -999em; |
24 | 23 | cursor: pointer; |
| 24 | + padding-right: 4px; |
25 | 25 | } |
26 | | -.ui-stars-star a, |
27 | | -.ui-stars-cancel a { |
28 | | - width: 16px; |
29 | | - height: 15px; |
| 26 | +.ui-stars-star a { |
| 27 | + width: 21px; |
| 28 | + height: 21px; |
30 | 29 | display: block; |
31 | | - background: url(../images/jquery.ui.stars.gif) no-repeat 0 0; |
| 30 | + background: url(../images/stars.gif) no-repeat 0 0; |
32 | 31 | } |
33 | 32 | .ui-stars-star a { |
34 | | - background-position: 0 -32px; |
| 33 | + background-position: 0 0px; |
35 | 34 | } |
36 | | -.ui-stars-star-on a { |
37 | | - background-position: 0 -48px; |
| 35 | +.ui-stars-star-on a { |
| 36 | + background-position: 0 -42px; |
38 | 37 | } |
| 38 | +.ui-stars-star-rated a { |
| 39 | + background-position: 0 -42px; |
| 40 | +} |
| 41 | +.ui-stars-star-stale a { |
| 42 | + background-position: 0 -63px; |
| 43 | +} |
39 | 44 | .ui-stars-star-hover a { |
40 | | - background-position: 0 -64px; |
| 45 | + background-position: 0 -21px; |
41 | 46 | } |
42 | | -.ui-stars-cancel-hover a { |
43 | | - background-position: 0 -16px; |
44 | | -} |
45 | 47 | .ui-stars-star-disabled, |
46 | | -.ui-stars-star-disabled a, |
47 | | -.ui-stars-cancel-disabled a { |
| 48 | +.ui-stars-star-disabled a { |
48 | 49 | cursor: default !important; |
49 | 50 | } |
50 | 51 | .ui-stars-cancel { |
51 | 52 | display: none; |
| 53 | +} |
| 54 | +/* End ui-stars styles */ |
| 55 | + |
| 56 | +/* Tipsy Styles */ |
| 57 | +.tipsy { padding: 5px; font-size: 12px; position: absolute; z-index: 100000; } |
| 58 | +.tipsy-inner { padding: 5px 8px 4px 8px; background-color: #d6f3ff; color: black; border: 1px solid #5dc9f4; max-width: 200px; text-align: center; } |
| 59 | +/* .tipsy-inner { border-radius: 3px; -moz-border-radius:3px; -webkit-border-radius:3px; } */ |
| 60 | +.tipsy-arrow { position: absolute; background: url( '../images/arrow.gif' ) no-repeat top left; width: 13px; height: 13px; } |
| 61 | +.tipsy-n .tipsy-arrow { top: 0; left: 50%; margin-left: -4px; } |
| 62 | +.tipsy-nw .tipsy-arrow { top: 0; left: 10px; } |
| 63 | +.tipsy-ne .tipsy-arrow { top: 0; right: 10px; } |
| 64 | +.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -4px; background-position: bottom left; } |
| 65 | +.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; background-position: bottom left; } |
| 66 | +.tipsy-se .tipsy-arrow { bottom: -7px; right: 10px; background-position: bottom left; } |
| 67 | +.tipsy-e .tipsy-arrow { top: 50%; margin-top: -4px; right: 0; width: 5px; height: 9px; background-position: top right; } |
| 68 | +.tipsy-w .tipsy-arrow { top: 50%; margin-top: -4px; left: 0; width: 5px; height: 9px; } |
| 69 | + |
| 70 | +/* End Tipsy styles */ |
| 71 | +#article-assessment-rate, |
| 72 | +#article-assessment-ratings { |
| 73 | + background: #f7f7f7; |
| 74 | + float: left; |
| 75 | +} |
| 76 | +#article-assessment-ratings { |
| 77 | + width: 320px; |
| 78 | +} |
| 79 | +#article-assessment-rate { |
| 80 | + width: 650px; |
| 81 | +} |
| 82 | +.field-wrapper { |
| 83 | + float: left; |
| 84 | + width: 250px; |
| 85 | + padding-right: 28px; |
| 86 | +} |
| 87 | +.rating-field { |
| 88 | + float: right; |
| 89 | + line-height: 24px; |
| 90 | + padding-right: 5px; |
| 91 | +} |
| 92 | +.rating-field-label{ |
| 93 | + float: left; |
| 94 | + line-height: 24px; |
| 95 | +} |
| 96 | +.rating-field-label { |
| 97 | + margin-right: 10px; |
| 98 | +} |
| 99 | +.rating-field-hint { |
| 100 | + width: 11px; |
| 101 | + height: 24px; |
| 102 | + display: block; |
| 103 | + float: right; |
| 104 | + background: url(../images/question.gif) 0 50% no-repeat; |
| 105 | +} |
| 106 | +.article-assessment-submit { |
| 107 | + text-align: right; |
| 108 | +} |
| 109 | +.article-assessment-stale-msg { |
| 110 | + background: #d6f3ff; |
| 111 | + border: 1px solid #5dc9f4; |
| 112 | + float: left; |
| 113 | + font-size: 12px; |
| 114 | + padding: 2px; |
| 115 | +} |
| 116 | +/* Self Clearing Floats */ |
| 117 | +.field-wrapper:after, |
| 118 | +.article-assessment-rating-fields:after, |
| 119 | +.article-assessment-submit:after, |
| 120 | +.rating-fields:after { |
| 121 | + content: "."; |
| 122 | + display: block; |
| 123 | + height: 0; |
| 124 | + clear: both; |
| 125 | + visibility: hidden; |
| 126 | +} |
| 127 | +.field-wrapper, |
| 128 | +.article-assessment-rating-fields, |
| 129 | +.article-assessment-submit, |
| 130 | +.rating-fields { |
| 131 | + display: inline-block; |
| 132 | +} |
| 133 | +* html .field-wrapper, |
| 134 | +* html .article-assessment-rating-fields, |
| 135 | +* html .article-assessment-submit, |
| 136 | +* html .rating-fields { |
| 137 | + height: 1%; |
| 138 | +} |
| 139 | +.field-wrapper, |
| 140 | +.article-assessment-rating-fields, |
| 141 | +.article-assessment-submit, |
| 142 | +.rating-fields { |
| 143 | + display: block; |
52 | 144 | } |
\ No newline at end of file |
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js |
— | — | @@ -1,72 +1,59 @@ |
2 | 2 | ( function( $ ) { |
3 | | - |
4 | | - /* startRating plugin |
5 | | - * |
6 | | - * turns a numeric select input into a star field |
7 | | - * |
8 | | - */ |
9 | | - // $.fn.starRating = function( $$options ) { |
10 | | - // // return if the function is called on an empty jquery object |
11 | | - // if( !this.length ) return this; |
12 | | - // //merge options into the defaults |
13 | | - // var $settings = $.extend( {}, $.starRating.defaults, $$options ); |
14 | | - // // run the initialization on each jquery object |
15 | | - // this.each( function() { |
16 | | - // $field = $( this ); |
17 | | - // // make the markup adjustments required |
18 | | - // $.starRating.fn.init( $field ); |
19 | | - // } ); |
20 | | - // return this; |
21 | | - // }; |
22 | | - // $.starRating = { |
23 | | - // defaults: { |
24 | | - // 'fieldHTML': '<div class="star-rating-wrapper"> \ |
25 | | - // <input type="hidden" name="{NAME}" /> \ |
26 | | - // <div class="star-rating-field"> \ |
27 | | - // </div> \ |
28 | | - // </div>' |
29 | | - // }, |
30 | | - // 'fn': { |
31 | | - // 'init': function( $field ) { |
32 | | - // var fieldName = $field.attr( 'name' ); |
33 | | - // // prep the markup |
34 | | - // var $newField = $( $.starRating.defaults.fieldHTML |
35 | | - // .replace( /\{NAME\}/g, name ) ); |
36 | | - // var $starContainer = $newField.find( '.star-rating-field' ); |
37 | | - // |
38 | | - // $field.children().each( function() { |
39 | | - // var $opt = $( this ); |
40 | | - // $starContainer |
41 | | - // .append( $( '<a href="#"></a>' ) |
42 | | - // .text( $opt.text() ) |
43 | | - // .click( function() { |
44 | | - // console.log( $opt.val() ); |
45 | | - // return false; |
46 | | - // })); |
47 | | - // }); |
48 | | - // // bind the click events |
49 | | - // $field |
50 | | - // .replaceWith( $newField ); |
51 | | - // // bind the mouseover events |
52 | | - // } |
53 | | - // } |
54 | | - // } |
55 | 3 | $.ArticleAssessment = { |
56 | 4 | 'config': { |
57 | | - 'endpoint': wgScriptPath + '/api.php?', |
58 | 5 | 'authtoken': '', |
59 | 6 | 'userID': '', |
60 | 7 | 'pageID': '', |
61 | 8 | 'revID': '' |
62 | 9 | }, |
63 | | - 'settings': {}, |
| 10 | + 'settings': { |
| 11 | + 'endpoint': wgScriptPath + '/api.php?', |
| 12 | + 'fieldMessages' : [ |
| 13 | + 'wellsourced', |
| 14 | + 'aneutrality', |
| 15 | + 'completeness', |
| 16 | + 'readability' |
| 17 | + ], |
| 18 | + 'fieldHintSuffix': '-tooltip', |
| 19 | + 'fieldPrefix': 'articleassessment-rating-', |
| 20 | + 'fieldHTML': '<div class="field-wrapper"> \ |
| 21 | + <label for="rating_{FIELD}" original-title="{HINT}" class="rating-field-label">{LABEL}</label> \ |
| 22 | + <select id="rating_{FIELD}" name="rating[{FIELD}]" class="rating-field"> \ |
| 23 | + <option value="1">1</option> \ |
| 24 | + <option value="2">2</option> \ |
| 25 | + <option value="3">3</option> \ |
| 26 | + <option value="4" selected>4</option> \ |
| 27 | + <option value="5">5</option> \ |
| 28 | + </select> \ |
| 29 | + </div>', |
| 30 | + 'structureHTML': '<div class="article-assessment-wrapper"> \ |
| 31 | + <form action="rate" method="post" id="article-assessment"> \ |
| 32 | + <fieldset id="article-assessment-rate"> \ |
| 33 | + <legend>{YOURFEEDBACK}</legend> \ |
| 34 | + <span class="article-assessment-rate-instructions">{INSTRUCTIONS}</span> \ |
| 35 | + <span class="article-assessment-rate-feedback">{FEEDBACK}</span> \ |
| 36 | + <div class="article-assessment-rating-fields"></div> \ |
| 37 | + <div class="article-assessment-submit"> \ |
| 38 | + <input type="submit" value="Submit" /> \ |
| 39 | + </div> \ |
| 40 | + </fieldset> \ |
| 41 | + <fieldset id="article-assessment-ratings"> \ |
| 42 | + <legend>{ARTICLERATING}</legend> \ |
| 43 | + </fieldset> \ |
| 44 | + </form> \ |
| 45 | + </div>', |
| 46 | + 'ratingHTML': '<div class="article-assessment-rating"> \ |
| 47 | + <span class="article-assessment-rating-field-name">{LABEL}</span> \ |
| 48 | + <span class="article-assessment-rating-field-value">{VALUE}</span> \ |
| 49 | + <span class="article-assessment-rating-count">{COUNT}</span> \ |
| 50 | + </div>', |
| 51 | + 'staleMSG': '<span class="article-assessment-stale-msg">{MSG}</span>' |
| 52 | + }, |
64 | 53 | |
65 | 54 | 'fn' : { |
66 | 55 | 'init': function( $$options ) { |
67 | | - console.log( this ); |
68 | 56 | // merge options with the config |
69 | | - var settings = $.extend( {}, $.ArticleAssessment.config, $$options ); |
70 | | - console.log( $.ArticleAssessment.config ); |
| 57 | + var settings = $.extend( {}, $.ArticleAssessment.settings, $$options ); |
71 | 58 | // load up the stored ratings and update the markup if the cookie exists |
72 | 59 | var cookieSettings = $.cookie( 'mwArticleAssessment' ); |
73 | 60 | if ( cookieSettings == null ) { |
— | — | @@ -75,14 +62,59 @@ |
76 | 63 | }; |
77 | 64 | $.cookie( 'mwArticleAssessment', cookieSettings ); |
78 | 65 | } |
| 66 | + // setup our markup |
| 67 | + var $output = $( settings.structureHTML |
| 68 | + .replace( /\{INSTRUCTIONS\}/g, 'articleassessment-pleaserate' ) |
| 69 | + .replace( /\{FEEDBACK\}/g, 'articleassessment-yourfeedback' ) |
| 70 | + .replace( /\{YOURFEEDBACK\}/g, 'articleassessment-featurefeedback' ) |
| 71 | + .replace( /\{ARTICLERATING\}/g, 'articleassessment-articlerating' ) ); |
| 72 | + for( var field in settings.fieldMessages ) { |
| 73 | + $output.find( '.article-assessment-rating-fields' ) |
| 74 | + .append( $( settings.fieldHTML |
| 75 | + .replace( /\{LABEL\}/g, settings.fieldPrefix + settings.fieldMessages[field] ) |
| 76 | + .replace( /\{NAME\}/g, settings.fieldMessages[field] ) |
| 77 | + .replace( /\{HINT\}/g, settings.fieldPrefix + settings.fieldMessages[field] + settings.fieldHintSuffix ) ) ); |
| 78 | + $output.find( '#article-assessment-ratings' ) |
| 79 | + .append( $( settings.ratingHTML |
| 80 | + .replace( /\{LABEL\}/g, settings.fieldPrefix + settings.fieldMessages[field] ) |
| 81 | + .replace( /\{VALUE\}/g, '0%' ) |
| 82 | + .replace( /\{COUNT\}/g, 'field-count' ) ) |
| 83 | + ); |
| 84 | + } |
| 85 | + $( '#catLinks' ).before( $output ); |
| 86 | + |
79 | 87 | // initialize the star plugin |
80 | 88 | $( '.rating-field' ).each( function() { |
81 | 89 | $( this ) |
82 | | - .wrapAll( '<div class="rating-field-wrapper"></div>' ) |
| 90 | + .wrapAll( '<div class="rating-field"></div>' ) |
83 | 91 | .parent() |
84 | | - .stars( { inputType: 'select' } ); |
| 92 | + .stars( { |
| 93 | + inputType: 'select', |
| 94 | + callback: function( value, link ) { |
| 95 | + // remove any stale classes |
| 96 | + value.$stars.each( function() { |
| 97 | + $(this).removeClass( 'ui-stars-star-stale' ); |
| 98 | + } ); |
| 99 | + } |
| 100 | + } ); |
85 | 101 | }); |
| 102 | + // if the rating is stale, add the stale class |
| 103 | + if( true /* replace with conditional */ ) { |
| 104 | + // add the stale star class to each on star |
| 105 | + $( '.ui-stars-star-on' ) |
| 106 | + .addClass( 'ui-stars-star-stale' ); |
| 107 | + // add the stale message |
| 108 | + $( '.article-assessment-submit' ) |
| 109 | + .append( settings.staleMSG.replace( /\{MSG\}/g, 'articleassessment-stalemessage-revisioncount' ) ); |
| 110 | + } |
86 | 111 | // intialize the tooltips |
| 112 | + $( '.field-wrapper label[original-title]' ).each(function() { |
| 113 | + $( this ) |
| 114 | + .after( $( '<span class="rating-field-hint" />' ) |
| 115 | + .attr( 'original-title', $( this ).attr( 'original-title' ) ) |
| 116 | + .tipsy( { gravity : 'se', opacity: '0.9' } ) ); |
| 117 | + } ); |
| 118 | + // initialize the ratings |
87 | 119 | |
88 | 120 | // bind submit event to the form |
89 | 121 | |
— | — | @@ -106,6 +138,6 @@ |
107 | 139 | }; |
108 | 140 | // FIXME - this should be moved out of here |
109 | 141 | $( document ).ready( function () { |
110 | | - $.ArticleAssessment.fn.init( { 'endpoint': 'hello' }); |
| 142 | + $.ArticleAssessment.fn.init( { 'endpoint': 'hello' } ); |
111 | 143 | } ); //document ready |
112 | 144 | } )( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/ArticleAssessmentPilot/js/jquery.tipsy.js |
— | — | @@ -0,0 +1,202 @@ |
| 2 | +// tipsy, facebook style tooltips for jquery |
| 3 | +// version 1.0.0a |
| 4 | +// (c) 2008-2010 jason frame [jason@onehackoranother.com] |
| 5 | +// released under the MIT license |
| 6 | + |
| 7 | +(function($) { |
| 8 | + |
| 9 | + function Tipsy(element, options) { |
| 10 | + this.$element = $(element); |
| 11 | + this.options = options; |
| 12 | + this.enabled = true; |
| 13 | + this.fixTitle(); |
| 14 | + } |
| 15 | + |
| 16 | + Tipsy.prototype = { |
| 17 | + show: function() { |
| 18 | + var title = this.getTitle(); |
| 19 | + if (title && this.enabled) { |
| 20 | + var $tip = this.tip(); |
| 21 | + |
| 22 | + $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title); |
| 23 | + $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity |
| 24 | + $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body); |
| 25 | + |
| 26 | + var pos = $.extend({}, this.$element.offset(), { |
| 27 | + width: this.$element[0].offsetWidth, |
| 28 | + height: this.$element[0].offsetHeight |
| 29 | + }); |
| 30 | + |
| 31 | + var actualWidth = $tip[0].offsetWidth, actualHeight = $tip[0].offsetHeight; |
| 32 | + var gravity = (typeof this.options.gravity == 'function') |
| 33 | + ? this.options.gravity.call(this.$element[0]) |
| 34 | + : this.options.gravity; |
| 35 | + |
| 36 | + var tp; |
| 37 | + switch (gravity.charAt(0)) { |
| 38 | + case 'n': |
| 39 | + tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}; |
| 40 | + break; |
| 41 | + case 's': |
| 42 | + tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}; |
| 43 | + break; |
| 44 | + case 'e': |
| 45 | + tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}; |
| 46 | + break; |
| 47 | + case 'w': |
| 48 | + tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}; |
| 49 | + break; |
| 50 | + } |
| 51 | + |
| 52 | + if (gravity.length == 2) { |
| 53 | + if (gravity.charAt(1) == 'w') { |
| 54 | + tp.left = pos.left + pos.width / 2 - 15; |
| 55 | + } else { |
| 56 | + tp.left = pos.left + pos.width / 2 - actualWidth + 15; |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + $tip.css(tp).addClass('tipsy-' + gravity); |
| 61 | + |
| 62 | + if (this.options.fade) { |
| 63 | + $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity}); |
| 64 | + } else { |
| 65 | + $tip.css({visibility: 'visible', opacity: this.options.opacity}); |
| 66 | + } |
| 67 | + } |
| 68 | + }, |
| 69 | + |
| 70 | + hide: function() { |
| 71 | + if (this.options.fade) { |
| 72 | + this.tip().stop().fadeOut(function() { $(this).remove(); }); |
| 73 | + } else { |
| 74 | + this.tip().remove(); |
| 75 | + } |
| 76 | + }, |
| 77 | + |
| 78 | + fixTitle: function() { |
| 79 | + var $e = this.$element; |
| 80 | + if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') { |
| 81 | + $e.attr('original-title', $e.attr('title') || '').removeAttr('title'); |
| 82 | + } |
| 83 | + }, |
| 84 | + |
| 85 | + getTitle: function() { |
| 86 | + var title, $e = this.$element, o = this.options; |
| 87 | + this.fixTitle(); |
| 88 | + var title, o = this.options; |
| 89 | + if (typeof o.title == 'string') { |
| 90 | + title = $e.attr(o.title == 'title' ? 'original-title' : o.title); |
| 91 | + } else if (typeof o.title == 'function') { |
| 92 | + title = o.title.call($e[0]); |
| 93 | + } |
| 94 | + title = ('' + title).replace(/(^\s*|\s*$)/, ""); |
| 95 | + return title || o.fallback; |
| 96 | + }, |
| 97 | + |
| 98 | + tip: function() { |
| 99 | + if (!this.$tip) { |
| 100 | + this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'); |
| 101 | + } |
| 102 | + return this.$tip; |
| 103 | + }, |
| 104 | + |
| 105 | + validate: function() { |
| 106 | + if (!this.$element[0].parentNode) { |
| 107 | + this.hide(); |
| 108 | + this.$element = null; |
| 109 | + this.options = null; |
| 110 | + } |
| 111 | + }, |
| 112 | + |
| 113 | + enable: function() { this.enabled = true; }, |
| 114 | + disable: function() { this.enabled = false; }, |
| 115 | + toggleEnabled: function() { this.enabled = !this.enabled; } |
| 116 | + }; |
| 117 | + |
| 118 | + $.fn.tipsy = function(options) { |
| 119 | + |
| 120 | + if (options === true) { |
| 121 | + return this.data('tipsy'); |
| 122 | + } else if (typeof options == 'string') { |
| 123 | + var tipsy = this.data('tipsy'); |
| 124 | + if (tipsy) tipsy[options](); |
| 125 | + return this; |
| 126 | + } |
| 127 | + |
| 128 | + options = $.extend({}, $.fn.tipsy.defaults, options); |
| 129 | + |
| 130 | + function get(ele) { |
| 131 | + var tipsy = $.data(ele, 'tipsy'); |
| 132 | + if (!tipsy) { |
| 133 | + tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options)); |
| 134 | + $.data(ele, 'tipsy', tipsy); |
| 135 | + } |
| 136 | + return tipsy; |
| 137 | + } |
| 138 | + |
| 139 | + function enter() { |
| 140 | + var tipsy = get(this); |
| 141 | + tipsy.hoverState = 'in'; |
| 142 | + if (options.delayIn == 0) { |
| 143 | + tipsy.show(); |
| 144 | + } else { |
| 145 | + tipsy.fixTitle(); |
| 146 | + setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn); |
| 147 | + } |
| 148 | + }; |
| 149 | + |
| 150 | + function leave() { |
| 151 | + var tipsy = get(this); |
| 152 | + tipsy.hoverState = 'out'; |
| 153 | + if (options.delayOut == 0) { |
| 154 | + tipsy.hide(); |
| 155 | + } else { |
| 156 | + setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut); |
| 157 | + } |
| 158 | + }; |
| 159 | + |
| 160 | + if (!options.live) this.each(function() { get(this); }); |
| 161 | + |
| 162 | + if (options.trigger != 'manual') { |
| 163 | + var binder = options.live ? 'live' : 'bind', |
| 164 | + eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus', |
| 165 | + eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'; |
| 166 | + this[binder](eventIn, enter)[binder](eventOut, leave); |
| 167 | + } |
| 168 | + |
| 169 | + return this; |
| 170 | + |
| 171 | + }; |
| 172 | + |
| 173 | + $.fn.tipsy.defaults = { |
| 174 | + delayIn: 0, |
| 175 | + delayOut: 0, |
| 176 | + fade: false, |
| 177 | + fallback: '', |
| 178 | + gravity: 'n', |
| 179 | + html: false, |
| 180 | + live: false, |
| 181 | + offset: 0, |
| 182 | + opacity: 0.8, |
| 183 | + title: 'title', |
| 184 | + trigger: 'hover' |
| 185 | + }; |
| 186 | + |
| 187 | + // Overwrite this method to provide options on a per-element basis. |
| 188 | + // For example, you could store the gravity in a 'tipsy-gravity' attribute: |
| 189 | + // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' }); |
| 190 | + // (remember - do not modify 'options' in place!) |
| 191 | + $.fn.tipsy.elementOptions = function(ele, options) { |
| 192 | + return $.metadata ? $.extend({}, options, $(ele).metadata()) : options; |
| 193 | + }; |
| 194 | + |
| 195 | + $.fn.tipsy.autoNS = function() { |
| 196 | + return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n'; |
| 197 | + }; |
| 198 | + |
| 199 | + $.fn.tipsy.autoWE = function() { |
| 200 | + return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w'; |
| 201 | + }; |
| 202 | + |
| 203 | +})(jQuery); |
Index: trunk/extensions/ArticleAssessmentPilot/test.html |
— | — | @@ -11,42 +11,23 @@ |
12 | 12 | <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script> |
13 | 13 | <script src="js/jquery.ui.stars.js" type="text/javascript" charset="utf-8"></script> |
14 | 14 | <script src="js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script> |
| 15 | + <script src="js/jquery.tipsy.js" type="text/javascript" charset="utf-8"></script> |
| 16 | + |
15 | 17 | <script src="js/ArticleAssessment.js" type="text/javascript" charset="utf-8"></script> |
16 | 18 | <style type="text/css" media="screen"> |
17 | 19 | body,html{ background: #fff; } |
18 | | - .field-wrapper { |
19 | | - clear: both; |
20 | | - } |
21 | 20 | </style> |
22 | 21 | <title>ArticleAssessment JS Test</title> |
23 | 22 | <link rel="stylesheet" href="css/ArticleAssessment.css" type="text/css" media="screen" title="CSS" charset="utf-8" /> |
24 | 23 | </head> |
25 | 24 | |
26 | 25 | <body> |
27 | | - |
28 | | -<form action="rate" method="post" id="rating-form"> |
29 | | - <div class="field-wrapper"> |
30 | | - <label for="rating_reliability">Reliability:</label> |
31 | | - <select id="rating_reliability" name="rating[reliability]" class="rating-field"> |
32 | | - <option value="1">1</option> |
33 | | - <option value="2">2</option> |
34 | | - <option value="3">3</option> |
35 | | - <option value="4">4</option> |
36 | | - <option value="5">5</option> |
37 | | - </select> |
| 26 | +<div class="article-assessment-wrapper"> |
| 27 | + <div id="catLinks"> |
| 28 | + |
38 | 29 | </div> |
39 | | - <div class="field-wrapper"> |
40 | | - <label for="rating_completeness">Completeness:</label> |
41 | | - <select id="rating_completeness" name="rating[completeness]" class="rating-field"> |
42 | | - <option value="1">1</option> |
43 | | - <option value="2">2</option> |
44 | | - <option value="3">3</option> |
45 | | - <option value="4">4</option> |
46 | | - <option value="5">5</option> |
47 | | - </select> |
48 | | - </div> |
49 | | - <p><input type="submit" value="Submit" /></p> |
50 | | -</form> |
| 30 | +</div> |
51 | 31 | |
| 32 | + |
52 | 33 | </body> |
53 | 34 | </html> |
Index: trunk/extensions/ArticleAssessmentPilot/images/question.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/ArticleAssessmentPilot/images/question.gif |
___________________________________________________________________ |
Added: svn:mime-type |
54 | 35 | + application/octet-stream |
Index: trunk/extensions/ArticleAssessmentPilot/images/rating_bar.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/ArticleAssessmentPilot/images/rating_bar.gif |
___________________________________________________________________ |
Added: svn:mime-type |
55 | 36 | + application/octet-stream |
Index: trunk/extensions/ArticleAssessmentPilot/images/tipsy.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/ArticleAssessmentPilot/images/tipsy.gif |
___________________________________________________________________ |
Added: svn:mime-type |
56 | 37 | + application/octet-stream |
Index: trunk/extensions/ArticleAssessmentPilot/images/arrow.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/ArticleAssessmentPilot/images/arrow.gif |
___________________________________________________________________ |
Added: svn:mime-type |
57 | 38 | + application/octet-stream |
Index: trunk/extensions/ArticleAssessmentPilot/images/rating_bg.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/ArticleAssessmentPilot/images/rating_bg.gif |
___________________________________________________________________ |
Added: svn:mime-type |
58 | 39 | + application/octet-stream |
Index: trunk/extensions/ArticleAssessmentPilot/images/stars.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/ArticleAssessmentPilot/images/stars.gif |
___________________________________________________________________ |
Added: svn:mime-type |
59 | 40 | + application/octet-stream |
Index: trunk/extensions/ArticleAssessmentPilot/images/rating_disabled_bg.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/ArticleAssessmentPilot/images/rating_disabled_bg.gif |
___________________________________________________________________ |
Added: svn:mime-type |
60 | 41 | + application/octet-stream |