谁都知道?关于tumblr api/read/json中的头像网址?比如facebook?
http://graph.facebook.com/ [your facebook id]/picture?type = normal
<?php
$tumblog = 'natadec0c0'; // change to your username
// if your Tumblog is self hosted, you need to change the base url to the location of your tumblog
$baseurl = 'http://' . $tumblog . '.tumblr.com';
$request = $baseurl . '/api/read/json';
$ci = curl_init($request);
curl_setopt($ci,CURLOPT_RETURNTRANSFER, TRUE);
$input = curl_exec($ci);
curl_close($ci);
// Tumblr JSON doesn't come in standard form, some str replace needed
$input = str_replace('var tumblr_api_read = ','',$input);
$input = str_replace(';','',$input);
// …Run Code Online (Sandbox Code Playgroud) 在创建Tumblr帖子和使用HTML编辑器选项时,当我向元素添加特定的HTML属性时,TinyMCE富文本编辑器几乎可以删除所有内容.
即:
<span class="something" data-random="foobar">
Run Code Online (Sandbox Code Playgroud)
成为这个:
<span class="something">
Run Code Online (Sandbox Code Playgroud)
这不受影响:
<span class="something" title="foobar">
Run Code Online (Sandbox Code Playgroud)
那么我可以1)禁用这个擦除(这是荒谬的,至少它当前如何实现)或2)获取所有有效属性的列表,以便我可以选择最佳的语义选择?
所以我试图将这些图像放在我正在构建的页面的侧边栏上,这些图像是静态的,但是当你鼠标悬停时它们会像GIF一样动画.我目前的设置是让background-imagecss属性图像正常为静态jpg,但在鼠标悬停时更改为动画gif.这是代码,更好地说明我的观点.
CSS:
#segments li a.fnb {
background-image: url(http://dl.dropbox.com/u/8808984/2.0/SegmentThumbs/fnb%21-small.jpg); /*fallback*/
}
#segments li a.whhu {
background-image: url(http://dl.dropbox.com/u/8808984/2.0/SegmentThumbs/still.jpg);
}
#segments li a.fnb:hover {
background-image: url(http://dl.dropbox.com/u/8808984/2.0/SegmentThumbs/549933.gif);
}
#segments li a.whhu:hover {
background-image: url(http://dl.dropbox.com/u/8808984/2.0/SegmentThumbs/549841.gif);
}
Run Code Online (Sandbox Code Playgroud)
我会把你从其余的中解脱出来,没有必要说明我的观点.
HTML:
<ul id="segments">
<li><a href="http://collabprojekt.com/tagged/fnb!" class="fnb"></a></li>
<li><a href="http://collabprojekt.com/tagged/whhu" class="whhu"></a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
该网站是http://tcptest.tumblr.com,请查看左侧栏中的图片,了解它目前是如何运作的.
这是有效的,但我唯一的问题是,对于第一次悬停,它必须加载gif,这会导致一个短暂的时刻,当它加载gif时框变为空白.虽然这不是一个大问题,但看起来真的很不专业.
我尝试了使用JS的这个想法(链接),但它让我失望了.
所以我想我的问题是:有没有更好的方法来使用CSS甚至任何其他语言来做到这一点,这样我就不会得到这个随机的空白时刻?
看看这里和谷歌小组关于这个主题的各种帖子,我正在尝试使用ciceron主题中的脚本来重现心脏(如)按钮,但到目前为止我还没有成功.
以下是我的代码.我错过了什么?有人设法解决了吗?
在<head>:
<script type="text/javascript" src="http://static.tumblr.com/53unaru/y8wlgzkbt/jquery.ui.totop.js"></script>
<script type="text/javascript">
$('a.like-link').click(function() {
var post = $(this).closest('.post');
var id = post.attr('id');
var oauth = post.attr('rel').slice(-8);
var like = 'http://www.tumblr.com/like/'+oauth+'?id='+id;
$('#likeit').attr('src', like);
$(this).addClass('liked'); return
false;})
</script>
Run Code Online (Sandbox Code Playgroud)
在CSS部分<head>:
#likeit {height: 0; width: 0; visibility: hidden;}
Run Code Online (Sandbox Code Playgroud)
在<body>:
<iframe id="likeit"></iframe>
in {Block:post}:
<a href="#" class="like-link">Like</a>
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Infinite Scroll中使用新的Tumblr类按钮(允许你的主题在主页上的各个Tumblr帖子上的类似按钮),它们适用于第一个"页面"的前15个帖子,但是一旦它加载另一个页面之类的按钮停止工作.这些是Tumblr在Docs页面上给出的说明:
功能:Tumblr.LikeButton.get_status_by_page(n)
描述:请求新的帖子页面后调用此函数.将刚刚加载的页码作为整数.功能:Tumblr.LikeButton.get_status_by_post_ids([n,n,n])
描述:请求喜欢各个帖子的状态.获取一系列帖子ID.
由于我不确定如何正确应用JQuery,我不知道在哪里添加这些函数,这是我当前主题的JS:
// MASONRY
var $container = $('#content');
$container.imagesLoaded( function(){
$container.masonry({
itemSelector: '.entry',
columnWidth: 220
});
});
// INFINITE SCROLL
$container.infinitescroll({
navSelector : '#pagination',
nextSelector : '#pagination li a.pagination_nextlink',
itemSelector : '.entry',
loading: {
img: 'http://static.tumblr.com/glziqhp/K37m9yaub/257__1_.gif'
}
},
function( newElements ) {
var $newElems = $( newElements ).css({
opacity: 0
});
$newElems.imagesLoaded(function(){
$newElems.animate({
opacity: 1
});
$container.masonry(
'appended', $newElems, true
);
});
});
Run Code Online (Sandbox Code Playgroud) 似乎Tumblr没有提供div标签来自定义"找不到网址"页面的外观.有没有其他方法来自定义404(URL NOT FOUND)页面?
所以我从400获得了这个问题http://www.tumblr.com/oauth/authorize?oauth_token=xxx.我使用此Google Chrome OAuth教程页面,只是从那里复制文件.
这一切都有效,直到有一天我不得不重新授权我的扩展.它失败了.
当我得到控制台时,我得到400个http结果代码和一条消息Missing or invalid oauth_verifier..
我制作了一个脚本来检索我的一个博客的所有帖子标题的字符串.问题是我无法检索超过20个标题.
理论上,http ://www.tumblr.com/docs/en/api/v1 说:"默认包含最近的20个帖子.你可以传递这些可选的GET参数:.... num - 帖子数量返回.默认值为20,最大值为50. ....."
我应该能够获得最多50?
我的GET代码如下所示:
$.ajax({
url: "http://api.tumblr.com/v2/blog/var-lak.tumblr.com/posts?api_key=(my-api-key)text?limit=50&format=text",
dataType: 'jsonp',
success: function(results){
//.....
Run Code Online (Sandbox Code Playgroud)
在此先感谢,Attila
注意:这是我之前的一个后续问题.
我决定通过#posts元素内的扩展程序将帖子显示在仪表板上.现在我的问题是Tumblr在滚动时自动删除帖子的内容.
以下是删除前正常帖子的示例:
<li class="post_container" data-pageable="post_110141415125">
<div class="post post_full ..." [...]>
<!-- ... -->
</div>
</li>
Run Code Online (Sandbox Code Playgroud)
删除其内容后,同一帖子:
<li class="post_container" data-pageable="post_110141415125" style="border-radius: 3px; height: 207px; width: 540px; background-color: rgb(255, 255, 255);">
</li>
Run Code Online (Sandbox Code Playgroud)
由于我的扩展程序将帖子重新定位为类似于pinterest的布局,因此删除帖子的内容会影响整个布局.是否可以阻止Tumblr仪表板移除每个内部的DOM元素.post?
编辑:
我removeChild在我的内容脚本中为该方法添加了这个注入代码:
function addScript(){
var script = document.createElement('script');
script.id = 'newRemoveChildScript'; ///just to find is faster in the code
script.src = chrome.extension.getURL("injectedCode.js");
$($('script')[0]).before(script); ///Script is indeed present, I checked that
} …Run Code Online (Sandbox Code Playgroud) 当我在tumblr上分享链接时,它有时会抓住该页面的博客文章图片.例如,如果我分享如下内容:
http://www.smartpassiveincome.com/income-reports/my-may-2016-monthly-income-report/
Run Code Online (Sandbox Code Playgroud)
它将获取此图像的缩略图:
http://cdn.smartpassiveincome.com/wp-content/uploads/2016/03/Income-Reports-legacy-posts.jpg
你怎么让tumblr抓住图像?是否需要包含一些元标记?
搜索源代码此图像出现三次:
<meta property="og:image" content="http://cdn.smartpassiveincome.com/wp-content/uploads/2016/03/Income-Reports-legacy-posts.jpg"/>
<meta name="twitter:image" content="http://cdn.smartpassiveincome.com/wp-content/uploads/2016/03/Income-Reports-legacy-posts.jpg"/>
<header style="background-image: url('http://cdn.smartpassiveincome.com/wp-content/uploads/2016/03/Income-Reports-legacy-posts.jpg')">
Run Code Online (Sandbox Code Playgroud)
有谁知道它使用哪一个,并可以解释选择如何抓取图像的过程是什么?
原始页面是:http://www.patchesoft.com/learning-linux-how-to-find-what-version-of-linux-youre-running-command-uname-and-lsb_release/
但是当我把它发布到Tumblr时,它并没有抓住特色图片.