diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-18 09:40:11 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-18 09:40:11 +0100 |
| commit | 089e221c2345c2f016119de9d1cea4b36f97c75e (patch) | |
| tree | 22b8d5e4ca3ca0c0b00a6c44f772bd46281e0b0e /templates | |
| parent | 2c1e099d7c511de01ad30bf22bed85eaac88016f (diff) | |
| download | boards-089e221c2345c2f016119de9d1cea4b36f97c75e.tar.gz boards-089e221c2345c2f016119de9d1cea4b36f97c75e.tar.bz2 boards-089e221c2345c2f016119de9d1cea4b36f97c75e.zip | |
Rework to use jquery and drop mockikit
as yet untested
Diffstat (limited to 'templates')
| -rwxr-xr-x | templates/html_head_inc.tpl | 15 | ||||
| -rwxr-xr-x | templates/post_display.tpl | 34 |
2 files changed, 11 insertions, 38 deletions
diff --git a/templates/html_head_inc.tpl b/templates/html_head_inc.tpl index 1cac695..3ff90f4 100755 --- a/templates/html_head_inc.tpl +++ b/templates/html_head_inc.tpl @@ -1,7 +1,6 @@ {if $gBitSystem->getActivePackage() == 'boards'} <script>/* <![CDATA[ */ {literal} - /* DEPENDENCIES: MochiKit Base Async, BitAjax */ BitBoards = { /* this is called from flipswitch.tpl */ "flipName": function( url, elm ){ @@ -11,14 +10,14 @@ }, /* this is called from post_display.tpl */ - "warn":function( elmid, caller ){ - var oldonclick = caller.onclick; - document.getElementById( elmid ).style['display']='inline'; - caller.onclick = function() { - document.getElementById( elmid ).style['display']='none'; - caller.onclick = oldonclick; - return false; + "warn": function( elmid, url, caller ) { + var $elm = $( '#' + elmid ); + if( !$.trim( $elm.html() ) ) { + $.get( url ).done( function( html ) { $elm.html( html ); } ); } + $elm.show(); + var prev = caller.onclick; + caller.onclick = function() { $elm.hide(); caller.onclick = prev; return false; }; return false; }, diff --git a/templates/post_display.tpl b/templates/post_display.tpl index a5b95aa..a62cebd 100755 --- a/templates/post_display.tpl +++ b/templates/post_display.tpl @@ -91,40 +91,14 @@ {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='comment' serviceHash=$comment} {if $gBitUser->isRegistered() and $comment.is_warned} + {assign var=comment_id value=$comment.comment_id} <div class="warning"> - {assign var=comment_id value=$comment.comment_id} - <a onclick=" - var e = document.getElementById('warned_message_{$comment.comment_id|escape:"url"}'); - var url = '{$smarty.const.BOARDS_PKG_URL}ajax.php?req=10&comment_id={$comment_id}&seq=' + new Date().getTime(); - var element = 'warned_message_{$comment.comment_id|escape:"url"}'; - var params = null; - {literal} - var ajax = new Ajax.Updater( - {success: element}, - url, {method: 'get', parameters: params, onFailure: reportError} - ); - {/literal} - e.style.display='block'; - this.oldonclick=this.onclick; - this.onclick=new Function(' - document.getElementById(\'warned_message_{$comment.comment_id|escape:"url"}\').style.display=\'none\'; - this.onclick=this.oldonclick; - return false; - '); - return false; - " href="{$thread_mInfo.display_url}&warning[{$comment_id}]={if empty($warnings.$comment_id)}show{else}hide{/if}" + <a onclick="return BitBoards.warn('warned_message_{$comment.comment_id|escape:"url"}', '{$smarty.const.BOARDS_PKG_URL}ajax.php?req=10&comment_id={$comment_id}', this)" + href="{$thread_mInfo.display_url}&warning[{$comment_id}]={if empty($warnings.$comment_id)}show{else}hide{/if}" >{booticon ipackage="icons" iname="icon-warning-sign" iexplain="Warned Post"}</a> - - <div id="warned_message_{$comment.comment_id|escape:"url"}"> + <div id="warned_message_{$comment.comment_id|escape:"url"}" style="{if empty($warnings.$comment_id)}display:none{/if}"> {if !empty($warnings.$comment_id)}{$comment.warned_message}{/if} </div> - - {if empty($warnings.$comment_id)} - <script>/*<![CDATA[*/ - var warned_message_{$comment.comment_id|escape:"url"} = document.getElementById('warned_message_{$comment.comment_id|escape:"url"}'); - warned_message_{$comment.comment_id|escape:"url"}.style.display='none'; - /*]]>*/</script> - {/if} </div> {/if} |
