FANDOM


  • Hi, it's me again :P, hope I'm not bothering you, but I was wondering if you could help me with 2 things to do with LinkPreview - the max text length and disable hover previews on Tab view.

    I have no experience with JavaScript whatsoever, so I took a look at the ru borderlands common.js and copied this code into my personal common.js page and tried to add tlen: 500, and iparents : ['.tabs [data-tab^=flytabs]'],

    window.pPreview = $.extend(true, window.pPreview, {
        defimage: 'https://vignette.wikia.nocookie.net/borderlands/images/0/05/Ajax.gif/revision/latest?cb=20170626182120&path-prefix=ru',
        noimage: 'https://vignette.wikia.nocookie.net/borderlands/images/f/f5/%D0%97%D0%B0%D0%B3%D0%BB%D1%83%D1%88%D0%BA%D0%B0.png/revision/latest/scale-to-width-down/350?cb=20160122074659&path-prefix=ru',
        tlen: 500,
        RegExp: {
            iimages: [new RegExp('^([Ff]ile:|[Фф]айл:)?Indef\\.png$')],
            ipages: [new RegExp('.*?Дерево[_ ]навыков.*')],
            ilinks: [new RegExp('.*?Дерево[_ ]навыков.*')],
            iparents : ['.tabs [data-tab^=flytabs]'],
        },
    });
    

    I assume I must have got the code completely wrong because I haven't noticed any changes at all. I would be grateful for any help. Thank you.

      Loading editor
    • to change max tet length, u need tlen: 500 only.
      window.pPreview = $.extend(true, window.pPreview, {
          tlen: 500,
      });
      by default, script will ognore links in the header only ('.tabs [data-tab^=flytabs]' selector). if u want to completely disable preview in the tabview, then u need 'id^=flytabs' selector:

      window.pPreview = $.extend(true, window.pPreview, {

         tlen: 500,
         RegExp: {
             iparents : ['[id^=flytabs]'],
         },
      
      });
        Loading editor
    • Thanks for the reply, I've copied that exact code into my personal js

      window.pPreview = $.extend(true, window.pPreview, {
         tlen: 500,
         RegExp: {
             iparents : ['[id^=flytabs]'],
         },
      });
      

      I don't notice any changes for me personally though. The max text length appears to be 1000 still, and hovering over Tab view will still show a preview.

        Loading editor
    • An update:

      I may have found the issue, on my own wiki I've been importing LinkPreviews through MediaWiki:ImportJS

      I tested importing the script on my personal js on another wiki through

      
      Update 2: Importing through PersonalJs doesn't really work on my own wiki for some reason, but it works fine on [[w:c:candycrush]]
      importArticles({
          type: 'script',
          articles: [
              'u:dev:MediaWiki:LinkPreview/code.js',
          ]
      });
      <pre>
      I think the changes appear to be taking place, so maybe ImportJS can't customize JavaScript
      importArticles({
          type: 'script',
          articles: [
              'u:dev:MediaWiki:LinkPreview/code.js',
          ]
      });
      

      I think the changes appear to be taking place, so maybe ImportJS can't customize JavaScript

      Update 2: importing article through personal js and adding the settings doesn't really work on my own wiki for some reason, but it works fine on Candy Crush. Very strange

        Loading editor
    • use importjs whenever it possible. there is no any problems with settings using importjs. i'll investigate the problem.

        Loading editor
    • I went back to importing it through ImportJS instead, I think the settings may finally be working now! I'll test it for a bit to see if it's working well, hopefully no more problems (although I think my own wiki may have problems as quite often pages don't load properly first time and can require several refreshes before displaying properly). Thank you!

        Loading editor
    • Hi, I hope you don't mind me reviving this thread, but I've noticed you have added a new setting for the LinkPreview script: RegExp.onlyinclude.

      Could you please provide an example of what a selector is and how certain content can be included/omitted? I have no JavaScript knowledge at all.

      Edit: Ok so I know what a CSS selector is actually, I can make a div class to put content in I guess, just not sure how to apply it to the JavaScript.

        Loading editor
    • some examples added.

        Loading editor
    • Hey, thanks for all the examples you've provided for all the settings! The onlyinclude works great! :)

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.