Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author ImageSilkyPress

    (@diana_burduja)

    Of course you can use the plugin to add the necessary javascript to the website. You will just have to consider that the javascript will be shown on the whole frontend, not only on the pages that use the widget.

    Thread Starter Imagepassegua

    (@passegua)

    thanks Diana for the reply.
    due to my poor English I do not understand if this plugin allows me to write javascript code into the widget itself.
    best regards

    Plugin Author ImageSilkyPress

    (@diana_burduja)

    Yes, you can use the plugin to write the Javascript code on the website.

    Thread Starter Imagepassegua

    (@passegua)

    I understand: “I can use the plugin to write the Javascript code on the website.”

    But I kindly wish to know if I can use the plugin to write the Javascript code into a side widget. If yes, how?

    How could I can use the plugin to write the Javascript code inside a widget?

    Many thanks for your patience.

    Plugin Author ImageSilkyPress

    (@diana_burduja)

    You cannot write javascript code directly inside a widget, but you can modify the javascript code in order to have the same effect. Essentially this is also what the forum moderator was suggesting.

    For example, the following code:

    <!--  ADVERTISEMENT TAG 160 x 600, DO NOT MODIFY THIS CODE -->
    <script type="text/javascript">
    <!--
    document.write('<iframe marginheight="0px" marginwidth="0px" frameborder="0" scrolling="no" width="160" height="600" src="http://optimized-by.simply.com/play.html?code=170107;61415;57339;0&from='+escape(document.referrer)+'"></iframe>');
    // -->
    </script>

    you can rewrite as follows:

    jQuery(window).ready(function($){
      $('.element-class').html('<iframe marginheight="0px" marginwidth="0px" frameborder="0" scrolling="no" width="160" height="600" src="http://optimized-by.simply.com/play.html?code=170107;61415;57339;0&from='+escape(document.referrer)+'"></iframe>');
    }

    where element-class is the CSS class of the widget were you want the code to show up.

    With Simple Custom CSS and JS you can add the rewritten code and it should have the same effect.

    I know this doesn’t sound like the easiest solution, but there is a reason for which they remove the javascript code from widgets.

    Plugin Author ImageSilkyPress

    (@diana_burduja)

    The second code you can rewrite as follows:

    jQuery(window).ready(function($){
    simply_publisher = 57339;
    simply_domain = 61415;
    simply_space = 170107;
    simply_ad_height = 600;
    simply_ad_width = 160;
    simply_callback = '';
    
    var cb = Math.round(new Date().getTime());
    $('.element-class').html('<scr'+'ipt type="text/javascript" src="'+ ('https:' == document.location.protocol ? 'https://' : 'http://') + 'optimized-by.4wnetwork.com/simply_loader.js?cb='+ cb +'"></scr' + 'ipt>');
    }

    where, again, the element-class is the CSS class of the widget were you want the code to show up.

    Let me know if this works.

    Plugin Author ImageSilkyPress

    (@diana_burduja)

    Sorry, you also need to add an ); at the end of each code snippet I gave you.

    Like this:

    jQuery(window).ready(function($){
      $('.element-class').html('<iframe marginheight="0px" marginwidth="0px" frameborder="0" scrolling="no" width="160" height="600" src="http://optimized-by.simply.com/play.html?code=170107;61415;57339;0&from='+escape(document.referrer)+'"></iframe>');
    });

    and

    jQuery(window).ready(function($){
    simply_publisher = 57339;
    simply_domain = 61415;
    simply_space = 170107;
    simply_ad_height = 600;
    simply_ad_width = 160;
    simply_callback = '';
    
    var cb = Math.round(new Date().getTime());
    $('.element-class').html('<scr'+'ipt type="text/javascript" src="'+ ('https:' == document.location.protocol ? 'https://' : 'http://') + 'optimized-by.4wnetwork.com/simply_loader.js?cb='+ cb +'"></scr' + 'ipt>');
    });

    Thread Starter Imagepassegua

    (@passegua)

    So you mean that:
    1) I install the plugin (any special setting?)
    2) I write the modified code into a widget

    and that’s all?

    It sounds very simple!

    I don’t have to set the plugin in order to make this widget code works?

    I’ll try asap. Thanks

    Thread Starter Imagepassegua

    (@passegua)

    Bad luck!

    I cannot activate this plugin!

    The plugin can not be activated because a fatal error.

    Parse error: syntax error, unexpected ‘[‘ in /web/htdocs/www.sinapsi.org/home/wordpress/wp-content/plugins/custom-css-js/custom-css-js.php on line 71

    Plugin Author ImageSilkyPress

    (@diana_burduja)

    Oh, your server is using an older version of PHP (<=3). I updated the code so it doesn’t throw that error.

    But you understood it wrong. You activate the plugin and write the modified javascript code in the “Add new JS” section of the plugin, as shown in the screenshot.

    Also you need to change the element-class from the modified code with the CSS class of the widget.

    Thread Starter Imagepassegua

    (@passegua)

    The plugin still generate a fatal error:

    Parse error: syntax error, unexpected ‘[‘ in /web/htdocs/www.sinapsi.org/home/wordpress/wp-content/plugins/custom-css-js/custom-css-js.php on line 266

    Plugin Author ImageSilkyPress

    (@diana_burduja)

    I’m sorry, please try again to uninstall and install/activate the plugin.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘java script side widget problem’ is closed to new replies.