MOD-Title: Simple Code Box Download
MOD-Version: 0.0.1
MOD-Author: 4seven
Request by: Benecore
Request post: http://www.phpbb.com/community/viewtopi ... #p13149859
MOD-Description: Provides a txt download link of codebox content after clicking [SELECT ALL]
phpBB-Version: phpBB 3.0.x
phpBB-Languages: en
phpBB-Styles: prosilver
Features:
- Download of [ code ] box content as txt file
- By click on [SELECT ALL] the txt file is made
- The file is temporary generated, so near zero disk space
- Successfull tested with FF, Chrome, Opera and Safari
- Less edits and minimalistic design
- No mass file generating
- Xhtml 1.0. strict
Exceptions/Known Bugs:
- The linebreaks dont work right in some IE Versions
- Infos:
http://www.google.com/search?q=download ... er+problem
http://www.biglist.com/lists/xsl-list/a ... 00299.html
http://www.codingforums.com/showthread.php?t=155570
Screens: (v.0.0.2)
Click [SELECT ALL]
Temp txt file is generated
Click on Link
Notepad++
Demo: http://4seven.bplaced.net/forum/media/viewto ... 1763#p1763
Note: You have to click [SELECT ALL] before download
Instruction:
download
copy
root/popcontent.php >> popcontent.php
root/popcontent/*.* >> popcontent/*.*
open
.htaccess
find
- Code: Select all
<Files "common.php">
Order Allow,Deny
Deny from All
</Files>
after add
- Code: Select all
<FilesMatch "\.(txt)$" >
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
open
styles/prosilver/template/bbcode.html
find
- Code: Select all
<!-- BEGIN code_open --><dl class="codebox"><dt>{L_CODE}: <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></dt><dd><code><!-- END code_open -->
<!-- BEGIN code_close --></code></dd></dl><!-- END code_close -->
replace with
- Code: Select all
<!-- BEGIN code_open --><dl class="codebox"><dt>{L_CODE}: <a href="#" onclick="selectCode(this); popcontent(); return false;">{L_SELECT_ALL_CODE}</a> | <span class="popcontent">Note: Click [Select All] before download</span></dt><dd><code><!-- END code_open -->
<!-- BEGIN code_close --></code></dd></dl><!-- END code_close -->
open
styles/prosilver/template/viewtopic_body.html
find
- Code: Select all
<!-- BEGIN postrow -->
before add
- Code: Select all
<!-- Simple Code Box Download / 4seven / 2012 -->
<script type="text/javascript">
// <![CDATA[
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery-latest.min.js"><\/script>');
// ]]>
</script>
<script type="text/javascript">
// <![CDATA[
function popcontent() {
var selobj = document.getSelection();
selob = selobj.toString();
var ts = Math.round((new Date()).getTime() / 1000);
$('.popcontent').load('popcontent.php', {codetxt : selob, filnam: ts+'.txt'});
}
// ]]>
</script>
<!-- Simple Code Box Download / 4seven / 2012 -->

