Tìm thấy 6 mục

[Code] bbcode phân trang trong bài viết

bbcode phân trang trong bài viết


Mẹo này có thể hoạt động thêm một nút để trình biên tập mà chèn một thẻ [đầu trang] để tạo ra một số trang trong một tin nhắn:

Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  NLbRbr5

Css

Code:

.postpagination span {
    float: left;
    display: inline;
    margin-left: 4px;
    padding: 0 8px;
    height: 26px;
    border: 1px solid;
    border-color: #C2D5E3;
    background-color: #FFF;
    background-repeat: no-repeat;
    color: #333;
    overflow: hidden;
    text-decoration: none;
    margin: 0 4px 0 0;
    line-height: 26px;
    cursor: pointer;
    font-weight: normal;
}
.postpagination span:hover {
    border-color: #369;
    color: #369;
}
.postpagination span.pp_current {
    background-color: #E5EDF2;
    border-color: #C2D5E3;
    color: #333;
    font-weight: bold;
}
.postpagination {
    display: block;
    font: 12px/1.5 Tahoma,Helvetica,'SimSun',sans-serif;
}
.postpagination:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
div.postpagination { margin: 10px 0 }
span.postpagination span {
    float: none;
    padding: 0 4px;
    font-size: 0.8em;
    margin: 0 2px 0 0;
}
.postpagination span.pp_next {
    padding-right: 25px;
    background-image: url(http://i.imgur.com/2C4dvL5.gif);
    background-position: 90% 50%;
}
span.postpagination span.pp_next {
    padding-right: 12px;
    background-position: 90% 50%;
}


Jquery

Code:

$(function() {
  var x= "selecteur_suivant_version";
  if($("#text_editor_textarea").length && $.sceditor) {
    $(function() {
      if(!$("#text_editor_textarea").sceditor("instance")) {
        return
      }
      $('<a class="sceditor-button" unselectable="on" title="Page"><div unselectable="on" style="background:url(http://i.imgur.com/a3RgTJc.gif);opacity:1">Page</div></a>').insertAfter(".sceditor-button-fahide").click(function(e) {
        $("#text_editor_textarea").sceditor("instance").insertText("[page]")
      })
    })
  }
  var c, y, g = function(a) {
    var b;
    a = document.createElement(a);
    b = "getComputedStyle" in window;
    document.body.appendChild(a);
    b = (b ? window.getComputedStyle(a, "") : a.currentStyle).display;
    document.body.removeChild(a);
    return b
  }, t = function(o) {
    if(o.tagName == "CODE") {
      return
    }
    if(!o.hasChildNodes()) {
      return
    }
    var a = 0;
    var p = [0];
    var i;
    for(i = 0;i < o.childNodes.length;i++) {
      c = o.childNodes[i];
      if(c.nodeType == 1) {
        p.push(c);
        t(c)
      }else {
        if(c.nodeType == 3 && c.nodeValue.indexOf("[page]") != -1) {
          while((y = c.nodeValue.indexOf("[page]")) != -1) {
            if(y != 0) {
              p.push(document.createTextNode(c.nodeValue.substr(0, y)))
            }
            p.push(0);
            a++;
            c.nodeValue = c.nodeValue.substr(y + 6)
          }
          p.push(c)
        }else {
          p.push(c)
        }
      }
    }
    if(a == 0) {
      return
    }
    var b = g(o.tagName) == "block";
    for(i = 0;i < p.length;i++) {
      if(p[i] === 0) {
        y = document.createElement(b ? "DIV" : "SPAN");
        y.className = "postpage";
        o.appendChild(y)
      }else {
        y.appendChild(p[i])
      }
    }
    $("> .postpage", o).not(":first").hide();
    y = document.createElement(b ? "DIV" : "SPAN");
    y.className = "postpagination";
    $(y).append('<span class="pp_current">1</span><span>2</span>');
    if(a > 1) {
      $(y).append("<span>... " + (a + 1) + "</span>")
    }
    if(b) {
      $(y).append('<span class="pp_next">Suivant</span><span class="pp_all">Voir tout</span>')
    }else {
      $(y).append('<span class="pp_next"></span>')
    }
    o.appendChild(y);
    $(y).on("click", "span", function() {
      if($(this).hasClass("pp_all")) {
        $(this).parent().parent().children().show();
        $(this).parent().remove();
        return
      }
      var pagin = $(this).parent();
      var num = parseInt($(".pp_next", pagin).prev().text().replace(/ ?\.\.\. ?/, ""));
      var cur = parseInt($(".pp_current", pagin).text().replace(/ ?\.\.\. ?/, ""));
      if($(this).hasClass("pp_next")) {
        cur += 1
      }else {
        cur = parseInt($(this).text().replace(/ ?\.\.\. ?/, ""))
      }
      if(cur < 1) {
        cur = 1
      }else {
        if(cur > num) {
          cur = num
        }
      }
      $(".pp_next", pagin).prevUntil().remove();
      if(cur < num - 1) {
        $(pagin).prepend("<span>... " + num + "</span>")
      }else {
        if(cur == num) {
          $(pagin).prepend('<span class="pp_current">' + num + "</span>")
        }
      }
      if(cur < num) {
        $(".pp_next", pagin).show();
        $(pagin).prepend('<span class="pp_current">' + cur + "</span><span>" + (cur + 1) + "</span>")
      }else {
        $(".pp_next", pagin).hide()
      }
      if(cur > 1) {
        $(pagin).prepend("<span>" + (cur - 1) + "</span>");
        if(cur > 2) {
          $(pagin).prepend("<span>1 ...</span>")
        }
      }
      $(".postpage", $(pagin).parent()).hide();
      $(".postpage", $(pagin).parent()).eq(cur - 1).show()
    })
  };
  $(x).each(function() {
    t(this)
  })
});


Tùy thuộc vào phiên bản của bạn, thay thế mã selecteur_suivant_version

pour phpbb3 :

Code:

div.postbody .content



pour phpbb2 :

Code:

div.postbody



pour invision :

Code:

div.postbody div.post-entry



pour punbb :

Code:

div.post-entry .entry-content > div



Nguồn :

Code:

http://forum.forumactif.com/t355762-pagination-dans-un-message?highlight=pagination

Tags: #code #forumotion #bbcode

[Code] bbcode thông báo notification hide forumotion

bbcode thông báo notification hide


Cũng ko biết diễn tả sao cũng như bbcode hide ngày trước thôi. nhưng làm trên sceditor

Nút hide mặc định ko có thông báo notification khiến member ko biết được là bài đó bị ẩn / thay việc thêm thủ công thì mình cho vào nút bbcode thì khi nào click nút hide là dc thêm dòng (You need to reply to see the hidden content)

Acp >> modules >>HTML & JAVASCRIPT >> Add a Javascript Code > Click all


jquery bbcode notification hide text


Code:

$(function(){
    $(function(){
          $('<a class="sceditor-button sceditor-button-fahide-hotrofm" unselectable="on"><div unselectable="on">Hide</div></a>').insertAfter('.sceditor-button-fahide').click(function(){
              $('#text_editor_textarea').sceditor("instance").insertText("(You need to reply to see the hidden content)[hide]","[/hide]");
          });
      });
        $("body").prepend("<style>.sceditor-button-fahide-hotrofm div {background-position: 0 -692px;}.sceditor-button-fahide {display: none !important;}</style>");
});



Các bạn có thể thay lại thông báo notification dạng text thành dạng ảnh như này

jquery bbcode notification hide image


Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  Unlock10

Code:

$(function(){
    $(function(){
          $('<a class="sceditor-button sceditor-button-fahide-hotrofm" unselectable="on"><div unselectable="on">Hide</div></a>').insertAfter('.sceditor-button-fahide').click(function(){
              $('#text_editor_textarea').sceditor("instance").insertText("[img]https://i37.servimg.com/u/f37/19/53/09/53/unlock10.gif[/img][hide]","[/hide]");
          });
      });
        $("body").prepend("<style>.sceditor-button-fahide-hotrofm div {background-position: 0 -692px;}.sceditor-button-fahide {display: none !important;}</style>");
});







Tags: #code #forumotion #bbcode

[Code] bbcode embe jsfiddle in website forumotion

bbcode embe jsfiddle in website forumotion


bbcode embe jsfiddle thích hợp cho những website thảo luận về code. cần thiết khi nêu 1 ví dụ cho người đọc dễ hiểu và hình dung hơn. :)

Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  GIsgYZj

khi cho vào code thì bài hiện sẽ hiện hình dưới

Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  CwSewot

Không dài dòng nữa chỉ thế này thôi

Code:

$(window).load(function() {
    $('.sceditor-group:last').append('<a title="jsfiddle bbcode" class="sceditor-button sceditor-button-jsfiddle" style="text-indent: 0px;"><img src="http://i.imgur.com/YKo9kd5.png" ></a>');
    $('body').append('<div id="bbcodejsfiddle" style="display:none;position:absolute;z-index:50000;-moz-background-clip:padding;-moz-border-radius:2px;-moz-box-shadow:1px 2px 4px rgba(0,0,0,.2);-webkit-background-clip:padding-box;-webkit-border-radius:2px;-webkit-box-shadow:1px 2px 4px rgba(0,0,0,.2);background:#fff;background-clip:padding-box;border:1px solid #ccc;border-radius:2px;box-shadow:1px 2px 4px rgba(0,0,0,.2);color:#333;line-height:1;padding:10px;position:absolute;z-index:4000"><input id="inputFieldjsfiddle" type="text"><br><input id="enterContentjsfiddle" type="submit" value="enter" style="margin-top: 5px;"></div><style>.jsfiddlehotro {width: 100%;}</style>');
    
    $('.sceditor-button-jsfiddle').click(function() {
        if ($('#bbcodejsfiddle').css('display') == 'none') {
            var y = $('.sceditor-button-jsfiddle').offset().top +25;
            var x = $('.sceditor-button-jsfiddle').offset().left;
            $('#bbcodejsfiddle').show().css('top',y + 'px').css('left',x + 'px');
        }
        else $('#bbcodejsfiddle').hide();
    });
    
    $('#enterContentjsfiddle').click(function() {
        if ($('#inputFieldjsfiddle').val().length > 0) $('#text_editor_textarea').sceditor('instance').insertText('[table class=jsfiddlehotro][tr][td]' + $('#inputFieldjsfiddle').val(),'[/td][/tr][/table]');
        else $('#text_editor_textarea').sceditor('instance').insertText("[table class=jsfiddlehotro][tr][td]", "[/td][/tr][/table]");
        $('#inputFieldjsfiddle').val('');
        $('#bbcodejsfiddle').hide();
    });
    
    $('.sceditor-button:not(.sceditor-button-jsfiddle), .sceditor-container textarea, .sceditor-container jsfiddle').click(function() { $('#bbcodejsfiddle').hide() });
});
$(document).on('ready', function() {
$(".jsfiddlehotro a[href*='http://jsfiddle.net/'], .jsfiddlehotro a[href*='https://jsfiddle.net/']").replaceWith(function() {
 return '<iframe width="100%" height="300" src="' + this.href + 'show/" allowfullscreen="allowfullscreen" frameborder="0"></iframe>'
 });
});



Mẫu bạn chỉ cần copy nguyên đường dẫn vào ví dụ như :

Code:

https://jsfiddle.net/kgtohgs3/


copy vào cho vảo bbcode là nó hiện thôi
Tags: #code #forumotion #bbcode

[Code] bbcode up file lên driver google bằng google app scrip

Hướng dẫn tạo bbcode up file lên driver google bằng google app scrip


Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  TNYG0tR

Forumotion có chức năng đính kèm nhưng dung lượng khá ít tầm 20MB như vậy được rất ít. Hotrofm mới tham khảo nhatchanh.info cách up lên driver google rất hay bằng app scrip. google driver tất nhiên là ngon rùi. với tài khoản free thì các bạn có 15G . bạn nào nhu cầu up nhiều file thì mua tài khoản không giới hạn dung lượng ( trên mạng bán rất nhiều từ 100>300k đều có )

Bước 1: truy cập vào https://www.google.com/script/start/ rùi click vào star strip

Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  RwfkzMK

- Dán đoạn mã dưới đây vào file *.gs và lưu lại

Code:

function doGet(e) {
  return HtmlService.createHtmlOutputFromFile('form.html');
}

function uploadFiles(form) {
  
  try {
    
    var dropbox = "Student Files"; // tên thư mục trong Google Drive
    var folder, folders = DriveApp.getFoldersByName(dropbox);
    
    if (folders.hasNext()) {
      folder = folders.next();
    } else {
      folder = DriveApp.createFolder(dropbox);
    }
    
    var blob = form.myFile;    
    var file = folder.createFile(blob);    
    file.setDescription("Uploaded by " + form.myName);
        
    return "File uploaded successfully " + file.getUrl();
    
  } catch (error) {
    
    return error.toString();
  }
  
}


- Tiếp theo, tạo một file với tên form.html bằng cách vào menu File ~> New ~> Html file

Code:

<form id="myForm">
    <input type="text" name="myName" placeholder="Your name..">
    <input type="file" name="myFile">
    <input type="submit" value="Upload File"
           onclick="this.value='Uploading..';
                    google.script.run.withSuccessHandler(fileUploaded)
                    .uploadFiles(this.parentNode);
                    return false;">
</form>

<div id="output"></div>

<script>
    function fileUploaded(status) {
        document.getElementById('myForm').style.display = 'none';
        document.getElementById('output').innerHTML = status;
    }
</script>

<style>
 input { display:block; margin: 20px; }
</style>


Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  V7hSllg

- Tại menu Run  ~> doGet để ủy quyền cho các kịch bản. Để nó có thể tải các tập tin từ form.html lên Google Drive của bạn

- Tiếp theo, chọn Publish ~> Deploy as web app và nhấn Save New Version, cấp quyền truy cập vào ứng dụng bằng cách chọn trình đơn thả xuống (bạn có thể chọn bất cứ ai cũng có thể tải file lên Google Drive của bạn bằng cách chọn Anyone, even anonymous). Và bạn sẽ được cung cấp một địa chỉ bất cứ ai cũng có thể truy cập vào địa chỉ này để tải các tập tin lên Google Drive của bạn.

Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  VjvvUfZ

Khi chúng ta có đoạn link mầu khoanh đỏ ở trên thì copy link đó vào code sau

HTML & JAVASCRIPT>>Javascript codes management tạo 1 js

Code:

$(window).load(function() {
    $('.sceditor-group:nth-child(4)').prepend('<a class="sceditor-button sceditor-button-upfilePop-hotrofm" title="Úp File"><div style="background:url(http://i.imgur.com/LLgXFFc.gif) no-repeat center;"></div></a>');
$('.sceditor-button-upfilePop-hotrofm').click(function(){

var left  = ($(window).width() / 2) - (300 / 2),
    top   = ($(window).height() / 2) - (300 / 2),
    popup = window.open("link khoanh đỏ", "popup", "width=400, height=300, top=" + top + ", left=" + left);
 
});
 
});



Tiếp đó dùng

Code:

<script src='link js vừa tạo'></script>

vào posting body và viewtopic là dc rùi :)

Bước cuối cùng

bạn vào https://drive.google.com/drive/

rùi tìm file Student Files click chuột phải vào chia sẻ

Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  FNgujJ2

rùi để chế độ ai cũng có thể xem

Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  U8R9fCu

Xong
Tags: #code #bbcode

[Code] Thay Úp ảnh mặc định thành úp ảnh Imgur

Code này là đơn giản nhất trong các code úp ảnh mà diễn đàn đã share . Chỉ cần chọn thẳng ảnh trong máy để up , khi úp xong sẽ tự động hiện link ảnh thẳng vào bài viết . Nhược điểm là phải úp từng lượt và không úp được bằng url .

Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  S2c32w0

Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  CHvQzMV

BƯỚC 1: TẠO JS THAY THẾ


Vào modules >> HTML & JAVASCRIPT >> Javascript codes management
Tạo js này và click vào In all the page

Code:

;window['FormData'] && $(function(){$(function(){
  
      var imgur_client_id = 'Thay ID ở Đây'; // you will get it via http://api.imgur.com/oauth2/addclient
  
      var current = 0, uploaded, xhrs, file_selector, button = $('.sceditor-button-servimg').off().click(function(){
        if(current) return finish();
        if(!file_selector) file_selector = $('<input type="file" multiple/ accept="image/*">').css({position:'absolute', top:-100}).appendTo('body').change(function (e) {
          var files = e.target.files, fd, len;
          uploaded = [], xhrs = [];
          for (var i = 0, len = files.length; i < len; i += 1) {
            if (files[i].type.indexOf('image/') && files[i].type !== 'application/pdf') continue;
            current++;
            fd = new FormData();
            fd.append('image', files[i]);
            (function(xhr){
              var num = i, xhr = jQuery.ajaxSettings.xhr();
              xhrs.push(xhr);
              xhr.open('POST', 'https://api.imgur.com/3/image');
              xhr.setRequestHeader('Authorization', 'Client-ID '+imgur_client_id);
              xhr.onreadystatechange = function () {
                if (xhr.readyState !== 4) return;
                current--;
                if (xhr.status === 200) {
                  var res = JSON.parse(xhr.responseText);
                  uploaded[num] = res.data.link;
                }
                if(!current) finish();
              };
              xhr.send(fd);
            })();
          }
          if(current) button.css({background:'url(http://i.imgur.com/EMsOJtZ.gif) no-repeat'});
        });
        file_selector.click();
        return false;
      }).children();
      var finish = function(){
        for(var i=0; i < xhrs.length; i++) {
            if(xhrs[i].readyState == 4) continue;
            xhrs[i].onreadystatechange = function(){};
            xhrs[i].abort();
        }
        for(var i=0; i < uploaded.length; i++) {
          if(uploaded[i] === undefined) continue;
          $('body').find('.sceditor-button-image').click().end().find('.sceditor-insertimage').find('#image').val(uploaded[i]).end().find('input.button').click();
          $('#text_editor_textarea').sceditor('instance').insertText('\n');
        }
        button.removeAttr('style');
        current = 0;
        file_selector.wrap('<form>').closest('form').get(0).reset();
        file_selector.unwrap();
        return false;
      };
    })});


BƯỚC 2: THAY CLIENT ID VÀO JS


Thay client ID đã tạo ở trang Imgur vào chữ 'Thay ID ở đây' dòng 3 của Js
Nếu chưa biết tạo Client ID thì vào đọc hướng dẫn ở topic này :
http://www.hotrofm.net/t304-code-up-anh-len-imgur-mien-phi


Nguồn : fmdesign

Tags: #code #imgur #bbcode

[Code] bbcode up ảnh imgur thay thế code tinypic forumotion

bbcode up ảnh imgur thay thế code tinypic


Việc sử dụng up ảnh trên tinypic mình thấy load chậm chậm sao ấy, hơn thế nữa cũng ko quản lý dc ảnh, vì vậy mình tích hợp code up ảnh của baivong từ devs vào nút bbcode cho các bạn sử dụng sceditor mặc định của forumotion

Mặc định:
Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  Qk3U4y8

Imgur:
Topics tagged under bbcode on Diễn Đàn Hỗ Trợ FM  GKYVudi

Bước 1: tạo trang html up ảnh imgur


Đầu tiên các bạn làm theo hướng dẫn ở topic này

http://www.hotrofm.net/t304-code-up-anh-len-imgur-mien-phi

Lưu lại html và Nhớ lại link html đó ví dụ như hotrofm này là http://www.hotrofm.net/h11-page 

Bước 2: Tạo js thay thế up ảnh cũ tinypic forumotion cũ


sau đó vào modules > HTML & JAVASCRIPT >> Javascript codes management

tạo js này không click vào đâu cả

Code:

$(window).load(function() {
    $('.sceditor-group:nth-child(4)').prepend('<a class="sceditor-button sceditor-button-upanh-hotrofm" title="Úp ảnh"><div></div></a>');
    $('.sceditor-button-upanh-hotrofm').click(function() {
        if ($('#upanhhotrofmPop').css('display') == 'none') {
            var y = $('.sceditor-button-upanh-hotrofm').offset().top +25;
            var x = $('.sceditor-button-upanh-hotrofm').offset().left;
            $('#upanhhotrofmPop').show().css('top',y + 'px').css('left',x + 'px');
        }
        else $('#upanhhotrofmPop').hide();
    });
$( ".sceditor-button-servimg" ).remove();
$('body').append('<div id="upanhhotrofmPop" style="display:none;position:absolute;z-index:50000;"><iframe src="http://www.domain.com/h1-page" scrolling="auto" allowtransparency="true" frameborder="0" width="300" height="400">Update your browser for tinypic.com</iframe></div><style>.sceditor-button-upanh-hotrofm div {background-position: 0 -644px;}</style>');
});


sau đó link http://www.domain.com/h1-page thành link html của bạn

Bước 3. Cho code bbocde up ảnh vào chỗ cần hiện


Code:

<script src="link.js" type="text/javascript">


Thường thì để ở viewtopicbody. postingbody


Tags: #code #forumotion #bbcode #imgur