Bokmålsordboka

Post Reply
User avatar
andrey
Posts: 2423
Joined: Sat Aug 24, 2013 3:27 pm

Bokmålsordboka

Post by andrey »

Версия от 26.03.2017 (11:50)

Image

Ссылка на ресурс:
http://ordbok.uib.no/info/om_ordbokene_bm.html

Код ordbok_uib_no.html:

Code: Select all

<html><head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" type="text/javascript"></script>

<style>
ordbokuibno span.b {
    font-weight: bold;
}

ordbokuibno .artikkeloppslagsord {
    font-size: 100%;
    font-weight: bold;
}


ordbokuibno .oppsgramordklasse {
    color: #557FBD;
    text-decoration: none;
}

ordbokuibno .henvisning {
    color: #557FBD;
    text-decoration: none;
}
</style>

<title>Bokmålsordboka</title>
</head>
<body>
<script type="text/javascript">


(function (){


var scr = document.getElementsByTagName('script');
scr = scr[scr.length - 1];
var div = scr.parentNode.parentNode.parentNode;
var artid = div.id.replace(/gdfrom-/, "");

div = div.getElementsByClassName('gddictname')[0];

if (div.className === 'gddictname')
{
	div.style.display = 'none';
}


var urlParam = function (name){

	var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);

	if (results===null)
	{
	  return undefined;
	}
	else
	{
	  return results[1] || undefined;
	}
}



var ordbok_uib_no = function (artid)
{


	var word = urlParam('word');


	if ((word) && (word.trim().length > 0) && (word.trim().length < 30))
	{


		var url = 'http://ordbok.uib.no/perl/ordbok.cgi?OPP=' + word;
		var xhttp = new XMLHttpRequest();
		xhttp.onreadystatechange = function()
		{

			if (this.readyState == 4 && this.status == 200)
			{


				var s = '';

				var body = /<body.*>([\s\S]+)<\/body>/.exec(xhttp.responseText);
				body = $.parseHTML(body[1]);
				body = $('<output>').append(body);

				var bokmal = body.find('#kolonnebm');
				bokmal = bokmal.find('.artikkel');
				
				bokmal.find('.kompakt, .oppsgramordklassevindu, .artikkeltopp').remove();

				
				bokmal.find('img').each(function(i, elem) {
					var src = $(this).attr('src');
					if ((src) && (/black_circle_e\.png/.test(src)))
					{
						$(this).replaceWith("<img height=6px width=6px src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADsAAAA7CAYAAADFJfKzAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sFEgw1OAX01WQAAAJ+SURBVGje7ZtBS1RRFMd/Dk8dRAoTJKRVRAwKqfQBhFmE60JEQqRNtCwNXLSIEHfiQtqEKxkiaFO4bRUR6WJM6RNEhMrQJCLytGGmhXfgMc4dxzdz37v3OAcOA8PjwW/Oufee879noGUtc97aDLwzAaSBYWAI6AdGgCTgqWcKgA9kgV31uQ18Boq2/2gJ4CHwETgBSiHdB94D99U7rbIrwCsg1wCgzn8DL4BuG0BngH0DkJW+BzyJC3IA2IoAstI3gFtRgk6rdVWKyQ+ByShAl2KErPR5k6AZi0DLvmIC9K2FoEaAFy0GbWpKTzsAWvaGNq0UcOQQ7CFwOyzspkOgwXM4VGVUctSfXgS0G8g7DJuvVUtXdhazQI/DLWsP8KyeBz1VdJcc9z1dexj8cgLoEyBI9CmWmrAPBCkwE7VkmYTqZtqFwP4DupT8cyayo4JAUSxpXRrfFSgmjlwm2Ds62KsCYa/rNqi848VENfsLXKsW2aTAyCZ1aewJhPXOq41FWxm2IJCtoIP1BcL6Oth1gbBZHewfgbC7OtjvAmG3dbDZy5DGwRbvCOgUAnqsWrxitcgWgQ+CorpGlXGFYFHxThDsuYFLAL9wX3DLUYfgVgReC4jqMnVO3HQBOw5HdZ/ToZa67bHDsDNhUuGLg6BbYfP+JnDgEKhPA1eWAOMOwU41Y2d76QDoUjO38jcWg2ZMnF0rFoKumjysFywCXYiiOpki3sGSAyIa5ytbingGNb8S8aBmsKaei+gs3lFVXezWq9aPCeifwHMsvK3oAB4Bn5Re28iazAD3MCDgm/hDhAeMcXoNmgJuAIMqQkFRPgf8UMrmN6UZSdTCWmbc/gPrb4lm1CUhJgAAAABJRU5ErkJggg==' />");
					}

				});
				
				
				if (bokmal)
				{
					s = bokmal.html();
				}
				
				if ((s) && (s !== ''))
				{
				
					var span = document.getElementById("gdfrom-" + artid);
					span.getElementsByTagName('ordbokuibno')[0].innerHTML = s;
					span.getElementsByClassName('gddictname')[0].style.display = 'block';

				}


			}
			
		}
		
		
		xhttp.open("GET", url, true);
		xhttp.send(); 

	}
	
}



ordbok_uib_no(artid);


})(); 
</script>
<ordbokuibno></ordbokuibno>
</body>
</html>
Для подключения в настройках GoldenDict-а в разделе Websites нужно добавить ссылку такого рода:

Code: Select all

file:///path/to/ordbok_uib_no.html?word=%GDWORD%
Чекбокс в колонке "As link" должен быть оставлен пустым.

Иконка:
Image
Post Reply