Topic Closed

I want to adapt  https://github.com/florincatalin/jquery-share-plugin

for SimpleBlog (for Typesetter I succeeded).

In this regard I have modified the SimpleBlogCommon.php file (  public static function AddCSS()  )

$ page-> head_js [] = 'goshare.js';
$ page-> jQueryCode. = '$ (". utilshare"). goshare ();';

The goshare.js file is copied to the root.

The problem is that it only works when I am logged on as an administrator, when I logout I receive an error message. The source code shows that indeed the goshare.js file is not found.
This occurs only when I see post without being logged in.

What could be the cause? Maybe I did something wrong?

2 years ago#11622

juergen
1.5K Posts
60.5K Downloads
16 Plugins

> The goshare.js file is copied to the root.

I wouldn't do it like that. The installation root shouldn't be used in this regard and is not (shouldn't be) writable to plugins.

Furthermore

$page-> head_js[] = 'goshare.js';

needs the (global) $dirPrefix; variable prepended in order to work in all situations.

global $dirPrefiix;
$page-> head_js[] = $dirPrefix . '/goshare.js';
2 years ago#11623

juergen
1.5K Posts
60.5K Downloads
16 Plugins
I'd implement it as a standalone plugin, so you can use it independent from SimpleBlog. Give me a moment…
2 years ago#11624

juergen
1.5K Posts
60.5K Downloads
16 Plugins
Please check out this plugin on my GitHub repo
Edited: 2 years ago#11625

I wouldn't do it like that. The installation root shouldn't be used in this regard and is not (shouldn't be) writable to plugins.

I understand, there are security reasons.

needs the (global) $dirPrefix; variable prepended in order to work in all situations.

it is good to know in the future

Thanks so much for the plugin, you were very kind! (and very fast)
I've already installed it on my site and my blog and it works flawlessly!

I think this plugin is very useful because it can also do terms search and translation using Google, which solves an important problem. In addition, Google uses AI algorithms for translation and is getting better and better every day.

It is not very complicated, other options can be added. For the addition of new icons we have online

https://onlinepngtools.com/convert-base64-to-png

we just need to change some code inside goshare.js. And now it could be used with any template.

All the best,
Florin

2 years ago#11628

juergen
1.5K Posts
60.5K Downloads
16 Plugins

Glad you like it. Please just add this semicolon to the code in goshare.php. Might cause issues with other plugins otherwise.

 

<?php
defined('is_running') or die('Not an entry point...');

class TSgoShare{

  /**
   * Typesetter action hook
   */

  public static function GetHead(){
    global $page, $addonRelativeCode;
    $page->css_admin[] = $addonRelativeCode . '/goshare.css';
    $page->head_js[] = $addonRelativeCode . '/goshare.js';
    $page->jQueryCode .= '$("#gpx_content").goshare();';
  }

}
Edited: 2 years ago#11631

I added, thank you!
2 years ago#11634

Topic Closed

 

News

elFinder 2.1.50 in Upcoming Release
12/28/2019

A new release for Typesetter is in the works with a lot of improvements including the ... Read More

Typesetter 5.1
8/12/2017

Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

More News

HH-Support

Company located in T├│rshavn, Faroe Islands. * Webpage Design * Consultant & Provider of a wide range of programs for visually impaired and dyslextics.

Find out more about our Provider Spotlight

Log In

  Register