<commit_before>/*
 *
 * tinycimm_link.js
 * Copyright (c) 2009 <NAME>
 * MIT license  : http://www.opensource.org/licenses/mit-license.php
 * Project      : http://tinycimm.googlecode.com/
 * Contact      : <EMAIL> : http://badsyntax.co.uk
 *
 */

function LinkDialog(){}
LinkDialog.prototype = new TinyCIMM('link');
LinkDialog.prototype.constructor = LinkDialog;

LinkDialog.prototype.preInit = function() {
	var images = ['../img/ajax-loader.gif', '../img/ajax-loader-sm.gif', '../img/progress.gif'];
	this.cacheImages(images);
	this.settings.tinycimm_controller = this.settings.tinycimm_link_controller;
};

LinkDialog.prototype.fileBrowser = function(folder, offset, load, el, search_query){
	var self = this;

	this.getBrowser(folder, offset, search_query, function(){

		// show the first level list
		tinyMCEPopup.dom.select('#link_wrapper_panel ul')[0].style.display = 'block';
			
		// bind click event to anchors
		var pages = tinyMCEPopup.dom.select('#link_wrapper_panel ul a');
		for(var page in pages) {
			pages[page].onclick = function(e){
				e.preventDefault();
				var url = "{page_url["+this.rel.replace(/^page-/, '')+"]}";
				self.insertLink(url, this.title);
			};
		}
	
		// bind click event to hit areas	
		var hitareas = tinyMCEPopup.dom.select('#link_wrapper_panel ul .hitarea');
		for(var i in hitareas) {
			hitareas[i].onclick = function(e){
				if (/hitarea-closed/.test(this.className)) {
					this.parentNode.getElementsByTagName('ul')[0].style.display = "block";
					this.className = this.className.replace(/hitarea-closed/, 'hitarea-open');
				} else if (/hitarea-open/.test(this.className)) {
					this.parentNode.getElementsByTagName('ul')[0].style.display = "none";
					this.className = this.className.replace(/hitarea-open/, 'hitarea-closed');
				}
			};
		}
	});
};

LinkDialog.prototype.insertLink = function(url, title){
	var win = tinyMCEPopup.getWindowArg("window");
        // insert the url into the link dialog window
	 if (win) {
		win.document.getElementById('href').value = url;
		win.document.getElementById('title').value = title;<commit_msg>Replaced tinycimm HelpfulParser syntax with  Dwoo syntax.<commit_after>/*
 *
 * tinycimm_link.js
 * Copyright (c) 2009 <NAME>
 * MIT license  : http://www.opensource.org/licenses/mit-license.php
 * Project      : http://tinycimm.googlecode.com/
 * Contact      : <EMAIL> : http://badsyntax.co.uk
 *
 */

function LinkDialog(){}
LinkDialog.prototype = new TinyCIMM('link');
LinkDialog.prototype.constructor = LinkDialog;

LinkDialog.prototype.preInit = function() {
	var images = ['../img/ajax-loader.gif', '../img/ajax-loader-sm.gif', '../img/progress.gif'];
	this.cacheImages(images);
	this.settings.tinycimm_controller = this.settings.tinycimm_link_controller;
};

LinkDialog.prototype.fileBrowser = function(folder, offset, load, el, search_query){
	var self = this;

	this.getBrowser(folder, offset, search_query, function(){

		// show the first level list
		tinyMCEPopup.dom.select('#link_wrapper_panel ul')[0].style.display = 'block';
			
		// bind click event to anchors
		var pages = tinyMCEPopup.dom.select('#link_wrapper_panel ul a');
		for(var page in pages) {
			pages[page].onclick = function(e){
				e.preventDefault();
				var url = "{page_url("+this.rel.replace(/^page-/, '')+")}";
				self.insertLink(url, this.title);
			};
		}
	
		// bind click event to hit areas	
		var hitareas = tinyMCEPopup.dom.select('#link_wrapper_panel ul .hitarea');
		for(var i in hitareas) {
			hitareas[i].onclick = function(e){
				if (/hitarea-closed/.test(this.className)) {
					this.parentNode.getElementsByTagName('ul')[0].style.display = "block";
					this.className = this.className.replace(/hitarea-closed/, 'hitarea-open');
				} else if (/hitarea-open/.test(this.className)) {
					this.parentNode.getElementsByTagName('ul')[0].style.display = "none";
					this.className = this.className.replace(/hitarea-open/, 'hitarea-closed');
				}
			};
		}
	});
};

LinkDialog.prototype.insertLink = function(url, title){
	var win = tinyMCEPopup.getWindowArg("window");
        // insert the url into the link dialog window
	 if (win) {
		win.document.getElementById('href').value = url;
		win.document.getElementById('title').value = title;
{'fraction_non_alphanumeric': 0.16399244926852288, 'fraction_numerical': 0.0033034450212364322, 'mean_word_length': 3.923344947735192, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6202922', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1381, 'n_words': 257}