(p_sign, p_selectedIndex, p_displayOptions)
| 31 | redraw a menu sign |
| 32 | */ |
| 33 | var _redrawMenuSign = function(p_sign, p_selectedIndex, p_displayOptions) { |
| 34 | var optLen = p_displayOptions.length, |
| 35 | i, |
| 36 | text; |
| 37 | // the offset is where the menu window begins |
| 38 | var offset = Math.max( |
| 39 | 0, |
| 40 | Math.min(optLen - 3, Math.floor(p_selectedIndex / 3) * 3) |
| 41 | ); |
| 42 | for (i = 0; i < 3; i++) { |
| 43 | text = ''; |
| 44 | if (offset + i < optLen) { |
| 45 | text = p_displayOptions[offset + i]; |
| 46 | } |
| 47 | if (offset + i == p_selectedIndex) { |
| 48 | text = ('' + text).replace(/^ /, '>'); |
| 49 | } |
| 50 | setLine(p_sign, i + 1, text); |
| 51 | } |
| 52 | if (__plugin.canary) { |
| 53 | p_sign.update(); |
| 54 | } |
| 55 | if (__plugin.bukkit) { |
| 56 | p_sign.update(true); |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | var _updaters = {}; |
| 61 | /* |
no outgoing calls
no test coverage detected