Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Sceditor Mod TTv3
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods in Progress

2021-02-16 22:24:01
A copy of my editor mod for v3 - in progress because some bbcode/smilies might need adding to format comment but this is easy to add afterwards just need some testers to finish this off
and here is the docs https://www.sceditor.com/documentation/options/

header.php with the other linked css stuff
<link rel="stylesheet" href="sceditor/minified/themes/default.min.css" id="theme-style" />


Add the js
    <script src="sceditor/minified/sceditor.min.js"></script>
<script src="sceditor/minified/icons/monocons.js"></script>
<script src="sceditor/minified/formats/bbcode.js"></script>



this line needs to go underneath the above code or below all the js links
<script>
// Replace the textarea #example with SCEditor
var textarea = document.getElementById('example');
sceditor.create(textarea, {
format: 'bbcode',
style: 'minified/themes/content/default.min.css',
 startInSourceMode: true,
 toolbar: 'bold,italic,underline,strike,left,center,right,font,size,color,cut,copy,paste,code,quote,image,link,emoticon,youtube,source',
 emoticonsRoot: "<?php echo $site_config['SITEURL'] ?>/sceditor/",
 emoticonsCompat: true
});
</script>


Please take note in the last piece of code we use example to link (textarea var textarea = document.getElementById('example');)
so all textareas with the editor need to be tagged/id with example

This is a example of forum if you search forum.php for textbbcode("Form", "body"); there is 2
And replace with
<textarea  id='example' style='height:300px;width:80%;' name='body' rows='13'></textarea>


There is one textbbcode("Form", "body"); in insert_compose_frame() as well
ill go through smilies and some bbcode later to finish this off


Finally add folder sceditor to root
sceditor.zip
File missing
Last edited by M-jay warn on 2021-02-16 22:39:52
2021-02-17 17:16:15
for smileys to keep old post intact i have added a second array still looking at how to add more

in functions.php find
function format_comment($text)
{
   global $smilies;


replace with global line with
global $smilies, $smilies1;



find
    reset($smilies);
   while (list($code, $url) = thisEach($smilies)) {
       $s = str_replace($code, '<img border="0" src="' .  $site_config['SITEURL'] . '/assets/images/smilies/' . $url . '" alt="' . $code . '" title="' . $code . '" />', $s);
   }


add below
 

   reset($smilies1);
   while (list($code, $url) = thisEach($smilies1)) {
       $s = str_replace($code, '<img border="0" src="' . $site_config['SITEURL'] . '/sceditor/' . $url . '" alt="' . $code . '" title="' . $code . '" />', $s);
   }


in backend smilies.php add new array under old one

$smilies1 = array
   (
":)" => "emoticons/smile.png",
":angel:" => "emoticons/angel.png",
":angry:" => "emoticons/angry.png",
"8-)" => "emoticons/cool.png",
":'(" => "emoticons/cwy.png",
":ermm:" => "emoticons/ermm.png",
":D" => "emoticons/grin.png",
"<3" => "emoticons/heart.png",
":(" => "emoticons/sad.png",
":O" => "emoticons/shocked.png",
":P" => "emoticons/tongue.png",
";)" => "emoticons/wink.png",
":alien:" => "emoticons/alien.png",
":blink:" => "emoticons/blink.png",
":blush:" => "emoticons/blush.png",
":cheerful:" => "emoticons/cheerful.png",
":devil:" => "emoticons/devil.png",
":dizzy:" => "emoticons/dizzy.png",
":getlost:" => "emoticons/getlost.png",
":happy:" => "emoticons/happy.png",
":kissing:" => "emoticons/kissing.png",
":ninja:" => "emoticons/ninja.png",
":pinch:" => "emoticons/pinch.png",
":pouty:" => "emoticons/pouty.png",
":sick:" => "emoticons/sick.png",
":sideways:" => "emoticons/sideways.png",
":silly:" => "emoticons/silly.png",
":sleeping:" => "emoticons/sleeping.png",
":unsure:" => "emoticons/unsure.png",
":woot:" => "emoticons/w00t.png",
":wassat:" => "emoticons/wassat.png",
":whistling:" => "emoticons/whistling.png",
":love:" => "emoticons/wub.png",
);


in header.php find this line and remove code, from this line that should now fully work with v3
toolbar: 'bold,italic,underline,strike,left,center,right,font,size,color,cut,copy,paste,code,quote,image,link,emoticon,youtube,source',
Last edited by M-jay warn on 2021-02-17 19:08:26
2021-02-17 17:20:11
Only thing i think i am missing is the edit post part where the db contents need echoing into post which should look like this
<textarea  id='example' style='height:300px;width:100%;' name='body' rows='13'><?php echo htmlspecialchars($body) ?></textarea>


Last edited by M-jay warn on 2021-02-17 17:20:36
2021-02-17 18:27:06
Im having better luck so far just by making a function and calling it. I put this in backend/bbcode.php at the top
function sceditor() {
?>
<textarea  id='example' style='height:300px;width:80%;' name='body' rows='13'></textarea>
<link rel="stylesheet" href="sceditor/minified/themes/default.min.css" id="theme-style" />
<script src="sceditor/minified/sceditor.min.js"></script>
<script src="sceditor/minified/icons/monocons.js"></script>
<script src="sceditor/minified/formats/bbcode.js"></script>
<script>
// Replace the textarea #example with SCEditor
var textarea = document.getElementById('example');
sceditor.create(textarea, {
format: 'bbcode',
style: 'minified/themes/content/default.min.css',
startInSourceMode: true,
toolbar: 'bold,italic,underline,strike,left,center,right,font,size,color,cut,copy,paste,code,quote,image,link,emoticon,youtube,source',
emoticonsRoot: "<?php echo $site_config['SITEURL'] ?>/sceditor/",
emoticonsCompat: true
});
</script>
<?php
}


then just calling the function rather than editing the headers. I dunno, im still fiddling, just a thought that seems to be a bit simpler I couldnt make it work using the header edits, not sure what was going wrong and I couldnt tell, so I piled all the code into the function to execute all of it so then I knew it was launching
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-02-18 12:37:15
2021-02-17 18:34:20
example in torrents-details.php
	if ($CURUSER) {
echo "<center>";
echo "<form name=\"comment\" method=\"post\" action=\"torrents-details.php?id=$row[id]&takecomment=yes\">";
// echo textbbcode("comment","body")."<br />";
echo sceditor();
echo "<input type=\"submit\"  value=\"".T_("ADDCOMMENT")."\" />";
echo "</form></center>";
}

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-02-17 19:12:23
This line commented out

//toolbar: 'bold,italic,underline,strike,left,center,right,font,size,color,cut,copy,paste,code,quote,image,link,emoticon,youtube,source',



Only code, needs removing all the other bbcode should work

Nice function not sure why header didnt work was it below all other js - doesnt really matter as long as its working
2021-02-17 19:22:30
My headers are a mess of addons, so I am sure I made an error, so rather than get a headache over it, I just made that function. The upside of that is you can just implement it where ever you want and not have to worry about the theme. So far so good, if it goes to shit, I'll report on it lol
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-02-17 19:28:05
the youtube part strips the url down to the video ID and we cant use that currently without more code. Have you looked at that yet?
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-02-17 19:30:27
Is this what its supposed to look like? Seems normal to me, but I dont know if I have anything being added to it, just wanted to check https://ibb.co/56dXtMg
Capture.PNG
File missing

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-02-17 19:31:29
2021-02-17 19:50:15
yes thats looks fine :thum
Last edited by M-jay warn on 2021-02-17 19:50:26
2021-02-17 19:58:31
for any bbcode you do not have in format_comment function just remove from this line
for standard v3 i think it should be something like this
replace
//toolbar: 'bold,italic,underline,strike,left,center,right,font,size,color,cut,copy,paste,code,quote,image,link,emoticon,youtube,source',


for

toolbar: 'bold,italic,underline,strike,left,center,right,font,size,color,cut,copy,paste,quote,image,link,emoticon,youtube,source',
2021-02-17 20:45:43
I dont have youtube format comment, you have that?

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-02-17 20:49:49
2021-02-17 22:37:28
oops, youtube can be added with this just enter the full url on editor

$s = preg_replace(
       '#\[youtube\](.+)\[/youtube\]#isU',
       '<iframe width="250" height="140" src="http://www.youtube.com/embed/$1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>',
       $s
   );


[youtube]Yj9UfkzvoTY[/youtube]
Last edited by M-jay warn on 2021-02-18 00:01:19
2021-02-17 23:22:26
can you post a screenshot of your code? something is being lost in translation on the post.
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-02-17 23:25:43
which code the format comment function

https://ibb.co/xz2CbJ3

still seem to have issue with backslashes - fixed \ \ \ \
Last edited by M-jay warn on 2021-02-18 00:01:50
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728