Recent Tutorials
Who is online?
In total there are 6 users online :: 1 Registered, 0 Hidden and 5 Guests

Niko!

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

GIFActif - Giphy Button for the Editor

Page 1 of 3 1, 2, 3  Next

View previous topic View next topic Go down

Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Fri 26 Aug 2016, 15:26

What is GIFActif ? GIFActif is a Giphy search plugin for the free forum service, Forumotion aka Forumactif. GIFActif adds a new button to the message editor that gives your members the ability to search for GIFS and attach them to their messages without ever leaving the page ! Why express yourself with just words alone when you can add a GIF to your message to liven things up ?


Click to view demo

How does it work ?

  • GIFActif adds a new button to the editor with the Giphy logo -->
  • Clicking the button opens the Giphy search drop down.
  • Type any words you want into the search bar and you'll immediately be presented with GIFs relevant to your keywords.
  • Scrolling to the end of the results will load more results.
  • Click the GIF you want to add to your message and you're done !
  • Open the drop down again to find more GIFs !!


Where do the GIFs come from ?
All GIFs are retrieved from Giphy.com by using the Giphy Search API to find GIFs just for you !
Note : Since this project is open source, it'll be using the public beta key provided by Giphy, which is subject to rate limit constraints.


Feel free to move onto the installation if you're ready to get giphy with it ! Cool


Installation

To install the Giphy search button, go to Admin Panel > Modules > JavaScript codes management and create a new JavaScript with the following settings.

Title : GIFActif
Placement : In all the pages
Paste the following script and submit :
Code:
(function() {
  'GIFACTIF - GIPHY PLUGIN FOR THE FORUMACTIF SCEDITOR';
  'REPOSITORY : https://github.com/SethClydesdale/gifactif';
  'SEARCH API BY : https://github.com/Giphy/GiphyAPI';


  // return if gifactif has been initialized
  if (window.gifactif) {
    if (window.console && console.warn) {
      console.warn('gifactif has already been initialized');
    }
    return;
  }


  // setup global object
  window.gifactif = {
    key : 'dc6zaTOxFJmzC', // PUBLIC BETA KEY
    limit : 26, // max image results
    delay : 200, // delay before searches commence (200ms)
    auto_close : true,

    // general language settings
    lang : {
      searching : 'Searching...',
      not_found : 'No results found.. <img src="http://illiweb.com/fa/i/smiles/icon_sad.gif" style="margin:0;vertical-align:middle;"/>'
    },

    // dropdown markup
    dropDown : $(
      '<div>'+
        '<input type="text" id="gifactif_search" placeholder="Search for a GIF..." style="width:90%;"/>'+
        '<div id="gifactif_results" onscroll="gifactif.scrolling(this);"><div id="gifactif_images"></div></div>'+
        '<div id="giphy_attribution_mark"></div>'+
      '</div>'
    )[0],


    // initial setup of the SCEditor command
    init : function () {
      if ($.sceditor && window.toolbar) {

        // set the gifactif command
        $.sceditor.command.set('gifactif', {

          tooltip : 'Find a GIF',

          // Dropdown and general functionality for gifactif
          dropDown : function (editor, caller, callback) {
            gifactif.reset();
            gifactif.editor = editor;
            gifactif.callback = callback;
            editor.createDropDown(caller, 'gifactif', gifactif.dropDown);

            $('#gifactif_search', gifactif.dropDown)[0].focus(); // focus the search area
          },


          // WYSIWYG MODE
          exec : function(caller) {
            var editor = this;

            $.sceditor.command.get('gifactif').dropDown(editor, caller, function(gif) {
              editor.insert('[img]' + gif + '[/img]');
            });
          },


          // SOURCE MODE
          txtExec : function(caller) {
            var editor = this;

            $.sceditor.command.get('gifactif').dropDown(editor, caller, function(gif) {
              editor.insertText('[img]' + gif + '[/img]');
            });
          }

        });


        // add gifactif to the editor toolbar
        toolbar = toolbar.replace('image,', 'image,gifactif,');

        // add CSS for button image and dropdown
        $('head').append(
          '<style type="text/css">'+
            '.sceditor-button-gifactif div { background-image:url(http://i35.servimg.com/u/f35/18/21/60/73/giphy10.png) !important; }'+
            '.sceditor-button-gifactif:after, .sceditor-button-gifactif:before { content:""; }'+ // Forumactif Edge override
            '#gifactif_results { width:300px; margin:10px auto; min-height:30px; max-height:300px; overflow-x:hidden; overflow-y:auto; }'+
            '.gifactif_imagelist { line-height:0; column-count:2; column-gap:3px; }'+
            '.gifactif_imagelist img { margin-bottom:3px; cursor:pointer; width:100%; }'+
            'html #giphy_attribution_mark { background:url(http://i35.servimg.com/u/f35/18/21/60/73/powere11.png) no-repeat 50% 50% transparent !important; height:22px !important; width:100%; !important; min-width:200px !important; display:block !important; visibility:visible !important; opacity:1 !important; }'+
          '</style>'
        );
      }

    },


    // search for a GIPHY gif
    search : function (query) {
      if (gifactif.timeout) {
        gifactif.abort(); // abort ongoing searches and requests
      }

      if (query) {

        // set a small timeout in case the user is still typing
        gifactif.timeout = window.setTimeout(function() {
          gifactif.reset(true, gifactif.lang.searching);
          gifactif.query = encodeURIComponent(query);

          gifactif.request = $.get('http://api.giphy.com/v1/gifs/search?q=' + gifactif.query + '&limit=' + gifactif.limit + '&rating=pg-13&api_key=' + gifactif.key, function(data) {
            // update global data such as page offsets for scrolling
            gifactif.request = null;
            gifactif.offset = data.pagination.offset + gifactif.limit;
            gifactif.offset_total = data.pagination.total_count;

            gifactif.reset(true); // reset HTML content
            gifactif.addGIF(data); // send data to be parsed
          });

        }, gifactif.delay);

      } else {
        gifactif.reset(true);
      }
    },


    // abort ongoing searches and requests
    abort : function () {
      if (gifactif.timeout) {
        window.clearInterval(gifactif.timeout);
        gifactif.timeout = null;
      }

      if (gifactif.request) {
        gifactif.request.abort();
        gifactif.request = null;
      }
    },


    // add gifs to the result list
    addGIF : function (data, loadMore) {
      // setup data and begin parsing results
      var gif = data.data,
          i = 0,
          j = gif.length,
          list = $('<div class="gifactif_imagelist" />')[0];

      if (j) {
        for (; i < j; i++) {
          list.appendChild($('<img id="' + gif[i].id + '" src="' + gif[i].images.fixed_width.url + '" />').click(gifactif.insert)[0]);
        }
      } else if (!loadMore) {
        gifactif.reset(true, gifactif.lang.not_found);
      }

      // add results to the result list
      $('#gifactif_results', gifactif.dropDown).append(list);
    },


    // listen to the scrolling so we can add more gifs when the user reaches the bottom
    scrolling : function (that) {
      if (that.scrollHeight - that.scrollTop === that.clientHeight) {
        gifactif.loadMore();
      }
    },


    // load more results once the user has scrolled through the last results
    loadMore : function () {
      if (gifactif.offset < gifactif.offset_total) {
        gifactif.request = $.get('http://api.giphy.com/v1/gifs/search?q=' + gifactif.query + '&offset=' + gifactif.offset + '&limit=' + gifactif.limit + '&rating=pg-13&api_key=' + gifactif.key, function(data) {
          gifactif.request = null;
          gifactif.offset = data.pagination.offset + gifactif.limit;
          gifactif.offset_total = data.pagination.total_count;

          gifactif.addGIF(data, true); // send data to be parsed
        });
      }
    },


    // inserts the gif into the editor
    insert : function () {
      // add the gif to the editor and close the dropdown
      gifactif.callback('http://media0.giphy.com/media/' + this.id + '/giphy.gif');

      if (gifactif.auto_close) {
        gifactif.editor.closeDropDown(true);
        gifactif.reset();
      }
    },


    // reset the dropdown fields
    reset : function (resultsOnly, newContent) {
      $('#gifactif_results', gifactif.dropDown).html(newContent ? newContent : '');

      if (!resultsOnly) {
        $('#gifactif_search', gifactif.dropDown).val('');
      }
    }
  };


  // bind keyup event to search input
  $('#gifactif_search', gifactif.dropDown)[0].onkeyup = function(e) {
    var k = e.keyCode;

    // ignore specific key inputs to prevent unnecessary requests
    if (k && (k == 16 || k == 17 || k == 18 || k == 20 || k == 37 || k == 38 || k == 39 || k == 40)) {
      return;
    } else {
      gifactif.search(this.value);
    }
  };

  // initilize gifactif
  $(gifactif.init);
}());

Modifications
If you want to make any modifications to this plugin, please click the spoiler below to reveal the instructions.
Click to view modifications:
1. limit
The limit variable determines the maximum amount of GIFs that are loaded into the search results at a time. By default, 26 GIFs are loaded into the results when you search or scroll to the end of the results. Increment or decrement this value to show more or less results at a time.
Code:
limit : 26, // max image results

2. delay
The delay variable defines a small delay before the search results are submitted to Giphy. This helps reduce the frequency of requests while you're still typing. By default, the delay is 200ms, if you want it to be longer or shorter, simply modify the value of this variable. Wink
Code:
delay : 200, // delay before searches commence (200ms)

3. auto_close
The auto_close variable allows you to choose if the Giphy search drop down closes once you choose an image. By default the drop down closes when you've chosen a GIF. If you want the drop down to remain open after picking a GIF simply change the value of this option to false !
Code:
auto_close : true, // choose if the drop down automatically closes

4. language
If you want to change the general language of this plugin simply find and edit the lang object and dropDown element :
Code:
    // general language settings
    lang : {
      searching : 'Searching...',
      not_found : 'No results found.. <img src="http://illiweb.com/fa/i/smiles/icon_sad.gif" style="margin:0;vertical-align:middle;"/>'
    },

    // dropdown markup
    dropDown : $(
      '<div>'+
        '<input type="text" id="gifactif_search" placeholder="Search for a GIF..." style="width:90%;"/>'+
        '<div id="gifactif_results" onscroll="gifactif.scrolling(this);"><div id="gifactif_images"></div></div>'+
        '<div id="giphy_attribution_mark"></div>'+
      '</div>'
    )[0],
The lang object contains the basic texts, whereas dropDown concerns the structure of search drop down.

5. key
The key variable is for the API key provided by Giphy to everyone -- it's necessary for submitting searches for the vast awesomeness that Giphy offers. You shouldn't need to edit this variable. Thumb right

Once you've installed the script and you're finished making modifications, the Giphy button should now be available in your editor !! Click the button to do searches and exchange some awesome GIFs with everyone ! Party

If you have any comments, questions, or problems, feel free to leave a reply below. Enjoy !




Extra - Display Giphy GIFs like Facebook


Thanks to baivong, you can also install an additional plugin which displays Giphy's GIFs like Facebook ; the GIFs will remain static until you click on them !

Click to view demo

To install this additional plugin, go to Admin Panel > Modules > JavaScript codes management and create a new script with the following settings.

Title : GIFActif Player
Placement : In all the pages
Paste the script below and submit :
Code:
// Demo: https://jsfiddle.net/baivong/a4z0hz63/embedded/result,html,js/

jQuery(function() {
  'use strict';

  // Giphy image in post
  var $giphyImg = $('.postbody, .post-entry').find('img[src*=".giphy.com/media/"][src$="giphy.gif"]');

  if (!$giphyImg.length) return;

  // Add style to player like Facebook
  $('head').append($('<style/>', {
    text: '.gifactif_icon_bg,.gifactif_icon_load,.gifactif_icon_text{background-image:url(//i.imgur.com/VvrpCQJ.png);background-repeat:no-repeat;background-size:auto;left:50%;top:50%;cursor:pointer}.gifactif_wrap{position:relative;display:inline-block}.gifactif_icon_bg{background-position:0 0;height:72px;margin-left:-36px;margin-top:-36px;position:absolute;width:72px}.gifactif_icon_load{background-position:0 -73px;height:66px;margin-left:-33px;margin-top:-33px;position:absolute;width:66px}.rotate-spinner{-webkit-animation:rotateSpinner 2.5s linear infinite;animation:rotateSpinner 2.5s linear infinite}.gifactif_icon_text{background-position:0 -140px;height:17px;margin-left:-16px;margin-top:-9px;position:absolute;width:32px}.gifactif_external{display:block;background:url(//i.imgur.com/1yqUihp.png) repeat-x;bottom:0;color:#fff;font-size:11px;-webkit-font-smoothing:antialiased;font-weight:700;height:56px;left:0;position:absolute;right:0;text-align:left;text-shadow:0 1px 4px rgba(0,0,0,.4);text-transform:uppercase;white-space:nowrap}.gifactif_external_text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;bottom:9px;left:11px;max-width:400px;position:absolute;vertical-align:top;color:#fff}.gifactif_external_icon{width:24px;height:24px;background-image:url(//i.imgur.com/VvrpCQJ.png);background-size:auto;background-repeat:no-repeat;display:inline-block;background-position:0 -158px;bottom:9px;position:absolute;right:10px}.gifactif_player,.gifactif_poster{max-width:100%}.gifactif_cover{display:block}.gifactif_player,.gifactif_video .gifactif_cover{display:none}.gifactif_video .gifactif_player{display:block}@-webkit-keyframes rotateSpinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotateSpinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}'
  }));

  // Replace GIF image to player like Facebook
  $giphyImg.replaceWith(function() {
    var imgUrl = this.src,
      pre = imgUrl.replace(/\.gif$/, '');

    return '<div class="gifactif_wrap" data-pre="' + pre + '" data-id="' + pre.match(/\/media\/([^\/]+)\/giphy/)[1] + '"><img class="gifactif_cover gifactif_poster" src="' + pre + '_s.gif" alt=""><div class="gifactif_cover gifactif_icon"><div class="gifactif_icon_bg"></div><div class="gifactif_icon_load"></div><div class="gifactif_icon_text"></div></div><a class="gifactif_cover gifactif_external" href="' + pre + '_s.gif" target="_blank"><div class="gifactif_external_text">giphy.com</div><i class="gifactif_external_icon"></i></a></div>';
  });

  // Click on player
  $('.gifactif_wrap').on('click', function(e) {
    var $this = $(this),
      $cover = $this.find('.gifactif_cover'),
      $video = $this.find('.gifactif_player'),
      $poster = $this.find('.gifactif_poster'),
      $loader = $this.find('.gifactif_icon_load'),
      pre = $this.data('pre');

    // Skip external url
    if (e.target.className === 'gifactif_cover gifactif_external') return;

    if (e.target.tagName !== 'VIDEO') {
      if (!$video.length) {

        // Generate video player
        $video = $('<video/>', {
          class: 'gifactif_player',
          poster: pre + '_s.gif',
          loop: 'loop',
          muted: 'muted',
          width: $poster.width(),
          height: $poster.height(),
          html: '<source src="' + pre + '.mp4" type="video/mp4"><source src="' + pre + '.webm" type="video/webm">Your browser does not support HTML5 video.'
        });
        $this.append($video);

        // Loading effect
        $loader.addClass('rotate-spinner');

        $video.on('canplay canplaythrough', function() {
          $loader.removeClass('rotate-spinner'); // Disable loading effect

          $this.addClass('gifactif_video'); // Hide image, show video
          $video.trigger('play');
        });

        $video.on('click', function() {
          $this.removeClass('gifactif_video'); // Show image, hide video
          $video.trigger('pause');
        });

        // Get real source url
        $.get('http://api.giphy.com/v1/gifs/' + $this.data('id') + '?api_key=' + (window.gifactif ? window.gifactif.key : 'dc6zaTOxFJmzC')).done(function(res) {
          if (res.meta.status !== 200) return;

          $this.find('.gifactif_external').attr('href', (res.data.source_post_url || res.data.url));
          $this.find('.gifactif_external_text').text(res.data.source_tld || 'giphy.com');
        });

      } else {
        $this.addClass('gifactif_video');
      }

      $video.get(0).currentTime = 0; // Play video from the start
      $video.trigger('play');
    }
  });

});

When you're finished, save the script and the Giphy GIFs should now display like Facebook ! Wink


Notice
Tutorial written by Ange Tuteur.
Special thanks to baivong for the Giphy player and to the Beta Testers for testing this plugin.
Reproduction not permitted without consent from the author.
ahmed salman2
Member
Title :
ahmed
Gender : Unspecified
Posts : 12
Points : 125
Reputation : 1
Language : ar
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile

Postahmed salman2 on Fri 26 Aug 2016, 15:43

thank you 
Valoish
Graphic Designer
Title :
Gender : Female
Age : 20
Posts : 3202
Points : 3828
Reputation : 259
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Opera Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile http://www.canvasforums.com https://twitter.com/https://twitter.com/Valoishx3

PostValoish on Fri 26 Aug 2016, 15:49

By far one of my favorite additions~!

--------

"I was afraid. And my own insecurity crushed him." - Youku x Boku SS
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Fri 26 Aug 2016, 16:15

@ahmed salman2 wrote:
thank you 
You're welcome ! ^^

@Valoish wrote:By far one of my favorite additions~!
Likewise ! Mr. Green I always wanted to make this in the past, but I wasn't as experienced back then. Computer Smash
skouliki

Title :
Gender : Female
Posts : 274
Points : 781
Reputation : 107
Language : english,greek
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB
Awards :
View all awards
View user profile http://iconskouliki.forumgreek.com https://www.facebook.com/iconskouliki https://twitter.com/iconskouliki

Postskouliki on Fri 26 Aug 2016, 16:26

thank you !! added to invision and punbb

--------

Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Fri 26 Aug 2016, 16:45

@skouliki you're welcome ! Angel
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1371
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Fri 26 Aug 2016, 20:31

wow Very Happy
what can i say
i have no words to say how cool and great is that
can i have a small request
is that possible to spilt the Script to
1- A css with the button images like blow
Code:
.sceditor-button-spoiler div {

  background-image:url(s.png);

}
2- the buttons commands like blow
Code:
if ($(element[0]).hasClass('spoiler')) {
                var desc = '';
                if($cite.length === 1 || $elm.data('desc')) {
 desc = $elm.data('desc') || $cite.text() ;

 $elm.data('desc', desc);
 $cite.remove();

 content = this.elementToBbcode($(element));
 desc  = '=' + desc;

 $elm.prepend($cite);
                }

                return '[spoiler' + desc + ']' + content + '[/spoiler]';
            }
/***********************
     * Add Spoiler command *
     ***********************/
    $.sceditor.plugins.bbcode.bbcode.set("spoiler", {
        allowsEmpty: true,
        isInline: false,    
        format: function(element, content) {
            var desc = '',
                $elm = $(element),
                $cite = $elm.children('cite').first();

            if($cite.length === 1 || $elm.data('desc')) {
                desc = $elm.data('desc') || $cite.text() ;

                $elm.data('desc', desc);
                $cite.remove();

                content = this.elementToBbcode($(element));
                desc = '=' + desc;

                $elm.prepend($cite);
            }

            return '[spoiler' + desc + ']' + content + '[/spoiler]';
        },
        html: function (token, attrs, content) {
 var data = '';
            
            if (attrs.defaultattr) {
                content = '<cite>' + attrs.defaultattr + '</cite>' + content;
 data += ' data-desc="' + attrs.defaultattr + '"';
            }
                
            return '<blockquote' + data + ' class="spoiler">' + content + '</blockquote>';
        },
        breakStart: true,
        breakEnd: true
    });
    
    $.sceditor.command.set("spoiler", {
        _dropDown: function (editor, caller, html) {
            var $content;

            $content = $(
                '<div>' +
                    '<label for="des">' + editor._('Description (optional):') + '</label> ' +
                    '<input type="text" id="des" />' +
                '</div>' +
                '<div><input type="button" class="button" value="' + editor._('Insert') + '" /></div>'
            );

            $content.find('.button').click(function (e) {
                var    description = $content.find('#des').val(),
                    descriptionAttr = '',
                    before = '[spoiler]',
                    end = '[/spoiler]';
                
                if (description) {
                   descriptionAttr = '=' + description + '';
                   before = '[spoiler'+ descriptionAttr +']';
                }
                
                if (html) {
                    before = before + html + end;
                    end    = null;
                }
                
                editor.insert(before, end);
                editor.closeDropDown(true);
                e.preventDefault();
            });

            editor.createDropDown(caller, 'insertspoiler', $content);
        },        
        exec: function (caller) {
            $.sceditor.command.get('spoiler')._dropDown(this, caller);
        },
        txtExec: function (caller) {
            $.sceditor.command.get('spoiler')._dropDown(this, caller);
        },
    tooltip: 'Insert a spoiler'
});
3- the ID of each button that will summon the button like blow
Code:
spoiler
so i can add it into my forum
my forum requerd a spared CSS for the Editor style
root/jscripts/sceditor/editor_themes/mybb.css
and the main commands for the JS settings
root/jscripts/bbcodes_sceditor.js
and the ID to add the button in the template codebuttons
this how i can add new buttons in my forum of MyBB versions
_______________________________________________
Edit
____________
i gave it a try but im getting
SyntaxError: function statement requires a name
at line
bbcodes_sceditor.js:827:30
which is
search : function (query) {
what should i do
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sat 27 Aug 2016, 11:50

@Michael_vx hmm.. I'm not quite sure since I've never used myBB, but going by the error it's saying the function doesn't have a name, which it does.

search : function(query) {

search == the name of the function which doesn't make sense... Think

Is that what happens when you just paste the code "as is" ?
IsmaelS.
New Member
Title :
Gender : Unspecified
Age : 21
Posts : 3
Points : 118
Reputation : 6
Language : Portugal
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB
Awards :
View all awards
View user profile

PostIsmaelS. on Sat 27 Aug 2016, 12:02

Thats amazing dude! D:
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sat 27 Aug 2016, 12:43

@IsmaelS. wrote:Thats amazing dude! D:
Thanks ! ^^
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1371
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sat 27 Aug 2016, 17:38

@Ange Tuteur wrote:@Michael_vx hmm.. I'm not quite sure since I've never used myBB, but going by the error it's saying the function doesn't have a name, which it does.

search : function(query) {

search == the name of the function which doesn't make sense... Think

Is that what happens when you just paste the code "as is" ?

MyBB its some kinda of mixing between VB and phpbb or may be im wrong Very Happy
and yeah i took a way the CSS part to the CSS file
which is
Code:
        // add CSS for button image and dropdown
        $('head').append(
          '<style type="text/css">'+
            '.sceditor-button-gifactif div { background-image:url(http://i35.servimg.com/u/f35/18/21/60/73/giphy10.png) !important; }'+
            '.sceditor-button-gifactif:after, .sceditor-button-gifactif:before { content:""; }'+ // Forumactif Edge override
            '#gifactif_results { width:300px; margin:10px auto; min-height:30px; max-height:300px; overflow-x:hidden; overflow-y:auto; }'+
            '.gifactif_imagelist { line-height:0; column-count:2; column-gap:3px; }'+
            '.gifactif_imagelist img { margin-bottom:3px; cursor:pointer; width:100%; }'+
            'html #giphy_attribution_mark { background:url(http://i35.servimg.com/u/f35/18/21/60/73/powere11.png) no-repeat 50% 50% transparent !important; height:22px !important; width:100%; !important; min-width:200px !important; display:block !important; visibility:visible !important; opacity:1 !important; }'+
          '</style>'
        );
      }
 
    },
with out the Java tags
and the rest of the Script in the js file
here what the Editor depends on
http://miccsoft.net/Editor
this rar file content CSS file and JS file
and that template is th used to add the buttons in the Editor
Code:
<link rel="stylesheet" href="{$mybb->asset_url}/jscripts/sceditor/editor_themes/{$theme['editortheme']}" type="text/css" media="all" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.bbcode.min.js?ver=1805"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/bbcodes_sceditor.js?ver=1804"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/editor_plugins/undo.js?ver=1805"></script>
<script type="text/javascript">
var partialmode = {$mybb->settings['partialmode']},
opt_editor = {
   plugins: "bbcode,undo",
   style: "{$mybb->asset_url}/jscripts/sceditor/textarea_styles/jquery.sceditor.{$theme['editortheme']}",
   rtl: {$lang->settings['rtl']},
   locale: "mybblang",
   enablePasteFiltering: true,
   autoUpdate: true,
   emoticonsEnabled: {$emoticons_enabled},
   emoticons: {
      // Emoticons to be included in the dropdown
      dropdown: {
         {$dropdownsmilies}
      },
      // Emoticons to be included in the more section
      more: {
         {$moresmilies}
      },
      // Emoticons that are not shown in the dropdown but will still be converted. Can be used for things like aliases
      hidden: {
         {$hiddensmilies}
      }
   },
   emoticonsCompat: true,
   toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,imgur,spoiler,|{$email}{$link}|video{$emoticon}|{$list}{$code}quote,|maximize,source",
};
{$editor_language}
$(function() {
   $("#{$bind}").sceditor(opt_editor);

   MyBBEditor = $("#{$bind}").sceditor("instance");
   {$sourcemode}
});
</script>
the main part which summon the buttons is
Code:
toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,imgur,spoiler,|{$email}{$link}|video{$emoticon}|{$list}{$code}quote,|maximize,source",
if you can find why this error happen or what parts need to be changed to work
ill be greatfull Smile
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 07:19

@Michael_vx could you replace this part :
Code:
<link rel="stylesheet" href="{$mybb->asset_url}/jscripts/sceditor/editor_themes/{$theme['editortheme']}" type="text/css" media="all" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.bbcode.min.js?ver=1805"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/bbcodes_sceditor.js?ver=1804"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/editor_plugins/undo.js?ver=1805"></script>
<script type="text/javascript">
var partialmode = {$mybb->settings['partialmode']},
opt_editor = {
  plugins: "bbcode,undo",
  style: "{$mybb->asset_url}/jscripts/sceditor/textarea_styles/jquery.sceditor.{$theme['editortheme']}",
  rtl: {$lang->settings['rtl']},
  locale: "mybblang",
  enablePasteFiltering: true,
  autoUpdate: true,
  emoticonsEnabled: {$emoticons_enabled},
  emoticons: {
      // Emoticons to be included in the dropdown
      dropdown: {
        {$dropdownsmilies}
      },
      // Emoticons to be included in the more section
      more: {
        {$moresmilies}
      },
      // Emoticons that are not shown in the dropdown but will still be converted. Can be used for things like aliases
      hidden: {
        {$hiddensmilies}
      }
  },
  emoticonsCompat: true,
  toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,imgur,spoiler,|{$email}{$link}|video{$emoticon}|{$list}{$code}quote,|maximize,source",
};
{$editor_language}
$(function() {
  $("#{$bind}").sceditor(opt_editor);
 
  MyBBEditor = $("#{$bind}").sceditor("instance");
  {$sourcemode}
});
</script>

with this maybe ?
Code:
<link rel="stylesheet" href="{$mybb->asset_url}/jscripts/sceditor/editor_themes/{$theme['editortheme']}" type="text/css" media="all" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.bbcode.min.js?ver=1805"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/bbcodes_sceditor.js?ver=1804"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/editor_plugins/undo.js?ver=1805"></script>
<script type="text/javascript">
var partialmode = {$mybb->settings['partialmode']},
opt_editor = {
  plugins: "bbcode,undo",
  style: "{$mybb->asset_url}/jscripts/sceditor/textarea_styles/jquery.sceditor.{$theme['editortheme']}",
  rtl: {$lang->settings['rtl']},
  locale: "mybblang",
  enablePasteFiltering: true,
  autoUpdate: true,
  emoticonsEnabled: {$emoticons_enabled},
  emoticons: {
      // Emoticons to be included in the dropdown
      dropdown: {
        {$dropdownsmilies}
      },
      // Emoticons to be included in the more section
      more: {
        {$moresmilies}
      },
      // Emoticons that are not shown in the dropdown but will still be converted. Can be used for things like aliases
      hidden: {
        {$hiddensmilies}
      }
  },
  emoticonsCompat: true,
  toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,gifactif,imgur,spoiler,|{$email}{$link}|video{$emoticon}|{$list}{$code}quote,|maximize,source",
};
{$editor_language}

(function() {
  'GIFACTIF - GIPHY PLUGIN FOR THE FORUMACTIF SCEDITOR';
  'REPOSITORY : https://github.com/SethClydesdale/gifactif';
  'SEARCH API BY : https://github.com/Giphy/GiphyAPI';
 
 
  // return if gifactif has been initialized
  if (window.gifactif) {
    if (window.console && console.warn) {
      console.warn('gifactif has already been initialized');
    }
    return;
  }
 
 
  // setup global object
  window.gifactif = {
    key : 'dc6zaTOxFJmzC', // PUBLIC BETA KEY
    limit : 26, // max image results
    delay : 200, // delay before searches commence (200ms)
    auto_close : true,
 
    // general language settings
    lang : {
      searching : 'Searching...',
      not_found : 'No results found.. <img src="http://illiweb.com/fa/i/smiles/icon_sad.gif" style="margin:0;vertical-align:middle;"/>'
    },
 
    // dropdown markup
    dropDown : $(
      '<div>'+
        '<input type="text" id="gifactif_search" placeholder="Search for a GIF..." style="width:90%;"/>'+
        '<div id="gifactif_results" onscroll="gifactif.scrolling(this);"><div id="gifactif_images"></div></div>'+
        '<div id="giphy_attribution_mark"></div>'+
      '</div>'
    )[0],
 
 
    // initial setup of the SCEditor command
    init : function () {
      if ($.sceditor) {
 
        // set the gifactif command
        $.sceditor.command.set('gifactif', {
 
          tooltip : 'Find a GIF',
 
          // Dropdown and general functionality for gifactif
          dropDown : function (editor, caller, callback) {
            gifactif.reset();
            gifactif.editor = editor;
            gifactif.callback = callback;
            editor.createDropDown(caller, 'gifactif', gifactif.dropDown);
 
            $('#gifactif_search', gifactif.dropDown)[0].focus(); // focus the search area
          },
 
 
          // WYSIWYG MODE
          exec : function(caller) {
            var editor = this;
 
            $.sceditor.command.get('gifactif').dropDown(editor, caller, function(gif) {
              editor.insert('[img]' + gif + '[/img]');
            });
          },
 
 
          // SOURCE MODE
          txtExec : function(caller) {
            var editor = this;
 
            $.sceditor.command.get('gifactif').dropDown(editor, caller, function(gif) {
              editor.insertText('[img]' + gif + '[/img]');
            });
          }
 
        });
 
        // add CSS for button image and dropdown
        $('head').append(
          '<style type="text/css">'+
            '.sceditor-button-gifactif div { background-image:url(http://i35.servimg.com/u/f35/18/21/60/73/giphy10.png) !important; }'+
            '.sceditor-button-gifactif:after, .sceditor-button-gifactif:before { content:""; }'+ // Forumactif Edge override
            '#gifactif_results { width:300px; margin:10px auto; min-height:30px; max-height:300px; overflow-x:hidden; overflow-y:auto; }'+
            '.gifactif_imagelist { line-height:0; column-count:2; column-gap:3px; }'+
            '.gifactif_imagelist img { margin-bottom:3px; cursor:pointer; width:100%; }'+
            'html #giphy_attribution_mark { background:url(http://i35.servimg.com/u/f35/18/21/60/73/powere11.png) no-repeat 50% 50% transparent !important; height:22px !important; width:100%; !important; min-width:200px !important; display:block !important; visibility:visible !important; opacity:1 !important; }'+
          '</style>'
        );
      }
 
    },
 
 
    // search for a GIPHY gif
    search : function (query) {
      if (gifactif.timeout) {
        gifactif.abort(); // abort ongoing searches and requests
      }
 
      if (query) {
 
        // set a small timeout in case the user is still typing
        gifactif.timeout = window.setTimeout(function() {
          gifactif.reset(true, gifactif.lang.searching);
          gifactif.query = encodeURIComponent(query);
 
          gifactif.request = $.get('http://api.giphy.com/v1/gifs/search?q=' + gifactif.query + '&limit=' + gifactif.limit + '&rating=pg-13&api_key=' + gifactif.key, function(data) {
            // update global data such as page offsets for scrolling
            gifactif.request = null;
            gifactif.offset = data.pagination.offset + gifactif.limit;
            gifactif.offset_total = data.pagination.total_count;
 
            gifactif.reset(true); // reset HTML content
            gifactif.addGIF(data); // send data to be parsed
          });
 
        }, gifactif.delay);
 
      } else {
        gifactif.reset(true);
      }
    },
 
 
    // abort ongoing searches and requests
    abort : function () {
      if (gifactif.timeout) {
        window.clearInterval(gifactif.timeout);
        gifactif.timeout = null;
      }
 
      if (gifactif.request) {
        gifactif.request.abort();
        gifactif.request = null;
      }
    },
 
 
    // add gifs to the result list
    addGIF : function (data, loadMore) {
      // setup data and begin parsing results
      var gif = data.data,
          i = 0,
          j = gif.length,
          list = $('<div class="gifactif_imagelist" />')[0];
 
      if (j) {
        for (; i < j; i++) {
          list.appendChild($('<img id="' + gif[i].id + '" src="' + gif[i].images.fixed_width.url + '" />').click(gifactif.insert)[0]);
        }
      } else if (!loadMore) {
        gifactif.reset(true, gifactif.lang.not_found);
      }
 
      // add results to the result list
      $('#gifactif_results', gifactif.dropDown).append(list);
    },
 
 
    // listen to the scrolling so we can add more gifs when the user reaches the bottom
    scrolling : function (that) {
      if (that.scrollHeight - that.scrollTop === that.clientHeight) {
        gifactif.loadMore();
      }
    },
 
 
    // load more results once the user has scrolled through the last results
    loadMore : function () {
      if (gifactif.offset < gifactif.offset_total) {
        gifactif.request = $.get('http://api.giphy.com/v1/gifs/search?q=' + gifactif.query + '&offset=' + gifactif.offset + '&limit=' + gifactif.limit + '&rating=pg-13&api_key=' + gifactif.key, function(data) {
          gifactif.request = null;
          gifactif.offset = data.pagination.offset + gifactif.limit;
          gifactif.offset_total = data.pagination.total_count;
 
          gifactif.addGIF(data, true); // send data to be parsed
        });
      }
    },
 
 
    // inserts the gif into the editor
    insert : function () {
      // add the gif to the editor and close the dropdown
      gifactif.callback('http://media0.giphy.com/media/' + this.id + '/giphy.gif');
 
      if (gifactif.auto_close) {
        gifactif.editor.closeDropDown(true);
        gifactif.reset();
      }
    },
 
 
    // reset the dropdown fields
    reset : function (resultsOnly, newContent) {
      $('#gifactif_results', gifactif.dropDown).html(newContent ? newContent : '');
 
      if (!resultsOnly) {
        $('#gifactif_search', gifactif.dropDown).val('');
      }
    }
  };
 
 
  // bind keyup event to search input
  $('#gifactif_search', gifactif.dropDown)[0].onkeyup = function(e) {
    var k = e.keyCode;
 
    // ignore specific key inputs to prevent unnecessary requests
    if (k && (k == 16 || k == 17 || k == 18 || k == 20 || k == 37 || k == 38 || k == 39 || k == 40)) {
      return;
    } else {
      gifactif.search(this.value);
    }
  };
 
  // initilize gifactif
  $(gifactif.init);
}());

$(function() {
  $("#{$bind}").sceditor(opt_editor);
 
  MyBBEditor = $("#{$bind}").sceditor("instance");
  {$sourcemode}
});
</script>
zizou2012
New Member
Title :
Gender : Male
Posts : 3
Points : 107
Reputation : 2
Location : algeria
Language : arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile

Postzizou2012 on Sun 28 Aug 2016, 09:37

you are great ange tuteur
trying it on phpbb2
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1371
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sun 28 Aug 2016, 14:17

oh my god
that did it my friend
its working 100%
affraid
i dont know how to thank you

tell me how did you do it so i might try on this
http://help.forumotion.com/t148168-script-reformat-is-needed
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 14:22

@Michael_vx you're welcome. Wink

I added the script before :
Code:
$(function() {
  $("#{$bind}").sceditor(opt_editor);
 
  MyBBEditor = $("#{$bind}").sceditor("instance");
  {$sourcemode}
});

removed
Code:
&& window.toolbar
from
Code:
if ($.sceditor && window.toolbar) {
.

Removed this part :
Code:
        // add gifactif to the editor toolbar
        toolbar = toolbar.replace('image,', 'image,gifactif,');

and added the button name to your toolbar :
Code:
toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,gifactif,imgur,spoiler,|{$email}{$link}|video{$emoticon}|{$list}{$code}quote,|maximize,source",
( see "gifactif" )
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1371
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sun 28 Aug 2016, 15:04

the other Script seems to be massed up
i cant find any thing like that
but i tried to use it in the template direct
some of buttons showed up but when i use any of them it say
Code:
TypeError: $(...).sceditor(...).insert is not a function
<anonymous>
newthread.php:904
m.event.dispatch()
jquery.js:4
m.event.add/r.handle()
jquery.js:4
newthread.php:904:15
im gonna give it a try in other time
oh by the way
Extra - Display Giphy GIFs like Facebook
failed to change it
my forum using the tag .post_body not .postbody and i think .post tag
but im getting this error
SyntaxError: missing variable name
which is
var = $('.post_body, .post-entry').find('img[src*=".giphy.com/media/"][src$="giphy.gif"]');
any tips or suggest
its not that important
its only for show nothing more Smile
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 15:34

@Michael_vx for the extra plugin you're missing the variable name : $giphyImg
Code:
var $giphyImg = $('.post_body, .post-entry').find('img[src*=".giphy.com/media/"][src$="giphy.gif"]');
I added it above. Wink

$(...).sceditor(...) might be referring to the element being null. What's the id for the text editor on your forum ? #text_editor_textarea is the id of the textarea on Forumotion.
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1371
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sun 28 Aug 2016, 15:52

reflect
that is odd lol
SyntaxError: missing variable name
var = $('.post_body, .post-entry').find('img[src*=".giphy.com/media/"][src$="giphy.gif"]');
SyntaxError: missing variable name
var = $('.post_body, .post-entry').find('img[src*=".giphy.com/media/"][src$="giphy.gif"]');
and that making my head smoke cuz i cant find any of that lines only the line you changed
oh the Editor ID im not sure yet
textarea
or
message
im still looking on this to be sure about it
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 15:54

Hmm.. perhaps it's stripping out words with a "$" sign ? Try replacing $giphyImg with giphyImg.
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1371
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sun 28 Aug 2016, 17:05

LOL
no matter what changes i made the line in the console still the same
i have even removed the part
Code:
          var giphyImg. = $('.post_body, .post-entry').find('img[src*=".giphy.com/media/"][src$="giphy.gif"]');
       
          if (!giphyImg.length) return;
never mind Zen
its not a big deal
i can live with out it
i think its better to keep moving after better Scripts and plugins
ill be waiting more Scripts by you
Master of Scripts @Ange Tuteur
thank you for every thing you made
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 17:10

@Michael_vx does it work if you replace it with this ?
Code:
Select Content
          var giphyImg = $('.post_body, .post-entry').find('img[src*=".giphy.com/media/"][src$="giphy.gif"]');
     
          if (!giphyImg.length) return;

No problem, I'll have more stuff coming soon. Wink

P.S.
Can get a sneak peek via my twitter or by joining the beta testers.
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1371
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sun 28 Aug 2016, 18:26

Embarassed
now you will say @Michael_vx is Epic stupid
Embarassed
before i get dinner
i was trying to make the last changes you told me
but i pasted the Script 2 times with out know that
right now i made the changes and the error changed to
SyntaxError: expected expression, got '.'
the line
.replaceWith(function() {
Embarassed
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 18:36

Everyone makes mistakes. Razz

About that error, this is what it originally looks like :
Code:
  $giphyImg.replaceWith(function() {
    var imgUrl = this.src,
      pre = imgUrl.replace(/\.gif$/, '');
 
    return '<div class="gifactif_wrap" data-pre="' + pre + '" data-id="' + pre.match(/\/media\/([^\/]+)\/giphy/)[1] + '"><img class="gifactif_cover gifactif_poster" src="' + pre + '_s.gif" alt=""><div class="gifactif_cover gifactif_icon"><div class="gifactif_icon_bg"></div><div class="gifactif_icon_load"></div><div class="gifactif_icon_text"></div></div><a class="gifactif_cover gifactif_external" href="' + pre + '_s.gif" target="_blank"><div class="gifactif_external_text">giphy.com</div><i class="gifactif_external_icon"></i></a></div>';
  });

Try removing the dollar sign again, so you get this :
Code:
  giphyImg.replaceWith(function() {
    var imgUrl = this.src,
      pre = imgUrl.replace(/\.gif$/, '');
 
    return '<div class="gifactif_wrap" data-pre="' + pre + '" data-id="' + pre.match(/\/media\/([^\/]+)\/giphy/)[1] + '"><img class="gifactif_cover gifactif_poster" src="' + pre + '_s.gif" alt=""><div class="gifactif_cover gifactif_icon"><div class="gifactif_icon_bg"></div><div class="gifactif_icon_load"></div><div class="gifactif_icon_text"></div></div><a class="gifactif_cover gifactif_external" href="' + pre + '_s.gif" target="_blank"><div class="gifactif_external_text">giphy.com</div><i class="gifactif_external_icon"></i></a></div>';
  });
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1371
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sun 28 Aug 2016, 20:12

reflect
SyntaxError: missing variable name
var = (this),
remove $ from Script done i removed all $`s
i wonder how many SyntaxError will keep hits me
reflect
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8393
Reputation : 2009
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 20:23

The $ before (this) should be fine, because it's shorthand for "jQuery". The variable name is missing though, which means it contains another dollar sign.

Page 1 of 3 1, 2, 3  Next

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum