mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 16:25:22 +03:00
Fix wiki (#3537)
* fix board wiki url * fix board wiki url * fix board wiki url * Update src/js/utils/common.js Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * Update src/js/utils/common.js Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * Update src/js/tabs/firmware_flasher.js Co-authored-by: Mark Haslinghuis <mark@numloq.nl> --------- Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
This commit is contained in:
parent
4204281f46
commit
058ab5b38a
2 changed files with 16 additions and 3 deletions
|
@ -16,7 +16,7 @@ import serial from '../serial';
|
|||
import STM32DFU from '../protocols/stm32usbdfu';
|
||||
import { gui_log } from '../gui_log';
|
||||
import semver from 'semver';
|
||||
import { checkChromeRuntimeError } from '../utils/common';
|
||||
import { checkChromeRuntimeError, urlExists } from '../utils/common';
|
||||
import { generateFilename } from '../utils/generate_filename';
|
||||
|
||||
const firmware_flasher = {
|
||||
|
@ -107,10 +107,15 @@ firmware_flasher.initialize = function (callback) {
|
|||
$('div.release_info #targetMCU').text(summary.mcu);
|
||||
$('div.release_info .configFilename').text(self.isConfigLocal ? self.configFilename : "[default]");
|
||||
|
||||
// Wiki link to url found in unified target configuration or if not defined to general wiki url
|
||||
// Wiki link: #wiki found in unified target configuration, if board description exist or generel board missing
|
||||
let urlWiki = 'https://betaflight.com/docs/wiki/boards/missing'; // generel board missing
|
||||
const urlBoard = `https://betaflight.com/docs/wiki/boards/${summary.target}`; // board description
|
||||
if (urlExists(urlBoard)) {
|
||||
urlWiki = urlBoard;
|
||||
}
|
||||
const targetWiki = $('#targetWikiInfoUrl');
|
||||
targetWiki.html(` [Wiki]`);
|
||||
targetWiki.attr("href", summary.wiki === undefined ? "https://betaflight.com/docs/wiki/" : summary.wiki);
|
||||
targetWiki.attr("href", urlWiki);
|
||||
|
||||
if (summary.cloudBuild) {
|
||||
$('div.release_info #cloudTargetInfo').show();
|
||||
|
|
|
@ -91,6 +91,14 @@ export function getTextWidth(text) {
|
|||
return Math.ceil(context.measureText(text).width);
|
||||
}
|
||||
|
||||
export function urlExists(url) {
|
||||
let http = new XMLHttpRequest ();
|
||||
|
||||
http.open('HEAD', url, false);
|
||||
http.send();
|
||||
return http.status !== 404;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns jquery sorted option list with optional value staying on top of the list.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue