The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
4 posters

    i need a modfication in this js script

    alla13
    alla13
    Forumember


    Posts : 91
    Reputation : 6
    Language : Arab5/5 Eng3/5 Fr2/5

    Solved i need a modfication in this js script

    Post by alla13 Thu 17 May - 17:22

    Technical Details

    Forum version : #phpBB3
    Position : Founder
    Concerned browser(s) : Mozilla Firefox, Google Chrome, Internet Explorer, Opera, Safari, Other
    Who the problem concerns : All members
    Forum link : http://alla-omar.mo-rpg.com

    Description of problem


    i need a modfication in this js script 9pAkXu6

    i want it to do the same act but with window to insert the img url

    i need a modfication in this js script QjhwKt9
    the code
    Code:
    $(function() {
     Â if ($.sceditor) {
     Â   $.sceditor.command.set('tbl', {
     
     Â     exec : function() {
     Â       this.insert('[tbl=',']');
     Â     },
     
     Â     txtExec : function() {
     Â       this.insert('[tbl=',']');
     Â     },
     
     Â     tooltip : 'ŰźÙ„ÙÙŠŰ© Ű§Ù„Ù…ÙˆŰ¶ÙˆŰč'
     
     Â   });
     
     Â   toolbar += ',tbl';
     Â }
     
     Â for (var a = $('.post .content'), i = 0, j = a.length; i < j; i++) {
     Â   if (/\[tbl=.*?\]/i.test(a[i].innerHTML)) {
     Â     a[i].innerHTML = a[i].innerHTML.replace(/\[tbl=(.*?)\]/i, function(M, $1) {
     Â       a[i].style.backgroundImage = 'url(' + $1 + ')';
     Â       return '';
     Â     });
     Â   }
     Â }
    });


    Last edited by alla13 on Sun 20 May - 14:59; edited 1 time in total
    alla13
    alla13
    Forumember


    Posts : 91
    Reputation : 6
    Language : Arab5/5 Eng3/5 Fr2/5

    Solved Re: i need a modfication in this js script

    Post by alla13 Fri 18 May - 16:30

    up
    SarkZKalie
    SarkZKalie
    Support Moderator
    Support Moderator


    Male Posts : 1443
    Reputation : 220
    Language : English

    Solved Re: i need a modfication in this js script

    Post by SarkZKalie Fri 18 May - 17:41

    Can you explain your issue in more detail here? And where did you get this script?



    i need a modfication in this js script Sarkzk10
    alla13
    alla13
    Forumember


    Posts : 91
    Reputation : 6
    Language : Arab5/5 Eng3/5 Fr2/5

    Solved Re: i need a modfication in this js script

    Post by alla13 Fri 18 May - 18:42

    SarkZKalie wrote:Can you explain your issue in more detail here? And where did you get this script?

    there is no issue i just want a modification in the script

    the script was made here in the help forum by ange the job of it is to make a background to the topic by the choice of the member

    https://help.forumotion.com/t144461-help-me-with-this-java-scripte#987269

    so instead of writing the url of the image and then click on the button 


    i want a window to show and pste the url of the img in it
    alla13
    alla13
    Forumember


    Posts : 91
    Reputation : 6
    Language : Arab5/5 Eng3/5 Fr2/5

    Solved Re: i need a modfication in this js script

    Post by alla13 Sat 19 May - 17:46

    up
    tikky
    tikky
    Forumember


    Posts : 922
    Reputation : 160
    Language : 🇵🇹

    Solved Re: i need a modfication in this js script

    Post by tikky Sun 20 May - 13:14

    Hey @alla13,
    you can adapte this code: [AddOn] Criar botĂŁo no editor com lista de comandos by @Daemon.

    Change your code to:
    Code:
    $(function() {
      if (!$.sceditor) return;
     
      $.sceditor.command.set('cmd', {
     
      dropDown : function(editor, caller, callback) {
     
        var content = $(
        '<div>' +
        '  <div>' +
        '    <label>URL</label>' +
        '    <input type="text" placeholder="bg image" id="cmdValue" value="" />' +
        '  </div>' +
        '  <div>' +
        '    <input type="button" class="button" value="ok!">' +
        '  </div>' +
        '</div>'
        );
                content.find('.button').click(function(e) {
                    callback(content.find('select').val());
                    editor.closeDropDown(true);
                });
                editor.createDropDown(caller, "cmd", content);
      },
      // WYSIWYG MODE
      exec : function(caller) {
      var editor = this;
          $.sceditor.command.get('cmd').dropDown(editor, caller, function(cmd) {
            var before = '[tbl]', title = $('#cmdValue').val();
            if(title !== '') {
              before = '[tbl=' + title + ']';
                editor.wysiwygEditorInsertHtml(before);
            }
          });
      },
      // SOURCE MODE
      txtExec : function(caller) {
      var editor = this;
          $.sceditor.command.get('cmd').dropDown(editor, caller, function(cmd) {
            var title = $('#cmdValue').val();
            if(title) {
                editor.insertText('[tbl=' + title + ']');
            } else {
                editor.insertText('[tbl=' + title + ']');
            }
          });
      }, tooltip: "ŰźÙ„ÙÙŠŰ© Ű§Ù„Ù…ÙˆŰ¶ÙˆŰč"});
     
        for (var a = $('.post .content'), i = 0, j = a.length; i < j; i++) {
        if (/\[tbl=.*?\]/i.test(a[i].innerHTML)) {
          a[i].innerHTML = a[i].innerHTML.replace(/\[tbl=(.*?)\]/i, function(M, $1) {
            a[i].style.backgroundImage = 'url(' + $1 + ')';
            return '';
          });
        }
      }
     
      toolbar = toolbar.replace(/image/,'cmd,image');
     
      $('head').append(
      '<style type="text/css">' +
      '.sceditor-button-cmd div {' +
      '  background:url(https://cdn2.iconfinder.com/data/icons/circle-icons-1/64/image-16.png) !important}' +
      '  .sceditor-cmd {' +
      '  width:auto;' +
      '  height:auto;' +
      '  overflow-y:auto;' +
      '}' +
      '.sceditor-cmd select {' +
      '  margin: 0 0 .75em;' +
      '}' +
      '</style>'
      );
    });


    best regards,
    Humor
    alla13
    alla13
    Forumember


    Posts : 91
    Reputation : 6
    Language : Arab5/5 Eng3/5 Fr2/5

    Solved Re: i need a modfication in this js script

    Post by alla13 Sun 20 May - 14:56

    thank you @pedxz
    the code is working
    topic solved
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3524
    Language : English
    Location : United States

    Solved Re: i need a modfication in this js script

    Post by SLGray Sun 20 May - 19:27

    Problem solved & topic archived.
    Please read our forum rules:  ESF General Rules



    i need a modfication in this js script Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.

      Current date/time is Wed 13 Nov - 17:43