. .
[iklan]

Random Post javascript Min (Singkat)

Sebagai catatan script untuk Random Post Blogspot. Script singkat dan bisa langsung dipasang di posting biasa atau di widget. Di bawah akan ditampilkan code css dan code javascriptnya. Bagi teman-teman bisa mencoba, tinggal copas saja. Bagi kami juga sebagai catatan, mungkin untuk blog lain atau di kesempatan lain memerlukan kembali.

Berikut adalah hasil dari script Random Post untuk blogger :

Cara Membuat Random Post javascript untuk Blogger






Berikut adalah code CSS dan Script cara membuat random post blogger:


 <h3 style="text-align: left;"><span style="color: #2b00fe;">Random </span>Post javascript untuk Blogger</h3>
<style>
#rp img{border-radius:10px;float:left;margin-right:5px;height:75px;transition:all 0.2s linear 0s}#rp img:hover{transform:scale(1.1)}ul#rp{padding:0;list-style-type:none}#rp a{padding:0px auto 5px}#rp a:hover{text-decoration:none}.rs{padding:5px;margin-right:8px}#rp li{margin-bottom:10px;border-bottom:1px solid#EEE}
</style>
<ul id="rp">
<script type="text/javaScript">
var num = 6;
var cha = 230;
var comm='Comments';var commd='Comments Disabled';var cur=[];var tot=0;var cur=new Array(num);function ranp(json){tot=json.feed.openSearch$totalResults.$t}document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&max-results=0&callback=ranp\"><\/script>');function getv(){for(var i=0;i<num;i++){var found=false;var rndValue=get_r();for(var j=0;j<cur.length;j++){if(cur[j]==rndValue){found=true;break}};if(found){i--}else{cur[i]=rndValue}}};function get_r(){var ranNum=1+Math.round(Math.random()*(tot-1));return ranNum};</script><script type="text/javaScript">function ran_p(json){for(var i=0;i<num;i++){var entry=json.feed.entry[i];var ranptitle=entry.title.$t;if('content'in entry){var ranpnippet=entry.content.$t}else{if('summary'in entry){var ranpnippet=entry.summary.$t}else{var ranpnippet=""}};ranpnippet=ranpnippet.replace(/<[^>]*>/g,"");if(ranpnippet.length<cha){var ranp_snippet=ranpnippet}else{ranpnippet=ranpnippet.substring(0,cha);var whitespace=ranpnippet.lastIndexOf(" ");ranp_snippet=ranpnippet.substring(0,whitespace)+"&#133;"};for(var j=0;j<entry.link.length;j++){if('thr$total'in entry){var commnum=entry.thr$total.$t+' '+comm}else{commnum=commd};if(entry.link[j].rel=='alternate'){var ranpurl=entry.link[j].href;var ranp_date=entry.published.$t;if('media$thumbnail'in entry){var ranpthumb=entry.media$thumbnail.url}else{ranpthumb="https://1.bp.blogspot.com/-NuVrQk3ssIk/YCPtqtvQM5I/AAAAAAAABaw/QYKN03opdckZyMYgpZuoTZVDFj4G13b_wCLcBGAsYHQ/s72-c/4%2Bpencarian%2Bcari%2Bsearch%2Bicon%2Bcall%2B%252823%2529.png"}}};document.write('<li>');document.write('<a target="_blank" href="'+ranpurl+'" rel="nofollow"><img alt="'+ranptitle+'" src="'+ranpthumb+'"/></a>');document.write('<div><a target="_blank" href="'+ranpurl+'" rel="nofollow">'+ranptitle+'</a></div>');document.write('<div class="rs">'+ranp_snippet+'</div><div style="clear:both"></div></li>')}};getv();for(var i=0;i<num;i++){document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&start-index='+cur[i]+'&max-results=1&callback=ran_p\"><\/script>')};
</script>
</ul>





Semoga berguna.

[dibuka]


    <script type="text/javaScript">
    var num=6;
    var cha=230;
    var comm='Comments';
    var commd='Comments Disabled';
    var cur=[];
    var tot=0;
    var cur=new Array(num);
    function ranp(json) {
        tot=json.feed.openSearch$totalResults.$t
    }

    document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&max-results=0&callback=ranp\"><\/script>');
    function getv() {
        for(var i=0;
        i<num;
        i++) {
            var found=false;
            var rndValue=get_r();
            for(var j=0;
            j<cur.length;
            j++) {
                if(cur[j]==rndValue) {
                    found=true;
                    break
                }
            }
            ;
            if(found) {
                i--
            }
            else {
                cur[i]=rndValue
            }
        }
    }

    ;
    function get_r() {
        var ranNum=1+Math.round(Math.random()*(tot-1));
        return ranNum
    }

    ;
    </script><script type="text/javaScript">function ran_p(json) {
        for(var i=0;
        i<num;
        i++) {
            var entry=json.feed.entry[i];
            var ranptitle=entry.title.$t;
            if('content'in entry) {
                var ranpnippet=entry.content.$t
            }
            else {
                if('summary'in entry) {
                    var ranpnippet=entry.summary.$t
                }
                else {
                    var ranpnippet=""
                }
            }
            ;
            ranpnippet=ranpnippet.replace(/<[^>]*>/g, "");
            if(ranpnippet.length<cha) {
                var ranp_snippet=ranpnippet
            }
            else {
                ranpnippet=ranpnippet.substring(0, cha);
                var whitespace=ranpnippet.lastIndexOf(" ");
                ranp_snippet=ranpnippet.substring(0, whitespace)+"&#133;"
            }
            ;
            for(var j=0;
            j<entry.link.length;
            j++) {
                if('thr$total'in entry) {
                    var commnum=entry.thr$total.$t+' '+comm
                }
                else {
                    commnum=commd
                }
                ;
                if(entry.link[j].rel=='alternate') {
                    var ranpurl=entry.link[j].href;
                    var ranp_date=entry.published.$t;
                    if('media$thumbnail'in entry) {
                        var ranpthumb=entry.media$thumbnail.url
                    }
                    else {
                        ranpthumb="https://1.bp.blogspot.com/-NuVrQk3ssIk/YCPtqtvQM5I/AAAAAAAABaw/QYKN03opdckZyMYgpZuoTZVDFj4G13b_wCLcBGAsYHQ/s72-c/4%2Bpencarian%2Bcari%2Bsearch%2Bicon%2Bcall%2B%252823%2529.png"
                    }
                }
            }
            ;
            document.write('<li>');
            document.write('<a target="_blank" href="'+ranpurl+'" rel="nofollow"><img alt="'+ranptitle+'" src="'+ranpthumb+'"/></a>');
            document.write('<div><a target="_blank" href="'+ranpurl+'" rel="nofollow">'+ranptitle+'</a></div>');
            document.write('<div class="rs">'+ranp_snippet+'</div><div style="clear:both"></div></li>')
        }
    }

    ;
    getv();
    for(var i=0;
    i<num;
    i++) {
        document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&start-index='+cur[i]+'&max-results=1&callback=ran_p\"><\/script>')
    }

    ;
    </script>
    </ul>



Karena template blog saya ini lebar, agar bisa menjadi dua kolom, saya tembahkan di css atau dalam kode <style> code sebagai berikut :

@media (min-width:700px){#rp li{width:49%;float:left;height:160px;overflow:hidden;margin:19px auto}}




0 comments:

Posting Komentar

Catatan Sementara

Assalamualaikum warahmatullahi wabarakatuh Bismillahirrohmanirrohim رَبَّنَا ظَلَمْنَاۤ اَنْفُسَنَا وَاِ نْ لَّمْ تَغْفِرْ لَـنَا وَتَرْحَمْنَا لَـنَكُوْنَنَّ مِنَ الْخٰسِرِيْنَ "Ya Tuhan kami, kami telah menzalimi diri kami sendiri. Jika Engkau tidak mengampuni kami dan memberi rahmat kepada kami, niscaya kami termasuk orang-orang yang rugi." (QS. Al-A'raf 7: Ayat 23). Ya Rahman ya Rahim, Jagalah kami dari neraka JahanamMu yg amat dahsyat. Sungguh, kami tidak akan mampu menjadi penghuninya, walau hanya sesaat. Yaa Aziz aku mohon , kembalikan kami smua di dlm Husnul khotimah.. Yaa ghofar ampuni dosa kedua orang tua kami , sdr2 kami serta orang2 Sholeh dan masukkan klg kami smua dlm surga-Mu . Aamiin 🤲
 
© 2021 Catatan Afandi Kusuma | www.suwur.com | Furniture.Omasae | JayaSteel | OmaSae | suwur | Galvalum | DepoAirIsiUlang | Seluruh Arsip