Oauth imgur - Changed the version check, to only show something if a version was supplied. Made the oauth-imgur.html work with alerts.

This commit is contained in:
Robin 2018-06-19 13:33:11 +02:00
commit 1a42f23258
2 changed files with 26 additions and 20 deletions

View file

@ -15,13 +15,13 @@ release_blog_posts["1.2.9.129"] = "/2017/01/28/129-bug-bash/";
</script>
<div id="currentVersion" class="alert alert-success collapse" role="alert">
<i class="fa fa-check-circle"></i> You installed the most recent version of Greenshot.
<div id="blogPost1" class="collapse">More information about the version you installed can be found <a id="blog1" href="">here</a>.</div>
<i class="fa fa-check-circle"></i> You are using the most recent version of Greenshot.
<div id="blogPost1" class="collapse">More information about this version can be found <a id="blog1" href="">here</a>.</div>
</div>
<div id="oldVersion" class="alert alert-danger collapse" role="alert">
<i class="fa fa-exclamation-triangle"></i> <strong>You are not using the newest Greenshot version.</strong><br/>
<div id="blogPost2" class="collapse">More information about the version you installed can be found <a id="blog2" href="">here</a>.</div>
You might want to download the newest version, which is {{ latest_release.tag_name }}, from <a href="/downloads/">here</a>. Also always make sure to get Greenshot from <a href="http://getgreenshot.org/">getgreenshot.org</a>, .
<div id="blogPost2" class="collapse">More information about the version you are using can be found <a id="blog2" href="">here</a>.</div>
You might want to download the newest version, which is {{ latest_release.tag_name }}, from <a href="/downloads/">here</a>. Also always make sure to get Greenshot from <a href="https://getgreenshot.org/">getgreenshot.org</a>, .
</div>
<script>
@ -70,21 +70,26 @@ function compareVersion(a, b) {
// Otherwise they are the same.
return 0;
}
var installedVersion = /version=([^&]+)/.exec(location)[1];
var greenshotTag = {% if latest_release.tag_name %}"{{ latest_release.tag_name }}"{% else %}"Greenshot-Test-1.2.9.129"{% endif %};
var releaseVersion = /.*(\d+\.\d+\.\d+\.\d+)/.exec(greenshotTag)[1];
var compare=compareVersion(releaseVersion, installedVersion);
var matchingBlogPost = release_blog_posts[installedVersion];
if (matchingBlogPost) {
var versionMatch = /version=([^&]+)/.exec(location);
if (versionMatch) {
var installedVersion = versionMatch[1];
var greenshotTag = {% if latest_release.tag_name %}"{{ latest_release.tag_name }}"{% else %}"Greenshot-Test-1.2.9.129"{% endif %};
var releaseVersion = /.*(\d+\.\d+\.\d+\.\d+)/.exec(greenshotTag)[1];
var compare=compareVersion(releaseVersion, installedVersion);
var matchingBlogPost = release_blog_posts[installedVersion];
if (matchingBlogPost) {
jQuery('#blog1').prop("href", matchingBlogPost);
jQuery('#blogPost1').slideToggle();
jQuery('#blog2').prop("href", matchingBlogPost);
jQuery('#blogPost2').slideToggle();
}
if (compare >= 1) {
}
if (compare >= 1) {
jQuery('#oldVersion').slideToggle();
} else if (compare == 0) {
} else if (compare == 0) {
jQuery('#currentVersion').slideToggle();
}
} else {
jQuery('#currentVersion').slideToggle();
}
</script>

View file

@ -3,10 +3,11 @@ layout: oauth
title: Greenshot authenticated with Imgur
permalink: /oauth/imgur
categories: [oauth]
tags: [uses_alerts]
comments: []
---
{% include version-check.html %}
{% include oauth-out-of-bounds.html %}
{% include version-check.html %}
<p>
Greenshot should now be authenticated to use Imgur, you can close this window.
<p>