Diễn Đàn Hỗ Trợ FM
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.


[Code] Khung hashtags posting_body

Tác giả: - vào lúc:
Giựt
Bài viết : 272
Points : 440
Like : 89
Punbb
Cẩn thận
Status : Giựt đẹp trai
GiựtMOD
9/18/2016, 22:51
#1

Demo


Code:

http://www.hotrofm.net/post?f=1&mode=newtopic

Smile

[Code] Khung hashtags posting_body LgWKI8B

Cách làm


Vào posting_body , thêm vào cuối templates posting_body code sau :

Code:

<script type="text/javascript">
    //<![CDATA[
    var dataTags = "comic, film, funny, cartoon, animation, music, vietnam, usuk, kpop, game, game mobile, ios game, android game, wp game, infographic, samsung, apple, microsoft, lg, blackberry, htc, oppo, sony, android, ios, windows phone, mobile, smartphone, tablet, phablet, smartwatch, computer, windows, os x, mac os, code, tutorial, skin, wallpaper, anime, design, guide tutorial, stock image, brushes, textures, fonts, software, firmware, update";
    (function(a) {
        var g = [],
            h = dataTags.split(/\s?,\s?/),
            b = a("#text_editor_textarea"),
            d = a("#tagsInput"),
            e = a("<select>", {
                "class": "js-example-data-array",
                multiple: "multiple",
                css: {
                    width: "100%"
                }
            });
        e.appendTo("#tagsSelect");
        if (/\[hr\]\n?\[b\]Tags:\s\[\/b\]#/.test(b.val())) {
            var f = b.val().split(/\[hr\]\n?\[b\]Tags:\s\[\/b\]/); - 1 === f[0].search(/\[quote="[^"]+"\]/) && -1 === f[1].indexOf("[/quote]") ? (b.val(f[0]), a.each(f[1].split(" "), function(c, k) {
                a("<option>", {
                    value: k.replace("#", ""),
                    text: k.replace("#", "").replace(/-/g, " "),
                    selected: "selected"
                }).appendTo(e)
            }), d.val(f[1])) : b.val(b.val().replace(/\[hr\]\n?\[b\]Tags:\s\[\/b\](\#[^\[]+\s?)+/g, ""))
        }
        a.each(h, function(c, a) {
            g[c] = {
                id: a.replace(/\s/g, "-"),
                text: a
            }
        });
        e.select2({
            data: g,
            placeholder: "Th\u00eam nh\u00e3n cho b\u00e0i vi\u1ebft...",
            tags: !0,
            tokenSeparators: [","]
        });
        e.on("change", function() {
            var c = e.val();
            null !== c ? (a.each(c, function(a, b) {
                -1 === h.indexOf(b.toLowerCase()) && (b = b.replace(/\s/g, "-").toLowerCase());
                c[a] = "#" + b
            }), d.val(c.join(" "))) : d.val("")
        });
        a('form[name="post"]').submit(function() {
            var a = b.sceditor("instance");
            "" !== d.val() && "" !== a.val() && a.val(a.val() + "[hr][b]Tags: [/b]" + d.val())
        })
    })(jQuery); //]]>
</script>


Rồi chèn code sau vào chỗ mình muốn Smile :

Code:

<fieldset>
    <dl><dt><label>Từ khóa </label></dt>
        <dd id="tagsSelect">
            <input id="tagsInput" type="hidden" />
        </dd>
    </dl>
</fieldset>


Xong , nhớ +1 Smile
the_dav
Bài viết : 226
Points : 323
Like : 47
Punbb
Quản trị
the_davMEM LV3
9/19/2016, 05:47
#2
á đù. rip của ht mới sợ chứ hi. cố gẳng học hỏi cũng tốt: )
ZzThuyNg0czZ
Bài viết : 10
Points : 11
Like : 1
Punbb
Cẩn thận
ZzThuyNg0czZMEM LV1
9/19/2016, 10:24
#3
[Code] Khung hashtags posting_body 263a [Code] Khung hashtags posting_body 1f60d
Sponsored content
#4