user_id) { $hentai_toggle = max(0, min(2, $_COOKIE['mangadex_h_toggle'] ?? 0)); if($type == "follows"){ return "
" . display_fa_icon('file', '', '', 'far') . ' ' . display_short_title($chapter_history[$i]) . " " . display_fa_icon('clock', '', '', 'far') . ' ' . get_time_ago($chapter_history[$i]['timestamp']) . "
Go and read a chapter!
"; } else $return = display_alert('info m-2', 'Notice', "Please " . display_fa_icon('sign-in-alt') . " log in to view your reading history."); return $return; } function display_latest_posts($array) { global $parser; $return = "" . $parser->getAsHtml() . "
" . $parser->getAsHtml() . "
" . display_fa_icon('globe', 'Language') . " | " . display_fa_icon('users', 'Group') . " | " . display_fa_icon('clock', 'Uploaded', '', 'far') . " | |||
---|---|---|---|---|---|
" . display_fa_icon('book', 'Title') . ' ' . display_manga_link_v2($manga_array[$j]) . " | |||||
" . display_fa_icon('file', '', '', 'far') . " " . display_short_title($chapter) . "" . ($has_end_tag ? ' END' : '') . ($chapter["available"] == 0 ? display_fa_icon('file-excel', 'Unavailable', 'mx-1', 'fas') : '') ." | " . display_lang_flag_v3($chapter) . " | " . display_group_link_v2($chapter) . " |
"; switch ($type) { case 'top_follows': $return .= "" . display_fa_icon('bookmark', 'Follows') . " " . number_format($manga['count_follows']) . " " . display_fa_icon('star', 'Bayesian rating') . " {$manga['manga_bayesian']} " . display_fa_icon('user') . " " . number_format($manga['count_pop']) . ""; break; case 'top_rating': $return .= "" . display_fa_icon('star', 'Bayesian rating') . " {$manga['manga_bayesian']} " . display_fa_icon('user') . " " . number_format($manga['count_pop']) . " " . display_fa_icon('bookmark', 'Follows') . " " . number_format($manga['count_follows']) . ""; break; default: $return .= "" . display_fa_icon('file', '', '', 'far') . ' ' . display_short_title($manga) . " " . display_fa_icon('eye', 'Views') . " " . number_format($manga['chapter_views']) . ""; break; } $return .= "
$forum->forum_description
" . number_format($forum->total_threads) . " threads
" . number_format($forum->total_posts) . " posts
" . get_time_ago($forum->last_post_timestamp) . " by " . display_user_link($forum->last_post_user_id, $forum->username, $forum->level_colour, $forum->show_premium_badge, $forum->show_md_at_home_badge) . "
" : "") . "Showing " . number_format($paging['offset'] + 1) . " to " . number_format(min($paging['num_rows'], $paging['limit'] * $paging['current_page'])) . " of " . number_format($paging['num_rows']) . " $type
"; } else $return = display_alert("warning", "Warning", "No results found."); return $return; } function display_pagination_forum($paging, $page, $id) { if ($paging['last_page'] == 1) $return = ''; elseif ($paging['current_page'] <= $paging['last_page']) { $return = " "; } else $return = ''; return $return; } function display_manga_link($manga_id, $manga_name, $manga_hentai, $trim = 1, $class = '') { if ($trim) return "" . mb_strimwidth($manga_name, 0, 40, "...") . "" . display_labels($manga_hentai); else return "$manga_name" . display_labels($manga_hentai); } function display_manga_link_v2($manga, $white = '', $hide_labels=false, $truncate=true) { if (is_array($manga)) $manga = (object) $manga; return "$manga->manga_name" . ( $hide_labels ? '' : display_labels($manga->manga_hentai)); } function display_group_link_v2($group) { if (is_array($group)) { $group['group_id_2'] = $group['group_id_2'] ?? 0; $group['group_id_3'] = $group['group_id_3'] ?? 0; $group = (object) $group; } $return = "$group->group_name"; if (isset($group->group_id_2) && $group->group_id_2 > 0) $return .= " | $group->group_name_2"; if (isset($group->group_id_3) && $group->group_id_3 > 0) $return .= " | $group->group_name_3"; return $return; } function display_user_link_v2($user, $note = '') { if (is_array($user)) $user = (object) $user; $levelClassname = str_replace(' ', '', ltrim(strtolower(preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '_$0', $user->level_name ?? 'guest')), '_')); $string = "$user->username"; if ($user->show_premium_badge ?? false) $string .= " " . display_fa_icon('gem', 'Supporter', '', 'far') . ""; if ($user->show_md_at_home_badge ?? false) $string .= " " . display_fa_icon('network-wired', 'MD@H Host', '', 'fas' . ($user->show_md_at_home_badge == 2 ? ' text-warning' : '')) . ""; if ($user->is_thread_starter ?? false) $string .= " OP"; if ($note) $string .= " " . htmlspecialchars($note, ENT_QUOTES) . ""; return $string; } function display_user_link($user_id, $username, $level_colour, $show_badge = 0, $show_mah_badge = 0) { $string = $show_badge ? " " . display_fa_icon('gem', 'Supporter', '', 'far') . "" : ''; $string2 = $show_mah_badge ? " " . display_fa_icon('network-wired', 'MD@H Host', '', 'fas' . ($show_mah_badge == 2 ? ' text-warning' : '')) . "" : ''; return "$username" . $string . $string2; } function display_avatar($ext, $id, $limit = 1) { if ($ext) return ""; else { //$avatar = rand(0, 4); return ""; } } function display_list_banner($user, $style) { if ($user->list_banner) return ""; else return ""; } function jquery_get($name, $id, $button_glyph, $button_text, $button_text_alt, $success_msg, $after) { return " $('#{$name}_button').click(function(event) { var button = $(this) var buttonHtml = button.html() var successMsg = \"" . display_alert("success", "Success", $success_msg) . "\"; button.html(\"" . display_fa_icon('spinner', '', 'fa-pulse') . " $button_text_alt...\").attr('disabled', true); $.ajax({ url: '/ajax/actions.ajax.php?function=$name" . ($id ? "&id=$id" : "") . "', type: 'GET', cache: false, headers: {'cache-control': 'no-cache'}, contentType: false, processData: false, async: true, success: function (data) { if (!data) { $('#message_container').html(successMsg).show().delay(" . FADE_DURATION . ").fadeOut(); $after } else { $('#message_container').html(data).show().delay(" . FADE_DURATION . ").fadeOut(); } button.html(buttonHtml).attr('disabled', false); }, }); event.preventDefault(); }); "; } function jquery_post($name, $id, $button_glyph, $button_text, $button_text_alt, $success_msg, $after) { return " $('#{$name}_form').submit(function(event) { Array.prototype.slice.call(this.querySelectorAll('input[type=file]')) .filter(function(n) { return n && !n.files.length }) .forEach(function(n) { n.parentNode.removeChild(n) }); var button = $('#{$name}_button') var buttonHtml = button.html() var formData = new FormData(this); var success_msg = \"" . display_alert("success", "Success", $success_msg) . "\"; button.html(\"" . display_fa_icon('spinner', '', 'fa-pulse') . " $button_text_alt...\").attr('disabled', true); $.ajax({ url: '/ajax/actions.ajax.php?function=$name" . ($id ? "&id=$id" : "") . "', type: 'POST', data: formData, cache: false, headers: {'cache-control': 'no-cache'}, contentType: false, processData: false, async: true, success: function (data) { if (!data) { $('#message_container').html(success_msg).show().delay(" . FADE_DURATION . ").fadeOut(); $after } else { $('#message_container').html(data).show().delay(" . FADE_DURATION . ").fadeOut(); } button.html(buttonHtml).attr('disabled', false); }, }); event.preventDefault(); }); "; } function js_display_file_select($button = '') { return " $('.btn-file :file').on('fileselect', function(event, numFiles, label) { var input = $(this).parents('.input-group').find(':text'); log = numFiles > 1 ? numFiles + ' files selected' : label; if(input.length) input.val(log); else if(log) alert(log); " . ($button ? "$('$button').focus();" : "") . " });"; } function display_genres_checkboxes($grouped_genres, $selected_genres = [], $excluded_genres = [], $isTertiary = true, $useIndeterminate = false, $inputName = 'manga_genres[]') { if (!is_array($selected_genres)) { $selected_genres = explode(',', $selected_genres); } if (!is_array($excluded_genres)) { $excluded_genres = explode(',', $excluded_genres); } $return = ''; foreach ($grouped_genres AS $group => $genres) { $return .= "