ทำลิ้งค์ Copy Code แบบ SMF 2.0
ทำลิ้งค์ Copy Code แบบ SMF 2.0
เนื่องจากว่ามีคนโพสขอวิธีทำไว้ที่คอมโพส และช่วงนี้ผมก็ไม่มีอะไรจะมาลงในบล็อกซะด้วย
ก็เลยจิ๊กเอาวิธีทำลิ้งค์ Copy Code แบบ SMF 2.0 มาใส่แทนครับ ![]()
หมาเหตุ : เราจะไม่อธิบายแบบละเอียด เพราะขี้เกียจ ![]()
1.ก๊อปโค้ด
<เอ class="codeoperation" onclick="return smfSelectText(this);" href="javascript:void(0);">Copy Code</เอ>
วางแถวๆ (บรรทัดที่ 125X)
' . $txt['smf238'] . ':
วางไว้ที่
/home/domains/ro89.com/public_html/forum/Sources/Subs.php
2.ก๊อปโค้ด
// Get the text in a code tag.
// From SMF 2.0 (expertduck.com)
// Modify By iChetblog.net
// ใครลบ 3 บรรทัดบน ขอให้เป็นหมัน มีแฟนเป็นกระเทย
:P
function smfSelectText(oCurElement, bActOnElement)
{
// The place we're looking for is one div up, and next door - if it's auto detect.
if (typeof(bActOnElement) == 'boolean' && bActOnElement)
var oCodeArea = document.getElementById(oCurElement);
else
var oCodeArea = oCurElement.parentNode.nextSibling;
if (typeof(oCodeArea) != 'object' || oCodeArea == null)
return false;
// Start off with my favourite, internet explorer.
if (document.body.createTextRange)
{
var oCurRange = document.body.createTextRange();
oCurRange.moveToElementText(oCodeArea);
oCurRange.select();
}
// Firefox at el.
else if (window.getSelection)
{
var oCurSelection = window.getSelection();
// Safari is special!
if (oCurSelection.setBaseAndExtent)
{
var oLastChild = oCodeArea.lastChild;
oCurSelection.setBaseAndExtent(oCodeArea, 0, oLastChild, typeof(oLastChild.innerText) == 'undefined' ? oLastChild.textContent.length :
oLastChild.innerText.length);
}
else
{
var curRange = document.createRange();
curRange.selectNodeContents(oCodeArea);
oCurSelection.removeAllRanges();
oCurSelection.addRange(curRange);
}
}
return false;
}
ไปวางไว้ที่
/home/domains/ro89.com/public_html/forum/Themes/default/script.js
คงได้ใช้ในสักวัน
ตอนนี้ยังไม่มีเว็บบอร์ดที่ใช้ SMF เป็นของตัวเอง แหะๆ
เอ อยากเห็นหน้าตาจังครับ
แต่ คอมโพสกับไอเชตบล๊อกนี่ บล่อยของได้เรื่อยๆเลยนะนิ
มีกระทู้ /me ด้วย