Index: trunk/extensions/MarkAsHelpful/modules/ext.markAsHelpful/ext.markAsHelpful.js |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | |
10 | 10 | var mah = mw.mah = { |
11 | 11 | loadedItems: [], |
12 | | - selector: '.markashelpful-item', //class of element(s) to apply MarkAsHelpful to. |
| 12 | + selector: '[class^=markashelpful]', //class of element(s) to apply MarkAsHelpful to. |
13 | 13 | |
14 | 14 | init: function() { |
15 | 15 | var props, thisItem; |
— | — | @@ -28,10 +28,13 @@ |
29 | 29 | * Return object of item properties |
30 | 30 | */ |
31 | 31 | getItemProperties: function( $item ) { |
32 | | - var properties = { |
33 | | - 'item': $item.data('markashelpful-item'), // item id |
34 | | - 'type': $item.data('markashelpful-type') // item type (eg, mbresponse) |
35 | | - }; |
| 32 | + var tag = $item.attr( 'class' ), |
| 33 | + //item properties are stored in classname to prevent parser from stripping out non html 5 objects. |
| 34 | + //(eg data-markashelpful-item) |
| 35 | + properties = { |
| 36 | + 'item': tag.split( '-' )[2], // item id |
| 37 | + 'type': tag.split( '-' )[1] // item type (eg, mbresponse) |
| 38 | + }; |
36 | 39 | return properties; |
37 | 40 | }, |
38 | 41 | |