@@ -1456,6 +1456,42 @@ function Wikiapi_redirects_root(title, options) {
14561456
14571457// --------------------------------------------------------
14581458
1459+ /**
1460+ * @alias redirect_to
1461+ * @description Get the page that <code>title</code> redirects to.
1462+ *
1463+ * @param {String } title - page title
1464+ * @param {Object } [options] - options to run this function
1465+ *
1466+ * @returns {Promise } Promise object represents {Array} redirect_list
1467+ *
1468+ * @example <caption>Get the page that [[WP:SB]] redirects to.</caption>
1469+ // <code>
1470+ const redirects_list = await enwiki.redirect_to('WP:SB');
1471+ // </code>
1472+ *
1473+ * @memberof Wikiapi.prototype
1474+ */
1475+ function Wikiapi_redirect_to ( title , options ) {
1476+ function Wikiapi_redirect_to_executor ( resolve , reject ) {
1477+ // const wiki = this[KEY_wiki_session];
1478+ // using wiki_API.redirect_to
1479+ wiki_API . redirect_to ( title , ( redirect_data , page_data , error ) => {
1480+ if ( error ) {
1481+ reject ( error ) ;
1482+ } else {
1483+ //console.trace(redirect_data);
1484+ //console.trace(page_data);
1485+ resolve ( page_data || redirect_data ) ;
1486+ }
1487+ } , this . append_session_to_options ( options ) ) ;
1488+ }
1489+
1490+ return new Promise ( Wikiapi_redirect_to_executor . bind ( this ) ) ;
1491+ }
1492+
1493+ // --------------------------------------------------------
1494+
14591495/**
14601496 * @alias redirects_here
14611497 * @description Get all pages redirects to <code>title</code>.
@@ -2140,6 +2176,30 @@ Object.assign(Wikiapi.prototype, {
21402176 move_to : Wikiapi_move_to ,
21412177 move_page : Wikiapi_move_page ,
21422178 purge : Wikiapi_purge ,
2179+
2180+ /**
2181+ * @description Find comment by talk page title and anchor.
2182+ *
2183+ * @example <code>
2184+
2185+ const comment_list = await wiki.find_comment(token);
2186+
2187+ </code>
2188+ *
2189+ * @param {String|Array }talk_page_and_anchor
2190+ * talk page and anchor: "title#anchor" | [title,anchor]
2191+ * @param {Object }[options]
2192+ * 附加參數/設定選擇性/特殊功能與選項
2193+ *
2194+ * @returns {Promise|Undefined } resolve({Array}comment_list)
2195+ *
2196+ * @memberof Wikiapi.prototype
2197+ */
2198+ find_comment ( talk_page_and_anchor , options ) {
2199+ const wiki = this [ KEY_wiki_session ] ;
2200+ return wiki . find_comment . apply ( wiki , arguments ) ;
2201+ } ,
2202+
21432203 /**
21442204 * @description Listen to page modification. 監視最近更改的頁面。<br />
21452205 * wrapper for {@link wiki_API}#listen
@@ -2176,6 +2236,7 @@ wiki.listen(function for_each_row() {
21762236 search : Wikiapi_search ,
21772237
21782238 redirects_root : Wikiapi_redirects_root ,
2239+ redirect_to : Wikiapi_redirect_to ,
21792240 // Warning: 採用 wiki_API.redirects_here(title) 才能追溯重新導向的標的。
21802241 // wiki.redirects() 無法追溯重新導向的標的!
21812242 redirects_here : Wikiapi_redirects_here ,
0 commit comments