[Mod] Simple Code Box Download v.0.0.1 (Release)

Little Mods and Snips 1

[Mod] Simple Code Box Download v.0.0.1 (Release)

Postby Sekuro » 04 Apr 2012, 01:04

Simple Code Box Download

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]

1.png

Temp txt file is generated

2.png

Click on Link

3.png

Notepad++

4.png


Demo: http://4seven.bplaced.net/forum/media/viewto ... 1763#p1763

Note: You have to click [SELECT ALL] before download

Instruction:

download
Simple_Code_Box_Download_v.0.0.1.zip
(1.34 KiB) Downloaded 175 times

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 -->


Image none

Image none
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Re: [Mod] Simple Code Box Download v.0.0.1 (Release)

Postby Sekuro » 05 Jun 2012, 02:08

v.0.0.2 [dev] preview in demo
http://4seven.bplaced.net/forum/media/viewto ... 1763#p1763

- new look and feel with mouseover link
- cometic fix: txt-download-link was shown on all other codeboxes on current site (v.0.0.1)
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Return to Snip Cl@ss I

Who is online

Users browsing this forum: No registered users and 2 guests

cron