Back To Top
Login
Register
Visit Us At TwitterVisit Us At YouTubeVisit Us At Facebook
KandiChat is in Beta Release. Try It Out
HomeHome  
  • UpdatesUpdates  
  • SearchSearch  
  • RegisterRegister  
  • Log inLog in  
  • November 2017
    MonTueWedThuFriSatSun
      12345
    6789101112
    13141516171819
    20212223242526
    27282930   

    Calendar Calendar

    Search
     
     

    Display results as :
     


    Rechercher Advanced Search

    Shopmotion


    Who is online?
    In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest

    None

    Most users ever online was 22 on June 26th 2013, 6:10 am
    RSS feeds


    Poll
    Top posting users this week


    View previous topic View next topic Go down  Message [Page 1 of 1]

    avatar

    The Doc Uploader on the New Editor!

    Mr.EasyBB
    06/12/2013
    Ok guys, so to add that awesome doc uploader from FilePicker.io we have a new code for you. It's easier and we are not instantiating the init sceditor twice now! 

    Easy, just create a new JavaScript file, then add this code

    Code:
    $(function() {
    var ifit = $('#text_editor_textarea');
    if(ifit.length){
      $.sceditor.command.set("servimg", {
        exec: function(caller) {
          var editor = this,
              data = $('#text_editor_textarea').data('sceditor'),
              source = data.inSourceMode();
          if(!editor.initalised) {
            filepicker.setKey('API KEY');
            filepicker.pick({
              mimetypes: ['application/msword','text/*','image/*'],
              services:['COMPUTER','GOOGLE_DRIVE','DROPBOX','FACEBOOK','PICASA','FLICKR','WEBCAM','URL','INSTAGRAM','IMAGE_SEARCH']
            }, function(FPFile) {
              var docFile = FPFile.url,
                  type= FPFile.mimetype;
              if(/^.*text.*$/.test(type)) { data.insert('[url]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/url]');
                                          }
              else if(/^.*image.*$/.test(type)) { data.insert('[img]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/img]');
                                                }
             });
            }
          }
        });
    }
      });









    Save it and you should be done.
    Share this post on: Excite BookmarksDiggRedditDel.icio.usGoogleLiveSlashdotNetscapeTechnoratiStumbleUponNewsvineFurlYahooSmarking

    avatar
    This doesn't seem to work for me here is the code I am using. It should work I can't see any errors with it.

    Code:
    $(document).ready(function() {
    $.sceditor.command.set("filepicker", {
      exec: function() {
    var editor = this;
    filepicker.setKey('MY API KEY');
      filepicker.pick({mimetypes: ['application/msword','text/*','image/*'],
                      services:['COMPUTER','GOOGLE_DRIVE','DROPBOX','FACEBOOK','PICASA','FLICKR','WEBCAM','URL','INSTAGRAM','IMAGE_SEARCH']
                      },function(FPFile) {
                        var docFile = FPFile.url,
                        textArea = $('#toolbar textarea'),
                        type= FPFile.mimetype;
    if(/^.*text.*$/.test(type)) {

    editor.insert('[url]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/url]');

    } else if(/^.*image.*$/.test(type)) {

    editor.insert('[img]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/img]');
    }
    });
      },
      tooltip: "Upload File"
    });

    WHat did I do wrong here?

    Post on June 13th 2013, 10:27 pm by Puppycheese889

    avatar
    Well that alone won't work because you didn't add it I have one that you don't need the entire template. You should really read the entire tutorial.


    This will replace the servimg button

    Code:
    $.sceditor.command.set("servimg", {
      exec: function(caller) {
    var editor = this,
     data = $('#text_editor_textarea').data('sceditor'),
     source = data.inSourceMode();
    if(!editor.initalised)
    {
    filepicker.setKey('AQIrUGd1FTuSBxvGURzGlz');
      filepicker.pick({mimetypes: ['text/*','image/*'],
                      services:['COMPUTER','FACEBOOK']
                      },function(FPFile) {
                        var docFile = FPFile.url,
                        type= FPFile.mimetype;
    if(/^.*text.*$/.test(type)) {
    data.insert('[url]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/url]');
    } else if(/^.*image.*$/.test(type)) {
    data.insert('[img]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/img]');
    }
    });
    }
      },
      tooltip: "Upload File"
    });

    Post on June 13th 2013, 11:39 pm by Mr.EasyBB

    avatar
    Ok what am i missing this time? It's not working still! This doesn't require the template correct? 



    Code:
    $.sceditor.command.set("servimg", {
    exec: function(caller) {
    var editor = this,
    data = $('#text_editor_textarea').data('sceditor'),
    source = data.inSourceMode();
    if(!editor.initalised)
    {
    filepicker.setKey('AJvmKUvCHRdOJVGEf4JSuz');
    filepicker.pick({mimetypes: ['application/msword','text/*','image/*'],
    services:['COMPUTER','GOOGLE_DRIVE','DROPBOX','FACEBOOK','PICASA','FLICKR','WEBCAM','URL','INSTAGRAM','IMAGE_SEARCH']
    },function(FPFile) {
    var docFile = FPFile.url,
    type= FPFile.mimetype;
    if(/^.*text.*$/.test(type)) {
    data.insert('[url=+FPFile.url+'+'+FPFile.filename.replace(/s/g,"")+]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/url]');
    } else if(/^.*image.*$/.test(type)) {
    data.insert('[img]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,[/img]');
    }
    });
    }
    },
    tooltip: "Upload File"
    });

    Post on June 13th 2013, 11:56 pm by Puppycheese889

    avatar
    Did you wrap that in a function???

    EX:
    Code:
    $(function() {
    //code
    });

    Post on June 13th 2013, 11:57 pm by Mr.EasyBB

    avatar
    no but I just did that and it's not working for me... the toolbar disappears when I add the function part.

    Code:
    $(function() {
    $.sceditor.command.set("servimg", {
    exec: function(caller) {
    var editor = this,
    data = $('#text_editor_textarea').data('sceditor'),
    source = data.inSourceMode();
    if(!editor.initalised)
    {
    filepicker.setKey('AJvmKUvCHRdOJVGEf4JSuz');
    filepicker.pick({mimetypes: ['application/msword','text/*','image/*'],
    services:['COMPUTER','GOOGLE_DRIVE','DROPBOX','FACEBOOK','PICASA','FLICKR','WEBCAM','URL','INSTAGRAM','IMAGE_SEARCH']
    },function(FPFile) {
    var docFile = FPFile.url,
    type= FPFile.mimetype;
    if(/^.*text.*$/.test(type)) {
    data.insert('[url]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/url]');
    } else if(/^.*image.*$/.test(type)) {
    data.insert('[img]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/img]');
    }
    });
    }
    },
    tooltip: "Upload File"
    });
    });

    Post on June 14th 2013, 12:02 am by Puppycheese889

    avatar
    I'd definitely consider myself a noob when it comes to this stuff, so sorry if this is a stupid question. I read the original tutorial, got my API Key, put it in the code you provided in this post, but when I click on the Host an Image button, it still brings up ServImg. Is there anything that needs to be done in addition to adding the code you posted to a javascript page and checking the "In the Topics" button?

    PS: Thanks for putting these tutorials together. They add a lot to our forums!

    Post on June 18th 2013, 10:06 pm by bob77707

    avatar
    Liked
    Bob

    Code:
    Code: Select Code
    $.sceditor.command.set("servimg", {
    exec: function(caller) {
    var editor = this,
    data = $('#text_editor_textarea').data('sceditor'),
    source = data.inSourceMode();
    if(!editor.initalised)
    {
    filepicker.setKey('API KEY');
    filepicker.pick({mimetypes: ['text/*','image/*'],
    services:['COMPUTER','FACEBOOK']
    },function(FPFile) {
    var docFile = FPFile.url,
    type= FPFile.mimetype;
    if(/^.*text.*$/.test(type)) {
    data.insert('[url]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/url]');
    } else if(/^.*image.*$/.test(type)) {
    data.insert('[img]'+FPFile.url+'+'+FPFile.filename.replace(/\s/g,"")+'[/img]');
    }
    });
    }
    },
    tooltip: "Upload File"
    });

    That should work for you, also please read the Dawn of an Era. We are shutting down, we will be moving to AvacWeb, I've already started transferring the tutorials over there just cleaning them up. Support will be provided by myself and other staff.

    Thank you

    Post on June 18th 2013, 11:05 pm by Mr.EasyBB

    avatar
    Thanks for the quick response.

    I read the Dawn of an Era. That's awesome that you guys are teaming up!

    I tried the code you gave me. I wrapped it in a function. The only part that obviously went through was the tooltip. When I hover over the button it successfully changed from saying "Host an Image" to "Upload File." This only happened when I ticked "All pages".

    I still get ServImg when I click on the button, though. Any other thoughts on what I am doing wrong?

    Post on June 19th 2013, 12:33 am by bob77707

    avatar
    A couple of after thoughts if they help. On my error console, it says that $.sceditor is undefined. Also I am using phpbb2. Looking at the code, it doesn't look like that would make a difference, but again, I'm a noob, so I am not sure.

    Post on June 19th 2013, 5:29 pm by bob77707

    Post  by Sponsored content

    View previous topic View next topic Back to top  Message [Page 1 of 1]