[312] | 1 | |
---|
| 2 | function toggleUtil(id) { |
---|
| 3 | $(id).toggle(); |
---|
| 4 | } |
---|
| 5 | |
---|
[322] | 6 | function toggleWithImgUtil(id, imageId, openImgUrl, closedImgUrl) { |
---|
| 7 | |
---|
| 8 | $(id).toggle(); |
---|
| 9 | |
---|
| 10 | if( $(id).visible() ) { |
---|
| 11 | $(imageId).src= openImgUrl; |
---|
| 12 | } |
---|
| 13 | else { |
---|
| 14 | $(imageId).src= closedImgUrl; |
---|
| 15 | } |
---|
| 16 | } |
---|
| 17 | |
---|
[312] | 18 | function showUtil(id) { |
---|
[714] | 19 | Effect.Appear(id,{duration:0.2,queue:'end'}); |
---|
[312] | 20 | } |
---|
| 21 | |
---|
| 22 | function hideUtil(id) { |
---|
[714] | 23 | Effect.Fade(id,{duration:0.2,queue:'end'}); |
---|
[323] | 24 | } |
---|
| 25 | |
---|
[568] | 26 | function toggleWithEffectUtil(id) { |
---|
| 27 | if( $(id).visible() ) { |
---|
| 28 | Effect.Fade(id,{duration:0.4,queue:'end'}); |
---|
| 29 | } |
---|
| 30 | else { |
---|
| 31 | Effect.Appear(id,{duration:0.4,queue:'end'}); |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | |
---|
[323] | 35 | function toggleWithImgAndEffectUtil(id, imageId, openImgUrl, closedImgUrl) { |
---|
| 36 | |
---|
| 37 | if( $(id).visible() ) { |
---|
| 38 | Effect.Fade(id,{duration:0.4,queue:'end'}); |
---|
| 39 | $(imageId).src= closedImgUrl; |
---|
| 40 | } |
---|
| 41 | else { |
---|
| 42 | Effect.Appear(id,{duration:0.4,queue:'end'}); |
---|
| 43 | $(imageId).src= openImgUrl; |
---|
| 44 | } |
---|
[358] | 45 | } |
---|
| 46 | |
---|
| 47 | function textAreaScrollBottom(id) { |
---|
| 48 | $(id).scrollTop = $(id).scrollHeight; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | function focusUtil(id) { |
---|
| 52 | $(id).focus(); |
---|
[712] | 53 | } |
---|
| 54 | |
---|
| 55 | function enableUtil(id) { |
---|
| 56 | $(id).disabled = false; |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | function disableUtil(id) { |
---|
| 60 | $(id).disabled = true; |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | // Looping in reverse is apparently more efficient. |
---|
| 64 | function containsUtil(val, array) { |
---|
| 65 | var i = array.length; |
---|
| 66 | while (i--) { |
---|
| 67 | if (array[i] == val) { |
---|
| 68 | return true; |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | return false; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | function toggleArrayUtil(idArray) { |
---|
| 75 | var i = idArray.length; |
---|
| 76 | while (i--) { |
---|
| 77 | toggleUtil(idArray[i]); |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | // Loops forwards. |
---|
| 82 | function showArrayUtil(idArray) { |
---|
| 83 | var len = idArray.length |
---|
| 84 | var i=0; |
---|
| 85 | for (i=0; i < len; i++) { |
---|
[714] | 86 | Effect.Appear(idArray[i],{duration:0.05,queue:'end'}); |
---|
[712] | 87 | } |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | // Loops backwards. |
---|
| 91 | function hideArrayUtil(idArray) { |
---|
| 92 | var i = idArray.length; |
---|
| 93 | while (i--) { |
---|
[714] | 94 | Effect.Fade(idArray[i],{duration:0.05,queue:'end'}); |
---|
[712] | 95 | } |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | function disableArrayUtil(idArray) { |
---|
| 99 | var i = idArray.length; |
---|
| 100 | while (i--) { |
---|
| 101 | disableUtil(idArray[i]); |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | function enableArrayUtil(idArray) { |
---|
| 106 | var i = idArray.length; |
---|
| 107 | while (i--) { |
---|
| 108 | enableUtil(idArray[i]); |
---|
| 109 | } |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | function toggleIfArrayContainsValueUtil(toggleIds, val, array) { |
---|
| 113 | if(containsUtil(val, array)) { |
---|
| 114 | //Effect.multiple(toggleIds, Effect.Appear, {duration:0.4,queue:'end'}); // A little slow, will not go bellow 0.1 per item. |
---|
| 115 | showArrayUtil(toggleIds); |
---|
| 116 | } |
---|
| 117 | else { |
---|
| 118 | hideArrayUtil(toggleIds); |
---|
| 119 | } |
---|
| 120 | } |
---|
[798] | 121 | |
---|
| 122 | function openWindow(url) { |
---|
| 123 | window.open(url); |
---|
| 124 | } |
---|
[819] | 125 | |
---|
| 126 | function getContextPath() { |
---|
| 127 | var contextPath = '/' + location.pathname.split('/',2)[1] |
---|
| 128 | return contextPath |
---|
| 129 | } |
---|