Commit 89ddc9b5 authored by lucha's avatar lucha
Browse files

[auto] plugin: autopost-to-mastodon 3.0

parent 509b8949
<?php
class Client
{
private $instance_url;
private $access_token;
private $app;
public function __construct($instance_url, $access_token = '') {
$this->instance_url = $instance_url;
$this->access_token = $access_token;
}
public function register_app($redirect_uri) {
$response = $this->_post('/api/v1/apps', array(
'client_name' => 'Mastodon Share for WordPress',
'redirect_uris' => $redirect_uri,
'scopes' => 'read write',
'website' => $this->instance_url
));
if (!isset($response->client_id)){
return "ERROR";
}
$this->app = $response;
$params = http_build_query(array(
'response_type' => 'code',
'scope' => 'read write',
'redirect_uri' => $redirect_uri,
'client_id' =>$this->app->client_id
));
return $this->instance_url.'/oauth/authorize?'.$params;
}
public function verify_credentials($access_token){
$headers = array(
'Authorization'=>'Bearer '.$access_token
);
$response = $this->_get('/api/v1/accounts/verify_credentials', null, $headers);
return $response;
}
public function get_bearer_token($client_id, $client_secret, $code, $redirect_uri) {
$response = $this->_post('/oauth/token',array(
'grant_type' => 'authorization_code',
'redirect_uri' => $redirect_uri,
'client_id' => $client_id,
'client_secret' => $client_secret,
'code' => $code
));
return $response;
}
public function get_client_id() {
return $this->app->client_id;
}
public function get_client_secret() {
return $this->app->client_secret;
}
public function postStatus($status, $mode, $media = '', $spoiler_text = '') {
$headers = array(
'Authorization'=> 'Bearer '.$this->access_token
);
$response = $this->_post('/api/v1/statuses', array(
'status' => $status,
'visibility' => $mode,
'spoiler_text' => $spoiler_text,
'media_ids[]' => $media
), $headers);
return $response;
}
public function create_attachment($media_path) {
$filename =basename($media_path);
$mime_type = mime_content_type($media_path);
$boundary ='hlx'.time();
$headers = array (
'Authorization'=> 'Bearer '.$this->access_token,
'Content-Type' => 'multipart/form-data; boundary='. $boundary,
);
$nl = "\r\n";
$data = '--'.$boundary.$nl;
$data .= 'Content-Disposition: form-data; name="file"; filename="'.$filename.'"'.$nl;
$data .= 'Content-Type: '. $mime_type .$nl.$nl;
$data .= file_get_contents($media_path) .$nl;
$data .= '--'.$boundary.'--';
$response = $this->_post('/api/v1/media', $data, $headers);
return $response;
}
private function _post($url, $data = array(), $headers = array()) {
return $this->post($this->instance_url.$url, $data, $headers);
}
public function _get($url, $data = array(), $headers = array()) {
return $this->get($this->instance_url.$url, $data, $headers);
}
private function post($url, $data = array(), $headers = array()) {
$args = array(
'headers' => $headers,
'body'=> $data,
'redirection' => 5
);
$response = wp_remote_post( $this->getValidURL($url), $args );
$responseBody = wp_remote_retrieve_body($response);
return json_decode($responseBody);
}
public function get($url, $data = array(), $headers = array()) {
$args = array(
'headers' => $headers,
'redirection' => 5
);
$response = wp_remote_get( $this->getValidURL($url), $args );
$responseBody = wp_remote_retrieve_body($response);
return json_decode($responseBody);
}
public function dump($value){
echo '<pre>';
print_r($value);
echo '</pre>';
}
private function getValidURL($url){
if ( $ret = parse_url($url) ) {
if ( !isset($ret["scheme"]) ){
$url = "http://{$url}";
}
}
return $url;
}
}
<?php
define("ACCOUNT_CONNECTED",isset($account) && $account !== null);
define("ADVANCED_VIEW",false);
?>
<div class="wrap">
<h1><?php esc_html_e( 'Mastodon Autopost Configuration', 'autopost-to-mastodon' ); ?></h1>
<br>
<a href="https://github.com/simonfrey/mastodon_wordpress_autopost" target="_blank" class="github-icon" target="_blank">
<svg aria-hidden="true" class="octicon octicon-mark-github" height="32" version="1.1" viewBox="0 0 16 16" width="32"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>
<a href="https://liberapay.com/Mastodon-Auto-Share-Team/donate" target="_blank"><img src="<?php echo plugins_url( 'img/donate.svg', __FILE__ );?>"></a>
<br>
<br>
<?php if(ACCOUNT_CONNECTED): ?>
<input type="button" class="button active tab-button" value="<?php esc_attr_e( 'Simple configuration', 'autopost-to-mastodon' ); ?>" id="hide_advanced_configuration">
<input type="button" class="button tab-button" value="<?php esc_attr_e( 'Advanced configuration', 'autopost-to-mastodon' ); ?>" id="show_advanced_configuration">
<?php endif ?>
<form method="POST">
<?php wp_nonce_field( 'autopostToMastodon-configuration' ); ?>
<table class="form-table">
<tbody>
<tr style="display:<?php echo !ACCOUNT_CONNECTED ? "block":"none"?>">
<th scope="row">
<label for="instance"><?php esc_html_e( 'Instance', 'autopost-to-mastodon' ); ?></label>
</th>
<td>
<input type="text" id="instance" name="instance" size="80" value="<?php esc_attr_e( $instance ); ?>" list="mInstances">
</td>
<td>
<input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Connect to Mastodon', 'autopost-to-mastodon' ); ?>" name="save" id="save">
</td>
</tr>
<tr style="display:<?php echo ACCOUNT_CONNECTED ? "block" : "none"?>">
<th scope="row">
<label><?php esc_html_e( 'Status', 'autopost-to-mastodon' ); ?></label>
</th>
<td>
<div class="account">
<?php if(ACCOUNT_CONNECTED): ?>
<a href="<?php echo $account->url ?>" target="_blank"><img class="m-avatar" src="<?php echo $account->avatar ?>"></a>
<?php endif ?>
<div class="details">
<?php if(ACCOUNT_CONNECTED): ?>
<div class="connected"><?php esc_html_e( 'Connected as', 'autopost-to-mastodon' ); ?>&nbsp;<?php echo $account->username ?></div>
<a class="link" href="<?php echo $account->url ?>" target="_blank"><?php echo $account->url ?></a>
<p><a href="<?php echo $_SERVER['REQUEST_URI'] . '&disconnect' ?>" class="button"><?php esc_html_e( 'Disconnect', 'autopost-to-mastodon' ); ?></a>
<a href="<?php echo $_SERVER['REQUEST_URI'] . '&testToot' ?>" class="button"><?php esc_html_e( 'Send test toot', 'autopost-to-mastodon' ); ?></a></p>
<?php else: ?>
<div class="disconnected"><?php esc_html_e( 'Disconnected', 'autopost-to-mastodon' ); ?></div>
<?php endif ?>
</div>
<div class="separator"></div>
</div>
</td>
</tr>
<tr class="advanced_setting">
<th scope="row">
<label for="content_warning"><?php esc_html_e( 'Default Content Warning', 'autopost-to-mastodon' ); ?></label>
</th>
<td>
<input type="text" id="content_warning" name="content_warning" style="width:300px" value="<?php esc_attr_e( $content_warning ); ?>">
</td>
</tr>
<tr style="display:<?php echo ACCOUNT_CONNECTED ? "block" : "none"?>">
<th scope="row">
<label for="message"><?php esc_html_e( 'Message', 'autopost-to-mastodon' ); ?></label>
</th>
<td class="advanced_setting">
<textarea rows="10" cols="80" name="message" id="message"><?php esc_html_e( stripslashes( $message ) ); ?></textarea>
<p class="description"><i><?php esc_html_e( 'You can use these metas in the message', 'autopost-to-mastodon' ); ?></i>
: [title], [excerpt], [permalink] <?php esc_html_e( 'and', 'autopost-to-mastodon' ); ?> [tags]</p>
</td>
<td class="not_advanced_setting messageRadioButtons">
<label>
<b>title</b><br>
<a href="">permalink</a><br><br><br>
<input type="radio" name="message_template" value="[title]&#10;&#10;[permalink]">
</label>
<label>
<b>title</b><br>
<a href="">permalink</a><br>#tags<br><br>
<input type="radio" name="message_template" value="[title]&#10;&#10;[permalink]&#10;&#10;[tags]">
</label>
<label>
<b>title</b><br>
<i>Here comes the excerpt...</i><br><a href="">permalink</a><br>
#tags<br>
<input type="radio" name="message_template" value="[title]&#10;&#10;[excerpt]&#10;&#10;[permalink]&#10;&#10;[tags]">
</label>
</td>
</tr>
<tr style="display:<?php echo ACCOUNT_CONNECTED ? "block" : "none"?>">
<th scope="row">
<label for="mode"><?php esc_html_e( 'Toot mode', 'autopost-to-mastodon' ); ?></label>
</th>
<td class="scopeRadioButtons">
<label><input type="radio" name="mode" <?php if ( 'public' === $mode ): ?>checked<?php endif; ?> value="public"><img src="<?php echo plugins_url( 'img/post/public.svg', __FILE__ );?>" class="modeIcon"> <?php esc_html_e( 'Public', 'autopost-to-mastodon' ); ?></label>
<label><input type="radio" name="mode" <?php if ( 'unlisted' === $mode ): ?>checked<?php endif; ?> value="unlisted"><img src="<?php echo plugins_url( 'img/post/unlisted.svg', __FILE__ );?>" class="modeIcon"> <?php esc_html_e( 'Unlisted', 'autopost-to-mastodon' ); ?></label>
<label><input type="radio" name="mode" <?php if ( 'private' === $mode ): ?>checked<?php endif; ?> value="private"><img src="<?php echo plugins_url( 'img/post/private.svg', __FILE__ );?>" class="modeIcon"> <?php esc_html_e( 'Private', 'autopost-to-mastodon' ); ?></label>
<label><input type="radio" name="mode" <?php if ( 'direct' === $mode ): ?>checked<?php endif; ?> value="direct"><img src="<?php echo plugins_url( 'img/post/direct.svg', __FILE__ );?>" class="modeIcon"> <?php esc_html_e( 'Direct', 'autopost-to-mastodon' ); ?></label>
</td>
</tr>
<tr class="advanced_setting">
<th scope="row">
<label for="size"><?php esc_html_e( 'Toot size', 'autopost-to-mastodon' ); ?></label>
</th>
<td>
<input name="size" id="size" type="number" min="100" max="500" value="<?php esc_attr_e( $toot_size ); ?>"> <?php esc_html_e( 'characters', 'autopost-to-mastodon' ); ?>
</td>
</tr>
<tr style="display:<?php echo ACCOUNT_CONNECTED ? "block" : "none"?>">
<th scope="row">
<label for="autopost_standard"><?php esc_html_e( 'Autopost new posts', 'autopost-to-mastodon' ); ?></label>
</th>
<td>
<input type="checkbox" id="autopost_standard" name="autopost_standard" value="on" <?php echo ( $autopost == 'on')?'checked':''; ?>>
</td>
</tr>
</tbody>
</table>
<?php if(ACCOUNT_CONNECTED): ?>
<input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Save configuration', 'autopost-to-mastodon' ); ?>" name="save" id="save">
<?php endif ?>
</form>
<?php
require("instanceList.php")
?>
</div>
<svg xmlns="http://www.w3.org/2000/svg" width="83" height="30"><rect id="back" fill="#f6c915" x="1" y=".5" width="82" height="29" rx="4"/><svg viewBox="0 0 80 80" height="16" width="16" x="7" y="7"><g transform="translate(-78.37-208.06)" fill="#1a171b"><path d="m104.28 271.1c-3.571 0-6.373-.466-8.41-1.396-2.037-.93-3.495-2.199-4.375-3.809-.88-1.609-1.308-3.457-1.282-5.544.025-2.086.313-4.311.868-6.675l9.579-40.05 11.69-1.81-10.484 43.44c-.202.905-.314 1.735-.339 2.489-.026.754.113 1.421.415 1.999.302.579.817 1.044 1.546 1.395.729.353 1.747.579 3.055.679l-2.263 9.278"/><path d="m146.52 246.14c0 3.671-.604 7.03-1.811 10.07-1.207 3.043-2.879 5.669-5.01 7.881-2.138 2.213-4.702 3.935-7.693 5.167-2.992 1.231-6.248 1.848-9.767 1.848-1.71 0-3.42-.151-5.129-.453l-3.394 13.651h-11.162l12.52-52.19c2.01-.603 4.311-1.143 6.901-1.622 2.589-.477 5.393-.716 8.41-.716 2.815 0 5.242.428 7.278 1.282 2.037.855 3.708 2.024 5.02 3.507 1.307 1.484 2.274 3.219 2.904 5.205.627 1.987.942 4.11.942 6.373m-27.378 15.461c.854.202 1.91.302 3.167.302 1.961 0 3.746-.364 5.355-1.094 1.609-.728 2.979-1.747 4.111-3.055 1.131-1.307 2.01-2.877 2.64-4.714.628-1.835.943-3.858.943-6.071 0-2.161-.479-3.998-1.433-5.506-.956-1.508-2.615-2.263-4.978-2.263-1.61 0-3.118.151-4.525.453l-5.28 21.948"/></g></svg><text fill="#1a171b" text-anchor="middle" font-family="Helvetica Neue,Helvetica,Arial,sans-serif" font-weight="700" font-size="14" x="50" y="20">Donate</text></svg>
\ No newline at end of file
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">
<g>
<g>
<path style="fill:#030104;" d="M7,9L5.268,7.484l-4.952,4.245C0.496,11.896,0.739,12,1.007,12h11.986
c0.267,0,0.509-0.104,0.688-0.271L8.732,7.484L7,9z"/>
<path style="fill:#030104;" d="M13.684,2.271C13.504,2.103,13.262,2,12.993,2H1.007C0.74,2,0.498,2.104,0.318,2.273L7,8
L13.684,2.271z"/>
<polygon style="fill:#030104;" points="0,2.878 0,11.186 4.833,7.079 "/>
<polygon style="fill:#030104;" points="9.167,7.079 14,11.186 14,2.875 "/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="401.998px" height="401.998px" viewBox="0 0 401.998 401.998" style="enable-background:new 0 0 401.998 401.998;"
xml:space="preserve">
<g>
<path d="M357.45,190.721c-5.331-5.33-11.8-7.993-19.417-7.993h-9.131v-54.821c0-35.022-12.559-65.093-37.685-90.218
C266.093,12.563,236.025,0,200.998,0c-35.026,0-65.1,12.563-90.222,37.688C85.65,62.814,73.091,92.884,73.091,127.907v54.821
h-9.135c-7.611,0-14.084,2.663-19.414,7.993c-5.33,5.326-7.994,11.799-7.994,19.417V374.59c0,7.611,2.665,14.086,7.994,19.417
c5.33,5.325,11.803,7.991,19.414,7.991H338.04c7.617,0,14.085-2.663,19.417-7.991c5.325-5.331,7.994-11.806,7.994-19.417V210.135
C365.455,202.523,362.782,196.051,357.45,190.721z M274.087,182.728H127.909v-54.821c0-20.175,7.139-37.402,21.414-51.675
c14.277-14.275,31.501-21.411,51.678-21.411c20.179,0,37.399,7.135,51.677,21.411c14.271,14.272,21.409,31.5,21.409,51.675V182.728
z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="31.416px" height="31.416px" viewBox="0 0 31.416 31.416" style="enable-background:new 0 0 31.416 31.416;"
xml:space="preserve">
<g>
<g>
<path d="M28.755,6.968l-0.47,0.149L25.782,7.34l-0.707,1.129l-0.513-0.163L22.57,6.51l-0.289-0.934L21.894,4.58l-1.252-1.123
l-1.477-0.289l-0.034,0.676l1.447,1.412l0.708,0.834L20.49,6.506l-0.648-0.191L18.871,5.91l0.033-0.783l-1.274-0.524l-0.423,1.841
l-1.284,0.291l0.127,1.027l1.673,0.322l0.289-1.641l1.381,0.204l0.642,0.376h1.03l0.705,1.412l1.869,1.896l-0.137,0.737
l-1.507-0.192l-2.604,1.315l-1.875,2.249l-0.244,0.996h-0.673l-1.254-0.578l-1.218,0.578l0.303,1.285l0.53-0.611l0.932-0.029
l-0.065,1.154l0.772,0.226l0.771,0.866l1.259-0.354l1.438,0.227l1.67,0.449l0.834,0.098l1.414,1.605l2.729,1.605l-1.765,3.372
l-1.863,0.866l-0.707,1.927l-2.696,1.8l-0.287,1.038c6.892-1.66,12.019-7.851,12.019-15.253
C31.413,12.474,30.433,9.465,28.755,6.968z"/>
<path d="M17.515,23.917l-1.144-2.121l1.05-2.188l-1.05-0.314l-1.179-1.184l-2.612-0.586l-0.867-1.814v1.077h-0.382l-2.251-3.052
v-2.507L7.43,8.545L4.81,9.012H3.045L2.157,8.43L3.29,7.532L2.16,7.793c-1.362,2.326-2.156,5.025-2.156,7.916
c0,8.673,7.031,15.707,15.705,15.707c0.668,0,1.323-0.059,1.971-0.137l-0.164-1.903c0,0,0.721-2.826,0.721-2.922
C18.236,26.357,17.515,23.917,17.515,23.917z"/>
<path d="M5.84,5.065l2.79-0.389l1.286-0.705l1.447,0.417l2.312-0.128l0.792-1.245l1.155,0.19l2.805-0.263L19.2,2.09l1.09-0.728
l1.542,0.232l0.562-0.085C20.363,0.553,18.103,0,15.708,0C10.833,0,6.474,2.222,3.596,5.711h0.008L5.84,5.065z M16.372,1.562
l1.604-0.883l1.03,0.595l-1.491,1.135l-1.424,0.143l-0.641-0.416L16.372,1.562z M11.621,1.691l0.708,0.295l0.927-0.295
l0.505,0.875l-2.14,0.562l-1.029-0.602C10.591,2.526,11.598,1.878,11.621,1.691z"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="438.533px" height="438.533px" viewBox="0 0 438.533 438.533" style="enable-background:new 0 0 438.533 438.533;"
xml:space="preserve">
<g>
<path d="M375.721,227.259c-5.331-5.331-11.8-7.992-19.417-7.992H146.176v-91.36c0-20.179,7.139-37.402,21.415-51.678
c14.277-14.273,31.501-21.411,51.678-21.411c20.175,0,37.402,7.137,51.673,21.411c14.277,14.276,21.416,31.5,21.416,51.678
c0,4.947,1.807,9.229,5.42,12.845c3.621,3.617,7.905,5.426,12.847,5.426h18.281c4.945,0,9.227-1.809,12.848-5.426
c3.606-3.616,5.42-7.898,5.42-12.845c0-35.216-12.515-65.331-37.541-90.362C284.603,12.513,254.48,0,219.269,0
c-35.214,0-65.334,12.513-90.366,37.544c-25.028,25.028-37.542,55.146-37.542,90.362v91.36h-9.135
c-7.611,0-14.084,2.667-19.414,7.992c-5.33,5.325-7.994,11.8-7.994,19.414v164.452c0,7.617,2.665,14.089,7.994,19.417
c5.33,5.325,11.803,7.991,19.414,7.991h274.078c7.617,0,14.092-2.666,19.417-7.991c5.325-5.328,7.994-11.8,7.994-19.417V246.673
C383.719,239.059,381.053,232.591,375.721,227.259z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
This diff is collapsed.
jQuery(document).ready(function($) {
//Select the right radio button for message on load
let textareaValue = $('textarea[name=message]').val();
$('input:radio[name=message_template]').prop("checked",false);
$('input[value="'+textareaValue+'"]').prop("checked", true);
$('input:radio').parent().css({ opacity: 0.5 });;
$('input:radio:checked').parent().css({ opacity: 1 });;
$('textarea[name=message]').change(function(){
$('input:radio[name=message_template]').prop("checked",false);
$('input[value="'+this.value+'"]').prop("checked", true);
});
//Show advanced config
$("#show_advanced_configuration").click(function(){
$(".not_advanced_setting").fadeOut("fast");
$("td.advanced_setting").fadeIn("slow");
$("tr.advanced_setting").fadeIn("slow").css("display","block");
$("#hide_advanced_configuration").removeClass("active");
$("#show_advanced_configuration").addClass("active");
});
//Hide advanced config
$("#hide_advanced_configuration").click(function(){
$(".advanced_setting").fadeOut("fast");
$(".not_advanced_setting").fadeIn("slow");
$("#show_advanced_configuration").removeClass("active");
$("#hide_advanced_configuration").addClass("active");
});
//Set the message value on radio select
$('input:radio[name=message_template]').change(function(){
let value = $('input:radio[name=message_template]:checked').val();
$('textarea[name=message]').val(value);
});
$('input:radio').change(function(){
$('input:radio').parent().css({ opacity: 0.5 });;
$('input:radio:checked').parent().css({ opacity: 1 });;
});
});
#German Translation
#for Mastdon Autopost Wordpress Plugin
msgid "Mastodon Autopost Configuration"
msgstr "Mastodon Autopost Konfiguration"
#: post_meta_box.php
msgid "Mastodon Autopost"
msgstr "Mastodon Autopost"
msgid "Simple configuration"
msgstr "Einfache Konfiguration"
msgid "Post to Mastodon"
msgstr "Auf Mastdodon tooten"
msgid "Advanced configuration"
msgstr "Erweiterte Konfiguration"
#: settings_page.php
msgid "Server Settings"
msgstr "Server Einstellungen"
msgid "Instance"
msgstr "Instanz"
msgid "Server URL"
msgstr "Server URL"
msgid "Connected as"
msgstr "Verbunden als"
msgid "Email"
msgstr "E-Mail"
msgid "Connect to Mastodon"
msgstr "Mit Mastodon verbinden"