Hiển thị các bài đăng có nhãn JAVASCRIPT. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn JAVASCRIPT. Hiển thị tất cả bài đăng

[Visual Basic] MathML to/from Plain Text Converter

Hi mọi người, tìm hiểu code trên codeproject.com thấy có bài hướng dẫn chuyển đổi dạng HTML
Chuyển đổi chuỗi mã hóa MathML thành/từ chuỗi văn bản thuần túy


[Visual Basic] MathML to/from Plain Text Converter

Mã bao gồm hai lớp để phân tích chuỗi MathML. Lớp đầu tiên, MathToString chuẩn bị chuỗi. Lớp thứ hai, ParseML, thực hiện phân tích. Tương tự, để lấy mã MathML từ văn bản, một lớp chuẩn bị và lớp kia thực hiện chuyển đổi.

Giới thiệu

Có vẻ như có ít tài nguyên chuyển đổi mã MathML thành văn bản thuần túy. Một lý do chính đáng là không có sự đồng thuận về cách định dạng một số biểu thức toán học. Nhưng đối với nhiều biểu thức liên quan đến toán tử (+,-,/,*,^,=), đây là một trình chuyển đổi khả thi.

Các lớp học đã tham gia

Lớp MathToString chuẩn bị string mã MathML để class ParseML
có thể thực hiện phân tích cú pháp chi tiết.

Sự chuẩn bị

Đầu tiên, các khoảng trắng được thay thế bằng các chuỗi rỗng và một số ký tự đặc biệt cũng được thay thế. Ngoài ra, một số thẻ không liên quan đến biểu thức toán học, như stylethẻ, sẽ bị xóa. Sau đó, mã sẽ chuyển từ <mfrac>...</mfrac>,<msup>...</msup>, <mrow>...</mrow>, <msqrt>...</msqrt> các thẻ bên trong nhất sang các thẻ bên ngoài nhất, được phân tích cú pháp và thay thế, bao quanh chúng giữa các ký tự đặc biệt để sau đó chúng có thể được phục hồi theo ParseML lớp.

Sử dụng Mã

Để chuyển đổi, chỉ cần gọi phương thức chia sẻ MathToString.convertToString():
Dim converted as String = MathMLToString.convertToString(MathMLcodeToConvert)

Để chuyển đổi văn bản sang MathML, hãy gọi convertStringToMathML().

Nguyên tắc cơ bản

Phương pháp phân tích cú pháp là phân tích cú pháp đệ quy-giảm dần: Phân tích biểu thức bằng phương pháp giảm dần đệ quy.

Phương pháp đánh giá Eyêu Tcầu bất kỳ phép cộng hoặc trừ nào, nhưng Ttrước tiên gọi Fbất kỳ phép nhân hoặc trừ nào, và Ftrước tiên gọi Pbất kỳ phép toán lũy thừa nào có thể. Pgọi trước để lấy mã thông báo tiếp theo. Nếu có (mã thông báo " ", v gọi đệ quy đến T.
E --> T {( "+" | "-" ) T}
T --> F {( "*" | "/" ) F}
F --> P ["^" F]
P --> v | "(" E ")" | "-" T

Phiên bản 1.0.3.0

Bây giờ, tệp zip demo có chứa tệp thiết lập.

Các ứng dụng JavaScript, .NET và Core đã được mã hóa lại, vì MathML là một ứng dụng của XML và để phản ánh các thẻ có thể được lồng nhau 'đệ quy', ý tôi là, một phần tử có thể xuất hiện bên trong chính nó hoặc bất kỳ cấp nào bên dưới các phần tử con của nó. Ví dụ:
<mfrac>
   <mrow>
     <mi>-1</mi>
   </mrow>
   <mn>
     <mn>3</mn>
   </mn>
</mfrac>

Phiên bản 2.0.0.0 (2024-03-25)

Mã đã được viết lại, cải thiện và mở rộng. Ví dụ, hiện tại nó hỗ trợ bao gồm các phương trình trong ngôn ngữ LaTex như sau:
\begin{array}{*{20}c} {x = \frac{{ - b \pm \sqrt {b^2 - 4ac} }}{{2a}}} &
{{\text{when}}} & {ax^2 + bx + c = 0} \\ \end{array}

Để thực hiện mục đích này, bằng cách đưa phương trình vào LaTex trong hộp văn bản MathML và nhấp vào 'Chuyển đổi thành văn bản thuần túy', mã Latex sẽ được thay thế bằng bản dịch sang MathML và được chuyển đổi thành văn bản thuần túy.

Phiên bản 2.0.5.0 (2024-04-17)

Một số mẫu khác đã được thêm vào.
Đã có sự sắp xếp để dấu ngoặc vuông và ngoặc nhọn được phản ánh trong quá trình chuyển đổi.
ConvertStringToMathML.EvaluateFromInnerToOuter() là một phương pháp mới và như tên gọi của nó, nó kiểm tra từ hầu hết các cặp ngoặc đơn và/hoặc ngoặc vuông bên trong đến hầu hết các cặp ngoặc vuông bên ngoài.

Phiên bản 2.0.5.9 (2024-05-01)

Đã thêm nhiều mẫu hơn.
Một số lỗi đã được vá và một số cải tiến đã được triển khai. Ví dụ, hiện tại thẻ <mlabeledtr>đã được tính đến.

Phiên bản 2.0.6.0 (17-05-2024)

Một số mẫu khác đã được thêm vào. Nhấn các phím chức năng F1, F2 và F12 tương ứng để chuyển đến số mẫu; chuyển đến mẫu tiếp theo; và quét các mẫu từ mẫu hiện tại (phím thoát 'Esc' sẽ hủy quét).
Có các tính năng mới. Việc giữ nguyên dấu ngoặc đơn bằng cách sử dụng ⸨ ⸩ đã được bật, ngăn ứng dụng xóa chúng. Ví dụ, khi chuyển đổi văn bản "(3)" thành MathML dấu ngoặc đơn bị loại bỏ. Thay vào đó, văn bản "⸨3⸩ "được chuyển đổi thành MathMLsẽ giữ nguyên chúng.

Bây giờ, với ↓ký tự (ascii 25), sau và trước dấu ngoặc đơn, một MathML thuộc tính stretchy='false' đã đạt được. Vì vậy, văn bản ∫⸨5*x+2*sin⸨↓x↓⸩⸩dx khi được dịch sang MathML sẽ mở rộng dấu ngoặc đơn bên ngoài chứ không phải dấu ngoặc đơn bên trong xung quanh x.

Ngoài ra, người dùng có thể lựa chọn giữa MathJa'sphiên bản 2.7.2 và 3. Phiên bản 2 cũ hơn nhưng có ngắt dòng tài khoản, trong khi phiên bản 3 thì không.

Phiên bản 2.0.13.0 (2024-07-11)

- Bao gồm thêm một số ví dụ.
- Một số bản sửa lỗi và cải tiến đã được thực hiện.

on Thứ Tư, 17 tháng 7, 2024 | , , , | A comment?

[JAVASCRIPT] Mã Nguồn Matrix Rain Chạy Trên Website

Hi mọi người, với bộ mã nguồn này thì mọi người không còn xa lạ gì nữa rồi, đây là một dạng mà lúc xưa mình đang tìm hiểu và học làm một "HACKER" hay tìm những dạng trang như này hoặc các trang deface khác trên Google để tìm hiểu và fâke bạn bè mình vừa HACK được trang website này. Nhưng thức tế là trang của mình. haha.

FULL CODE.

<!DOCTYPE html>
<html>
<head>
    <title>Matrix Rain Javascript - Hung Pro VN</title>
</head>

<body>
    <canvas id="canvas"></canvas>
    <style type="text/css">
body{margin: 0; padding: 0; overflow: hidden;}
</style>
<script type="text/javascript">
var canvas = document.getElementById('canvas');
        var ctx = canvas.getContext('2d');


        canvas.height = window.innerHeight;
        canvas.width = window.innerWidth;
        canvas.height = 768;
        canvas.width = 1366;

        var texts = '0123456789'.split('');

        var fontSize = 16;
        var columns = canvas.width/fontSize;       
        var drops = [];       
        for(var x = 0; x < columns; x++){
            drops[x] = 1;
        }

        function draw(){          
            ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
            ctx.fillRect(0, 0, canvas.width, canvas.height);           
            ctx.fillStyle = '#0F0';
            ctx.font = fontSize + 'px arial';           
            for(var i = 0; i < drops.length; i++){
                var text = texts[Math.floor(Math.random()*texts.length)];
                ctx.fillText(text, i*fontSize, drops[i]*fontSize);

                if(drops[i]*fontSize > canvas.height || Math.random() > 0.95){
                    drops[i] = 0;
                }

                drops[i]++;
            }
        }

        setInterval(draw, 33);
</script>
</body>

Qua đoạn code phía trên mọi người cùng nắm bắt được mình cần thay thế chỉnh sưa gì rồi chứ. Chúc mọi người thành công với bộ mã nguồn đơn giản này.

on Thứ Tư, 3 tháng 7, 2024 | , , | A comment?

[BLOGGER] Theme Maintenance 2024

Hi mọi người, hôm qua ngồi viết bài chia sẽ về [CSHARP] How To Login Zalo With Api Version 4 và vào để lưu dữ liệu ở trang Mediafire.Com một trang lưu dữ liệu một thời nỗi đình nỗi đám của dân IT và Hacker những năm 2005,2006,2007...

Thì mình thấy có một số giao diện những năm 2005, 2006... những giao diện lúc đó mình mới chập chửng vào học làm website/Blogger và lúc đó mình tìm kiếm rất nhiều giao diện phù hợp với bản thân nhưng loay hoay mãi không thấy giao diện nào ưng ý nên mình đã tự học làm một giao diện đơn giản kiểu như blog đang bảo trì hay đang khắc phục lỗi sữ cố, như những website thời bấy giờ đang làm ra.
Bên duối là hình ảnh demo của blog mình viết ra.

Với giao diện này thì hoàn toàn đơn giản, không phúc tạp gì và như mọi người cũng đã biết thì với giao diện blogger thì chỉ có HTML,CSS,JAVASCRIPT. Và không có thể thêm bộ code php vào giao diện mặc định của nó được nhé mọi người, và sau này không biết blogger nó có tùy biến gì không nhưng với những thứ hiện tại thì cũng đủ để những người không chuyên về website/blog như mình và những người khác tìm hiểu và áp dụng để tạo cho mình một giao diện tuyệt với, dù có giao diện đẹp nhưng cũng theo năng lực của bản thân là đi SEO cho web/blog của các bạn được hiện thị đứng top từ khóa của blog các bạn phát triển để có thự hạng rank và traffic ổn định trên GOOGLE

Mình không tự nhận giao diện mình chuẩn SEO và đạt được những yêu cầu của GOOGLE đặt ra, nhưng mình cảm nhận thấy giao diện này phù hợp với những anh em chưa biết phát triển web/blog của mình làm gì, thì có thể áp dụng tên miền mặc định hay tên miền tùy chỉnh để tăng rank từ giao diện này, và sẽ có một ngày lọt top google từ seo bài viết cho blog bạn phát triển hay trang mà bạn đang đặt sidebar trượt bài viết ở phía dưới.

BÊN DƯỚI LÀ FULL GIAO DIỆN.

<html xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<link href='https://www.blogger.com/static/v1/widgets/55013136-widget_css_bundle.css' rel='stylesheet' type='text/css'/>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<meta content='width=1100' name='viewport'/>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
<meta content='blogger' name='generator'/>
<link href='https://hungcoderlink.blogspot.com/favicon.ico' rel='icon' type='image/x-icon'/>
<link href='https://hungcoderlink.blogspot.com/' rel='canonical'/>
<link rel="alternate" type="application/atom+xml" title="HUNG PRO VN - Atom" href="https://hungcoderlink.blogspot.com/feeds/posts/default" />
<link rel="alternate" type="application/rss+xml" title="HUNG PRO VN - RSS" href="https://hungcoderlink.blogspot.com/feeds/posts/default?alt=rss" />
<link rel="service.post" type="application/atom+xml" title="HUNG PRO VN - Atom" href="https://www.blogger.com/feeds/3652659979300949499/posts/default" />
<!--Can't find substitution for tag [blog.ieCssRetrofitLinks]-->
<meta content='https://hungcoderlink.blogspot.com/' property='og:url'/>
<meta content='Go Hùng Coder' property='og:title'/>
<meta content='' property='og:description'/>
<title>SOM Theme.Pro.VN</title>
<style id='page-skin-1' type='text/css'><!--
/*
@import url(http://fonts.googleapis.com/css?family=Raleway:200,300);
/* ============================================ Reset ============================================ */
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, figure, footer, header,
hgroup, menu, nav, section, menu,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
article, aside, figure, footer, header,
hgroup, nav, section {
display:block;
}
nav ul {
list-style:none;
}
blockquote, q {
quotes:none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content:'';
content:none;
}
a {
margin:0;
padding:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
ins {
background-color:#ff9;
color:#000;
text-decoration:none;
}
mark {
background-color:#ff9;
color:#000;
font-style:italic;
font-weight:bold;
}
del {
text-decoration: line-through;
}
abbr[title], dfn[title] {
border-bottom:1px dotted #000;
cursor:help;
}
/* tables still need cellspacing="0" in the markup */
table {
border-collapse:collapse;
border-spacing:0;
}
hr {
display:block;
height:1px;
border:0;
border-top:1px solid #ccc;
margin:1em 0;
padding:0;
}
input, select {
vertical-align:middle;
}
/* ============================================ General Type styles ============================================ */
body {
width: 980px;
margin: 80px auto;
font-family: 'Raleway', sans-serif;
font-weight: 200;
text-align: center;
color: #909090;
}
p {
font-size: 25px;
margin-bottom: 20px;
line-height: 1.3;
}
p a {
color: #1abc9c;
border-bottom: 1px solid #1abc9c;
text-decoration: none;
font-style: normal;
-webkit-font-smoothing: antialiased;
font-size: 52px;
font-weight: 300;
}
#carousel{width:980px;height:125px;border-bottom:1px solid #ccc;position:relative;display:block;background:#9DE2D5;margin-bottom:8px}
#carousel h5{color:#555;margin:2px}
#carousel .container{position:absolute;left:24px;width:960px;height:125px;overflow:hidden}
#carousel .thumb{float:left;margin-right:5px;}
#carousel #previous_button{position:absolute;width:24px;height:125px;background:url("") center;z-index:100;cursor:pointer;}
#carousel #next_button{position:absolute;right:0;width:24px;height:125px;background:url("") center;z-index:100;cursor:pointer;}
#carousel #next_button:hover,#carousel .thumb:hover,#carousel #previous_button:hover{filter:alpha(opacity=70);opacity:.7}
#carousel ul{width:100000px;position:relative;margin-top:10px}
#carousel ul li{background:#ebebeb;display:inline;float:left;text-align:left;font:bold 11px Arial;border:0px solid #ccc;width:212px;height:90px;margin:0 2px 20px 6px;padding:6px}
#carousel ul li a.slider_title{color:#222;display:block;margin-top:0;padding-top:0}
#carousel ul li a.slider_title:hover{color:#1b5d97}
#carousel a img{display:block;background:#fff;margin-top:0}
.bomkhung{background:#f9f9f9;padding:10px 20px 10px;border:2px dashed #3598DB;text-align:center;margin-top:10px;}
--></style>
<meta name='google-adsense-platform-account' content='ca-host-pub-1556223355139109'/>
<meta name='google-adsense-platform-domain' content='blogspot.com'/>

</head>
<!-- chuyen huong link -->
<script type='text/javascript'>
//<![CDATA[
/* Redirector */
(function(b){window.top.location.href.includes("https://www.theme.pro.vn/")||b.filter(function(a){return!a.hasAttribute("imageanchor")&&!a.href.startsWith("https://www.theme.pro.vn/")&&5<a.href.length}).map(function(a){a.href="https://www.theme.pro.vn/chuyen-huong-link.html?hungprovn="+(a.href);a.rel="nofollow noopener";a.target="_blank"})})(Array.from(document.querySelectorAll(".post-body a")));
//]]></script>
<!-- end -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<!-- <script src='http://yourjavascript.com/265232511102/carousellite.js' type='text/javascript'/> -->
<script type='text/javascript'>
//<![CDATA[
imgr = new Array();
imgr[0] = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbrFzg1yRBDU5vres72dFcwmrKKthrzzy7T56bZML1bEN13APWTpvxHoF_KKQmVjggNZSYcpK51YcSWiwGUrVoeSsd9SPdIez-6f-qBPEA5gyN8SNeVllyGdnNe7UTIL76NN3Nqmy55L8/s1600/no+image.jpg";
showRandomImg = true;

aBold = true;

summaryPost = 140;
summaryTitle = 25;
numposts1 = 20;

function removeHtmlTag(strx,chop){
var s = strx.split("<");
for(var i=0;i<s.length;i++){
if(s[i].indexOf(">")!=-1){
s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);
}
}

s = s.join("");
s = s.substring(0,chop-1);
return s;
}
function showrecentposts(json) {
j = (showRandomImg) ? Math.floor((imgr.length+1)*Math.random()) : 0;
img = new Array();
document.write('<ul>');
for (var i = 0; i < numposts1; i++) {
var entry = json.feed.entry[i];
var posttitle = entry.title.$t;
var pcm;
var posturl;
if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
posturl = entry.link[k].href;
break;
}
}

for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'replies' && entry.link[k].type == 'text/html') {
pcm = entry.link[k].title.split(" ")[0];
break;
}
}

if ("content" in entry) {
var postcontent = entry.content.$t;}
else
if ("summary" in entry) {
var postcontent = entry.summary.$t;}
else var postcontent = "";
postdate = entry.published.$t;
if(j>imgr.length-1) j=0;
img[i] = imgr[j];
s = postcontent ; a = s.indexOf("<img"); b = s.indexOf("src=\"",a); c = s.indexOf("\"",b+5); d = s.substr(b+5,c-b-5);
if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!="")) img[i] = d;
//cmtext = (text != 'no') ? '<i><font color="'+acolor+'">('+pcm+' '+text+')</font></i>' : '';
var month = [1,2,3,4,5,6,7,8,9,10,11,12];
var month2 = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var day = postdate.split("-")[2].substring(0,2);
var m = postdate.split("-")[1];
var y = postdate.split("-")[0];
for(var u2=0;u2<month.length;u2++){
if(parseInt(m)==month[u2]) {
m = month2[u2] ; break;
}
}

var daystr = day+ ' ' + m + ' ' + y ;
var trtd = '<li class="car"><div class="thumb"><a href="'+posturl+'"><img width="100" height="90" class="alignnone" src="'+img[i]+'"/></a></div><h5>'+daystr+'</h5><a class="slider_title" href="'+posturl+'">'+posttitle+'</a></li>';

document.write(trtd);
j++;
}
document.write('</ul>');
}
/* javascript load */
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var running=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var div=$(this),ul=$("ul:first",div),tLi=$(".car",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v;}
var li=$(".car",ul),itemLength=li.size(),curr=o.start;div.css("visibility","visible");li.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({padding:"0",position:"relative","list-style-type":"none","z-index":"1"});div.css({overflow:"hidden","z-index":"2"});var liSize=o.vertical?height(li):width(li);var ulSize=liSize*itemLength;var divSize=liSize*v;li.css({width:li.width()});ul.css(sizeCss,ulSize+"px").css(animCss,-(curr*liSize));div.css(sizeCss,divSize+"px");if(o.btnPrev)
$(o.btnPrev).click(function(){return go(curr-o.scroll);});if(o.btnNext)
$(o.btnNext).click(function(){return go(curr+o.scroll);});if(o.btnGo)
$.each(o.btnGo,function(i,val){$(val).click(function(){return go(o.circular?o.visible+i:i);});});if(o.mouseWheel&&div.mousewheel)
div.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll);});if(o.auto)
setInterval(function(){go(curr+o.scroll);},o.auto+o.speed);function vis(){return li.slice(curr).slice(0,v);};function go(to){if(!running){if(o.beforeStart)
o.beforeStart.call(this,vis());if(o.circular){if(to<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*liSize)+"px");curr=to==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll;}else if(to>=itemLength-v+1){ul.css(animCss,-((v)*liSize)+"px");curr=to==itemLength-v+1?v+1:v+o.scroll;}else curr=to;}else{if(to<0||to>itemLength-v)return;else curr=to;}
running=true;ul.animate(animCss=="left"?{left:-(curr*liSize)}:{top:-(curr*liSize)},o.speed,o.easing,function(){if(o.afterEnd)
o.afterEnd.call(this,vis());running=false;});if(!o.circular){$(o.btnPrev+","+ o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled");}}
return false;};});};function css(el,prop){return parseInt($.css(el[0],prop))||0;};function width(el){return el[0].offsetWidth+ css(el,'marginLeft')+ css(el,'marginRight');};function height(el){return el[0].offsetHeight+ css(el,'marginTop')+ css(el,'marginBottom');};})(jQuery);
//]]>
</script>
<body>
<center><img src='https://csdl.hung.pro.vn/LOGO-HUNG-PRO-WEBP.png'/>
</center>
<p>We are sorry for this blog while we close, perhaps to the fore we don't use blog <b><span style='color:#ff0000'>HÙNG PRO VN</span></b> again and Changed into a new Blog, wait his coming :), we will announce them later in social media if we have issued our new blog with the theme or template that is super than ever. Thank you for your attention :)</p>
<p><a href='http://hung.pro.vn/'>HUNG.PRO.VN</a></p>
<div id='carousel'>
<div id='previous_button'></div>
<div class='container'>
<script>
  document.write("<script src=\"https://www.hung.pro.vn/feeds/posts/default/?max-results="+numposts1+"&orderby=published&alt=json-in-script&callback=showrecentposts\"><\/script>");
</script>
<div class='clear'></div>
</div>
<div id='next_button'></div>
</div>
<script type='text/javascript'>
(function($) {     $(document).ready(function(){
$("#carousel .container").jCarouselLite({
    auto:4000,
    scroll: 1,
    speed: 800,   
    visible: 4,
    start: 0,
    circular: true,
    btnPrev: "#previous_button",
    btnNext: "#next_button"
    });
    })})(jQuery)   
</script>
<script type='text/javascript'>
//<![CDATA[
function changetargetlink(x){
var a = document.getElementsByTagName('a');
var args = changetargetlink.arguments;
for(var i in a){
a[i].target = "_blank";
a[i].rel = "_blank";
for(var j=0;j<args.length;j++){
if(a[i].href.match(args[j])){
a[i].target = "";
a[i].rel = "";
}}}}
  changetargetlink('http://baotri.theme.pro.vn/');
//]]>
</script>
<style type='text/css'>body, a, a:hover {cursor: url(https://blogger.googleusercontent.com/img/proxy/AVvXsEjljjfcLRV0GpgxfRaBzN3gOvQqxpo_j92LDKfhRZgydViDN-MEMa3lVneuLA5p4STmlNVRoynjHjX7m2BMMqhf5erzmVwaKQzkqNyJDYlJgIXMTg8MsOBsJeLuerZs4ga0isS8AEnUkMIAtZSBF4aXlA=s0-d), progress;}</style>
<div class='main no-items section' id='main'></div>
<!-- Don't Ctrl + U -->
<script type='text/javascript'>
//<![CDATA[
shortcut={all_shortcuts:{},add:function(a,b,c){var d={type:"keydown",propagate:!1,disable_in_input:!1,target:document,keycode:!1};if(c)for(var e in d)"undefined"==typeof c[e]&&(c[e]=d[e]);else c=d;d=c.target,"string"==typeof c.target&&(d=document.getElementById(c.target)),a=a.toLowerCase(),e=function(d){d=d||window.event;if(c.disable_in_input){var e;d.target?e=d.target:d.srcElement&&(e=d.srcElement),3==e.nodeType&&(e=e.parentNode);if("INPUT"==e.tagName||"TEXTAREA"==e.tagName)return}d.keyCode?code=d.keyCode:d.which&&(code=d.which),e=String.fromCharCode(code).toLowerCase(),188==code&&(e=","),190==code&&(e=".");var f=a.split("+"),g=0,h={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"},i={esc:27,escape:27,tab:9,space:32,"return":13,enter:13,backspace:8,scrolllock:145,scroll_lock:145,scroll:145,capslock:20,caps_lock:20,caps:20,numlock:144,num_lock:144,num:144,pause:19,"break":19,insert:45,home:36,"delete":46,end:35,pageup:33,page_up:33,pu:33,pagedown:34,page_down:34,pd:34,left:37,up:38,right:39,down:40,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},j=!1,l=!1,m=!1,n=!1,o=!1,p=!1,q=!1,r=!1;d.ctrlKey&&(n=!0),d.shiftKey&&(l=!0),d.altKey&&(p=!0),d.metaKey&&(r=!0);for(var s=0;k=f[s],s<f.length;s++)"ctrl"==k||"control"==k?(g++,m=!0):"shift"==k?(g++,j=!0):"alt"==k?(g++,o=!0):"meta"==k?(g++,q=!0):1<k.length?i[k]==code&&g++:c.keycode?c.keycode==code&&g++:e==k?g++:h[e]&&d.shiftKey&&(e=h[e],e==k&&g++);if(g==f.length&&n==m&&l==j&&p==o&&r==q&&(b(d),!c.propagate))return d.cancelBubble=!0,d.returnValue=!1,d.stopPropagation&&(d.stopPropagation(),d.preventDefault()),!1},this.all_shortcuts[a]={callback:e,target:d,event:c.type},d.addEventListener?d.addEventListener(c.type,e,!1):d.attachEvent?d.attachEvent("on"+c.type,e):d["on"+c.type]=e},remove:function(a){var a=a.toLowerCase(),b=this.all_shortcuts[a];delete this.all_shortcuts[a];if(b){var a=b.event,c=b.target,b=b.callback;c.detachEvent?c.detachEvent("on"+a,b):c.removeEventListener?c.removeEventListener(a,b,!1):c["on"+a]=!1}}},shortcut.add("Ctrl+U",function(){top.location.href="http://www.hung.pro.vn/p/privacy-policy.html"});
//]]>
</script>
<!-- /End Don't Ctrl + U -->
<!-- don't clip right -->
<style type='text/css'>
body{
-webkit-touch-callout: none;
-webkit-user-select: none; 
-moz-user-select: none; 
-ms-user-select: none; 
-o-user-select: none;
user-select: none;
}
</style>
<script type='text/javascript'>
//<![CDATA[
// JavaScript Document
var message="NoRightClicking"; function defeatIE() {if (document.all) {(message);return false;}} function defeatNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=defeatNS;} else{document.onmouseup=defeatNS;document.oncontextmenu=defeatIE;} document.oncontextmenu=new Function("return false")
//]]>
</script>
<!-- dont ctrl + U BomKhung.Info-->
<script type='text/javascript'> 
//<![CDATA[
shortcut={all_shortcuts:{},add:function(a,b,c){var d={type:"keydown",propagate:!1,disable_in_input:!1,target:document,keycode:!1};if(c)for(var e in d)"undefined"==typeof c[e]&&(c[e]=d[e]);else c=d;d=c.target,"string"==typeof c.target&&(d=document.getElementById(c.target)),a=a.toLowerCase(),e=function(d){d=d||window.event;if(c.disable_in_input){var e;d.target?e=d.target:d.srcElement&&(e=d.srcElement),3==e.nodeType&&(e=e.parentNode);if("INPUT"==e.tagName||"TEXTAREA"==e.tagName)return}d.keyCode?code=d.keyCode:d.which&&(code=d.which),e=String.fromCharCode(code).toLowerCase(),188==code&&(e=","),190==code&&(e=".");var f=a.split("+"),g=0,h={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"},i={esc:27,escape:27,tab:9,space:32,"return":13,enter:13,backspace:8,scrolllock:145,scroll_lock:145,scroll:145,capslock:20,caps_lock:20,caps:20,numlock:144,num_lock:144,num:144,pause:19,"break":19,insert:45,home:36,"delete":46,end:35,pageup:33,page_up:33,pu:33,pagedown:34,page_down:34,pd:34,left:37,up:38,right:39,down:40,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},j=!1,l=!1,m=!1,n=!1,o=!1,p=!1,q=!1,r=!1;d.ctrlKey&&(n=!0),d.shiftKey&&(l=!0),d.altKey&&(p=!0),d.metaKey&&(r=!0);for(var s=0;k=f[s],s<f.length;s++)"ctrl"==k||"control"==k?(g++,m=!0):"shift"==k?(g++,j=!0):"alt"==k?(g++,o=!0):"meta"==k?(g++,q=!0):1<k.length?i[k]==code&&g++:c.keycode?c.keycode==code&&g++:e==k?g++:h[e]&&d.shiftKey&&(e=h[e],e==k&&g++);if(g==f.length&&n==m&&l==j&&p==o&&r==q&&(b(d),!c.propagate))return d.cancelBubble=!0,d.returnValue=!1,d.stopPropagation&&(d.stopPropagation(),d.preventDefault()),!1},this.all_shortcuts[a]={callback:e,target:d,event:c.type},d.addEventListener?d.addEventListener(c.type,e,!1):d.attachEvent?d.attachEvent("on"+c.type,e):d["on"+c.type]=e},remove:function(a){var a=a.toLowerCase(),b=this.all_shortcuts[a];delete this.all_shortcuts[a];if(b){var a=b.event,c=b.target,b=b.callback;c.detachEvent?c.detachEvent("on"+a,b):c.removeEventListener?c.removeEventListener(a,b,!1):c["on"+a]=!1}}},shortcut.add("Ctrl+U",function(){top.location.href="http://www.bomkhung.info/p/ban-quyen-bom-khung-blogger.html"}),shortcut.add("F12",function(){top.location.href="http://www.bomkhung.info/p/ban-quyen-bom-khung-blogger.html"}),shortcut.add("Ctrl+Shift+I",function(){top.location.href="http://www.bomkhung.info/p/ban-quyen-bom-khung-blogger.html"}),shortcut.add("Ctrl+S",function(){top.location.href="http://www.bomkhung.info/p/ban-quyen-bom-khung-blogger.html"}),shortcut.add("Ctrl+Shift+C",function(){top.location.href="http://www.bomkhung.info/p/ban-quyen-bom-khung-blogger.html"}); //]]> </script>
<!-- end -->
<iframe allowfullscreen='true' frameborder='0' height='1' scrolling='no' src='https://mp3.zing.vn/embed/song/ZW8WA7WB?start=true' width='1'></iframe>
</body>
</html>
DEMO

Mọi người lưu ý khi áp dụng mẫu giao diện này thì nhớ thay đổi địa chỉ link "https://www.hung.pro.vn/feeds/posts/default/?max-results=" trong theme lại để hiển thị bài viết mà các bạn muốn hiển thị trong giao diện nhé. Xem xét nếu thấy hợp lý thì áp dụng cho web/blog của bản thân nhé.

Cảm ơn mọi người đã quan tâm.

on Thứ Sáu, 14 tháng 6, 2024 | , , , , , | A comment?

[BLOGGER] Create more pens on pages for blogspot 2024


Hi mọi người, sau những ngày lễ rảnh rỗi mình đã thay đổi giao diện blogger hiện tại từ một giao diện cũng khá ổn sang giao diện mình tự design và tối ưu cũng khá ổn đối với bản thân chứ chưa thực sự ok với mọi người.

[BLOGGER] Hiệu ứng lên đầu trang cho blogspot mới nhất 2024

Và mình đã thêm nhiều thứ vào giao diện hiện tại của mình và mình cảm nhận được hiệu ứng lên đầu trang (back to top) nhìn khá vui nên hôm nay mình sẽ chia sẽ cho mọi người được biết và mọi người áp dụng cho blog của bạn thân để có một giao diện đẹp mắt nha.


Chúng ta bắt đầu thôi.

Bước 1: Các bạn thêm đoạn mã CSS bên dưới vào trong giao diện của các bạn nhé.
#mybacktotop {
  background: url(https://csdl.hung.pro.vn/ICON/back-to-top.png) 0 0 no-repeat;
  height: 130px;
  width: 72px;
  padding: 5px;
  position: fixed;
  bottom: 5px;
  right: 5px;
  cursor: pointer;
  transition: none;
  z-index: 15;
}
#mybacktotop:hover {
  background: url(https://csdl.hung.pro.vn/ICON/back-to-top.png) no-repeat;
  background-position: 0 -142px;
}

Ở phía trên có 2 đường link mình bôi đỏ, đó là hình ảnh như ở giao diện mình đang sữ dụng. Mọi người có thể tải về lưu trử trên hosting riêng hoặc cơ sỡ dữ liệu riêng của các bạn nhé. hoặc sữ dụng trực tiếp luôn của mình nhé.

Bước 2. Mình thêm đoạn code Javascript bên dưới vào trên khung </body> nhé.
<script type="text/javascript">
//<![CDATA[
$(window).scroll(function(){if($(this).scrollTop()>100)
{$("#mybacktotop").removeAttr("href");$("#mybacktotop").stop().animate(
{bottom:"0"},{duration:100,queue:false})}
else{$("#mybacktotop").stop().animate({bottom:"30000"},
{duration:8000,queue:false})}});$(function()
{$("#mybacktotop").click(function()
{$("html, body").animate({scrollTop:0},"slow");
return false})});
//]]>
</script>

Và cuối cùng đễ gọi thủ thuật đó ra blog của các bạn thì sữ dụng đoạn mã này để gọi ra nhé.
<a href="#" id="mybacktotop"></a>

Như vậy đã hoàn thành xong việc thêm tiện ích trở về đầu trang cho blogspot rồi nhé.

Lưu lại giao diện và tận hưởng kết quả thôi nhé mọi người, và demo giao diện đó mình đang sữ dụng, mọi người cỏ thể xem tại trang blog này của mình.
DEMO TẠI ĐÂY

on Thứ Tư, 1 tháng 5, 2024 | , , | A comment?

[JAVASRIPT] Get the direct download link from Google Drive


Xin chào các bạn, bài viết hôm nay mình sẽ hướng dẫn các bạn cách download link trực tiếp từ dịch vụ chia sẽ file Google Drive.

[JAVASCRIPT] Lấy link download trực tiếp từ Google Drive

Hiện nay, Google Drive là một trong những dịch vụ chia sẽ file phổ biến, giúp cho chúng ta dễ dàng upload source code hay dữ liệu của mình lên Google Drive, mà không phải lưu ở hosting, giúp giảm dung lượng cho hosting của chúng ta.

Nhưng mặc định Google Drive chỉ cho phép chúng ta chia sẽ link nhưng không được download trực tiếp.

Khi chúng ta click vào link Google Drive, thì sẽ mở đến Website của Google.

Vậy chúng ta sẽ làm cách nào để khi click vào link thì trình duyệt sẽ tự động get link và download trực tiếp file về, không phải thông qua Website Google Drive.

VD: mình có một link download google drive như sau
https://drive.google.com/file/d/1TnnK9Fn5g66Ivzli9e7DjR63q47-63KF/view

phần mình bôi đậm ở trên là ID của file google drive, các bạn chuyển đường dẫn link ở trên thành đường dẫn bên dưới:
https://docs.google.com/file/d/1TnnK9Fn5g66Ivzli9e7DjR63q47/edit

Kết quả khi chúng ta lấy link thứ hai, thì trình duyệt sẽ tự động download về.

Dưới đây mình sẽ chia sẽ cho các bạn hàm Javascript để lấy Id từ đường dẫn link google drive, để chúng ta edit lại đường link của nó.
<script>    
        function getIdFromGoogleDrive(url) {
          var id = "";
          var parts = url.split(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/);
          if (url.indexOf('?id=') >= 0){
             id = (parts[6].split("=")[1]).replace("&usp","");
             return id;
           } else {
           id = parts[5].split("/");
           //Using sort to get the id as it is the longest element. 
           var sortArr = id.sort(function(a,b){return b.length - a.length});
           id = sortArr[0];
           return id;
           }
         }
    </script>

Chúc mọi người thành công với thủ thuật trên.
 
Qua bài trên mình chỉ hướng dẫn các bạn biết cách để thực hiện việc lấy link download một cách nhanh chống để mọi người viết chương trình tích hợp việc download tốt nhất đễ tích hợp vào chương trình nhé. Và qua thủ thuật trên mình cũng chia sẽ cho mọi người chương trình lấy link tải từ google drive từ website chứ không nhất thiết phải viết chương trình máy tính nhé mọi người.

on Chủ Nhật, 28 tháng 4, 2024 | , , | A comment?

[JAVASCRIPT] Introduction to Debounce Function

Các sự kiện input từ người dùng (thông qua mouse, keyboard,…) thường diễn ra với tần suất rất nhanh. Điều này khiến hàm xử lý sự kiện được thực thi rất nhiều rất và có thể ảnh hưởng đến performance cũng như user experience (UX), đặc biệt khi việc input tác động đến giao diện trang web. Để khắc phục điều này, ta hãy tìm hiểu và ứng dụng phương pháp “Debounce” trong javascript.

Giới Thiệu

Debounce, hiểu một cách đơn giản, là một khái niệm chỉ sự giới hạn việc thực thi một đoạn code liên tục với tần suất nhanh.

Để hiểu rõ hơn, ta hãy tìm hiểu cách hiện thực hàm debounce() của thư viện underscore.js. Đây là một phiên bản cũ của hàm debounce() trong underscore.js. Phiên bản này cũng hoạt động tương tự như phiên bản mới nhưng ngắn gọn và dễ hiểu hơn nên tôi dùng nó để minh họa.
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
     var timeout;
     return function() {
          var context = this, args = arguments;
          var later = function() {
               timeout = null;
               if (!immediate) func.apply(context, args);
          };
          var callNow = immediate && !timeout;
          clearTimeout(timeout);
          timeout = setTimeout(later, wait);
          if (callNow) func.apply(context, args);
     };
};

Tôi đã tạo một phiên bản rút gọn giúp bạn dễ hiểu hơn bằng cách loại bỏ bớt tham số immediate:

function debounce(func, wait) {
     var timeout;
     return function() {
          var context = this, args = arguments;
          var executeFunction = function() {
               func.apply(context, args);
          };
        clearTimeout(timeout);
        timeout = setTimeout(executeFunction, wait);
     };
};

Cách sử dụng hàm này:

// Usage
var handleClick = debounce(function (e) {
     // do stuff here
    console.log(e);
}, 500);
$("input").on("click", handleClick);

Theo cách hiện thực hàm debounce() bên trên, nếu đoạn code cần thực thi(được đại diện bởi tham số func) được gọi liên tục thì nó sẽ chỉ thực thi một lần duy nhất.

Điều này xảy ra do func được gọi sau một khoảng thời gian thông qua setTimeout(). Nếu có một lệnh thực thi func nữa xảy ra, nó sẽ hủy việc gọi func trước đó bằng clearTimeout() và tạo một setTimeout() mới cho func. Vậy nên chỉ có lệnh gọi cuối cùng được thực thi nếu sự kiện xảy ra quá nhanh. Như trong ví dụ trên, hai sự kiện click phải được gọi cách nhau một khoảng thời gian tối thiểu là 500 milisecond.

Lời Kết

Có một hàm tương tự trong underscore.js mà bạn có thể tìm hiểu để sử dụng đó là throttle(). Bạn có thể thấy sự khác biệt của hai hàm này qua demo sau: http://jsfiddle.net/amyseqmedia/dD99u/37/ hoặc có thể xem ở bên dưới 


Ngoài ra, bạn có thể tận dụng các ưu điểm của requestAnimationFrame()
thay thế cho setTimeout(), bạn thậm chí có thể không cần đến tham số wait khi sử dụng phương pháp này.

on Thứ Sáu, 19 tháng 4, 2024 | | A comment?