/**
* Thumbnail Helper
* @description Get the thumbnail url from a post
* @example
*     <%- thumbnail(post) %>
*/
hexo.extend.helper.register('thumbnail', function (post) {
    var url = post.thumbnail || post.banner || '';
    if (!url) {
        var imgPattern = /\<img\s.*?\s?src\s*=\s*['|"]?([^\s'"]+).*?\>/ig;
        var result = imgPattern.exec(post.content);
        if (result && result.length > 1) {
            url = result[1];
        }
        if(url.length > 0) {
            var pattern = /^[\\{0,1}\/{0,1}]([^\/^\\]+)/,
                pattern_ = /([^\/^\\]+)/;
            if ((ret = pattern.exec(url)) != null) {
                if(ret[0].length == url.length) {
                    url = post.path + ret[1];
                }
            } else if ((ret = pattern_.exec(url)) != null) {
                if(ret[0].length == url.length) {
                    url = post.path + ret[1];
                }
            }
        }
    }
    return url;
});
@@ -175,17 +175,14 @@
     
-var url =
+return
  pos
@@ -219,749 +219,7 @@
 '';%0A
-    if (!url) %7B%0A        var imgPattern = /%5C%3Cimg%5Cs.*?%5Cs?src%5Cs*=%5Cs*%5B'%7C%22%5D?(%5B%5E%5Cs'%22%5D+).*?%5C%3E/ig;%0A        var result = imgPattern.exec(post.content);%0A        if (result && result.length %3E 1) %7B%0A            url = result%5B1%5D;%0A        %7D%0A        if(url.length %3E 0) %7B%0A            var pattern = /%5E%5B%5C%5C%7B0,1%7D%5C/%7B0,1%7D%5D(%5B%5E%5C/%5E%5C%5C%5D+)/,%0A                pattern_ = /(%5B%5E%5C/%5E%5C%5C%5D+)/;%0A            if ((ret = pattern.exec(url)) != null) %7B%0A                if(ret%5B0%5D.length == url.length) %7B%0A                    url = post.path + ret%5B1%5D;%0A                %7D%0A            %7D else if ((ret = pattern_.exec(url)) != null) %7B%0A                if(ret%5B0%5D.length == url.length) %7B%0A                    url = post.path + ret%5B1%5D;%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A    return url;%0A
 %7D);

remove implict thumbnail declaration